Integrating Wayland loop into GMainLoop

I am writing a GTK app that needs to connect to events from a Wayland display. At the moment I have a Wayland client loop, like this:

while (1)
wl_display_dispatch (display);

How do I integrate a Wayland client loop into a GMainLoop?

Can you access the Wayland events through GTK and GDK, rather than connecting to Wayland yourself? That would be a lot easier.

Otherwise, you’ll have to read gdkeventsource.c and construct something like it yourself to integrate the Wayland event FD into a GSource which you can attach to your GMainContext.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.