Commit 9a8abcfa authored by Ben Byer's avatar Ben Byer Committed by Ben Byer

Fixed focus problem (clicking on an X11 window that sits behind

an Aqua window would not always bring it to the top of the stack.
parent b34d2ffc
......@@ -201,6 +201,8 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
if (_x_active) [self activateX:NO];
} else if ([self modalWindow] == nil) {
/* Must be an X window. Tell appkit it doesn't have focus. */
WindowPtr pWin = xprGetXWindowFromAppKit([e windowNumber]);
if (pWin) RootlessReorderWindow(pWin);
for_appkit = NO;
if ([self isActive]) {
......
......@@ -38,6 +38,9 @@ void AppleDRIExtensionInit(void);
void xprAppleWMInit(void);
Bool xprInit(ScreenPtr pScreen);
Bool xprIsX11Window(void *nsWindow, int windowNumber);
WindowPtr xprGetX11Window(xp_window_id wid);
WindowPtr xprGetXWindowFromAppKit(int windowNumber);
void xprHideWindows(Bool hide);
Bool QuartzInitCursor(ScreenPtr pScreen);
......
......@@ -424,6 +424,37 @@ xprGetXWindow(xp_window_id wid)
return winRec != NULL ? winRec->win : NULL;
}
/*
* Given the id of a physical window, try to find the top-level (or root)
* X window that it represents.
*/
WindowPtr
xprGetXWindowFromAppKit(int windowNumber)
{
RootlessWindowRec *winRec;
Bool ret;
xp_window_id wid;
if (window_hash == NULL)
return FALSE;
/* need to lock, since this function can be called by any thread */
pthread_mutex_lock(&window_hash_mutex);
if (xp_lookup_native_window(windowNumber, &wid))
ret = xprGetXWindow(wid) != NULL;
else
ret = FALSE;
pthread_mutex_unlock(&window_hash_mutex);
if (!ret) return NULL;
winRec = x_hash_table_lookup(window_hash, (void *) wid, NULL);
return winRec != NULL ? winRec->win : NULL;
}
/*
* The windowNumber is an AppKit window number. Returns TRUE if xpr is
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment