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
This commit is contained in:
Jonas Dreßler 2020-03-09 12:32:07 +01:00 committed by verdre
parent 6f62c5b575
commit 38db4a5a65

View File

@ -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,