winex11.drv: Only grab or warp the cursor when keyboard isn't grabbed.
When the window manager has taken a keyboard grab, it may be going to move the window itself, so the application should not move the cursor at the same time. Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
4b81771b00
commit
54f8077c41
|
@ -155,6 +155,9 @@ static const char * event_names[MAX_EVENT_HANDLERS] =
|
|||
"SelectionNotify", "ColormapNotify", "ClientMessage", "MappingNotify", "GenericEvent"
|
||||
};
|
||||
|
||||
/* is someone else grabbing the keyboard, for example the WM, when manipulating the window */
|
||||
BOOL keyboard_grabbed = FALSE;
|
||||
|
||||
int xinput2_opcode = 0;
|
||||
|
||||
/* return the name of an X event */
|
||||
|
@ -778,10 +781,13 @@ static BOOL X11DRV_FocusIn( HWND hwnd, XEvent *xev )
|
|||
WARN( "unexpected FocusIn event with NotifyGrab mode\n" );
|
||||
break;
|
||||
case NotifyWhileGrabbed:
|
||||
keyboard_grabbed = TRUE;
|
||||
break;
|
||||
case NotifyNormal:
|
||||
keyboard_grabbed = FALSE;
|
||||
break;
|
||||
case NotifyUngrab:
|
||||
keyboard_grabbed = FALSE;
|
||||
return TRUE; /* ignore wm specific NotifyUngrab / NotifyGrab events w.r.t focus */
|
||||
}
|
||||
|
||||
|
@ -875,10 +881,13 @@ static BOOL X11DRV_FocusOut( HWND hwnd, XEvent *xev )
|
|||
WARN( "unexpected FocusOut event with NotifyUngrab mode\n" );
|
||||
break;
|
||||
case NotifyNormal:
|
||||
keyboard_grabbed = FALSE;
|
||||
break;
|
||||
case NotifyWhileGrabbed:
|
||||
keyboard_grabbed = TRUE;
|
||||
break;
|
||||
case NotifyGrab:
|
||||
keyboard_grabbed = TRUE;
|
||||
return TRUE; /* ignore wm specific NotifyUngrab / NotifyGrab events w.r.t focus */
|
||||
}
|
||||
|
||||
|
|
|
@ -392,6 +392,12 @@ static BOOL grab_clipping_window( const RECT *clip )
|
|||
GetModuleHandleW(0), NULL )))
|
||||
return TRUE;
|
||||
|
||||
if (keyboard_grabbed)
|
||||
{
|
||||
WARN( "refusing to clip to %s\n", wine_dbgstr_rect(clip) );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* enable XInput2 unless we are already clipping */
|
||||
if (!data->clip_hwnd) enable_xinput2();
|
||||
|
||||
|
@ -1430,6 +1436,12 @@ BOOL CDECL X11DRV_SetCursorPos( INT x, INT y )
|
|||
struct x11drv_thread_data *data = x11drv_init_thread_data();
|
||||
POINT pos = virtual_screen_to_root( x, y );
|
||||
|
||||
if (keyboard_grabbed)
|
||||
{
|
||||
WARN( "refusing to warp to %u, %u\n", pos.x, pos.y );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
XWarpPointer( data->display, root_window, root_window, 0, 0, 0, 0, pos.x, pos.y );
|
||||
data->warp_serial = NextRequest( data->display );
|
||||
XNoOp( data->display );
|
||||
|
|
|
@ -382,6 +382,7 @@ extern Colormap default_colormap DECLSPEC_HIDDEN;
|
|||
extern XPixmapFormatValues **pixmap_formats DECLSPEC_HIDDEN;
|
||||
extern Window root_window DECLSPEC_HIDDEN;
|
||||
extern BOOL clipping_cursor DECLSPEC_HIDDEN;
|
||||
extern BOOL keyboard_grabbed DECLSPEC_HIDDEN;
|
||||
extern unsigned int screen_bpp DECLSPEC_HIDDEN;
|
||||
extern BOOL use_xkb DECLSPEC_HIDDEN;
|
||||
extern BOOL usexrandr DECLSPEC_HIDDEN;
|
||||
|
|
Loading…
Reference in New Issue