Global events receiving (keyboard, mouse events, active window change)

Heinrich Janzing h.janzing at
Thu Jan 4 10:59:15 PST 2007

On Thursday 04 January 2007 17:55, Alexander Nemish wrote:
> Hi Yong,
> Thank you for advise. Of course I've looked at xnee and sven's realization
> of grabbing global keypresses (
> The problem is that I can't rely on whether there is XRecord on a client
> machine. I can agree to have X11 and XKB as the dependencies. And still
> there are several unanswered questions, like:
> 1. Also I need to get all top-level windows and their titles. I'm using
> XQueryTree(dpy, root_window, ...) and XGetWMName for every child
> returned. I'm getting _all_windows and have no idea on which are
> top-level.

XQueryTree should only return direct children of the root window afaik. You 
can get more windows than you expect because of unmapped windows (especially 
when running KDE or similar, try it without a window manager running). Try 
checking if they're mapped and don't have the override_redirect flag (using 

> 2. Have no idea how to receive active window change notification. Any ideas
> are welcome.

Just set the event mask to FocusChangeMask. You will receive FocusIn and 
FocusOut events. Look here for more information:

> > Hi, Alex,
> >
> > Try XRecord extension. See xnee for reference.
> >
> > Regards,
> Thank you,
> Alexander
> _______________________________________________
> xorg mailing list
> xorg at

More information about the xorg mailing list