[mutter] wayland/pointer-constraints: Maybe constrain on pointer focus change
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] wayland/pointer-constraints: Maybe constrain on pointer focus change
- Date: Fri, 9 Sep 2016 03:11:08 +0000 (UTC)
commit abee020f716394aa519ee7592360ff08b7efd63f
Author: Jonas Ådahl <jadahl gmail com>
Date: Tue Sep 6 13:14:44 2016 +0800
wayland/pointer-constraints: Maybe constrain on pointer focus change
Since Xwayland surface constraints might need to enable not only
because the constrained window appears focused, add a pointer focus
listener and try constrain whenever the pointer focus changes. It's
still required that a Xwayland window is focused to activate.
https://bugzilla.gnome.org/show_bug.cgi?id=771050
src/wayland/meta-wayland-pointer-constraints.c | 30 ++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/src/wayland/meta-wayland-pointer-constraints.c b/src/wayland/meta-wayland-pointer-constraints.c
index 4930723..853a811 100644
--- a/src/wayland/meta-wayland-pointer-constraints.c
+++ b/src/wayland/meta-wayland-pointer-constraints.c
@@ -58,6 +58,7 @@ struct _MetaWaylandPointerConstraint
MetaWaylandPointerGrab grab;
MetaWaylandSeat *seat;
enum zwp_pointer_constraints_v1_lifetime lifetime;
+ gulong pointer_focus_surface_handler_id;
gboolean hint_set;
wl_fixed_t x_hint;
@@ -277,6 +278,13 @@ surface_remove_pointer_constraints (MetaWaylandSurface *surface,
}
}
+static void
+pointer_focus_surface_changed (MetaWaylandPointer *pointer,
+ MetaWaylandPointerConstraint *constraint)
+{
+ meta_wayland_pointer_constraint_maybe_enable (constraint);
+}
+
static MetaWaylandPointerConstraint *
meta_wayland_pointer_constraint_new (MetaWaylandSurface *surface,
MetaWaylandSeat *seat,
@@ -307,6 +315,11 @@ meta_wayland_pointer_constraint_new (MetaWaylandSurface *su
constraint->region = NULL;
}
+ constraint->pointer_focus_surface_handler_id =
+ g_signal_connect (seat->pointer, "focus-surface-changed",
+ G_CALLBACK (pointer_focus_surface_changed),
+ constraint);
+
return constraint;
}
@@ -1056,6 +1069,18 @@ bind_pointer_constraints (struct wl_client *client,
NULL);
}
+static void
+meta_wayland_pointer_constraint_finalize (GObject *object)
+{
+ MetaWaylandPointerConstraint *constraint =
+ META_WAYLAND_POINTER_CONSTRAINT (object);
+
+ g_signal_handler_disconnect (constraint->seat->pointer,
+ constraint->pointer_focus_surface_handler_id);
+
+ G_OBJECT_CLASS (meta_wayland_pointer_constraint_parent_class)->finalize (object);
+}
+
void
meta_wayland_pointer_constraints_init (MetaWaylandCompositor *compositor)
{
@@ -1073,6 +1098,11 @@ meta_wayland_pointer_constraint_init (MetaWaylandPointerConstraint *constraint)
static void
meta_wayland_pointer_constraint_class_init (MetaWaylandPointerConstraintClass *klass)
{
+ GObjectClass *object_class;
+
+ object_class = G_OBJECT_CLASS (klass);
+ object_class->finalize = meta_wayland_pointer_constraint_finalize;
+
quark_pending_constraint_state =
g_quark_from_static_string ("-meta-wayland-pointer-constraint-pending_state");
quark_surface_pointer_constraints_data =
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]