| author | Ben Byer <bbyer@bbyer.local> | 2007-11-02 09:59:29 (GMT) |
|---|---|---|
| committer | Ben Byer <bbyer@bbyer.local> | 2007-11-02 09:59:29 (GMT) |
| commit | a8910527b0966b2417abbe61df7f2d5516c07a94 (patch) | |
| tree | d01f7934849542900cb9a6f636936257b4369a4b | |
| parent | a6f038d2f4b455cb2f1376f55f08d04bb9b6ab0f (diff) | |
| download | xserver-a8910527b0966b2417abbe61df7f2d5516c07a94.zip xserver-a8910527b0966b2417abbe61df7f2d5516c07a94.tar.gz xserver-a8910527b0966b2417abbe61df7f2d5516c07a94.tar.bz2 | |
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!
| -rw-r--r-- | hw/darwin/apple/X11Application.m | 5 | ||||
| -rw-r--r-- | hw/darwin/darwin.h | 1 | ||||
| -rw-r--r-- | hw/darwin/quartz/quartz.c | 4 | ||||
| -rw-r--r-- | miext/rootless/rootless.h | 4 | ||||
| -rw-r--r-- | miext/rootless/rootlessWindow.c | 26 |
5 files changed, 36 insertions, 4 deletions
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"); +} |
