Re: Can't retrieve actual GdkWindow for a Gtk::Widget



----- Original Message ----- From: "Timothy M. Shead" <tshead k-3d com>
To: <gtkmm-list gnome org>
Sent: Saturday, December 17, 2005 5:33 AM
Subject: Can't retrieve actual GdkWindow for a Gtk::Widget


I am working on some tutorial-playback functionality for a gtkmm-based
application, K-3D (http://k3d.sourceforge.net).  To this end, I would
like to synthesize Gdk events and insert them into the main event loop.
 This would not be difficult, except that I cannot obtain the actual
GdkWindow for a given widget.  If you run the attached example, press
the button, and view the console output, you will see that the GdkWindow
in the GdkEvent object is not the same as the window returned by
button.get_window()->gobj().  In fact, the latter returns the *parent*
of the GdkEvent window.  I need to obtain the actual widget window so I
can generate corresponding events for it.  Could anyone comment on this
behavior?

Many thanks,
Tim Shead

A Gtk::Button has no window for drawing, you can test this with button.has_no_window(). So button.get_window()->gobj() will return the GdkWindow of its container.

It does have an event_window for handling events, that's the one you want, you can get this with:

   button.gobj()->event_window

--

Marco






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