From 962bc58178503ee8ffcd0890b3b2882370ffd5eb Mon Sep 17 00:00:00 2001 From: Max Weber Date: Mon, 25 Jun 2018 17:31:28 -0600 Subject: [PATCH] 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. --- .../net/runelite/client/config/Keybind.java | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/config/Keybind.java b/runelite-client/src/main/java/net/runelite/client/config/Keybind.java index 9148ce40d9..b165aae863 100644 --- a/runelite-client/src/main/java/net/runelite/client/config/Keybind.java +++ b/runelite-client/src/main/java/net/runelite/client/config/Keybind.java @@ -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(); + } }