Skip to content
Snippets Groups Projects
Commit 720af28e authored by Alexandre Julliard's avatar Alexandre Julliard
Browse files

Always ignore BadMatch errors resulting from XSetInputFocus so that we

don't need to wait for the reply.
parent 3f6cb0cc
Branches
Tags
No related merge requests found
......@@ -381,17 +381,6 @@ inline static BOOL can_activate_window( HWND hwnd )
}
/**********************************************************************
* set_focus_error_handler
*
* Handler for X errors happening during XSetInputFocus call.
*/
static int set_focus_error_handler( Display *display, XErrorEvent *event, void *arg )
{
return (event->error_code == BadMatch);
}
/**********************************************************************
* set_focus
*/
......@@ -409,12 +398,10 @@ static void set_focus( HWND hwnd, Time time )
if (win)
{
Display *display = thread_display();
TRACE( "setting focus to %p (%lx) time=%ld\n", focus, win, time );
X11DRV_expect_error( display, set_focus_error_handler, NULL );
XSetInputFocus( display, win, RevertToParent, time );
XSync( display, False );
if (X11DRV_check_error()) TRACE("got BadMatch, ignoring\n" );
wine_tsx11_lock();
XSetInputFocus( thread_display(), win, RevertToParent, time );
wine_tsx11_unlock();
}
}
......
......@@ -38,6 +38,18 @@
#include <X11/XKBlib.h>
#endif
#define BOOL X_BOOL
#define BYTE X_BYTE
#define INT8 X_INT8
#define INT16 X_INT16
#define INT32 X_INT32
#include <X11/Xproto.h>
#undef BOOL
#undef BYTE
#undef INT8
#undef INT16
#undef INT32
#include "windef.h"
#include "winbase.h"
#include "wine/winbase16.h"
......@@ -99,6 +111,18 @@ static int (*old_error_handler)( Display *, XErrorEvent * );
#define IS_OPTION_FALSE(ch) \
((ch) == 'n' || (ch) == 'N' || (ch) == 'f' || (ch) == 'F' || (ch) == '0')
/***********************************************************************
* ignore_error
*
* Check if the X error is one we can ignore.
*/
static inline BOOL ignore_error( Display *display, XErrorEvent *event )
{
if (event->request_code == X_SetInputFocus && event->error_code == BadMatch) return TRUE;
return FALSE;
}
/***********************************************************************
* X11DRV_expect_error
*
......@@ -145,10 +169,17 @@ static int error_handler( Display *display, XErrorEvent *error_evt )
{
if ((err_callback_result = err_callback( display, error_evt, err_callback_arg )))
{
TRACE( "got expected error\n" );
TRACE( "got expected error %d req %d\n",
error_evt->error_code, error_evt->request_code );
return 0;
}
}
if (ignore_error( display, error_evt ))
{
TRACE( "got ignored error %d req %d\n",
error_evt->error_code, error_evt->request_code );
return 0;
}
if (synchronous) DebugBreak(); /* force an entry in the debugger */
old_error_handler( display, error_evt );
return 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment