How to attach X11 app to Dbus
Question
How to make X11 application to listen to DBus signal. That to listen to Dbus signal gmainloop should be launched, and for X11 app XEvent loop. So is there an elegant way to do this ? Or do I have to run gmainloop in another thread.
Regards, Levon
Solution
If you want to block on two or more things (say X and dbus) you need a main loop. You could use GLib's main loop or libev or other libraries.
Here are two examples of using Xlib with GLib's main loop:
OTHER TIPS
Shouldn't you be able to get a file descriptor for the X event loop? Then you should be able to add it to the gobject mainloop.
From what I can see, ConnectionNumber(xdpy)
will give the file
descriptor, which you can then add to a source, which you can use with
g_source_add_poll()
.