Skip to content

Commit

Permalink
Add support for proxying mouseWheelMoved events
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderhenne committed Mar 5, 2018
1 parent ec77df3 commit 170991d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ public static MouseEvent mouseMoved(MouseEvent mouseEvent)
return mouseManager.processMouseMoved(mouseEvent);
}

public static void mouseWheelMoved(MouseWheelEvent event)
public static MouseWheelEvent mouseWheelMoved(MouseWheelEvent event)
{
mouseManager.processMouseWheelMoved(event);
return mouseManager.processMouseWheelMoved(event);
}

public static void keyPressed(KeyEvent keyEvent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,12 @@ public MouseEvent processMouseMoved(MouseEvent mouseEvent)
return mouseEvent;
}

public void processMouseWheelMoved(MouseWheelEvent mouseWheelEvent)
public MouseWheelEvent processMouseWheelMoved(MouseWheelEvent mouseWheelEvent)
{
for (MouseWheelListener mouseWheelListener : mouseWheelListeners)
{
mouseWheelListener.mouseWheelMoved(mouseWheelEvent);
mouseWheelEvent = mouseWheelListener.mouseWheelMoved(mouseWheelEvent);
}
return mouseWheelEvent;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
*/
package net.runelite.client.input;

public interface MouseWheelListener extends java.awt.event.MouseWheelListener
import java.awt.event.MouseWheelEvent;

public abstract class MouseWheelListener
{
public MouseWheelEvent mouseWheelMoved(MouseWheelEvent event)
{
return event;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public static MouseEvent mouseMoved(MouseEvent mouseEvent)
throw new RuntimeException();
}

public static void mouseWheelMoved(MouseWheelEvent event)
public static MouseWheelEvent mouseWheelMoved(MouseWheelEvent event)
{
throw new RuntimeException();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public abstract class RSMouseWheelHandlerMixin implements RSMouseWheelHandler
@Replace("mouseWheelMoved")
public void mouseWheelMoved(MouseWheelEvent event)
{
Hooks.mouseWheelMoved(event);
event = Hooks.mouseWheelMoved(event);
if (!event.isConsumed())
{
rs$mouseWheelMoved(event);
Expand Down

0 comments on commit 170991d

Please sign in to comment.