More interesting stuff with timers, held keys, held mouse buttons: Firstly, the timer doesn't even get created every time. I can demonstrate this by starting xwin with just one xterm, and running xeyes. Normally if I move the mouse out of the xterm then about half a second later the x cursor gets deleted and the xeyes continue to update. But if I move the mouse really quickly out of the xterm (helps that I have mouse sensitivity set at the highest setting) then sometimes the cursor is not deleted and xeyes don't update until I move mouse back into the xterm. So occasionally the timer is not created, it seems. As a secondary phenomenon, if I do this fast movement out of the xterm while at the same time holding a mouse button, then the windows mouse cursor not shown either (ie the mouse is invisible) until I release the click.
Secondly, the recent fix whereby all x keys get forced released on losing focus doesn't seem to be strictly correct either. If I put focus on my xterm and then hold, say shift or control, and while holding it click on the desktop to remove focus from xterm and then click back on the xterm, the xterm behaves as if shift and control are not pressed. Of course this is rarely a problem but perhaps it could be an issue if there are any X applications that make use of shift-drag/drop or control-drag/drop, etc, like windows does. Might also be a problem for people using the windows accessibility options such as "sticky keys". So, all things considered, the message hook idea sounds better than using a timer, and while you're at it, you could do the right thing(tm) concerning keydown, keyup instead of just force-releasing all keys. With this, might it in fact be possible to remove most of the event-handling stuff out of each client-window message loop and just use the hook to pass these messages directly to the root window. (Ie install the hook once, at server-startup, and then you receive all the mouse and keboard events, just like in the non-rootless, non-multiwindow case). I don't know enough about the multiwindow implementation to know if this is sensible. Lev