[Xquartz-changes] xserver: Branch 'server-1.4-apple' - 4 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Thu Aug 19 20:26:44 PDT 2010


 hw/xquartz/X11Application.m     |   28 +++++++++++++++++++++-------
 hw/xquartz/darwinEvents.c       |    2 +-
 hw/xquartz/quartz.c             |    5 +++--
 hw/xquartz/xpr/xprEvent.c       |    2 +-
 hw/xquartz/xpr/xprFrame.c       |   10 ++++++++--
 miext/rootless/rootless.h       |    4 ++--
 miext/rootless/rootlessWindow.c |   12 +++++++++---
 7 files changed, 45 insertions(+), 18 deletions(-)

New commits:
commit 7a8a3ca6859d0f5374f048e88dd96f1034e311c1
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sun Aug 1 11:41:58 2010 -0700

    XQuartz: xpr: Bail on errors during unlock and destroy
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
    (cherry picked from commit 5d1d9d9ae39fab2ee2ac085f9776f82768828dc8)

diff --git a/hw/xquartz/xpr/xprFrame.c b/hw/xquartz/xpr/xprFrame.c
index 53aa0ea..162e004 100644
--- a/hw/xquartz/xpr/xprFrame.c
+++ b/hw/xquartz/xpr/xprFrame.c
@@ -206,13 +206,16 @@ xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
 static void
 xprDestroyFrame(RootlessFrameID wid)
 {
+    xp_error err;
     TA_SERVER();
     
     pthread_mutex_lock(&window_hash_mutex);
     x_hash_table_remove(window_hash, wid);
     pthread_mutex_unlock(&window_hash_mutex);
 
-    xp_destroy_window(x_cvt_vptr_to_uint(wid));
+    err = xp_destroy_window(x_cvt_vptr_to_uint(wid));
+    if (err != Success)
+        FatalError("Could not destroy window %i.", (int)x_cvt_vptr_to_uint(wid));
 }
 
 
@@ -366,9 +369,12 @@ xprStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow)
 static void
 xprStopDrawing(RootlessFrameID wid, Bool flush)
 {
+    xp_error err;
     TA_SERVER();
     
-    xp_unlock_window(x_cvt_vptr_to_uint(wid), flush);
+    err = xp_unlock_window(x_cvt_vptr_to_uint(wid), flush);
+    if(err != Success)
+        FatalError("Could not unlock window %i after drawing.", (int)x_cvt_vptr_to_uint(wid));
 }
 
 
commit e03b08f4f236065f4bbda7acf76a794402b8c385
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Thu Aug 19 19:49:39 2010 -0700

    XQuartz: UpdateScreen at the end of SetRootless
    
    This will ensure that pRoot is unlocked after the miPaintWindow
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
    (cherry picked from commit ee7fd8fc58d9fadfbb92302ddea224537f068538)
    
    Conflicts:
    
    	hw/xquartz/quartz.c

diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index aceb805..0726465 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -274,7 +274,6 @@ static void QuartzUpdateScreens(void) {
     pScreen->height = height;
     
     DarwinAdjustScreenOrigins(&screenInfo);
-    quartzProcs->UpdateScreen(pScreen);
     
     /* DarwinAdjustScreenOrigins or UpdateScreen may change dixScreenOrigins,
      * so use it rather than x/y
@@ -286,7 +285,7 @@ static void QuartzUpdateScreens(void) {
     pRoot = WindowTable[pScreen->myNum];
     AppleWMSetScreenOrigin(pRoot);
     pScreen->ResizeWindow(pRoot, x - sx, y - sy, width, height, NULL);
-    //pScreen->PaintWindowBackground (pRoot, &pRoot->borderClip,  PW_BACKGROUND);
+
     miPaintWindow(pRoot, &pRoot->borderClip,  PW_BACKGROUND);
     DefineInitialRootWindow(pRoot);
 
@@ -303,6 +302,8 @@ static void QuartzUpdateScreens(void) {
     e.u.configureNotify.borderWidth = wBorderWidth(pRoot);
     e.u.configureNotify.override = pRoot->overrideRedirect;
     DeliverEvents(pRoot, &e, 1, NullWindow);
+
+    quartzProcs->UpdateScreen(pScreen);
     
 #ifdef FAKE_RANDR
     RREditConnectionInfo(pScreen);
commit d5f64eb1d9f2d74a7c1bab77e4c594f882e39bd2
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Thu Aug 19 19:48:45 2010 -0700

    XQuartz: Make application switching work better for the no-spaces case
    
    We still have the issue with not raising the frontmost window for the case
    when spaces is enabled, and the AppleSpacesSwitchOnActivate preference is
    disabled.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
    (cherry picked from commit 4fc4cab98d454afbfd0d2f48548b5b481e8e7c82)
    
    Conflicts:
    
    	hw/xquartz/xpr/xprEvent.c

diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 4828072..87501ef 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -338,7 +338,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
                 case NSApplicationActivatedEventType:
                     for_x = NO;
                     if ([self modalWindow] == nil) {
-                        BOOL switch_on_activate, ok;
+                        BOOL order_all_windows = YES, workspaces, ok;
                         for_appkit = NO;
                         
                         /* FIXME: hack to avoid having to pass the event to appkit,
@@ -348,13 +348,27 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
                         [self activateX:YES];
                         
                         /* Get the Spaces preference for SwitchOnActivate */
-                        (void)CFPreferencesAppSynchronize(CFSTR(".GlobalPreferences"));
-                        switch_on_activate = CFPreferencesGetAppBooleanValue(CFSTR("AppleSpacesSwitchOnActivate"), CFSTR(".GlobalPreferences"), &ok);
-                        if(!ok)
-                            switch_on_activate = YES;
+                        (void)CFPreferencesAppSynchronize(CFSTR("com.apple.dock"));
+                        workspaces = CFPreferencesGetAppBooleanValue(CFSTR("workspaces"), CFSTR("com.apple.dock"), &ok);
+                        if (!ok)
+                            workspaces = NO;
+
+                        if (workspaces) {
+                            (void)CFPreferencesAppSynchronize(CFSTR(".GlobalPreferences"));
+                            order_all_windows = CFPreferencesGetAppBooleanValue(CFSTR("AppleSpacesSwitchOnActivate"), CFSTR(".GlobalPreferences"), &ok);
+                            if (!ok)
+                                order_all_windows = YES;
+                        }
                         
-                        if ([e data2] & 0x10 && switch_on_activate) // 0x10 is set when we use cmd-tab or the dock icon
-                            DarwinSendDDXEvent(kXquartzBringAllToFront, 0);
+                        /* TODO: In the workspaces && !AppleSpacesSwitchOnActivate case, the windows are ordered
+                         *       correctly, but we need to activate the top window on this space if there is
+                         *       none active.
+                         *
+                         *       If there are no active windows, and there are minimized windows, we should
+                         *       be restoring one of them.
+                         */
+                        if ([e data2] & 0x10) // 0x10 is set when we use cmd-tab or the dock icon
+                            DarwinSendDDXEvent(kXquartzBringAllToFront, 1, order_all_windows);
                     }
                     break;
                     
