[Xquartz-changes] xserver: Branch 'master' - 4 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Sun Aug 1 23:08:49 PDT 2010


Rebased ref, commits from common ancestor:
commit 7420e5e7515ee77e0d408d9efdb7743c024d590b
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>

diff --git a/hw/xquartz/xpr/xprFrame.c b/hw/xquartz/xpr/xprFrame.c
index 9f5d8a6..42f06ef 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 68b0a89942e4cdf8e59d95de49950d20378a5261
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sun Aug 1 11:39:14 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>

diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index bdaa262..eee6151 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -265,7 +265,6 @@ void QuartzUpdateScreens(void) {
     pScreen->height = height;
     
     DarwinAdjustScreenOrigins(&screenInfo);
-    quartzProcs->UpdateScreen(pScreen);
     
     /* DarwinAdjustScreenOrigins or UpdateScreen may change pScreen->x/y,
      * so use it rather than x/y
@@ -277,6 +276,7 @@ void QuartzUpdateScreens(void) {
     pRoot = pScreen->root;
     AppleWMSetScreenOrigin(pRoot);
     pScreen->ResizeWindow(pRoot, x - sx, y - sy, width, height, NULL);
+
     miPaintWindow(pRoot, &pRoot->borderClip,  PW_BACKGROUND);
 
     /* <rdar://problem/7770779> pointer events are clipped to old display region after display reconfiguration
@@ -303,6 +303,8 @@ 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 bcffc2ab1408e62797d224302b84df3e7a2fa47f
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Thu Jul 29 14:49:10 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>

diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 805ed99..36c39e5 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -337,7 +337,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,
@@ -347,13 +347,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 6245cce..342b54c 100644
--- a/hw/xquartz/xpr/xprEvent.c
+++ b/hw/xquartz/xpr/xprEvent.c
@@ -73,7 +73,7 @@ Bool QuartzModeEventHandler(int screenNum, XQuartzEvent *e, DeviceIntPtr dev) {
             
         case kXquartzBringAllToFront:
             DEBUG_LOG("kXquartzBringAllToFront\n");
-            RootlessOrderAllWindows();
+            RootlessOrderAllWindows(e->data[0]);
             return TRUE;
         default:
             return FALSE;
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 bef8a2f..c1c6bdb 100644
--- a/miext/rootless/rootlessWindow.c
+++ b/miext/rootless/rootlessWindow.c
@@ -581,10 +581,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;
@@ -1502,7 +1507,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;
@@ -1519,6 +1524,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 7e0575baf14ec4a89492fd2780f9ab5b9244afbd
Author: Matt Turner <mattst88 at gmail.com>
Date:   Tue Jul 27 23:32:36 2010 -0400

    ddc: Fix memory leak in GetEDID_DDC1
    
    Mark argument to DDC_checksum as const too.
    
    Signed-off-by: Matt Turner <mattst88 at gmail.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/ddc/ddc.c b/hw/xfree86/ddc/ddc.c
index 7379e95..2d9d4dc 100644
--- a/hw/xfree86/ddc/ddc.c
+++ b/hw/xfree86/ddc/ddc.c
@@ -102,7 +102,7 @@ resort(unsigned char *s_block)
 }
 
 static int
-DDC_checksum(unsigned char *block, int len)
+DDC_checksum(const unsigned char *block, int len)
 {
     int i, result = 0;
     int not_null = 0;
@@ -149,7 +149,10 @@ GetEDID_DDC1(unsigned int *s_ptr)
 	d_pos++;
     }
     free(s_ptr);
-    if (d_block && DDC_checksum(d_block,EDID1_LEN)) return NULL;
+    if (d_block && DDC_checksum(d_block,EDID1_LEN)) {
+	free(d_block);
+	return NULL;
+    }
     return (resort(d_block));
 }
 


More information about the Xquartz-changes mailing list