XGetInputFocus not working
Ravindranath.Varadharajan at alcatel-lucent.com
Mon Apr 20 23:10:16 PDT 2009
Following is the code in the windows manager to get the focused
focusDisplay = XOpenDisplay(NULL);
int retcode = 0;
int param = 0;
retcode = XGetInputFocus(focusDisplay,&focusWindow,¶m);
fprintf(stderr,"Retcode = %d\n Focus Window = %u\nparam = %d
A sample X11 application is written to check if the focus is obtained
correctly. This x11 aplication creates a simple window and starts
listening to KeyPress Events. During the startup of this x11
application, I printed the Window ID . Now when I click the
mouse in the window which the x11 application has created [to bring the
x11 application to focus], I find that the windows manager prints the
Retcode = 1
Focus Window = 64
Can you pls point where am I getting wrong ??
Thanks & Regards,
From: Peter Hutterer [mailto:peter.hutterer at who-t.net]
Sent: Tuesday, April 21, 2009 10:17 AM
To: VARADHARAJAN RAVINDRANATH
Cc: xorg at lists.freedesktop.org
Subject: Re: XGetInputFocus not working
On Tue, Apr 21, 2009 at 06:16:13AM +0200, VARADHARAJAN RAVINDRANATH
> I am developing an X11 windows manager with minimal functionality.
> Here, I need to find the focus window. I used XGetInputFocus API, this
> always returns 64 as window ID and never the actual Window ID of the
> focused window. Can anyone help ??
Have you set the focus window? 64 sounds like a root window ID, so maybe
focus is on the root window?
More information about the xorg