diff options
author | Jonas Ådahl <jadahl@gmail.com> | 2016-02-25 11:20:09 +0800 |
---|---|---|
committer | Jonas Ådahl <jadahl@gmail.com> | 2016-03-09 14:27:43 +0800 |
commit | 517078d1426f5df49051b4753f977f67af6c0a20 (patch) | |
tree | 9155909e6628502819bdbe088e208818c1a2f3ab /src | |
parent | 1c94d0e59818a39161faa503ebb41965b44c38ac (diff) | |
download | mutter-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.c | 49 |
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 (); } } |