Merge pull request #4013 from Abextm/hotkey-ezfix

runelite-client: Don't use system specific modifier key names
This commit is contained in:
Tomas Slusny
2018-06-28 10:24:24 +02:00
committed by GitHub

View File

@@ -133,7 +133,7 @@ public class Keybind
String mod = ""; String mod = "";
if (modifiers != 0) if (modifiers != 0)
{ {
mod = InputEvent.getModifiersExText(modifiers); mod = getModifiersExText(modifiers);
} }
if (mod.isEmpty() && key.isEmpty()) if (mod.isEmpty() && key.isEmpty())
@@ -150,4 +150,31 @@ public class Keybind
} }
return mod; return mod;
} }
public static String getModifiersExText(int modifiers)
{
StringBuilder buf = new StringBuilder();
if ((modifiers & InputEvent.META_DOWN_MASK) != 0)
{
buf.append("Meta+");
}
if ((modifiers & InputEvent.CTRL_DOWN_MASK) != 0)
{
buf.append("Ctrl+");
}
if ((modifiers & InputEvent.ALT_DOWN_MASK) != 0)
{
buf.append("Alt+");
}
if ((modifiers & InputEvent.SHIFT_DOWN_MASK) != 0)
{
buf.append("Shift+");
}
if (buf.length() > 0)
{
buf.setLength(buf.length() - 1); // remove trailing '+'
}
return buf.toString();
}
} }