[SOLVED] XWindow ID From GtkWindow

Linux specific forum
User avatar
grabiller
Enthusiast
Enthusiast
Posts: 309
Joined: Wed Jun 01, 2011 9:38 am
Location: France - 89220 Rogny-Les-Septs-Ecluses
Contact:

[SOLVED] XWindow ID From GtkWindow

Post by grabiller »

Hi,

I'm trying to retrieve the XWindow ID of a Purebasic existing Window.

Purebasic WindowID() returns a GtkWindow*.

This is what I've found, in C, to get the XWindow ID from it:

Code: Select all

GtkWindow *mywindow;
GdkWindow *gwin;
gwin = gtk_widget_get_window(GTK_WIDGET(mywindow));
printf("the X11 id is %u\n", GDK_DRAWABLE_XID(gwin));
Unfortunately, this way uses 2 macros GTK_WIDGET & GDK_DRAWABLE_XID that can't be directly used in Purebasic.

I've tried to search for functions equivalent to these macros without success (or perhaps I've missed those ?).

My question is then: How to accomplish this in Purebasic ?

Perhaps there is a smarter way to retrieve the XWindow ID out of a GtkWindow ?

Cheers,
Guy.
Last edited by grabiller on Mon Jun 29, 2015 7:27 am, edited 1 time in total.
guy rabiller | radfac founder / ceo | raafal.org
User avatar
grabiller
Enthusiast
Enthusiast
Posts: 309
Joined: Wed Jun 01, 2011 9:38 am
Location: France - 89220 Rogny-Les-Septs-Ecluses
Contact:

Re: XWindow ID From GtkWindow

Post by grabiller »

Of course, just after posting my message I've found one function to replace the macro GDK_DRAWABLE_XID():

Code: Select all

Window gdk_x11_window_get_xid (GdkWindow *window);
#define GDK_DRAWABLE_XID(win)         (gdk_x11_window_get_xid (win))
Still unsuccessful for GTK_WIDGET() though : /

Any idea ?

Cheers,
Guy.
guy rabiller | radfac founder / ceo | raafal.org
freak
PureBasic Team
PureBasic Team
Posts: 5948
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Re: XWindow ID From GtkWindow

Post by freak »

GTK_WIDGET() just performs a type check and a cast. You can just leave it out in PB.
quidquid Latine dictum sit altum videtur
User avatar
grabiller
Enthusiast
Enthusiast
Posts: 309
Joined: Wed Jun 01, 2011 9:38 am
Location: France - 89220 Rogny-Les-Septs-Ecluses
Contact:

Re: XWindow ID From GtkWindow

Post by grabiller »

freak wrote:GTK_WIDGET() just performs a type check and a cast. You can just leave it out in PB.
Thanks a lot, should work then.


The only issue I have left is that PB don't link to "gdk_x11_window_get_xid" with:

Code: Select all

ImportC ""
  gtk_widget_get_window.i ( self.i )
  gdk_x11_window_get_xid.i ( window.i )
EndImport
gtk_widget_get_window is found but not gdk_x11_window_get_xid.

Should I point to a specific library ?

Cheers,
Guy.
guy rabiller | radfac founder / ceo | raafal.org
User avatar
grabiller
Enthusiast
Enthusiast
Posts: 309
Joined: Wed Jun 01, 2011 9:38 am
Location: France - 89220 Rogny-Les-Septs-Ecluses
Contact:

Re: XWindow ID From GtkWindow

Post by grabiller »

Hmm I'm afraid gdk_x11_window_get_xid is part of GTK 3 and not 2 which, afaik, Purebasic uses : /

Well, if anyone has any idea how I could solve this issue, you are welcome.

Cheers,
Guy.
guy rabiller | radfac founder / ceo | raafal.org
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: XWindow ID From GtkWindow

Post by ts-soft »

SubSystem gtk3?
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
grabiller
Enthusiast
Enthusiast
Posts: 309
Joined: Wed Jun 01, 2011 9:38 am
Location: France - 89220 Rogny-Les-Septs-Ecluses
Contact:

Re: XWindow ID From GtkWindow

Post by grabiller »

ts-soft wrote:SubSystem gtk3?
Yes!

Thanks a lot.

Cheers,
Guy.
guy rabiller | radfac founder / ceo | raafal.org
Post Reply