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

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Fri Aug 8 01:21:25 PDT 2008


 dix/getevents.c             |    2 +
 hw/xquartz/quartzKeyboard.c |   47 +++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 46 insertions(+), 3 deletions(-)

New commits:
commit 6f74475a04f103e1654a7ece683822cb82988a11
Author: Peter Hutterer <peter.hutterer at redhat.com>
Date:   Fri Aug 8 17:37:06 2008 +0930

    dix: don't try to create events if we don't have a screen. #16898
    
    A NULL screen may happen during server shutdown, when the output has been shut
    down but the devices still generate events.
    
    X.Org Bug 16898 <http://bugs.freedesktop.org/show_bug.cgi?id=16898>
    (cherry picked from commit 465a9bb96e8a90e53e655b3245e22910201786d7)

diff --git a/dix/getevents.c b/dix/getevents.c
index 876ad3c..685cd8b 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -540,6 +540,8 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
     ScreenPtr scr = miPointerGetScreen(pDev);
 
     /* Sanity checks. */
+    if (!scr) /* can happen during server shutdown */
+        return 0;
     if (type != MotionNotify && type != ButtonPress && type != ButtonRelease)
         return 0;
 
commit 8894e5312aeb06d8aeca7b2e6dc0ad13d26baf01
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Fri Aug 8 00:19:41 2008 -0700

    XQuartz: Re-added deprecated code fallback failsafe for keyboard layout on Leopard with some debugging spew.
    (cherry picked from commit 5854e712e9ebc210d2f8de6f5d4fb650944f314a)

diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 5e7a13c..0bfb50b 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -71,6 +71,8 @@
 #include "X11/keysym.h"
 #include "keysym2ucs.h"
 
+#include <Availability.h>
+
 void QuartzXkbUpdate(DeviceIntPtr pDev);
 
 enum {
@@ -1090,6 +1092,7 @@ Bool LegalModifier(unsigned int key, DeviceIntPtr pDev)
 /* TODO: Not thread safe */
 unsigned int QuartzSystemKeymapSeed(void) {
     static unsigned int seed = 0;
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
     static TISInputSourceRef last_key_layout = NULL;
     TISInputSourceRef key_layout;
 
@@ -1106,7 +1109,15 @@ unsigned int QuartzSystemKeymapSeed(void) {
     } else {
         last_key_layout = key_layout;
     }
+#else
+    static KeyboardLayoutRef last_key_layout;
+    KeyboardLayoutRef key_layout;
 
+    KLGetCurrentKeyboardLayout (&key_layout);
+    if (key_layout != last_key_layout)
+        seed++;
+    last_key_layout = key_layout;
+#endif
     return seed;
 }
 
@@ -1148,6 +1159,9 @@ static KeySym make_dead_key(KeySym in) {
 }
 
 Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
+#if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060
+    KeyboardLayoutRef key_layout;
+#endif
     const void *chr_data = NULL;
     int num_keycodes = NUM_KEYCODES;
     UInt32 keyboard_type = 0;
@@ -1156,17 +1170,44 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
     KeySym *k;
 
     TISInputSourceRef currentKeyLayoutRef = TISCopyCurrentKeyboardLayoutInputSource();
-    keyboard_type = LMGetKbdType ();
+    keyboard_type = LMGetKbdType();
+
     if (currentKeyLayoutRef) {
       CFDataRef currentKeyLayoutDataRef = (CFDataRef )TISGetInputSourceProperty(currentKeyLayoutRef, kTISPropertyUnicodeKeyLayoutData);
-      if (currentKeyLayoutDataRef) chr_data = CFDataGetBytePtr(currentKeyLayoutDataRef);
+      if (currentKeyLayoutDataRef)
+          chr_data = CFDataGetBytePtr(currentKeyLayoutDataRef);
+    }
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060
+    if (chr_data == NULL) {
+        ErrorF("X11.app: Error detected in determining keyboard layout.  Please report this error at http://xquartz.macosforge.org\n");
+        ErrorF("X11.app: Debug Info: currentKeyLayoutRef=%p, chr_data=%p\n", currentKeyLayoutRef, chr_data);
+
+        KLGetCurrentKeyboardLayout (&key_layout);
+        KLGetKeyboardLayoutProperty (key_layout, kKLuchrData, &chr_data);
+
+        if(chr_data != NULL) {
+            ErrorF("X11.app: Fallback succeeded, but this is still a bug.  Please report the above information.\n");
+        }
     }
 
     if (chr_data == NULL) {
+        ErrorF("X11.app: Debug Info: kKLuchrData fallback failed, trying kKLKCHRData.\n", currentKeyLayoutRef, chr_data);
+        KLGetKeyboardLayoutProperty (key_layout, kKLKCHRData, &chr_data);
+        is_uchr = 0;
+        num_keycodes = 128;
+        
+        if(chr_data != NULL) {
+            ErrorF("X11.app: Fallback succeeded, but this is still a bug.  Please report the above information.\n");
+        }
+    }
+#endif
+
+    if (chr_data == NULL) {
       ErrorF ( "Couldn't get uchr or kchr resource\n");
       return FALSE;
     }
-
+    
     /* Scan the keycode range for the Unicode character that each
        key produces in the four shift states. Then convert that to
        an X11 keysym (which may just the bit that says "this is


More information about the xorg-commit mailing list