mirror of
https://github.com/brl/mutter.git
synced 2025-02-11 10:54:09 +00:00
wayland/pointer-constraints: Disable or remove when grab is cancelled
When the grab is cancelled, for example because of an Alt-tab, VT switch etc, disable or remove (depending on the constraint type) the constraint. This avoids a re-entry issue when the focus is returned and the focus listener tries to re-enable a disabled constraint. https://bugzilla.gnome.org/show_bug.cgi?id=771859
This commit is contained in:
parent
bb8e6afae6
commit
7ae4b28bda
@ -519,6 +519,24 @@ meta_wayland_pointer_constraint_remove (MetaWaylandPointerConstraint *constraint
|
|||||||
meta_wayland_pointer_constraint_destroy (constraint);
|
meta_wayland_pointer_constraint_destroy (constraint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_wayland_pointer_constraint_deactivate (MetaWaylandPointerConstraint *constraint)
|
||||||
|
{
|
||||||
|
switch (constraint->lifetime)
|
||||||
|
{
|
||||||
|
case ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT:
|
||||||
|
meta_wayland_pointer_constraint_remove (constraint);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT:
|
||||||
|
meta_wayland_pointer_constraint_disable (constraint);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
g_assert_not_reached ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_wayland_pointer_constraint_maybe_remove_for_seat (MetaWaylandSeat *seat,
|
meta_wayland_pointer_constraint_maybe_remove_for_seat (MetaWaylandSeat *seat,
|
||||||
MetaWindow *window)
|
MetaWindow *window)
|
||||||
@ -539,19 +557,7 @@ meta_wayland_pointer_constraint_maybe_remove_for_seat (MetaWaylandSeat *seat,
|
|||||||
pointer->focus_surface == window->surface)
|
pointer->focus_surface == window->surface)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (constraint->lifetime)
|
meta_wayland_pointer_constraint_deactivate (constraint);
|
||||||
{
|
|
||||||
case ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT:
|
|
||||||
meta_wayland_pointer_constraint_remove (constraint);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT:
|
|
||||||
meta_wayland_pointer_constraint_disable (constraint);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
g_assert_not_reached ();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -938,10 +944,20 @@ locked_pointer_grab_pointer_button (MetaWaylandPointerGrab *grab,
|
|||||||
meta_wayland_pointer_send_button (grab->pointer, event);
|
meta_wayland_pointer_send_button (grab->pointer, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
locked_pointer_grab_pointer_cancel (MetaWaylandPointerGrab *grab)
|
||||||
|
{
|
||||||
|
MetaWaylandPointerConstraint *constraint =
|
||||||
|
wl_container_of (grab, constraint, grab);
|
||||||
|
|
||||||
|
meta_wayland_pointer_constraint_deactivate (constraint);
|
||||||
|
}
|
||||||
|
|
||||||
static const MetaWaylandPointerGrabInterface locked_pointer_grab_interface = {
|
static const MetaWaylandPointerGrabInterface locked_pointer_grab_interface = {
|
||||||
locked_pointer_grab_pointer_focus,
|
locked_pointer_grab_pointer_focus,
|
||||||
locked_pointer_grab_pointer_motion,
|
locked_pointer_grab_pointer_motion,
|
||||||
locked_pointer_grab_pointer_button,
|
locked_pointer_grab_pointer_button,
|
||||||
|
locked_pointer_grab_pointer_cancel,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -999,10 +1015,20 @@ confined_pointer_grab_pointer_button (MetaWaylandPointerGrab *grab,
|
|||||||
meta_wayland_pointer_send_button (grab->pointer, event);
|
meta_wayland_pointer_send_button (grab->pointer, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
confined_pointer_grab_pointer_cancel (MetaWaylandPointerGrab *grab)
|
||||||
|
{
|
||||||
|
MetaWaylandPointerConstraint *constraint =
|
||||||
|
wl_container_of (grab, constraint, grab);
|
||||||
|
|
||||||
|
meta_wayland_pointer_constraint_deactivate (constraint);
|
||||||
|
}
|
||||||
|
|
||||||
static const MetaWaylandPointerGrabInterface confined_pointer_grab_interface = {
|
static const MetaWaylandPointerGrabInterface confined_pointer_grab_interface = {
|
||||||
confined_pointer_grab_pointer_focus,
|
confined_pointer_grab_pointer_focus,
|
||||||
confined_pointer_grab_pointer_motion,
|
confined_pointer_grab_pointer_motion,
|
||||||
confined_pointer_grab_pointer_button,
|
confined_pointer_grab_pointer_button,
|
||||||
|
confined_pointer_grab_pointer_cancel,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user