[Xquartz-changes] xserver: Branch 'master'

Jeremy Huddleston jeremyhu at freedesktop.org
Mon Apr 5 16:55:52 PDT 2010


 hw/xquartz/quartzKeyboard.c |   63 ++++++++++++++++++++++++++++++--------------
 1 file changed, 43 insertions(+), 20 deletions(-)

New commits:
commit 767ae026974c0d1518bd787d7036cad3c5b6754e
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Mon Apr 5 16:54:22 2010 -0700

    XQuartz: Blacklist some oddball legacy Mac keycodes that break wine
    
    http://xquartz.macosforge.org/trac/ticket/295
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index a4a0b08..fb2bd91 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>
@@ -83,6 +84,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. */
 
@@ -117,7 +119,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. */
 
@@ -143,6 +147,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. */
@@ -772,32 +787,40 @@ 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++) {
+        fprintf(stderr, "Blacking out keycode %u\n", keycode_blacklist[i]);
+        
+        k = info->keyMap + keycode_blacklist[i] * GLYPHS_PER_KEY;
+        k[0] = k[1] = k[2] = k[3] = NoSymbol;
+    }
+#endif
 
     DarwinBuildModifierMaps(info);
 


More information about the Xquartz-changes mailing list