summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@apple.com>2010-04-05 16:54:22 -0700
committerJeremy Huddleston <jeremyhu@apple.com>2010-04-13 10:05:08 -0700
commita998849997b5ca7acfbeee248101d83f8432a432 (patch)
tree8c2650533716b98439cde3b2c5356e06878f4679
parent3ab6d90bb56238f84057d6e87267a10d750f2894 (diff)
XQuartz: Blacklist some oddball legacy Mac keycodes that break wine
http://xquartz.macosforge.org/trac/ticket/295 Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com> Reviewed-by: Kevin Van Vechten <kvv@apple.com> (cherry picked from commit d6f160510a50d4c4eaa48c9c69a5ddda0d50052c)
-rw-r--r--hw/xquartz/quartzKeyboard.c61
1 files changed, 41 insertions, 20 deletions
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index c89ebf086..67f16cd75 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -39,6 +39,7 @@
#define HACK_MISSING 1
#define HACK_KEYPAD 1
+#define HACK_BLACKLIST 1
#include <unistd.h>
#include <stdio.h>
@@ -80,6 +81,7 @@ enum {
#define UKEYSYM(u) ((u) | 0x01000000)
+#if HACK_MISSING
/* Table of keycode->keysym mappings we use to fallback on for important
keys that are often not in the Unicode mapping. */
@@ -114,7 +116,9 @@ const static struct {
{107, XK_F14},
{113, XK_F15},
};
+#endif
+#if HACK_KEYPAD
/* Table of keycode->old,new-keysym mappings we use to fixup the numeric
keypad entries. */
@@ -140,6 +144,17 @@ const static struct {
{91, XK_8, XK_KP_8},
{92, XK_9, XK_KP_9},
};
+#endif
+
+#if HACK_BLACKLIST
+/* <rdar://problem/7824370> wine notepad produces wrong characters on shift+arrow
+ * http://xquartz.macosforge.org/trac/ticket/295
+ * http://developer.apple.com/legacy/mac/library/documentation/mac/Text/Text-579.html
+ *
+ * legacy Mac keycodes for arrow keys that shift-modify to math symbols
+ */
+const static unsigned short keycode_blacklist[] = {66, 70, 72, 77};
+#endif
/* Table mapping normal keysyms to their dead equivalents.
FIXME: all the unicode keysyms (apart from circumflex) were guessed. */
@@ -800,32 +815,38 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
if (k[3] == k[2]) k[3] = NoSymbol;
if (k[1] == k[0]) k[1] = NoSymbol;
if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol;
+ if (k[3] == k[0] && k[2] == k[1] && k[2] == NoSymbol) k[3] = NoSymbol;
}
+#if HACK_MISSING
/* Fix up some things that are normally missing.. */
-
- if (HACK_MISSING) {
- for (i = 0; i < sizeof (known_keys) / sizeof (known_keys[0]); i++) {
- k = info->keyMap + known_keys[i].keycode * GLYPHS_PER_KEY;
-
- if (k[0] == NoSymbol && k[1] == NoSymbol
- && k[2] == NoSymbol && k[3] == NoSymbol)
- k[0] = known_keys[i].keysym;
- }
+
+ for (i = 0; i < sizeof (known_keys) / sizeof (known_keys[0]); i++) {
+ k = info->keyMap + known_keys[i].keycode * GLYPHS_PER_KEY;
+
+ if ( k[0] == NoSymbol && k[1] == NoSymbol
+ && k[2] == NoSymbol && k[3] == NoSymbol)
+ k[0] = known_keys[i].keysym;
}
-
+#endif
+
+#if HACK_KEYPAD
/* And some more things. We find the right symbols for the numeric
- keypad, but not the KP_ keysyms. So try to convert known keycodes. */
-
- if (HACK_KEYPAD) {
- for (i = 0; i < sizeof (known_numeric_keys)
- / sizeof (known_numeric_keys[0]); i++) {
- k = info->keyMap + known_numeric_keys[i].keycode * GLYPHS_PER_KEY;
-
- if (k[0] == known_numeric_keys[i].normal)
- k[0] = known_numeric_keys[i].keypad;
- }
+ keypad, but not the KP_ keysyms. So try to convert known keycodes. */
+ for (i = 0; i < sizeof (known_numeric_keys) / sizeof (known_numeric_keys[0]); i++) {
+ k = info->keyMap + known_numeric_keys[i].keycode * GLYPHS_PER_KEY;
+
+ if (k[0] == known_numeric_keys[i].normal)
+ k[0] = known_numeric_keys[i].keypad;
}
+#endif
+
+#if HACK_BLACKLIST
+ for (i = 0; i < sizeof (keycode_blacklist) / sizeof (keycode_blacklist[0]); i++) {
+ k = info->keyMap + keycode_blacklist[i] * GLYPHS_PER_KEY;
+ k[0] = k[1] = k[2] = k[3] = NoSymbol;
+ }
+#endif
info->modMapInitialized = FALSE;
DarwinBuildModifierMaps(info);