[mutter] MetaWaylandPointerConstraint: Disable if 'appears-focused' is false
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] MetaWaylandPointerConstraint: Disable if 'appears-focused' is false
- Date: Wed, 9 Mar 2016 06:32:55 +0000 (UTC)
commit 517078d1426f5df49051b4753f977f67af6c0a20
Author: Jonas Ådahl <jadahl gmail com>
Date: Thu Feb 25 11:20:09 2016 +0800
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
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 48d3dd6..89b6edb 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 ();
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]