/* If we should try wl_display_dispatch_pending() before *pollingtheWaylandfd
*/ static gboolean
gdk_wayland_display_can_dispatch (GdkWaylandDisplay *display_wayland)
{
GdkWaylandPollSource *poll_source = (GdkWaylandPollSource *) display_wayland->poll_source;
return poll_source->can_dispatch;
}
/* If we still have events to process and don't need to poll */ static gboolean
gdk_wayland_display_has_events_pending (GdkWaylandDisplay *display_wayland)
{ return gdk_wayland_display_can_dispatch (display_wayland) ||
_gdk_event_queue_find_first (GDK_DISPLAY (display_wayland)) != NULL;
}
if (gdk_wayland_display_has_events_pending (source->display)) returnFALSE;
/* wl_display_prepare_read() needs to be balanced with either *wl_display_read_events()orwl_display_cancel_read()
* (in gdk_wayland_event_source_check() */ if (source->reading) returnFALSE;
/* if prepare_read() returns non-zero, there are events to be dispatched */ if (wl_display_prepare_read (display->wl_display) != 0)
{
source->can_dispatch = TRUE; returnTRUE;
}
/* We need to check whether there are pending events on the surface queues as well, *butwealsoneedtomakesuretoonlyhaveoneactive"read"intheend, *ornoneifweimmediatelyreturnTRUE,asmultiplereadsexpectreadsfrom *asmanythreads.
*/ for (l = display->event_queues; l; l = l->next)
{ struct wl_event_queue *queue = l->data;
if (wl_display_prepare_read_queue (display->wl_display, queue) != 0)
{
source->can_dispatch = TRUE; /* cancel the read from before the for loop */
wl_display_cancel_read (display->wl_display); returnTRUE;
}
wl_display_cancel_read (display->wl_display);
}
/* read the events from the wayland fd into their respective queues if we have data */ if (source->reading)
{ if (source->pfd.revents & (G_IO_ERR | G_IO_HUP))
{
g_message ("Lost connection to Wayland compositor.");
_exit (1);
} if (source->pfd.revents & G_IO_IN)
{ if (wl_display_read_events (display_wayland->wl_display) < 0)
{
g_message ("Error reading events from display: %s", g_strerror (errno));
_exit (1);
}
source->pfd.revents = 0;
source->can_dispatch = TRUE;
} else
wl_display_cancel_read (display_wayland->wl_display);
source->reading = FALSE;
}
/* We must guarantee to ALWAYS be called and called FIRST after *everypoll-orrather:aftereveryprepare(). *AnyothersourcemightcallWaylandfunctionsandinturn *blockwhilewaitingforus. *AndGSourcehasnoafter_pool()vfunc,check()isnotguaranteed *tobecalled.
*/
g_source_set_priority (source, G_MININT);
g_source_attach (source, NULL);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.