XGetInputFocus not working

VARADHARAJAN RAVINDRANATH 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
window details:

	Window focusWindow;
	Display *focusDisplay;
	focusDisplay = XOpenDisplay(NULL);
	int retcode = 0;
	int param = 0;
	retcode = XGetInputFocus(focusDisplay,&focusWindow,&param);
	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 [6291457]. 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
following line 

Retcode = 1
 Focus Window = 64
 Param = 

Can you pls point where am I getting wrong ??

Thanks & Regards,

-----Original Message-----
From: Peter Hutterer [mailto:peter.hutterer at who-t.net] 
Sent: Tuesday, April 21, 2009 10:17 AM
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 mailing list