Window change event?
thomas.luebking at gmail.com
Sun Aug 4 08:16:18 PDT 2013
On Sonntag, 4. August 2013 16:08:08 CEST, László Monda wrote:
> I'm writing an application that has to be aware of the current window.
> So far I've extracted the relevant code from xprop and put it into
> https://github.com/mondalaci/current-window-linux . (I screwed up
> The above solution would work but it'd involve polling the info of the
> current window from time to time which is not very efficient.
> Wondering whether there's a way to register a callback for a "window
> change" event. That'd be so much more efficient. Ideally I'm looking
> for a way to do this in a window manager independent manner.
XSelectInput(dpy, root, PropertyChangeMask );
You'll then receive "PropertyNotify" type events (google for "X11 event handler" w/o quotes - you'll find examples for main event loop implementations) from the root window.
Then you've to check whether it's the correct property.
I didn't check what you're actually trying to do, but this is different from selecting input of FocusChangeMask on each interesting window and receive FocusIn/Out events.
Focus and Active window do not necessarily have to go along each other (and also clients grabbing the keyboard might actually receive keyboard events)
More information about the xorg