Re: XGetInputFocus() does not work for GTK based applications



Hi Owen,
Thanks a lot for the immediate response.
When I use the window id I get in the "focus" parameter of the following call
XGetInputFocus(disp,&focus,&revert);
as an input to xprop, I donot get any output.
that is, say I get the value 0x220001a in focus,
xprop -id 0x220001a doesnot give me the properties.
 
If your time permits, can you please explain to me the reason. Thanks.
 
Also, how do I get the window id of the window on focus ? I manually move the mouse to the window to the GTK window, but still, XGetInputFocus gives me a different id.
 
How do I get the window id of the toplevel window?
 
 
Thanks a lot,
Kala

 
 


Owen Taylor <otaylor redhat com> wrote:
On Tue, 2004-07-27 at 05:43, Kala B wrote:
> Hi,
> The following code does not give me the correct window id for GTK based applications.
>
> #include
> #include
> #include
> main()
> {
> Window focus = 0;
> int revet = 0;
> Display *disp = XOpenDisplay(0);
> assert(disp);
> sleep(2);
> XGetInputFocus(disp,&focus,&revert);
> printf("Win id is %x\n",focus);
>
> }
> It always prints a wrong window id for GTK based applications. (gaim, evolution)
> Do I need to set some environment variable?
> I am using xlsclients and xprop to verify the values being printed.
> Could somebody please help me?
> Is there a GTK API which with the same functionality of XGetInputFocus()? I basically want to get the window id of the window in focus.

Nothing is "wrong" about the value you getting. GTK+ sets focus to
an immediate child of the toplevel rather than the toplevel itself.

Regards,
Owen



> ATTACHMENT part 2 application/pgp-signature name=signature.asc

Yahoo! India Matrimony: Find your life partner online.



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