(Wayland) Don't relock the pointer (#15128)

This commit is contained in:
Colin Kinloch 2023-03-24 04:07:48 +00:00 committed by GitHub
parent 7144acd26e
commit eeda1f6141
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -426,14 +426,14 @@ static void input_wl_grab_mouse(void *data, bool state)
if (gfx->pointer_constraints) if (gfx->pointer_constraints)
{ {
if (state) if (state && !gfx->locked_pointer)
{ {
gfx->locked_pointer = zwp_pointer_constraints_v1_lock_pointer(gfx->pointer_constraints, gfx->locked_pointer = zwp_pointer_constraints_v1_lock_pointer(gfx->pointer_constraints,
gfx->surface, gfx->wl_pointer, NULL, ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT); gfx->surface, gfx->wl_pointer, NULL, ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT);
zwp_locked_pointer_v1_add_listener(gfx->locked_pointer, zwp_locked_pointer_v1_add_listener(gfx->locked_pointer,
&locked_pointer_listener, gfx); &locked_pointer_listener, gfx);
} }
else if (gfx->locked_pointer) else if (!state && gfx->locked_pointer)
{ {
zwp_locked_pointer_v1_destroy(gfx->locked_pointer); zwp_locked_pointer_v1_destroy(gfx->locked_pointer);
gfx->locked_pointer = NULL; gfx->locked_pointer = NULL;