winex11.drv: Allow explorer to focus other process windows.

When explorer gets a take focus message, it tries to focus the foreground
window, but this doesn't work because set_focus can only focus windows in
the current process. We have to look for the focus window in the foreground
thread, not the current one, or we won't find the other process's windows.

Since the other process may crash at any time, causing its windows to be
destroyed, we also have to ignore the BadWindow error that will occur if that
happens at a critical time.
This commit is contained in:
Vincent Povirk 2009-11-11 14:37:51 -06:00 committed by Alexandre Julliard
parent 05f00f4ed8
commit 6823f4aaf8
2 changed files with 5 additions and 2 deletions

View File

@ -476,11 +476,13 @@ static void set_focus( Display *display, HWND hwnd, Time time )
{
HWND focus;
Window win;
GUITHREADINFO threadinfo;
TRACE( "setting foreground window to %p\n", hwnd );
SetForegroundWindow( hwnd );
focus = GetFocus();
GetGUIThreadInfo(0, &threadinfo);
focus = threadinfo.hwndFocus;
if (focus) focus = GetAncestor( focus, GA_ROOT );
win = X11DRV_get_whole_window(focus);

View File

@ -188,7 +188,8 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] =
*/
static inline BOOL ignore_error( Display *display, XErrorEvent *event )
{
if (event->request_code == X_SetInputFocus && event->error_code == BadMatch) return TRUE;
if (event->request_code == X_SetInputFocus &&
(event->error_code == BadMatch || event->error_code == BadWindow)) return TRUE;
/* ignore a number of errors on gdi display caused by creating/destroying windows */
if (display == gdi_display)