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

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Tue Apr 8 17:00:16 PDT 2008


 configure.ac                    |    3 ++-
 dix/events.c                    |    7 +++++++
 dix/window.c                    |    3 +++
 hw/xquartz/quartz.c             |    8 ++++++--
 include/windowstr.h             |    3 +++
 miext/rootless/rootlessWindow.c |   14 ++++++++------
 miext/rootless/rootlessWindow.h |    4 +---
 7 files changed, 30 insertions(+), 12 deletions(-)

New commits:
commit 2e78818232314908a73113b1d46c2420d9d4fcbf
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Tue Apr 8 16:53:50 2008 -0700

    XQuartz: Fix issue where clicking on an X11 window might send that event to an X11 window in another space.

diff --git a/configure.ac b/configure.ac
index cfe75a5..fc8e7fb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1635,7 +1635,8 @@ if test "X$XQUARTZ" = Xauto; then
 fi
 
 if test "x$XQUARTZ" = xyes; then
-	AC_DEFINE([XQUARTZ],[1],[Have Quartz])
+	AC_DEFINE(XQUARTZ,1,[Have Quartz])
+	AC_DEFINE(ROOTLESS,1,[Build Rootless code])
 
 #glxAGL / glxCGL don't work yet
 #	AC_CACHE_CHECK([for AGL framework],xorg_cv_AGL_framework,[
diff --git a/dix/events.c b/dix/events.c
index c57a30e..84a802a 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1970,6 +1970,13 @@ XYToWindow(int x, int y)
 				x - pWin->drawable.x,
 				y - pWin->drawable.y, &box))
 #endif
+#ifdef ROOTLESS
+    /* In rootless mode windows may be offscreen, even when
+     * they're in X's stack. (E.g. if the native window system
+     * implements some form of virtual desktop system).
+     */
+		&& !pWin->rootlessUnhittable
+#endif
 	    )
 	{
 	    if (spriteTraceGood >= spriteTraceSize)
diff --git a/dix/window.c b/dix/window.c
index 3dfeda3..ab1f3f1 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -305,6 +305,9 @@ SetWindowToDefaults(register WindowPtr pWin)
 #ifdef COMPOSITE
     pWin->redirectDraw = 0;
 #endif
+#ifdef ROOTLESS
+    pWin->rootlessUnhittable = FALSE;
+#endif
 }
 
 static void
diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index 65be72c..969d4a2 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -51,7 +51,6 @@
 #include "windowstr.h"
 #include "colormapst.h"
 #include "globals.h"
-#include "rootlessWindow.h"
 
 // System headers
 #include <sys/types.h>
@@ -61,6 +60,11 @@
 
 #define FAKE_RANDR 1
 
+/* FIXME: Abstract this away into xpr */
+#include <Xplugin.h>
+#include "rootlessWindow.h"
+WindowPtr xprGetXWindow(xp_window_id wid);
+
 // Shared global variables for Quartz modes
 int                     quartzEventWriteFD = -1;
 int                     quartzRootless = -1;
