RE: XGetInputFocus not working

2009-04-21 Thread VARADHARAJAN RAVINDRANATH
Hi,

   Following is the code in the windows manager to get the focused
window details:

Some_fn()
{
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
\n,retcode,focusWindow,param);
}


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,
R.Varadharajan.

-Original Message-
From: Peter Hutterer [mailto:peter.hutte...@who-t.net] 
Sent: Tuesday, April 21, 2009 10:17 AM
To: VARADHARAJAN RAVINDRANATH
Cc: xorg@lists.freedesktop.org
Subject: Re: XGetInputFocus not working

On Tue, Apr 21, 2009 at 06:16:13AM +0200, VARADHARAJAN RAVINDRANATH
wrote:
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
the
focus is on the root window?

Cheers,
  Peter
___
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg


RE: XGetInputFocus not working

2009-04-21 Thread VARADHARAJAN RAVINDRANATH
Hi Peter,
  
   Tones of thanks  it is only because, the sample application
did'nt have the focus, I was not able to get the window ID of it
properly. I have done a small workaround in my windows manager to set
the sample application in-focus for one-time and after that, I am able
to get the window ID of the sample application correctly in the windows
manager. This work around is only for checking... In real time, the
process that manages the windows will bring that to focus
asynchronously... 

Thanks again

Regards,
R.Varadharajan.

-Original Message-
From: Peter Hutterer [mailto:peter.hutte...@who-t.net] 
Sent: Tuesday, April 21, 2009 12:25 PM
To: VARADHARAJAN RAVINDRANATH
Cc: xorg@lists.freedesktop.org
Subject: Re: XGetInputFocus not working

On Tue, Apr 21, 2009 at 08:10:16AM +0200, VARADHARAJAN RAVINDRANATH
wrote:
 Hi,
 
Following is the code in the windows manager to get the focused
 window details:
 
 Some_fn()
 {
   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
 \n,retcode,focusWindow,param);
 }
 
 
 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 ??

As I said, have you set the focus?
If you're writing a window manager, you're responsible for setting the
input
focus to the window when you click into it. The server does not change
the
focus by itself.

The code should be something like:
XNextEvent(ev)
if (ev == key press)
XSetInputFocus(ev.window);

Cheers,
  Peter
___
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg


XGetInputFocus not working

2009-04-20 Thread VARADHARAJAN RAVINDRANATH
Hi ,

   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 ??

Thanks in advance...
Regards,
R.Varadharajan.
___
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg

How to Grab Key Events

2009-04-13 Thread VARADHARAJAN RAVINDRANATH
Hi ,

   I am a newbie in Xorg. I have a requirement wherein I need to grab
the key events in my X11 application even though it does not have focus.
This application in turn will do some manipulation in the received key
and will send the updated key press event to other X11 clients using
XSendEvent. This is some thing like a window manager implementation
where all X11 applications will be registered as clients to my
application. Hence, my application will be running as a background
process. So,when Xorg receives a key press, it should NOT send the
keypress event to the focused client (even though it has registered for
that event). It should first send it to my application.

   It would be highly helpful if you could help me this solving this

Thanks  Regards, 
Varadh
___
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg