mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 10:50:10 +00:00
wayland: Add event queue dispatch helper
Dispatch failing should always fatal; use a helper to centralize the error handling everywhere.
This commit is contained in:
parent
04c3af537c
commit
dd9433b50e
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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__ */
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user