diff --git a/hw/xquartz/xpr/xprEvent.c b/hw/xquartz/xpr/xprEvent.c
index 08581c0..8a9ee75 100644
--- a/hw/xquartz/xpr/xprEvent.c
+++ b/hw/xquartz/xpr/xprEvent.c
@@ -78,7 +78,7 @@ static void xprEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int n
                 
             case kXquartzBringAllToFront:
                 DEBUG_LOG("kXquartzBringAllToFront\n");
-                RootlessOrderAllWindows();
+                RootlessOrderAllWindows(xe[i].u.clientMessage.u.l.longs0);
                 break;
         }
     }
diff --git a/miext/rootless/rootless.h b/miext/rootless/rootless.h
index 00eac4e..dc4213f 100644
--- a/miext/rootless/rootless.h
+++ b/miext/rootless/rootless.h
@@ -444,7 +444,7 @@ void RootlessUpdateScreenPixmap(ScreenPtr pScreen);
 void RootlessRepositionWindows(ScreenPtr pScreen);
 
 /*
- * Bring all windows to the front of the Aqua stack
+ * Bring all windows to the front of the native stack
  */
-void RootlessOrderAllWindows (void);
+void RootlessOrderAllWindows (Bool include_unhitable);
 #endif /* _ROOTLESS_H */
diff --git a/miext/rootless/rootlessWindow.c b/miext/rootless/rootlessWindow.c
index a12c64b..cc0f296 100644
--- a/miext/rootless/rootlessWindow.c
+++ b/miext/rootless/rootlessWindow.c
@@ -596,10 +596,15 @@ RootlessReorderWindow(WindowPtr pWin)
 
         RootlessStopDrawing(pWin, FALSE);
 
-        /* Find the next window above this one that has a mapped frame. */
+        /* Find the next window above this one that has a mapped frame. 
+         * Only include cases where the windows are in the same category of
+         * hittability to ensure offscreen windows dont get restacked
+         * relative to onscreen ones (but that the offscreen ones maintain
+         * their stacking order if they are explicitly asked to Reorder
+         */
 
         newPrevW = pWin->prevSib;
-        while (newPrevW && (WINREC(newPrevW) == NULL || !newPrevW->realized))
+        while (newPrevW && (WINREC(newPrevW) == NULL || !newPrevW->realized || newPrevW->rootlessUnhittable != pWin->rootlessUnhittable))
             newPrevW = newPrevW->prevSib;
 
         newPrev = newPrevW != NULL ? WINREC(newPrevW) : NULL;
@@ -1608,7 +1613,7 @@ RootlessChangeBorderWidth(WindowPtr pWin, unsigned int width)
  * (i.e in front of Aqua windows) -- called when X11.app is given focus
  */
 void
-RootlessOrderAllWindows (void)
+RootlessOrderAllWindows (Bool include_unhitable)
 {
     int i;
     WindowPtr pWin;
@@ -1625,6 +1630,7 @@ RootlessOrderAllWindows (void)
       for (pWin = pWin->firstChild; pWin != NULL; pWin = pWin->nextSib) {
 	if (!pWin->realized) continue;
 	if (RootlessEnsureFrame(pWin) == NULL) continue;
+        if (!include_unhitable && pWin->rootlessUnhittable) continue;
 	RootlessReorderWindow (pWin);
       }
     }
commit 34bbbe0377efa6e01d83899fc3876cef9f132d83
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Thu Aug 19 19:47:42 2010 -0700

    XQuartz: Ignore kXquartzToggleFullscreen when rootless
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
    (cherry picked from commit e5bc62a03289f956c54c4699edf47f7ff237b5be)
    
    Conflicts:
    
    	hw/xquartz/darwinEvents.c

diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index e03454a..28ad680 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -243,7 +243,7 @@ static void DarwinEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, in
             case kXquartzToggleFullscreen:
                 DEBUG_LOG("kXquartzToggleFullscreen\n");
                 if (quartzEnableRootless) 
-                    QuartzSetFullscreen(!quartzHasRoot);
+                    ErrorF("Ignoring kXquartzToggleFullscreen because of rootless mode.");
                 else if (quartzHasRoot)
                     QuartzHide();
                 else


More information about the Xquartz-changes mailing list