[mutter] wayland/wl-output: Emit "output-destroyed" signal earlier



commit 38db4a5a65f07151bedcbf6cb2ecc0340f6b3a48
Author: Jonas Dreßler <verdre v0yd nl>
Date:   Mon Mar 9 12:32:07 2020 +0100

    wayland/wl-output: Emit "output-destroyed" signal earlier
    
    The "output-destroyed" signal is used for notifying MetaWaylandSurfaces
    that an output they are shown just got invalid (for example because a
    monitor hotplug happened).
    
    While we delay the destroying of outputs by 10 seconds since commit
    1923db97 because of a race-condition, it doesn't make sense to wait 10
    seconds until we let surfaces know that an output was destroyed.
    
    So move the emission of the "output-destroyed" signal to
    make_output_inert(), which is called before we start the 10 seconds
    delay.
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1230

 src/wayland/meta-wayland-outputs.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)
---
diff --git a/src/wayland/meta-wayland-outputs.c b/src/wayland/meta-wayland-outputs.c
index 64de5abc3..aed66f30c 100644
--- a/src/wayland/meta-wayland-outputs.c
+++ b/src/wayland/meta-wayland-outputs.c
@@ -338,15 +338,7 @@ bind_output (struct wl_client *client,
 #endif
 
   send_output_events (resource, wayland_output, logical_monitor, TRUE, NULL);
-}
-
-static void
-wayland_output_destroy_notify (gpointer data)
-{
-  MetaWaylandOutput *wayland_output = data;
 
-  g_signal_emit (wayland_output, signals[OUTPUT_DESTROYED], 0);
-  g_object_unref (wayland_output);
 }
 
 static void
@@ -468,6 +460,8 @@ make_output_inert (gpointer key,
 {
   MetaWaylandOutput *wayland_output = value;
 
+  g_signal_emit (wayland_output, signals[OUTPUT_DESTROYED], 0);
+
   wayland_output->logical_monitor = NULL;
   make_output_resources_inert (wayland_output);
 }
@@ -489,7 +483,7 @@ meta_wayland_compositor_update_outputs (MetaWaylandCompositor *compositor,
   logical_monitors =
     meta_monitor_manager_get_logical_monitors (monitor_manager);
   new_table = g_hash_table_new_full (g_int64_hash, g_int64_equal, NULL,
-                                     wayland_output_destroy_notify);
+                                     g_object_unref);
 
   for (l = logical_monitors; l; l = l->next)
     {
@@ -737,7 +731,7 @@ meta_wayland_outputs_init (MetaWaylandCompositor *compositor)
                     G_CALLBACK (on_monitors_changed), compositor);
 
   compositor->outputs = g_hash_table_new_full (g_int64_hash, g_int64_equal, NULL,
-                                               wayland_output_destroy_notify);
+                                               g_object_unref);
   compositor->outputs = meta_wayland_compositor_update_outputs (compositor, monitors);
 
   wl_global_create (compositor->wayland_display,


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