Window change event?
laci at monda.hu
Mon Aug 5 13:48:12 PDT 2013
On Sun, Aug 4, 2013 at 5:16 PM, Thomas Lübking
<thomas.luebking at gmail.com> wrote:
> 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)
Thank you very much Thomas, looks like a good starting point for me.
I'll be looking into XSelectInput().
> xorg at lists.x.org: X.Org support
> Archives: http://lists.freedesktop.org/archives/xorg
> Info: http://lists.x.org/mailman/listinfo/xorg
> Your subscription address: laci at monda.hu
László Monda <http://monda.hu>
More information about the xorg