wayland: update enter/leave output after effects
authorOlivier Fourdan <ofourdan@redhat.com>
Wed, 4 Apr 2018 08:15:25 +0000 (10:15 +0200)
committerSimon McVittie <smcv@debian.org>
Sun, 8 Jul 2018 10:32:56 +0000 (11:32 +0100)
Compositor effects change the actor size and position, which can lead to
inconsistent output enter/leave notifications, leaving clients' surfaces
without any output set.

Update output enter/leave notifications after all compositor effects are
completed so that we give clients accurate output location.

(cherry picked from commit 17a745bf81c24dae9c081e93ae1593e2bb81efd6)

Bug: https://gitlab.gnome.org/GNOME/mutter/issues/104
Origin: upstream, 3.28.3, commit:235c35182b54eb3a86164afa5be13ae8c520d228

Gbp-Pq: Name wayland-update-enter-leave-output-after-effects.patch

src/wayland/meta-wayland-surface.c

index 9fdad3eb9b6e0b9f73c520eb35d917d4ee1fa368..899f777c3d2d214e3ec64ea6b05fe926601ca5f2 100644 (file)
@@ -54,6 +54,7 @@
 
 #include "compositor/region-utils.h"
 #include "compositor/meta-shaped-texture-private.h"
+#include "compositor/meta-window-actor-private.h"
 
 #include "meta-surface-actor.h"
 #include "meta-surface-actor-wayland.h"
@@ -142,6 +143,9 @@ surface_actor_position_notify (MetaSurfaceActorWayland *surface_actor,
 static void
 window_position_changed (MetaWindow         *window,
                          MetaWaylandSurface *surface);
+static void
+window_actor_effects_completed (MetaWindowActor    *window_actor,
+                                MetaWaylandSurface *surface);
 
 static void
 role_assignment_valist_to_properties (GType       role_type,
@@ -1138,6 +1142,9 @@ meta_wayland_surface_set_window (MetaWaylandSurface *surface,
       g_signal_handlers_disconnect_by_func (surface->window,
                                             window_position_changed,
                                             surface);
+      g_signal_handlers_disconnect_by_func (meta_window_actor_from_window (surface->window),
+                                            window_actor_effects_completed,
+                                            surface);
     }
 
   surface->window = window;
@@ -1154,6 +1161,10 @@ meta_wayland_surface_set_window (MetaWaylandSurface *surface,
                                "position-changed",
                                G_CALLBACK (window_position_changed),
                                surface, 0);
+      g_signal_connect_object (meta_window_actor_from_window (window),
+                               "effects-completed",
+                               G_CALLBACK (window_actor_effects_completed),
+                               surface, 0);
     }
 }
 
@@ -1255,6 +1266,13 @@ window_position_changed (MetaWindow         *window,
   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);
+}
+
 void
 meta_wayland_surface_create_surface_actor (MetaWaylandSurface *surface)
 {