gdk/wayland: Dispatch GdkAppLaunchContext activation token in its own queue
authorCarlos Garnacho <carlosg@gnome.org>
Thu, 2 Jun 2022 21:04:40 +0000 (23:04 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Thu, 2 Jun 2022 21:08:40 +0000 (23:08 +0200)
Use a separate queue to dispatch the token object exclusively, just like we
do on the GdkSurface activation paths.

gdk/wayland/gdkapplaunchcontext-wayland.c

index c8bf5afd25489040c7f5d8ad1e637edd83db6f72..80cc3ffaf4f50e936f12da02586177ebc54f637d 100644 (file)
@@ -59,13 +59,17 @@ gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context
   if (display->xdg_activation)
     {
       struct xdg_activation_token_v1 *token;
+      struct wl_event_queue *event_queue;
       GdkWaylandSeat *seat;
       GdkSurface *focus_surface;
       AppLaunchData app_launch_data = { 0 };
 
+      event_queue = wl_display_create_queue (display->wl_display);
+
       seat = GDK_WAYLAND_SEAT (gdk_display_get_default_seat (GDK_DISPLAY (display)));
       focus_surface = gdk_wayland_device_get_focus (gdk_seat_get_keyboard (GDK_SEAT (seat)));
       token = xdg_activation_v1_get_activation_token (display->xdg_activation);
+      wl_proxy_set_queue ((struct wl_proxy *) token, event_queue);
 
       xdg_activation_token_v1_add_listener (token,
                                             &token_listener,
@@ -79,10 +83,11 @@ gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context
       xdg_activation_token_v1_commit (token);
 
       while (app_launch_data.token == NULL)
-        wl_display_roundtrip (display->wl_display);
+        wl_display_dispatch_queue (display->wl_display, event_queue);
 
       xdg_activation_token_v1_destroy (token);
       id = app_launch_data.token;
+      wl_event_queue_destroy (event_queue);
     }
   else if (display->gtk_shell_version >= 3)
     {