diff --git a/hw/darwin/apple/X11Application.m b/hw/darwin/apple/X11Application.m index afd495bd6..cc28b18e4 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 fc4a58a95..5981864b7 100644 --- a/hw/darwin/darwin.h +++ b/hw/darwin/darwin.h @@ -141,6 +141,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 422bd17cf..8670e57f9 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 f83defeb6..d9fdb6adb 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 30b7daaab..1e06d2c11 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"); +}