summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2016-02-25 11:20:09 +0800
committerJonas Ådahl <jadahl@gmail.com>2016-03-09 14:27:43 +0800
commit517078d1426f5df49051b4753f977f67af6c0a20 (patch)
tree9155909e6628502819bdbe088e208818c1a2f3ab /src
parent1c94d0e59818a39161faa503ebb41965b44c38ac (diff)
downloadmutter-517078d1426f5df49051b4753f977f67af6c0a20.tar.gz
MetaWaylandPointerConstraint: Disable if 'appears-focused' is false
Disable a constraint if the associated MetaWindow's 'appears-focused' state changed to false. https://bugzilla.gnome.org/show_bug.cgi?id=762661
Diffstat (limited to 'src')
-rw-r--r--src/wayland/meta-wayland-pointer-constraints.c49
1 files changed, 27 insertions, 22 deletions
diff --git a/src/wayland/meta-wayland-pointer-constraints.c b/src/wayland/meta-wayland-pointer-constraints.c
index 48d3dd6d2..89b6edb34 100644
--- a/src/wayland/meta-wayland-pointer-constraints.c
+++ b/src/wayland/meta-wayland-pointer-constraints.c
@@ -100,7 +100,7 @@ meta_wayland_pointer_constraint_maybe_enable_for_window (MetaWindow *window);
static void
meta_wayland_pointer_constraint_maybe_remove_for_seat (MetaWaylandSeat *seat,
- MetaWindow *focus_window);
+ MetaWindow *window);
static MetaWaylandSurfacePointerConstraintsData *
get_surface_constraints_data (MetaWaylandSurface *surface)
@@ -402,31 +402,36 @@ meta_wayland_pointer_constraint_remove (MetaWaylandPointerConstraint *constraint
void
meta_wayland_pointer_constraint_maybe_remove_for_seat (MetaWaylandSeat *seat,
- MetaWindow *focus_window)
+ MetaWindow *window)
{
MetaWaylandPointer *pointer = &seat->pointer;
+ MetaWaylandPointerConstraint *constraint;
+
+ if ((pointer->grab->interface != &confined_pointer_grab_interface &&
+ pointer->grab->interface != &locked_pointer_grab_interface))
+ return;
+
+ constraint = wl_container_of (pointer->grab, constraint, grab);
+
+ if (constraint->surface != window->surface)
+ return;
- if ((pointer->grab->interface == &confined_pointer_grab_interface ||
- pointer->grab->interface == &locked_pointer_grab_interface) &&
- pointer->focus_surface &&
- pointer->focus_surface->window != focus_window)
+ if (meta_window_appears_focused (window) &&
+ pointer->focus_surface == window->surface)
+ return;
+
+ switch (constraint->lifetime)
{
- MetaWaylandPointerConstraint *constraint =
- wl_container_of (pointer->grab, constraint, grab);
-
- 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 ();
- }
+ 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 ();
}
}