runelite-client: Don't use system specific modifier key names

Without this OSX shows a replacement character, see #4006. When/If #4006 is merged, this should be reverted.
This commit is contained in:
Max Weber
2018-06-25 17:31:28 -06:00
parent 58404f098d
commit 962bc58178

View File

@@ -131,7 +131,7 @@ public class Keybind
String mod = "";
if (modifiers != 0)
{
mod = InputEvent.getModifiersExText(modifiers);
mod = getModifiersExText(modifiers);
}
if (mod.isEmpty() && key.isEmpty())
@@ -148,4 +148,31 @@ public class Keybind
}
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();
}
}