Sample Header Ad - 728x90

Does either GTK+ or GDK offer a way to directly make Xlib or Xlib-xcb calls and/or receive x events?

2 votes
0 answers
836 views
Currently, I have had no problems compiling and running applications using Xlib-xcb and GTK+. However I haven't found a way to integrate the two, to use together. For example, it's be nice to be able to copy an area from an xcb pixmap into a GDK or GTK+ pixmap or window any other GTK or GDK object. Or to receive x events mixed with GTK's events. Currently, I use a separate thread to run an event loop using xcb_wait_for_event() if I want to use GTK in the same application. Does GTK+ have any means of delivering regular x events? Currently, when I run a program mixing calls from Xlib-xcb and GTK+, I get two icons in the Ubuntu application launcher strip, which is ok, just annoying. I'm pretty sure this is because I must use a separate Display variable (for Xlib), and xcb_connection_t variable (for my xcb calls). The window manager must assume there're two applications, separately using X11. I'm just a hobbyist and I'm doing this for fun and to teach myself. So even if replies of "why would you want to do that," or "that's not a good idea" are sensible ones, I still want to do that and don't care if it's a bad idea. I'm having fun! There are kludges I've thought of which could allow me to get image data from one realm to the other, but I'm hoping to find out that GTK+ or GDK have a way for me to directly call Xlib-xcb and share the same connection, which I just haven't been able to find. Since it's all one client application, it makes sense to have only one connection to the X11 server right? And I can get events without any problem and as long as I don't grab the pointer, keyboard, etc., the GTK+ side works just fine. Yeah, it really does sound like a bad idea! and why WOULD I want to do this? I dunno. It's fun. BTW, Cairo can use a pixmap as a surface, or creates a surface that renders in the pixmap - I'm unsure the technical terms. I use Cairo for text instead of the X Windows text calls.
Asked by DeeDeeK (21 rep)
Feb 21, 2018, 08:20 PM