[mutter] MetaWaylandPointerConstraint: Maybe enable on window 'raise'



commit d4b0c21d06a0aa25449fc9268194c4a11d0c0e35
Author: Jonas Ådahl <jadahl gmail com>
Date:   Thu Feb 25 11:27:27 2016 +0800

    MetaWaylandPointerConstraint: Maybe enable on window 'raise'
    
    If a MetaWindow's 'appears-focused' state changed to true, but the
    window did not have pointer focus, the constraint did not enable. Thus,
    make it possible for the user to also click the window to enable it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=762661

 src/wayland/meta-wayland-pointer-constraints.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/src/wayland/meta-wayland-pointer-constraints.c b/src/wayland/meta-wayland-pointer-constraints.c
index 89b6edb..62c2399 100644
--- a/src/wayland/meta-wayland-pointer-constraints.c
+++ b/src/wayland/meta-wayland-pointer-constraints.c
@@ -70,6 +70,7 @@ typedef struct _MetaWaylandSurfacePointerConstraintsData
   GList *pointer_constraints;
   MetaWindow *window;
   gulong appears_changed_handler_id;
+  gulong raised_handler_id;
 } MetaWaylandSurfacePointerConstraintsData;
 
 typedef struct
@@ -126,6 +127,12 @@ appears_focused_changed (MetaWindow *window,
   meta_wayland_pointer_constraint_maybe_enable_for_window (window);
 }
 
+static void
+window_raised (MetaWindow *window)
+{
+  meta_wayland_pointer_constraint_maybe_enable_for_window (window);
+}
+
 static MetaWaylandSurfacePointerConstraintsData *
 surface_constraint_data_new (MetaWaylandSurface *surface)
 {
@@ -141,6 +148,9 @@ surface_constraint_data_new (MetaWaylandSurface *surface)
       data->appears_changed_handler_id =
         g_signal_connect (data->window, "notify::appears-focused",
                           G_CALLBACK (appears_focused_changed), NULL);
+      data->raised_handler_id =
+        g_signal_connect (data->window, "raised",
+                          G_CALLBACK (window_raised), NULL);
     }
   else
     {
@@ -158,6 +168,8 @@ surface_constraint_data_free (MetaWaylandSurfacePointerConstraintsData *data)
     {
       g_signal_handler_disconnect (data->window,
                                    data->appears_changed_handler_id);
+      g_signal_handler_disconnect (data->window,
+                                   data->raised_handler_id);
       g_object_remove_weak_pointer (G_OBJECT (data->window),
                                     (gpointer *) &data->window);
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]