xserver: Branch 'xorg-server-1.2-apple'

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Mon Dec 10 20:50:18 PST 2007


 hw/xquartz/darwinEvents.c   |    2 +-
 hw/xquartz/darwinKeyboard.c |   20 +++++++++-----------
 hw/xquartz/quartzKeyboard.c |    8 ++++----
 hw/xquartz/quartzKeyboard.h |    4 ++--
 4 files changed, 16 insertions(+), 18 deletions(-)

New commits:
commit 0e017177dcca7185716ca760dcce9ddedc7bfef9
Author: Jeremy Huddleston <jeremy at yuffie.local>
Date:   Mon Dec 10 20:47:48 2007 -0800

    Xquartz: Make Alt work with Xmodmap again

diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index a9fff43..381f2e1 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -452,7 +452,7 @@ void ProcessInputEvents(void)
                     static unsigned int last_seed;
                     unsigned int this_seed;
 
-                    this_seed = DarwinModeSystemKeymapSeed();
+                    this_seed = QuartzSystemKeymapSeed();
                     if (this_seed != last_seed)
                     {
                         last_seed = this_seed;
diff --git a/hw/xquartz/darwinKeyboard.c b/hw/xquartz/darwinKeyboard.c
index 735ed9c..6ad2802 100644
--- a/hw/xquartz/darwinKeyboard.c
+++ b/hw/xquartz/darwinKeyboard.c
@@ -507,8 +507,9 @@ Bool DarwinParseNXKeyMapping(darwinKeyboardInfo  *info) {
                                 (left ? XK_Control_L : XK_Control_R);
                         break;
                     case NX_MODIFIERKEY_ALTERNATE:
-                        info->keyMap[keyCode * GLYPHS_PER_KEY] = XK_Mode_switch;
-                                // (left ? XK_Alt_L : XK_Alt_R);
+                        // info->keyMap[keyCode * GLYPHS_PER_KEY] = XK_Mode_switch;
+                        info->keyMap[keyCode * GLYPHS_PER_KEY] =
+                                (left ? XK_Alt_L : XK_Alt_R);
                         break;
                     case NX_MODIFIERKEY_COMMAND:
                         info->keyMap[keyCode * GLYPHS_PER_KEY] =
@@ -685,6 +686,7 @@ static void DarwinBuildModifierMaps(darwinKeyboardInfo *info) {
             case XK_Alt_L:
                 info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i;
                 info->modMap[MIN_KEYCODE + i] = Mod1Mask;
+                *k = XK_Mode_switch; // Yes, this is ugly.  This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor.
                 break;
 
             case XK_Alt_R:
@@ -693,15 +695,11 @@ static void DarwinBuildModifierMaps(darwinKeyboardInfo *info) {
 #else
                 info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i;
 #endif
+                *k = XK_Mode_switch; // Yes, this is ugly.  This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor.
                 info->modMap[MIN_KEYCODE + i] = Mod1Mask;
                 break;
 
             case XK_Mode_switch:
-                // Yes, this is ugly.  This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor.
-#ifdef NX_MODIFIERKEY_RALTERNATE
-                info->modifierKeycodes[NX_MODIFIERKEY_RALTERNATE][0] = i;
-#endif
-                info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i;
                 info->modMap[MIN_KEYCODE + i] = Mod1Mask;
                 break;
 
@@ -735,12 +733,12 @@ static void DarwinLoadKeyboardMapping(KeySymsRec *keySyms) {
     memset(keyInfo.keyMap, 0, sizeof(keyInfo.keyMap));
 
     /* TODO: Clean this up
-     * DarwinModeReadSystemKeymap is in quartz/quartzKeyboard.c
+     * QuartzReadSystemKeymap is in quartz/quartzKeyboard.c
      * DarwinParseNXKeyMapping is here
      */
     if (!DarwinParseNXKeyMapping(&keyInfo)) {
-        DEBUG_LOG("DarwinParseNXKeyMapping returned 0... running DarwinModeReadSystemKeymap().\n");
-        if (!DarwinModeReadSystemKeymap(&keyInfo)) {
+        DEBUG_LOG("DarwinParseNXKeyMapping returned 0... running QuartzReadSystemKeymap().\n");
+        if (!QuartzReadSystemKeymap(&keyInfo)) {
             FatalError("Could not build a valid keymap.");
         }
     }
@@ -790,7 +788,7 @@ void DarwinKeyboardInit(DeviceIntPtr pDev) {
     //    DarwinKeyboardReload(pDev);
     /* Initialize the seed, so we don't reload the keymap unnecessarily
        (and possibly overwrite xinitrc changes) */
-    DarwinModeSystemKeymapSeed();
+    QuartzSystemKeymapSeed();
 
     assert( InitKeyboardDeviceStruct( (DevicePtr)pDev, &keySyms,
                                       keyInfo.modMap, QuartzBell,
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 0a50d06..9b899ca 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -66,11 +66,11 @@ const static struct {
     {55,  XK_Meta_L},
     {56,  XK_Shift_L},
     {57,  XK_Caps_Lock},
-    {58,  XK_Mode_switch},
+    {58,  XK_Alt_L},
     {59,  XK_Control_L},
 
     {60,  XK_Shift_R},
-    {61,  XK_Mode_switch},
+    {61,  XK_Alt_R},
     {62,  XK_Control_R},
     {63,  XK_Meta_R},
 
@@ -146,7 +146,7 @@ const static struct {
     {UKEYSYM (0x31b), XK_dead_horn},		/* COMBINING HORN */
 };
 
-unsigned int DarwinModeSystemKeymapSeed(void) {
+unsigned int QuartzSystemKeymapSeed(void) {
     static unsigned int seed;
     static KeyboardLayoutRef last_key_layout;
     KeyboardLayoutRef key_layout;
@@ -195,7 +195,7 @@ static KeySym make_dead_key(KeySym in) {
     return in;
 }
 
-Bool DarwinModeReadSystemKeymap(darwinKeyboardInfo *info) {
+Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
     KeyboardLayoutRef key_layout;
     const void *chr_data = NULL;
     int num_keycodes = NUM_KEYCODES;
diff --git a/hw/xquartz/quartzKeyboard.h b/hw/xquartz/quartzKeyboard.h
index c5f22bf..0c7e70e 100644
--- a/hw/xquartz/quartzKeyboard.h
+++ b/hw/xquartz/quartzKeyboard.h
@@ -47,7 +47,7 @@ typedef struct darwinKeyboardInfo_struct {
 
 /* These functions need to be implemented by XQuartz, XDarwin, etc. */
 void DarwinKeyboardReload(DeviceIntPtr pDev);
-Bool DarwinModeReadSystemKeymap(darwinKeyboardInfo *info);
-unsigned int DarwinModeSystemKeymapSeed(void);
+Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info);
+unsigned int QuartzSystemKeymapSeed(void);
 
 #endif /* QUARTZ_KEYBOARD_H */


More information about the xorg-commit mailing list