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!
This commit is contained in:
Ben Byer 2007-11-02 02:59:29 -07:00 committed by Jeremy Huddleston
parent 23cdc7027a
commit 0ed01da098
5 changed files with 36 additions and 4 deletions

View File

@ -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

View File

@ -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
*/

View File

@ -395,6 +395,10 @@ void DarwinModeProcessEvent(
QuartzUpdateScreens();
break;
case kXDarwinBringAllToFront:
RootlessOrderAllWindows();
break;
case kXDarwinWindowState:
case kXDarwinWindowMoved:
// FIXME: Not implemented yet

View File

@ -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 */

View File

@ -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");
}