Merge branch 'wip/wl-dispatch-helper' into 'main'

wayland: Add event queue dispatch helper

See merge request GNOME/gtk!5498
This commit is contained in:
Matthias Clasen 2023-02-12 01:01:29 +00:00
commit c2cb1ffe9e
5 changed files with 22 additions and 17 deletions

View File

@ -87,7 +87,7 @@ 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_dispatch_queue (display->wl_display, event_queue);
gdk_wayland_display_dispatch_queue (GDK_DISPLAY (display), event_queue);
xdg_activation_token_v1_destroy (token);
id = app_launch_data.token;

View File

@ -2694,3 +2694,17 @@ gdk_wayland_display_query_registry (GdkDisplay *display,
return FALSE;
}
void
gdk_wayland_display_dispatch_queue (GdkDisplay *display,
struct wl_event_queue *event_queue)
{
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
if (wl_display_dispatch_queue (display_wayland->wl_display, event_queue) == -1)
{
g_message ("Error %d (%s) dispatching to Wayland display.",
errno, g_strerror (errno));
_exit (1);
}
}

View File

@ -158,6 +158,9 @@ struct _GdkWaylandDisplayClass
gboolean gdk_wayland_display_prefers_ssd (GdkDisplay *display);
void gdk_wayland_display_dispatch_queue (GdkDisplay *display,
struct wl_event_queue *event_queue);
G_END_DECLS
#endif /* __GDK_WAYLAND_DISPLAY__ */

View File

@ -1334,8 +1334,6 @@ gdk_wayland_surface_present_popup (GdkWaylandPopup *wayland_popup,
GdkPopupLayout *layout)
{
GdkSurface *surface = GDK_SURFACE (wayland_popup);
GdkWaylandDisplay *display_wayland =
GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
GdkWaylandSurface *wayland_surface = GDK_WAYLAND_SURFACE (wayland_popup);
if (!wayland_surface->mapped)
@ -1389,13 +1387,8 @@ gdk_wayland_surface_present_popup (GdkWaylandPopup *wayland_popup,
while (wayland_popup->display_server.xdg_popup && !is_relayout_finished (surface))
{
if (wl_display_dispatch_queue (display_wayland->wl_display,
wayland_surface->event_queue) == -1)
{
g_message ("Error %d (%s) dispatching to Wayland display.",
errno, g_strerror (errno));
_exit (1);
}
gdk_wayland_display_dispatch_queue (surface->display,
wayland_surface->event_queue);
}
if (wayland_popup->display_server.xdg_popup)

View File

@ -2120,13 +2120,8 @@ gdk_wayland_toplevel_focus (GdkToplevel *toplevel,
while (startup_id == NULL)
{
if (wl_display_dispatch_queue (display_wayland->wl_display,
event_queue) == -1)
{
g_message ("Error %d (%s) dispatching to Wayland display.",
errno, g_strerror (errno));
_exit (1);
}
gdk_wayland_display_dispatch_queue (GDK_DISPLAY (display_wayland),
event_queue);
}
xdg_activation_token_v1_destroy (token);