[Lazarus] Linux Window Handles

SteveG steveg at nevets.com.au
Sun Aug 3 13:30:35 CEST 2008


Found the code necessary to get the GTK handle from a Lazarus handle 
(for GTK2)
fWindow(int64) := GDK_WINDOW_XWINDOW( pointer( 
PGtkWidget(Form1.Handle)^.Window ) );

add gtk2, gdk2x  to the 'uses' section

> So far I have found that Laz uses a Gtk pointer to a structure rather 
> than a window handle directly.
> Anybody know what type of structure (and where to find it) ?
>
> SteveG wrote:
>   
>> Thanks Graeme
>> I will see if I can find how to convert from GTK to LCL handles (your 
>> theory sounds good)
>> I have been waiting for fpGUI to be stable enough to use anyway (from 
>> the LCL point of view),
>> so this issue may be a null point soon anyway for me.
>>
>> 'xwininfo' does indeed find the 'main' window, but I am calling 
>> 'xquerytree' to get a list of windows
>> and children (using xwininfo just for testing), and dont seem to be able 
>> to find how to determine which is the 'main' from the returned data 
>> (seem to be a lot of 'no name' windows in the tree - many at the top level)
>>
>> Graeme Geldenhuys wrote:
>>   
>>     
>>> On Sun, Aug 3, 2008 at 6:37 AM, SteveG <steveg at nevets.com.au> wrote:
>>>   
>>>     
>>>       
>>>> Having a problem understanding the usage of window handles in Linux
>>>>
>>>> Linux (Ubuntu 8.04):
>>>> I can find no correlation between the Laz supplied window handle
>>>> (Form1.Handle), and the X11 required handle - found using 'xwininfo -int
>>>> -tree' (and clicking on Form1 of testapp)
>>>> As an example, Laz returned 138531872, xwininfo returned 62915166.
>>>>     
>>>>       
>>>>         
>>> I think the following is true, but I might be wrong. Due to the fact
>>> that LCL doesn't talk directly to XLib (unlike fpGUI), it returns some
>>> GTK object handle. I guess you need to find a way to convert or query
>>> the actual X11 handle from that GTK object handle. This is just a
>>> guess.
>>>
>>>   
>>>     
>>>       
>>>> As an aside to this, how do I determine the 'main/important' window
>>>> handle from the list returned by
>>>>     
>>>>       
>>>>         
>>> I simply use "xwininfo -tree" and gives me the following results,
>>> after I clicked on the window I am interested in.
>>>
>>> ----------------------[ start ]------------------------------
>>> graemeg at graemeg-laptop:~$ xwininfo -tree
>>>
>>> xwininfo: Please select the window about which you
>>>           would like information by clicking the
>>>           mouse in that window.
>>>
>>> xwininfo: Window id: 0x2e000a4 "Vodafone Mobile Connect Card driver for Linux"
>>>
>>>   Root window id: 0x5b (the root window) (has no name)
>>>   Parent window id: 0x100013d (has no name)
>>>      25 children:
>>>      0x2e000fd (has no name): ()  578x15+2+468  +1305+1150
>>>      0x2e000fc (has no name): ()  15x3+583+462  +1886+1144
>>>      0x2e000f5 (has no name): ()  576x1+3+463  +1306+1145
>>>         1 child:
>>>         0x2e000f6 (has no name): ()  566x1+5+5  +1311+1150
>>>            1 child:
>>>            0x2e000f7 (has no name): ()  566x1+0+0  +1311+1150
>>>      0x2e000f4 (has no name): ()  600x27+0+433  +1303+1115
>>>      0x2e000f3 (has no name): ()  168x87+416+307  +1719+989
>>>      0x2e000d8 (has no name): ()  168x87+242+307  +1545+989
>>> <...snip....>
>>> ------------[  end  ]-----------------
>>>
>>> Now that clearly shows the root id (desktop or Root window id: 0x5b)
>>> and the main window I clicked on (Parent window id: 0x100013d) and
>>> then it's 25 children with their positions.
>>>
>>>
>>> Regards,
>>>  - Graeme -
>>>
>>>
>>> _______________________________________________
>>> fpGUI - a cross-platform Free Pascal GUI toolkit
>>> http://opensoft.homeip.net/fpgui/
>>> _______________________________________________
>>> Lazarus mailing list
>>> Lazarus at lazarus.freepascal.org
>>> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>>>
>>>   
>>>     
>>>       
>> _______________________________________________
>> Lazarus mailing list
>> Lazarus at lazarus.freepascal.org
>> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>>
>>   
>>     
>
> _______________________________________________
> Lazarus mailing list
> Lazarus at lazarus.freepascal.org
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>
>   




More information about the Lazarus mailing list