Work around bug in Mac OS X 10.1's AppKit that causes rootless XDarwin to

lock up when creating windows.
This commit is contained in:
Torrey Lyons 2004-03-25 01:23:14 +00:00
parent 714f8454b8
commit 19dccd6930

View file

@ -27,8 +27,7 @@
* holders shall not be used in advertising or otherwise to promote the sale,
* use or other dealings in this Software without prior written authorization.
*/
/* $XdotOrg: xc/programs/Xserver/hw/darwin/quartz/cr/crFrame.m,v 1.1.4.2.4.1 2004/03/04 17:47:30 eich Exp $ */
/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/cr/crFrame.m,v 1.7 2003/11/27 01:53:39 torrey Exp $ */
/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/cr/crFrame.m,v 1.9 2004/03/19 02:05:29 torrey Exp $ */
#include "quartzCommon.h"
#include "cr.h"
@ -36,6 +35,7 @@
#undef BOOL
#define BOOL xBOOL
#include "rootless.h"
#include "windowstr.h"
#undef BOOL
WindowPtr nextWindowToFrame = NULL;
@ -79,7 +79,12 @@ CRCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
theWindow = [[NSWindow alloc] initWithContentRect:bounds
styleMask:theStyleMask
backing:NSBackingStoreBuffered
#ifdef DEFER_NSWINDOW
defer:YES];
#else
defer:NO];
#endif
if (!theWindow) return FALSE;
[theWindow setBackgroundColor:[NSColor clearColor]]; // erase transparent
@ -96,6 +101,21 @@ CRCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
[theWindow setContentView:theView];
[theWindow setInitialFirstResponder:theView];
#ifdef DEFER_NSWINDOW
// We need the NSWindow to actually be created now.
// If we had to defer creating it, we have to order it
// onto the screen to force it to be created.
if (pFrame->win->prevSib) {
CRWindowPtr crWinPtr = (CRWindowPtr) RootlessFrameForWindow(
pFrame->win->prevSib, FALSE);
int upperNum = [crWinPtr->window windowNumber];
[theWindow orderWindow:NSWindowBelow relativeTo:upperNum];
} else {
[theWindow orderFront:nil];
}
#endif
[theWindow setAcceptsMouseMovedEvents:YES];
crWinPtr->window = theWindow;