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

Ben Byer bbyer at kemper.freedesktop.org
Fri Nov 2 02:59:40 PDT 2007


 hw/darwin/apple/X11Application.m |    5 +----
 hw/darwin/darwin.h               |    1 +
 hw/darwin/quartz/quartz.c        |    4 ++++
 miext/rootless/rootless.h        |    4 ++++
 miext/rootless/rootlessWindow.c  |   26 ++++++++++++++++++++++++++
 5 files changed, 36 insertions(+), 4 deletions(-)

New commits:
commit a8910527b0966b2417abbe61df7f2d5516c07a94
Author: Ben Byer <bbyer at bbyer.local>
Date:   Fri Nov 2 02:59:29 2007 -0700

    Fix for focus issue:
    <rdar://problem/5289578> X11 menu bar uncoupled from X11 application's windows
    Credit to William Mortensen for submitting the first community patch!

diff --git a/hw/darwin/apple/X11Application.m b/hw/darwin/apple/X11Application.m
index fe18214..ccdc072 100644
--- a/hw/darwin/apple/X11Application.m
+++ b/hw/darwin/apple/X11Application.m
@@ -360,10 +360,7 @@ message_kit_thread (SEL selector, NSObject *arg)
 
 - (void) set_front_process:unused
 {
-    [NSApp activateIgnoringOtherApps:YES];
-	
-    if ([self modalWindow] == nil)
-		[self activateX:YES];
+    QuartzMessageServerThread(kXDarwinBringAllToFront, 0);
 }
 
 - (void) set_can_quit:(NSNumber *)state
diff --git a/hw/darwin/darwin.h b/hw/darwin/darwin.h
index 48a2224..93ad3ab 100644
--- a/hw/darwin/darwin.h
+++ b/hw/darwin/darwin.h
@@ -137,6 +137,7 @@ enum {
     kXDarwinQuit,             // kill the X server and release the display
     kXDarwinReadPasteboard,   // copy Mac OS X pasteboard into X cut buffer
     kXDarwinWritePasteboard,  // copy X cut buffer onto Mac OS X pasteboard
+    kXDarwinBringAllToFront,  // bring all X windows to front
     /*
      * AppleWM events
      */
diff --git a/hw/darwin/quartz/quartz.c b/hw/darwin/quartz/quartz.c
index 422bd17..8670e57 100644
--- a/hw/darwin/quartz/quartz.c
+++ b/hw/darwin/quartz/quartz.c
@@ -395,6 +395,10 @@ void DarwinModeProcessEvent(
             QuartzUpdateScreens();
             break;
 
+        case kXDarwinBringAllToFront:
+	    RootlessOrderAllWindows();
+            break;
+
         case kXDarwinWindowState:
         case kXDarwinWindowMoved:
             // FIXME: Not implemented yet
diff --git a/miext/rootless/rootless.h b/miext/rootless/rootless.h
index f83defe..d9fdb6a 100644
--- a/miext/rootless/rootless.h
+++ b/miext/rootless/rootless.h
@@ -432,4 +432,8 @@ void RootlessUpdateScreenPixmap(ScreenPtr pScreen);
  */
 void RootlessRepositionWindows(ScreenPtr pScreen);
 
+/*
+ * Bring all windows to the front of the Aqua stack
+ */
+void RootlessOrderAllWindows (void);
 #endif /* _ROOTLESS_H */
diff --git a/miext/rootless/rootlessWindow.c b/miext/rootless/rootlessWindow.c
index 30b7daa..1e06d2c 100644
--- a/miext/rootless/rootlessWindow.c
+++ b/miext/rootless/rootlessWindow.c
@@ -1468,3 +1468,29 @@ RootlessChangeBorderWidth(WindowPtr pWin, unsigned int width)
 
     RL_DEBUG_MSG("change border width end\n");
 }
+
+/*
+ * RootlessOrderAllWindows
+ * Brings all X11 windows to the top of the window stack
+ * (i.e in front of Aqua windows) -- called when X11.app is given focus
+ */
+void
+RootlessOrderAllWindows (void)
+{
+    int i;
+    WindowPtr pWin;
+    
+    RL_DEBUG_MSG("RootlessOrderAllWindows() ");
+    for (i = 0; i < screenInfo.numScreens; i++) {
+      if (screenInfo.screens[i] == NULL) continue;
+      pWin = WindowTable[i];
+      if (pWin == NULL) continue;
+      
+      for (pWin = pWin->firstChild; pWin != NULL; pWin = pWin->nextSib) {
+	if (!pWin->realized) continue;
+	if (RootlessEnsureFrame(pWin) == NULL) continue;
+	RootlessReorderWindow (pWin);
+      }
+    }
+    RL_DEBUG_MSG("RootlessOrderAllWindows() done");
+}


More information about the xorg-commit mailing list