[mutter] wayland/actor-surface: Update outputs on stage-views changes



commit abdbc14ca8a6dffd452d738c10f3984787cc1d45
Author: Jonas Dreßler <verdre v0yd nl>
Date:   Thu Mar 12 23:35:28 2020 +0100

    wayland/actor-surface: Update outputs on stage-views changes
    
    ClutterActors new "stage-views-changed" signal fits pretty well for the
    updating of wl_outputs a MetaWaylandActorSurface is on: With that signal
    we get notified if the surface moved to a different CRTC, of which every
    output has at least one.
    
    So start listening to that signal, which fixes a bug where the wl_output
    of a surface changes, but its allocation remains the same (which means
    no signals triggering an update of the outputs will be emitted) and no
    enter/leave events for the new wl_outputs are sent to the client. This
    can happen when a monitor is hotplugged but the new allocation is
    exactly the same as the old one even though it's on a different monitor.
    
    Since the "stage-views-on-changed" signal will also get emitted when a
    parent actor of the surface is moved, this means we can now remove the
    call to meta_wayland_surface_update_outputs_recursively() on window
    position changes or the completion of window-effects.
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1358

 src/wayland/meta-wayland-actor-surface.c |  6 ++++++
 src/wayland/meta-wayland-shell-surface.c | 16 ----------------
 src/wayland/meta-xwayland-surface.c      | 16 ----------------
 3 files changed, 6 insertions(+), 32 deletions(-)
---
diff --git a/src/wayland/meta-wayland-actor-surface.c b/src/wayland/meta-wayland-actor-surface.c
index 47b3c1c3e2..5d4478253e 100644
--- a/src/wayland/meta-wayland-actor-surface.c
+++ b/src/wayland/meta-wayland-actor-surface.c
@@ -76,6 +76,9 @@ clear_surface_actor (MetaWaylandActorSurface *actor_surface)
   g_signal_handlers_disconnect_by_func (priv->actor,
                                         meta_wayland_surface_update_outputs_recursively,
                                         surface);
+  g_signal_handlers_disconnect_by_func (priv->actor,
+                                        meta_wayland_surface_update_outputs,
+                                        surface);
   g_clear_object (&priv->actor);
 }
 
@@ -445,4 +448,7 @@ meta_wayland_actor_surface_reset_actor (MetaWaylandActorSurface *actor_surface)
   g_signal_connect_swapped (priv->actor, "notify::mapped",
                             G_CALLBACK (meta_wayland_surface_update_outputs_recursively),
                             surface);
+  g_signal_connect_swapped (priv->actor, "stage-views-changed",
+                            G_CALLBACK (meta_wayland_surface_update_outputs),
+                            surface);
 }
diff --git a/src/wayland/meta-wayland-shell-surface.c b/src/wayland/meta-wayland-shell-surface.c
index 12d291043d..7bad43f34d 100644
--- a/src/wayland/meta-wayland-shell-surface.c
+++ b/src/wayland/meta-wayland-shell-surface.c
@@ -37,7 +37,6 @@ typedef struct _MetaWaylandShellSurfacePrivate
   MetaWindow *window;
 
   gulong unmanaging_handler_id;
-  gulong position_changed_handler_id;
   gulong effects_completed_handler_id;
 } MetaWaylandShellSurfacePrivate;
 
@@ -107,8 +106,6 @@ clear_window (MetaWaylandShellSurface *shell_surface)
 
   g_clear_signal_handler (&priv->unmanaging_handler_id,
                           priv->window);
-  g_clear_signal_handler (&priv->position_changed_handler_id,
-                          priv->window);
   g_clear_signal_handler (&priv->effects_completed_handler_id,
                           meta_window_actor_from_window (priv->window));
   priv->window = NULL;
@@ -127,18 +124,10 @@ window_unmanaging (MetaWindow              *window,
   clear_window (shell_surface);
 }
 
-static void
-window_position_changed (MetaWindow         *window,
-                         MetaWaylandSurface *surface)
-{
-  meta_wayland_surface_update_outputs_recursively (surface);
-}
-
 static void
 window_actor_effects_completed (MetaWindowActor    *window_actor,
                                 MetaWaylandSurface *surface)
 {
-  meta_wayland_surface_update_outputs_recursively (surface);
   meta_wayland_compositor_repick (surface->compositor);
 }
 
@@ -167,11 +156,6 @@ meta_wayland_shell_surface_set_window (MetaWaylandShellSurface *shell_surface,
                       "unmanaging",
                       G_CALLBACK (window_unmanaging),
                       shell_surface);
-  priv->position_changed_handler_id =
-    g_signal_connect (window,
-                      "position-changed",
-                      G_CALLBACK (window_position_changed),
-                      surface);
   priv->effects_completed_handler_id =
     g_signal_connect (meta_window_actor_from_window (window),
                       "effects-completed",
diff --git a/src/wayland/meta-xwayland-surface.c b/src/wayland/meta-xwayland-surface.c
index c8625f414c..11f5801272 100644
--- a/src/wayland/meta-xwayland-surface.c
+++ b/src/wayland/meta-xwayland-surface.c
@@ -44,7 +44,6 @@ struct _MetaXwaylandSurface
   MetaWindow *window;
 
   gulong unmanaging_handler_id;
-  gulong position_changed_handler_id;
   gulong effects_completed_handler_id;
 };
 
@@ -67,8 +66,6 @@ clear_window (MetaXwaylandSurface *xwayland_surface)
 
   g_clear_signal_handler (&xwayland_surface->unmanaging_handler_id,
                           xwayland_surface->window);
-  g_clear_signal_handler (&xwayland_surface->position_changed_handler_id,
-                          xwayland_surface->window);
 
   window_actor = meta_window_actor_from_window (xwayland_surface->window);
   g_clear_signal_handler (&xwayland_surface->effects_completed_handler_id,
@@ -91,18 +88,10 @@ window_unmanaging (MetaWindow          *window,
   clear_window (xwayland_surface);
 }
 
-static void
-window_position_changed (MetaWindow         *window,
-                         MetaWaylandSurface *surface)
-{
-  meta_wayland_surface_update_outputs_recursively (surface);
-}
-
 static void
 window_actor_effects_completed (MetaWindowActor    *window_actor,
                                 MetaWaylandSurface *surface)
 {
-  meta_wayland_surface_update_outputs_recursively (surface);
   meta_wayland_compositor_repick (surface->compositor);
 }
 
@@ -142,11 +131,6 @@ meta_xwayland_surface_associate_with_window (MetaXwaylandSurface *xwayland_surfa
                       "unmanaging",
                       G_CALLBACK (window_unmanaging),
                       xwayland_surface);
-  xwayland_surface->position_changed_handler_id =
-    g_signal_connect (window,
-                      "position-changed",
-                      G_CALLBACK (window_position_changed),
-                      surface);
   xwayland_surface->effects_completed_handler_id =
     g_signal_connect (meta_window_actor_from_window (window),
                       "effects-completed",


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