Catching *every* event
j85wilson at fastmail.fm
Tue Aug 2 21:54:56 PDT 2005
I don't know if this is the best list to send this to, but I've
browsed through the listings on freedesktop.org and x.org, and
couldn't find one that really fit, and this was the closest. If this
is wrong, kindly point me in the right direction, and I will wobble
off again, leaving this mailing list in peace.
I already asked this question on comp.windows.x several days ago, and
didn't get any response.
I want to be able to catch, in one X client, literally every X event
which is sent to any window. Furthermore, I want this one client to
be able to catch all of these events before any other client gets
them, and also have the ability to delay or prevent (a la substructure
redirect) these events from reaching the client that owns the window
they were sent to. Does substructure redirect do this for all events,
or just mapping/resizing/etc. events? Is there a clean, simple way to
do this at all?
The purpose of this is to write an application that allows complete
customization of what occurs on not only input, but also on any other
event that might occur. This application would eventually be one
piece of a window manager I am beginning work on.
I've read through some documentation on Xlib, which is very helpful
when it comes to telling me how to select various events, but not so
helpful when it comes to telling me which events get sent where when,
and if it is possible to intercept them.
A few approaches I've thought of, but haven't been able to verify in
any documentation I've found:
1) select for every event on the root window. However, I'm pretty
sure that events get sent to childmost windows first, and then
propogate up the chain, eventually landing on the root window if
nobody else handles them.
2) select for every event on *every* window that is on the server.
This seems like it might work, but it would probably be somewhat
slower than I'd like, as the number of X windows can be very high at
times, I believe. Additionally, I suspect that this would not allow
me to prevent event delivery to other clients.
3) For every window on the server, create a child of that window which
is transparent, the same dimensions, and always on top of its parent.
Then, select for every event on these transparent covers, and set
the do not propagate mask for every event. However, I don't believe
that do not propagate stops events of every type. This has the same
bloat problems as 2) it would seem. I suppose this could be slightly
ameliorated, especially on multi-core/processor systems, by starting a
new thread to catch events on every cover that is created.
More information about the xorg