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

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Wed Apr 30 17:33:15 PDT 2008


 dix/getevents.c           |   12 +++++++++---
 hw/xquartz/darwin.h       |   32 --------------------------------
 hw/xquartz/darwinEvents.h |   32 ++++++++++++++++++++++++++++++++
 3 files changed, 41 insertions(+), 35 deletions(-)

New commits:
commit 51925ed0db2dd1507b6164a8b085659305948ef1
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Wed Apr 30 17:30:57 2008 -0700

    XQuartz: Moved some relevant stuff from darwin.h to darwinEvents.h
    (cherry picked from commit 1fcf74a436f2e19cceb3f285b89859025d94c040)

diff --git a/hw/xquartz/darwin.h b/hw/xquartz/darwin.h
index 4300b9f..bdf0046 100644
--- a/hw/xquartz/darwin.h
+++ b/hw/xquartz/darwin.h
@@ -89,38 +89,6 @@ extern int              darwinDesiredRefresh;
 extern int              darwinMainScreenX;
 extern int              darwinMainScreenY;
 
-
-/*
- * Special ddx events understood by the X server
- */
-enum {
-    kXquartzReloadKeymap      // Reload system keymap
-            = LASTEvent+1,    // (from X.h list of event names)
-    kXquartzActivate,         // restore X drawing and cursor
-    kXquartzDeactivate,       // clip X drawing and switch to Aqua cursor
-    kXquartzSetRootClip,      // enable or disable drawing to the X screen
-    kXquartzQuit,             // kill the X server and release the display
-    kXquartzReadPasteboard,   // copy Mac OS X pasteboard into X cut buffer
-    kXquartzWritePasteboard,  // copy X cut buffer onto Mac OS X pasteboard
-    kXquartzBringAllToFront,  // bring all X windows to front
-    kXquartzToggleFullscreen, // Enable/Disable fullscreen mode
-    kXquartzSetRootless,      // Set rootless mode
-    kXquartzSpaceChanged,     // Spaces changed
-    /*
-     * AppleWM events
-     */
-    kXquartzControllerNotify, // send an AppleWMControllerNotify event
-    kXquartzPasteboardNotify, // notify the WM to copy or paste
-    /*
-     * Xplugin notification events
-     */
-    kXquartzDisplayChanged,   // display configuration has changed
-    kXquartzWindowState,      // window visibility state has changed
-    kXquartzWindowMoved,      // window has moved on screen
-};
-
-void DarwinSendDDXEvent(int type, int argc, ...);
-
 #define ENABLE_DEBUG_LOG 1
 
 #ifdef ENABLE_DEBUG_LOG
diff --git a/hw/xquartz/darwinEvents.h b/hw/xquartz/darwinEvents.h
index ef8bf39..a676aeb 100644
--- a/hw/xquartz/darwinEvents.h
+++ b/hw/xquartz/darwinEvents.h
@@ -40,4 +40,36 @@ void DarwinSendScrollEvents(float count_x, float count_y, int pointer_x, int poi
 			    float pressure, float tilt_x, float tilt_y);
 void DarwinUpdateModKeys(int flags);
 
+/*
+ * Special ddx events understood by the X server
+ */
+enum {
+    kXquartzReloadKeymap      // Reload system keymap
+    = LASTEvent+1,    // (from X.h list of event names)
+    kXquartzActivate,         // restore X drawing and cursor
+    kXquartzDeactivate,       // clip X drawing and switch to Aqua cursor
+    kXquartzSetRootClip,      // enable or disable drawing to the X screen
+    kXquartzQuit,             // kill the X server and release the display
+    kXquartzReadPasteboard,   // copy Mac OS X pasteboard into X cut buffer
+    kXquartzWritePasteboard,  // copy X cut buffer onto Mac OS X pasteboard
+    kXquartzBringAllToFront,  // bring all X windows to front
+    kXquartzToggleFullscreen, // Enable/Disable fullscreen mode
+    kXquartzSetRootless,      // Set rootless mode
+    kXquartzSpaceChanged,     // Spaces changed
+    /*
+     * AppleWM events
+     */
+    kXquartzControllerNotify, // send an AppleWMControllerNotify event
+    kXquartzPasteboardNotify, // notify the WM to copy or paste
+    /*
+     * Xplugin notification events
+     */
+    kXquartzDisplayChanged,   // display configuration has changed
+    kXquartzWindowState,      // window visibility state has changed
+    kXquartzWindowMoved,      // window has moved on screen
+};
+
+/* Send one of the above events to the server thread. */
+void DarwinSendDDXEvent(int type, int argc, ...);
+
 #endif  /* _DARWIN_EVENTS_H */
commit 3a89ce6307b51206f593c93d14c57ddbeabe0a21
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Wed Apr 30 17:30:32 2008 -0700

    Dix: Cleaned up sanity checking in Get{Pointer,Keyboard}Events
    
    XQuartz was crashing because the Appkit thread was trying to GetXXXEvents while the Xserver thread was exiting.
    This adds some more sanity checks and avoids that crash
    (cherry picked from commit 34ec4bd6acb834c0e3f9a5042a0cc3f52c6f3a68)

diff --git a/dix/getevents.c b/dix/getevents.c
index bf9331e..0229c0a 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -407,8 +407,8 @@ GetKeyboardValuatorEvents(xEvent *events, DeviceIntPtr pDev, int type,
                           int num_valuators, int *valuators) {
     int numEvents = 0;
     CARD32 ms = 0;
-    KeySym *map = pDev->key->curKeySyms.map;
-    KeySym sym = map[key_code * pDev->key->curKeySyms.mapWidth];
+    KeySym *map;
+    KeySym sym;
     deviceKeyButtonPointer *kbp = NULL;
 
     if (!events)
@@ -419,11 +419,14 @@ GetKeyboardValuatorEvents(xEvent *events, DeviceIntPtr pDev, int type,
         return 0;
 
     if (!pDev->key || !pDev->focus || !pDev->kbdfeed ||
-        (pDev->coreEvents && !inputInfo.keyboard->key))
+        (pDev->coreEvents && !(inputInfo.keyboard && inputInfo.keyboard->key)))
         return 0;
 
     if (key_code < 8 || key_code > 255)
         return 0;
+    
+    map = pDev->key->curKeySyms.map;
+    sym = map[key_code * pDev->key->curKeySyms.mapWidth];
 
     if (pDev->coreEvents)
         numEvents = 2;
@@ -539,6 +542,9 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
 
     if ((type == ButtonPress || type == ButtonRelease) && !pDev->button)
         return 0;
+    
+    if(pDev->coreEvents && !cp)
+        return 0;
 
     /* FIXME: I guess it should, in theory, be possible to post button events
      *        from devices without valuators. */


More information about the xorg-commit mailing list