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.
This commit is contained in:
Gaël Bonithon
2024-01-06 23:12:47 +01:00
parent 782615ec68
commit a58ae95c87

View File

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