Add support for intercepting mouse and keyboard input

Also allow translating mouse input for stretched fixed mode.

This is required for moving overlays, and interacting with the instance map.
This commit is contained in:
Adam
2018-02-27 19:23:08 -05:00
parent 326f498ae9
commit a999863a80
13 changed files with 801 additions and 0 deletions

View File

@@ -28,6 +28,9 @@ import com.google.common.eventbus.EventBus;
import com.google.inject.Injector;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;
import java.awt.image.BufferedImage;
import net.runelite.api.ChatMessageType;
import net.runelite.api.Client;
@@ -52,6 +55,8 @@ import static net.runelite.api.widgets.WidgetID.WORLD_MAP;
import net.runelite.client.RuneLite;
import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.game.DeathChecker;
import net.runelite.client.input.KeyManager;
import net.runelite.client.input.MouseManager;
import net.runelite.client.task.Scheduler;
import net.runelite.client.ui.overlay.OverlayLayer;
import net.runelite.client.ui.overlay.OverlayRenderer;
@@ -73,6 +78,8 @@ public class Hooks
private static final InfoBoxManager infoBoxManager = injector.getInstance(InfoBoxManager.class);
private static final ChatMessageManager chatMessageManager = injector.getInstance(ChatMessageManager.class);
private static final OverlayRenderer renderer = injector.getInstance(OverlayRenderer.class);
private static final MouseManager mouseManager = injector.getInstance(MouseManager.class);
private static final KeyManager keyManager = injector.getInstance(KeyManager.class);
private static final DeathChecker death = new DeathChecker(client, eventBus);
private static final GameTick tick = new GameTick();
@@ -140,6 +147,61 @@ public class Hooks
}
}
public static MouseEvent mousePressed(MouseEvent mouseEvent)
{
return mouseManager.processMousePressed(mouseEvent);
}
public static MouseEvent mouseReleased(MouseEvent mouseEvent)
{
return mouseManager.processMouseReleased(mouseEvent);
}
public static MouseEvent mouseClicked(MouseEvent mouseEvent)
{
return mouseManager.processMouseClicked(mouseEvent);
}
public static MouseEvent mouseEntered(MouseEvent mouseEvent)
{
return mouseManager.processMouseEntered(mouseEvent);
}
public static MouseEvent mouseExited(MouseEvent mouseEvent)
{
return mouseManager.processMouseExited(mouseEvent);
}
public static MouseEvent mouseDragged(MouseEvent mouseEvent)
{
return mouseManager.processMouseDragged(mouseEvent);
}
public static MouseEvent mouseMoved(MouseEvent mouseEvent)
{
return mouseManager.processMouseMoved(mouseEvent);
}
public static void mouseWheelMoved(MouseWheelEvent event)
{
mouseManager.processMouseWheelMoved(event);
}
public static void keyPressed(KeyEvent keyEvent)
{
keyManager.processKeyPressed(keyEvent);
}
public static void keyReleased(KeyEvent keyEvent)
{
keyManager.processKeyReleased(keyEvent);
}
public static void keyTyped(KeyEvent keyEvent)
{
keyManager.processKeyTyped(keyEvent);
}
public static void draw(MainBufferProvider mainBufferProvider, Graphics graphics, int x, int y)
{
final BufferedImage image = (BufferedImage) mainBufferProvider.getImage();

View File

@@ -0,0 +1,29 @@
/*
* Copyright (c) 2018, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.input;
public interface KeyListener extends java.awt.event.KeyListener
{
}

View File

@@ -0,0 +1,70 @@
/*
* Copyright (c) 2018, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.input;
import java.awt.event.KeyEvent;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import javax.inject.Singleton;
@Singleton
public class KeyManager
{
private final List<KeyListener> keyListeners = new CopyOnWriteArrayList<>();
public void registerKeyListener(KeyListener keyListener)
{
keyListeners.add(keyListener);
}
public void unregisterKeyListener(KeyListener keyListener)
{
keyListeners.remove(keyListener);
}
public void processKeyPressed(KeyEvent keyEvent)
{
for (KeyListener keyListener : keyListeners)
{
keyListener.keyPressed(keyEvent);
}
}
public void processKeyReleased(KeyEvent keyEvent)
{
for (KeyListener keyListener : keyListeners)
{
keyListener.keyReleased(keyEvent);
}
}
public void processKeyTyped(KeyEvent keyEvent)
{
for (KeyListener keyListener : keyListeners)
{
keyListener.keyTyped(keyEvent);
}
}
}

View File

@@ -0,0 +1,65 @@
/*
* Copyright (c) 2018, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.input;
import java.awt.event.MouseEvent;
public abstract class MouseListener
{
public MouseEvent mouseClicked(MouseEvent mouseEvent)
{
return mouseEvent;
}
public MouseEvent mousePressed(MouseEvent mouseEvent)
{
return mouseEvent;
}
public MouseEvent mouseReleased(MouseEvent mouseEvent)
{
return mouseEvent;
}
public MouseEvent mouseEntered(MouseEvent mouseEvent)
{
return mouseEvent;
}
public MouseEvent mouseExited(MouseEvent mouseEvent)
{
return mouseEvent;
}
public MouseEvent mouseDragged(MouseEvent mouseEvent)
{
return mouseEvent;
}
public MouseEvent mouseMoved(MouseEvent mouseEvent)
{
return mouseEvent;
}
}

View File

@@ -0,0 +1,129 @@
/*
* Copyright (c) 2018, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.input;
import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import javax.inject.Singleton;
@Singleton
public class MouseManager
{
private final List<MouseListener> mouseListeners = new CopyOnWriteArrayList<>();
private final List<MouseWheelListener> mouseWheelListeners = new CopyOnWriteArrayList<>();
public void registerMouseListener(MouseListener mouseListener)
{
mouseListeners.add(mouseListener);
}
public void unregisterMouseListener(MouseListener mouseListener)
{
mouseListeners.remove(mouseListener);
}
public void registerMouseWheelListener(MouseWheelListener mouseWheelListener)
{
mouseWheelListeners.add(mouseWheelListener);
}
public void unregisterMouseWheelListener(MouseWheelListener mouseWheelListener)
{
mouseWheelListeners.remove(mouseWheelListener);
}
public MouseEvent processMousePressed(MouseEvent mouseEvent)
{
for (MouseListener mouseListener : mouseListeners)
{
mouseEvent = mouseListener.mousePressed(mouseEvent);
}
return mouseEvent;
}
public MouseEvent processMouseReleased(MouseEvent mouseEvent)
{
for (MouseListener mouseListener : mouseListeners)
{
mouseEvent = mouseListener.mouseReleased(mouseEvent);
}
return mouseEvent;
}
public MouseEvent processMouseClicked(MouseEvent mouseEvent)
{
for (MouseListener mouseListener : mouseListeners)
{
mouseEvent = mouseListener.mouseClicked(mouseEvent);
}
return mouseEvent;
}
public MouseEvent processMouseEntered(MouseEvent mouseEvent)
{
for (MouseListener mouseListener : mouseListeners)
{
mouseEvent = mouseListener.mouseEntered(mouseEvent);
}
return mouseEvent;
}
public MouseEvent processMouseExited(MouseEvent mouseEvent)
{
for (MouseListener mouseListener : mouseListeners)
{
mouseEvent = mouseListener.mouseExited(mouseEvent);
}
return mouseEvent;
}
public MouseEvent processMouseDragged(MouseEvent mouseEvent)
{
for (MouseListener mouseListener : mouseListeners)
{
mouseEvent = mouseListener.mouseDragged(mouseEvent);
}
return mouseEvent;
}
public MouseEvent processMouseMoved(MouseEvent mouseEvent)
{
for (MouseListener mouseListener : mouseListeners)
{
mouseEvent = mouseListener.mouseMoved(mouseEvent);
}
return mouseEvent;
}
public void processMouseWheelMoved(MouseWheelEvent mouseWheelEvent)
{
for (MouseWheelListener mouseWheelListener : mouseWheelListeners)
{
mouseWheelListener.mouseWheelMoved(mouseWheelEvent);
}
}
}

View File

@@ -0,0 +1,29 @@
/*
* Copyright (c) 2018, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.input;
public interface MouseWheelListener extends java.awt.event.MouseWheelListener
{
}

View File

@@ -25,6 +25,9 @@
package net.runelite.client.callback;
import com.google.common.eventbus.EventBus;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;
import org.slf4j.Logger;
/**
@@ -37,4 +40,59 @@ public class Hooks
public static Logger log;
public static EventBus eventBus;
public static MouseEvent mousePressed(MouseEvent mouseEvent)
{
throw new RuntimeException();
}
public static MouseEvent mouseReleased(MouseEvent mouseEvent)
{
throw new RuntimeException();
}
public static MouseEvent mouseClicked(MouseEvent mouseEvent)
{
throw new RuntimeException();
}
public static MouseEvent mouseEntered(MouseEvent mouseEvent)
{
throw new RuntimeException();
}
public static MouseEvent mouseExited(MouseEvent mouseEvent)
{
throw new RuntimeException();
}
public static MouseEvent mouseDragged(MouseEvent mouseEvent)
{
throw new RuntimeException();
}
public static MouseEvent mouseMoved(MouseEvent mouseEvent)
{
throw new RuntimeException();
}
public static void mouseWheelMoved(MouseWheelEvent event)
{
throw new RuntimeException();
}
public static void keyPressed(KeyEvent keyEvent)
{
throw new RuntimeException();
}
public static void keyReleased(KeyEvent keyEvent)
{
throw new RuntimeException();
}
public static void keyTyped(KeyEvent keyEvent)
{
throw new RuntimeException();
}
}

View File

@@ -0,0 +1,78 @@
/*
* Copyright (c) 2018, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.mixins;
import java.awt.event.KeyEvent;
import net.runelite.api.mixins.Copy;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Replace;
import net.runelite.client.callback.Hooks;
import net.runelite.rs.api.RSKeyFocusListener;
@Mixin(RSKeyFocusListener.class)
public abstract class RSKeyFocusListenerMixin implements RSKeyFocusListener
{
@Copy("keyPressed")
abstract void rs$keyPressed(KeyEvent keyEvent);
@Copy("keyReleased")
abstract void rs$keyReleased(KeyEvent keyEvent);
@Copy("keyTyped")
abstract void rs$keyTyped(KeyEvent keyEvent);
@Override
@Replace("keyPressed")
public final synchronized void keyPressed(KeyEvent keyEvent)
{
Hooks.keyPressed(keyEvent);
if (!keyEvent.isConsumed())
{
rs$keyPressed(keyEvent);
}
}
@Override
@Replace("keyReleased")
public final synchronized void keyReleased(KeyEvent keyEvent)
{
Hooks.keyReleased(keyEvent);
if (!keyEvent.isConsumed())
{
rs$keyReleased(keyEvent);
}
}
@Override
@Replace("keyTyped")
public final void keyTyped(KeyEvent keyEvent)
{
Hooks.keyTyped(keyEvent);
if (!keyEvent.isConsumed())
{
rs$keyTyped(keyEvent);
}
}
}

View File

@@ -0,0 +1,135 @@
/*
* Copyright (c) 2018, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.mixins;
import java.awt.event.MouseEvent;
import net.runelite.api.mixins.Copy;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Replace;
import net.runelite.client.callback.Hooks;
import net.runelite.rs.api.RSMouseInput;
@Mixin(RSMouseInput.class)
public abstract class RSMouseInputMixin implements RSMouseInput
{
@Copy("mousePressed")
abstract void rs$mousePressed(MouseEvent mouseEvent);
@Copy("mouseReleased")
abstract void rs$mouseReleased(MouseEvent mouseEvent);
@Copy("mouseClicked")
abstract void rs$mouseClicked(MouseEvent mouseEvent);
@Copy("mouseEntered")
abstract void rs$mouseEntered(MouseEvent mouseEvent);
@Copy("mouseExited")
abstract void rs$mouseExited(MouseEvent mouseEvent);
@Copy("mouseDragged")
abstract void rs$mouseDragged(MouseEvent mouseEvent);
@Copy("mouseMoved")
abstract void rs$mouseMoved(MouseEvent mouseEvent);
@Override
@Replace("mousePressed")
public synchronized void mousePressed(MouseEvent mouseEvent)
{
mouseEvent = Hooks.mousePressed(mouseEvent);
if (!mouseEvent.isConsumed())
{
rs$mousePressed(mouseEvent);
}
}
@Override
@Replace("mouseReleased")
public synchronized void mouseReleased(MouseEvent mouseEvent)
{
mouseEvent = Hooks.mouseReleased(mouseEvent);
if (!mouseEvent.isConsumed())
{
rs$mouseReleased(mouseEvent);
}
}
@Override
@Replace("mouseClicked")
public void mouseClicked(MouseEvent event)
{
event = Hooks.mouseClicked(event);
if (!event.isConsumed())
{
rs$mouseClicked(event);
}
}
@Override
@Replace("mouseEntered")
public synchronized void mouseEntered(MouseEvent mouseEvent)
{
mouseEvent = Hooks.mouseEntered(mouseEvent);
if (!mouseEvent.isConsumed())
{
rs$mouseEntered(mouseEvent);
}
}
@Override
@Replace("mouseExited")
public synchronized void mouseExited(MouseEvent mouseEvent)
{
mouseEvent = Hooks.mouseExited(mouseEvent);
if (!mouseEvent.isConsumed())
{
rs$mouseExited(mouseEvent);
}
}
@Override
@Replace("mouseDragged")
public synchronized void mouseDragged(MouseEvent mouseEvent)
{
mouseEvent = Hooks.mouseDragged(mouseEvent);
if (!mouseEvent.isConsumed())
{
rs$mouseDragged(mouseEvent);
}
}
@Override
@Replace("mouseMoved")
public synchronized void mouseMoved(MouseEvent mouseEvent)
{
mouseEvent = Hooks.mouseMoved(mouseEvent);
if (!mouseEvent.isConsumed())
{
rs$mouseMoved(mouseEvent);
}
}
}

View File

@@ -0,0 +1,50 @@
/*
* Copyright (c) 2018, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.mixins;
import java.awt.event.MouseWheelEvent;
import net.runelite.api.mixins.Copy;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Replace;
import net.runelite.client.callback.Hooks;
import net.runelite.rs.api.RSMouseWheelHandler;
@Mixin(RSMouseWheelHandler.class)
public abstract class RSMouseWheelHandlerMixin implements RSMouseWheelHandler
{
@Copy("mouseWheelMoved")
abstract void rs$mouseWheelMoved(MouseWheelEvent event);
@Override
@Replace("mouseWheelMoved")
public void mouseWheelMoved(MouseWheelEvent event)
{
Hooks.mouseWheelMoved(event);
if (!event.isConsumed())
{
rs$mouseWheelMoved(event);
}
}
}

View File

@@ -0,0 +1,32 @@
/*
* Copyright (c) 2018, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.rs.api;
import java.awt.event.FocusListener;
import java.awt.event.KeyListener;
public interface RSKeyFocusListener extends KeyListener, FocusListener
{
}

View File

@@ -0,0 +1,33 @@
/*
* Copyright (c) 2018, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.rs.api;
import java.awt.event.FocusListener;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
public interface RSMouseInput extends MouseListener, MouseMotionListener, FocusListener
{
}

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2018, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.rs.api;
import java.awt.event.MouseWheelListener;
public interface RSMouseWheelHandler extends MouseWheelListener
{
}