[PATCH v3 2/6] winex11.drv: Only call XWarpPointer if we can get exclusive grab
Huw Davies
huw at codeweavers.com
Fri Aug 2 04:38:07 CDT 2019
On Thu, Jun 27, 2019 at 04:30:11PM +0200, Rémi Bernon wrote:
> XWarpPointer will always succeed regardless of grabs. If the pointer is
> already grabbed by some other application, we should not ask to warp it.
>
> Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
> ---
> dlls/winex11.drv/mouse.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
> index f737a306a56..c3a9a027957 100644
> --- a/dlls/winex11.drv/mouse.c
> +++ b/dlls/winex11.drv/mouse.c
> @@ -1430,6 +1430,18 @@ 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 (!clipping_cursor &&
> + XGrabPointer( data->display, root_window, False,
> + PointerMotionMask | ButtonPressMask | ButtonReleaseMask,
> + GrabModeAsync, GrabModeAsync, root_window, None, CurrentTime ) != GrabSuccess)
> + {
> + WARN( "refusing to warp pointer to %u, %u without exclusive grab\n", pos.x, pos.y );
> + return FALSE;
> + }
> +
> + if (!clipping_cursor)
> + XUngrabPointer( data->display, CurrentTime );
Shouldn't we hold onto the grab until we call XWarpPointer(), in case something
else grabs it in between?
> XWarpPointer( data->display, root_window, root_window, 0, 0, 0, 0, pos.x, pos.y );
> data->warp_serial = NextRequest( data->display );
> XNoOp( data->display );
More information about the wine-devel
mailing list