Re: Getting an X11 Window associated with a Gtk widget



Peter F Bradshaw wrote:
> I'm new to Gtk. I'm looking for a way to get the underlying X11 Window
> value from a Gtk widget. The Gtk library version is 1,2.

Hi, something like (untested):

#include <gdk/gdkprivate.h>

Window
get_xwin( GtkWidget *widget )
{
	GdkWindow *gwin = widget->window;
	GdkWindowPrivate *pgwin = (GdkWindowPrivate *) gwin;

	return( pgwin->xwindow );
}

Take a look at the source for (eg.) gdk_window_show() for hints. Of course
this is an unsupported hack and will break horribly with lib changes. You
might be able to find another way to solve your problem --- why do you need
the xwindow?

John



========================================================== 

Coming Soon: 

T I T I A N 

19 February - 18 May 2003 

Advance Booking Recommended 
Open every day 
Wed-Sat late opening until 9pm 

For information and tickets: 
http://www.nationalgallery.org.uk/exhibitions/titian



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]