From a58ae95c877f28fc9ff183509bc2772f6b785433 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Bonithon?= Date: Sat, 6 Jan 2024 23:12:47 +0100 Subject: [PATCH] gdkdisplay-wayland: Init selection before roundtrips Some of the listeners connected during the initial roundtrip assume a non-NULL selection, when they finally invoke functions such as gdk_wayland_selection_ensure_offer(), gdk_wayland_selection_ensure_primary_offer() or gdk_wayland_selection_set_offer(). The GdkWaylandSelection should therefore be initialized before the second series of roundtrips, as the compositor may have already sent a selection by then. --- gdk/wayland/gdkdisplay-wayland.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c index 7c5e2f8771..63f26bf769 100644 --- a/gdk/wayland/gdkdisplay-wayland.c +++ b/gdk/wayland/gdkdisplay-wayland.c @@ -640,6 +640,7 @@ _gdk_wayland_display_open (const gchar *display_name) } process_on_globals_closures (display_wayland); + display_wayland->selection = gdk_wayland_selection_new (); /* Wait for initializing to complete. This means waiting for all * asynchrounous roundtrips that were triggered during initial roundtrip. */ @@ -684,8 +685,6 @@ _gdk_wayland_display_open (const gchar *display_name) return NULL; } - display_wayland->selection = gdk_wayland_selection_new (); - g_signal_emit_by_name (display, "opened"); return display;