3

My C application uses X11 calls to create and manage a window. I only want to use GTK3 for menus.

I create a window using Window wnd = XCreateWindow(...);

Now I want to use GTK to add menus to wnd.

GTK APIs such as gtk_container_add(GTK_CONTAINER(gtk_wnd), vbox) want a GtkWindow, which I do not have.

How do I accomplish this?

Ideally I'd like to get a X11 handle to work with GTK, potentially via a conversion. Alternatively, I'd also settle for getting the current window via some GTK API.

ApoorvaJ
  • 830
  • 1
  • 7
  • 24
  • What do you mean by "add menus" ? Where do you want these menus to appear? Do you mean that you want to add a whole menu bar with drop-down menus? That can be done in GTK/X11 by creating a GTK window with a menu bar and a GtkEventBox that occupies the rest of the window. Then re-parent the X11 window so that it is a child of the GtkEventBox. It's a horrible job, however. – Kevin Boone Aug 27 '17 at 08:21
  • 1
    Yeah, just don't do this. – ptomato Aug 28 '17 at 05:38
  • There's no notion of current window in X11. If you want to create a top level window via GTK and then use it with X11 calls, use something like `gdk_x11_drawable_get_xid(gtk_widget_get_window(widget))`. – n. m. could be an AI Aug 29 '17 at 14:40

0 Answers0