@@ -459,7 +463,7 @@ void QuartzProcessEvent(xEvent *xe) {
 
         case kXquartzWindowState:
             DEBUG_LOG("kXquartzWindowState\n");
-            RootlessNativeWindowStateChanged(xe->u.clientMessage.u.l.longs0,
+            RootlessNativeWindowStateChanged(xprGetXWindow(xe->u.clientMessage.u.l.longs0),
 		  			     xe->u.clientMessage.u.l.longs1);
 	    break;
 	  
diff --git a/include/windowstr.h b/include/windowstr.h
index a37dc6b..27261ec 100644
--- a/include/windowstr.h
+++ b/include/windowstr.h
@@ -138,6 +138,9 @@ typedef struct _Window {
 #ifdef COMPOSITE
     unsigned		redirectDraw:1;	/* rendering is redirected from here */
 #endif
+#ifdef ROOTLESS
+    unsigned		rootlessUnhittable:1;	/* doesn't hit-test */
+#endif
     DevUnion		*devPrivates;
 } WindowRec;
 
diff --git a/miext/rootless/rootlessWindow.c b/miext/rootless/rootlessWindow.c
index bf0380f..453f7d1 100644
--- a/miext/rootless/rootlessWindow.c
+++ b/miext/rootless/rootlessWindow.c
@@ -117,12 +117,10 @@ rootlessHasRoot (ScreenPtr pScreen)
 }
 
 void
-RootlessNativeWindowStateChanged (xp_window_id id, unsigned int state)
+RootlessNativeWindowStateChanged (WindowPtr pWin, unsigned int state)
 {
-  WindowPtr pWin;
   RootlessWindowRec *winRec;
 
-  pWin = xprGetXWindow (id);
   if (pWin == NULL) return;
 
   winRec = WINREC (pWin);
@@ -130,7 +128,7 @@ RootlessNativeWindowStateChanged (xp_window_id id, unsigned int state)
 
   winRec->is_offscreen = ((state & XP_WINDOW_STATE_OFFSCREEN) != 0);
   winRec->is_obscured = ((state & XP_WINDOW_STATE_OBSCURED) != 0);
-  //  pWin->rootlessUnhittable = winRec->is_offscreen;
+  pWin->rootlessUnhittable = winRec->is_offscreen;
 }
 
 void
@@ -143,7 +141,7 @@ RootlessNativeWindowMoved (WindowPtr pWin)
   ClientPtr client;
   RootlessWindowRec *winRec = WINREC(pWin);
 
-  if (xp_get_window_bounds (winRec->wid, &bounds) != Success) return;
+  if (xp_get_window_bounds ((xp_window_id)winRec->wid, &bounds) != Success) return;
 
   sx = dixScreenOrigins[pWin->drawable.pScreen->myNum].x + darwinMainScreenX;
   sy = dixScreenOrigins[pWin->drawable.pScreen->myNum].y + darwinMainScreenY;
@@ -1428,6 +1426,10 @@ RootlessReparentWindow(WindowPtr pWin, WindowPtr pPriorParent)
 
     pTopWin = TopLevelParent(pWin);
     assert(pTopWin != pWin);
+    
+    pWin->rootlessUnhittable = FALSE;
+    
+    DeleteProperty (pWin, xa_native_window_id ());
 
     if (WINREC(pTopWin) != NULL) {
         /* We're screwed. */
@@ -1484,7 +1486,7 @@ RootlessFlushWindowColormap (WindowPtr pWin)
   wc.colormap = RootlessColormapCallback;
   wc.colormap_data = pWin->drawable.pScreen;
 
-  configure_window (winRec->wid, XP_COLORMAP, &wc);
+  configure_window ((xp_window_id)winRec->wid, XP_COLORMAP, &wc);
 }
 
 /*
diff --git a/miext/rootless/rootlessWindow.h b/miext/rootless/rootlessWindow.h
index ad876e5..3bdb3bd 100644
--- a/miext/rootless/rootlessWindow.h
+++ b/miext/rootless/rootlessWindow.h
@@ -36,8 +36,6 @@
 
 #include "rootlessCommon.h"
 
-#include <Xplugin.h>
-
 Bool RootlessCreateWindow(WindowPtr pWin);
 Bool RootlessDestroyWindow(WindowPtr pWin);
 
@@ -61,6 +59,6 @@ void RootlessPaintWindowBorder(WindowPtr pWin, RegionPtr pRegion,
                                int what);
 void RootlessChangeBorderWidth(WindowPtr pWin, unsigned int width);
 void RootlessNativeWindowMoved (WindowPtr pWin);
-void RootlessNativeWindowStateChanged (xp_window_id id, unsigned int state); 
+void RootlessNativeWindowStateChanged (WindowPtr pWin, unsigned int state); 
 
 #endif


More information about the xorg-commit mailing list