key remapping: add control remap

Co-authored-by: Adam <Adam@sigterm.info>
This commit is contained in:
Matthew Zegar
2020-10-31 12:06:33 -07:00
committed by Adam
parent 7ceb3c9e02
commit 43bf4d60eb
3 changed files with 33 additions and 0 deletions

View File

@@ -24,6 +24,7 @@
*/
package net.runelite.client.plugins.keyremapping;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
@@ -286,4 +287,15 @@ public interface KeyRemappingConfig extends Config
{
return new ModifierlessKeybind(KeyEvent.VK_SPACE, 0);
}
@ConfigItem(
position = 21,
keyName = "control",
name = "Control",
description = "The key which will replace {Control}."
)
default ModifierlessKeybind control()
{
return new ModifierlessKeybind(KeyEvent.VK_UNDEFINED, InputEvent.CTRL_DOWN_MASK);
}
}

View File

@@ -162,6 +162,11 @@ class KeyRemappingListener implements KeyListener
mappedKeyCode = KeyEvent.VK_SPACE;
}
if (config.control().matches(e))
{
mappedKeyCode = KeyEvent.VK_CONTROL;
}
if (mappedKeyCode != KeyEvent.VK_UNDEFINED && mappedKeyCode != e.getKeyCode())
{
final char keyChar = e.getKeyChar();