barrier: Allow releasing without any event in the native implementation

This allows for a sticky barrier to hold the pointer until it is
released, but the owner of the barrier doesn't need a barrier event to
release it. It will be used to implement input capturing.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2628>
This commit is contained in:
Jonas Ådahl 2022-04-01 10:09:46 +02:00 committed by Carlos Garnacho
parent 221ac2af76
commit a8f461a4eb
2 changed files with 7 additions and 1 deletions

View File

@ -640,7 +640,7 @@ meta_barrier_impl_native_release (MetaBarrierImpl *impl,
MetaBarrierImplNative *self = META_BARRIER_IMPL_NATIVE (impl);
if (self->state == META_BARRIER_STATE_HELD &&
event->event_id == self->trigger_serial)
(!event || event->event_id == self->trigger_serial))
{
self->state = META_BARRIER_STATE_RELEASE;
self->manager->pointer_trap = NULL;

View File

@ -75,6 +75,12 @@ meta_barrier_impl_x11_release (MetaBarrierImpl *impl,
MetaBackendX11 *backend_x11 = META_BACKEND_X11 (backend);
Display *xdisplay = meta_backend_x11_get_xdisplay (backend_x11);
if (!event)
{
g_warning ("X11 barriers always need barrier events to release");
return;
}
XIBarrierReleasePointer (xdisplay,
META_VIRTUAL_CORE_POINTER_ID,
self->xbarrier, event->event_id);