Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting X11 window handle from GtkWidget

The wxWindow::GetHandle() function returns HWND on Windows and GtkWidget on linux. I need to get X11 Window Handle, which isn't the widget itself. How can I get the handle from that widget? I need C++ code as it's the main language of wxWidgets.

like image 573
user1873947 Avatar asked Feb 09 '13 13:02

user1873947


1 Answers

Something like:

GtkWidget *widget = ...;
Window w = gdk_x11_drawable_get_xid(gtk_widget_get_window(widget));

It is C because Gtk+ is a C API, but it is also C++, so there should be no problem.

And don't forget to #include <gdk/gdkx.h>!

like image 109
rodrigo Avatar answered Sep 29 '22 00:09

rodrigo