runelite-client: Make hotkeys run on KeyPressed

Finding when keyUp actually happens is difficult because you have to store state to tell if a key is up on modifier or it's optional non-modifier. The current implementation is good enough for masking events, but not accurate enough for generating them

Fixes #4513
This commit is contained in:
Max Weber
2018-07-31 02:13:35 -06:00
parent e86b2f9a48
commit d581f3e55e
2 changed files with 1 additions and 8 deletions

View File

@@ -175,7 +175,7 @@ public class ScreenshotPlugin extends Plugin
private final HotkeyListener hotkeyListener = new HotkeyListener(() -> config.hotkey())
{
@Override
public void hotkeyReleased()
public void hotkeyPressed()
{
takeScreenshot(format(new Date()));
}

View File

@@ -26,7 +26,6 @@ package net.runelite.client.util;
import java.awt.event.KeyEvent;
import java.util.function.Supplier;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import net.runelite.client.config.Keybind;
import net.runelite.client.input.KeyListener;
@@ -36,7 +35,6 @@ public abstract class HotkeyListener implements KeyListener
{
private final Supplier<Keybind> keybind;
@Getter
private boolean isPressed = false;
private boolean isConsumingTyped = false;
@@ -77,7 +75,6 @@ public abstract class HotkeyListener implements KeyListener
{
isPressed = false;
isConsumingTyped = false;
hotkeyReleased();
if (Keybind.getModifierForKeyCode(e.getKeyCode()) == null)
{
// Only consume non modifier keys
@@ -89,8 +86,4 @@ public abstract class HotkeyListener implements KeyListener
public void hotkeyPressed()
{
}
public void hotkeyReleased()
{
}
}