summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2016-09-21 16:32:55 +0800
committerJonas Ådahl <jadahl@gmail.com>2016-10-19 17:20:14 +0800
commitd22db60a2b5a73ce4008185655d6a0eb0c8e32f5 (patch)
tree250f139aafa72db4b5ca74e81b86c60cfe8eed05
parentab21c3cad7065670dc9190c5d700866d3d5f05e5 (diff)
downloadmutter-d22db60a2b5a73ce4008185655d6a0eb0c8e32f5.tar.gz
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
-rw-r--r--src/wayland/meta-wayland-pointer-constraints.c52
1 files changed, 39 insertions, 13 deletions
diff --git a/src/wayland/meta-wayland-pointer-constraints.c b/src/wayland/meta-wayland-pointer-constraints.c
index 5cf74fcd4..8e7d5af1f 100644
--- a/src/wayland/meta-wayland-pointer-constraints.c
+++ b/src/wayland/meta-wayland-pointer-constraints.c
@@ -519,6 +519,24 @@ meta_wayland_pointer_constraint_remove (MetaWaylandPointerConstraint *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
meta_wayland_pointer_constraint_maybe_remove_for_seat (MetaWaylandSeat *seat,
MetaWindow *window)
@@ -539,19 +557,7 @@ meta_wayland_pointer_constraint_maybe_remove_for_seat (MetaWaylandSeat *seat,
pointer->focus_surface == window->surface)
return;
- 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 ();
- }
+ meta_wayland_pointer_constraint_deactivate (constraint);
}
static void
@@ -938,10 +944,20 @@ locked_pointer_grab_pointer_button (MetaWaylandPointerGrab *grab,
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 = {
locked_pointer_grab_pointer_focus,
locked_pointer_grab_pointer_motion,
locked_pointer_grab_pointer_button,
+ locked_pointer_grab_pointer_cancel,
};
static void
@@ -999,10 +1015,20 @@ confined_pointer_grab_pointer_button (MetaWaylandPointerGrab *grab,
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 = {
confined_pointer_grab_pointer_focus,
confined_pointer_grab_pointer_motion,
confined_pointer_grab_pointer_button,
+ confined_pointer_grab_pointer_cancel,
};
static void