[gtkmm] Fw: How to get X window ID of a gtk window?



Hi,

I found this message from Jan 98 (see forwarded message below).
What's the proper way to get the window ID in GTKMM now?

In a class that inherits from Gtk::Window, I use
GDK_WINDOW_XWINDOW (get_window());
But I get the error:
cannot convert `RefPtr<Gdk::Window>()' from type `Glib::RefPtr<Gdk::Window>' to type `_GdkDrawable *'

Obviously I'm missing smthg in the RefPtr mechanism, but how to solve this?
Any help is greatly appreciated.

Merry Xmas to you all!
Sylvain

raster redhat com writes:

> On 16 Jan, Nils Philippsen shouted:
> ->  Hello,
> ->  
> ->  I wnated to know how one could get the X window id of a goven GTK window. I
> ->  need this to set a default icon the WM uses instead of an 'unknown
> ->  application'-icon. I found out that I must dig this way gtk_window ->
> ->  gdk_window -> X_window but it seems I'm not wit enough to find out the correct
> ->  member names to get the GDK window from the GTK and the X window from the GDK
> ->  window :-( (maybe there are some cast macros for this?)
> 
> get your pointer to the gdk_window then:
> 
> GdkWindowPrivate *priv;
> Window xwin;
> Display *xdisp;
> 
> priv=(GdkWindowPrivate *)gdk_window;
> xwin=priv->xwindow;
> 
> and even better:
> xdisp=priv->xdisplay;
> 
> there's more interesting stuff there too.. check gdkprivate.h :)

How about:

include <gdk/gdkx.h>

...

  xwin = GDK_WINDOW_XWINDOW (window);
  xdisp = GDK_WINDOW_XDISPLAY (window);

Things in gdkprivate.h are private, so can and will change 
without notice.

gdkx.h is for translating X windows objects <-> GDK ojects.

Regards,
                                        Owen




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