xserver: Branch 'xorg-server-1.5-apple' - 2 commits

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Wed Jul 15 23:14:26 PDT 2009


 hw/xquartz/quartzKeyboard.c |   29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

New commits:
commit 3638f99f03fb77f3b175da082661284d33f05976
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Wed Jul 15 23:05:11 2009 -0700

    XQuartz: SwitchCoreKeyboard() to copy the keymap to the virtual core keyboard.

diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 6f0eedf..c26134e 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -360,6 +360,7 @@ void DarwinKeyboardInit(DeviceIntPtr pDev) {
         XkbSetRepeatKeys(pDev, -1, AutoRepeatModeOn);
     }
 
+    SwitchCoreKeyboard(pDev);
 }
 
 void DarwinKeyboardReloadHandler(int screenNum, xEventPtr xe, DeviceIntPtr pDev, int nevents) {
commit 044bd7f6053e325d4b78535609d2b41aa123bae4
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Wed Jul 15 23:04:46 2009 -0700

    XQuartz: Cleanup keymap locking, fix a possible synchro bug
    (cherry picked from commit 33e7437a4984ee7c1b04b87d23dee7d4739d5f12)

diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 143f910..6f0eedf 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -277,17 +277,13 @@ static void DarwinBuildModifierMaps(darwinKeyboardInfo *info) {
  *  Load the keyboard map from a file or system and convert
  *  it to an equivalent X keyboard map and modifier map.
  */
-static void DarwinLoadKeyboardMapping(KeySymsRec *keySyms) {
-    pthread_mutex_lock(&keyInfo_mutex);
-    
+static void DarwinLoadKeyboardMapping(KeySymsRec *keySyms) {    
     DarwinBuildModifierMaps(&keyInfo);
 
     keySyms->map        = keyInfo.keyMap;
     keySyms->mapWidth   = GLYPHS_PER_KEY;
     keySyms->minKeyCode = MIN_KEYCODE;
     keySyms->maxKeyCode = MAX_KEYCODE;
-
-    pthread_mutex_unlock(&keyInfo_mutex);
 }
 
 /*
@@ -333,16 +329,16 @@ void DarwinKeyboardInit(DeviceIntPtr pDev) {
     // for a kIOHIDParamConnectType connection.
     assert(darwinParamConnect = NXOpenEventStatus());
 
-    DarwinLoadKeyboardMapping(&keySyms);
-
     bzero(&names, sizeof(names));
 
     /* We need to really have rules... or something... */
     //XkbSetRulesDflts("base", "pc105", "us", NULL, NULL);
-    
+
     pthread_mutex_lock(&keyInfo_mutex);
-    assert(XkbInitKeyboardDeviceStruct(pDev, &names, &keySyms, keyInfo.modMap,
-                                       QuartzBell, DarwinChangeKeyboardControl));
+    
+    DarwinLoadKeyboardMapping(&keySyms);    
+    XkbInitKeyboardDeviceStruct(pDev, &names, &keySyms, keyInfo.modMap,
+                                       QuartzBell, DarwinChangeKeyboardControl);
     pthread_mutex_unlock(&keyInfo_mutex);
 
     /* Get our key repeat settings from GlobalPreferences */
@@ -364,16 +360,17 @@ void DarwinKeyboardInit(DeviceIntPtr pDev) {
         XkbSetRepeatKeys(pDev, -1, AutoRepeatModeOn);
     }
 
-    DarwinKeyboardSetDeviceKeyMap(&keySyms);
 }
 
 void DarwinKeyboardReloadHandler(int screenNum, xEventPtr xe, DeviceIntPtr pDev, int nevents) {
     KeySymsRec keySyms;
 
     DEBUG_LOG("DarwinKeyboardReloadHandler\n");
-
+    
+    pthread_mutex_lock(&keyInfo_mutex);
     DarwinLoadKeyboardMapping(&keySyms);
     DarwinKeyboardSetDeviceKeyMap(&keySyms);
+    pthread_mutex_unlock(&keyInfo_mutex);
 }
 
 //-----------------------------------------------------------------------------
@@ -409,21 +406,22 @@ int DarwinModifierNXKeyToNXKeycode(int key, int side) {
 int DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide) {
     int key, side;
 
-    pthread_mutex_lock(&keyInfo_mutex);
     keycode += MIN_KEYCODE;
+
     // search modifierKeycodes for this keycode+side
+    pthread_mutex_lock(&keyInfo_mutex);
     for (key = 0; key < NX_NUMMODIFIERS; key++) {
         for (side = 0; side <= 1; side++) {
             if (keyInfo.modifierKeycodes[key][side] == keycode) break;
         }
     }
+    pthread_mutex_unlock(&keyInfo_mutex);
+
     if (key == NX_NUMMODIFIERS) {
-        pthread_mutex_unlock(&keyInfo_mutex);
         return -1;
     }
     if (outSide) *outSide = side;
 
-    pthread_mutex_unlock(&keyInfo_mutex);
     return key;
 }
 


More information about the xorg-commit mailing list