[Lazarus] Getting X Window handle ?

zeljko zeljko at holobit.net
Mon Nov 5 11:32:57 CET 2012


On Monday 05 of November 2012 11:24:41 Michael Van Canneyt wrote:
> On Mon, 5 Nov 2012, zeljko wrote:
> > On Monday 05 of November 2012 10:35:45 Michael Van Canneyt wrote:
> >> Hello,
> >> 
> >> I'm trying to embed the VLC player (using the videolan DLLS) in a LCL
> >> application. On Windows, this works fine. On Linux, this does not work.
> >> 
> >> The reason is that the VideoLan library expects the native window
> >> handle. On Windows, TWinControl.Handle provides this.
> >> 
> >> On Linux, TWinControl.Handle returns the GTK widget pointer if I'm using
> >> GTK. (I imagine it will be something similar when using Qt)
> >> 
> >> How can I get access to the low-level X window handle (id) of a
> >> TWinControl on Linux ?
> > 
> > It's not so problematic. Look at qtx11.inc in lcl/widgetset/qt or in
> > gtk2widgetset.inc (there's IFDEF X11 or similar) which gets X11 TWindow
> > from GdkWindow.
> 
> Actually, it is in gtk2proc, FormToX11Window :-)
> 
> Thanks.
> 
> The function could accept a TWinControl instead of TCustomForm I would
> think. Maybe an overloaded version can be added. The code is the same.
> 
> I'd even suggest adding a GetNativeHandle : Pointer to TWinControl,
> but I suspect that will encounter some resistance :-)

Yes, I'm suspicious about it too :)

zeljko




More information about the Lazarus mailing list