Re: [gtk-vnc-devel] PATCH: Track key presses & fake up events when loosing focus



Daniel P. Berrange wrote:
> The VNC protocol has no concept of focus in/out, nor modifier key states.
> So if the VNC widget looses key board focus while certain keys are held
> down, and then re-gains it when a different set of keys are held down it
> can get very confusing state - missing key up events for the original set
> of keys, and unexpected key up events for the new set of keys. This is
> particularly bad if the keys are modifier keys. This is really really 
> painful if one uses 'Alt+Tab' for cycling keyboard focus through local
> windows because Alt+Tab get stuck on in the remote server.

X11 has a KeymapNotify event for that.  It usually comes in when the
window re-gains the kbd focus and it tells you the current key state, so
you can fixup things for changes you havn't seen.

That way you even get the case right where the Alt Key is still (or
again) in down state when the vnc window gets the focus (due to
switching back to the vnc window is done via kbd hotkey too).

It is a bit tricky to get these events though.  There is no gtk event
for them and also no signal, so you have to install an event filter
using gdk_window_add_filter().

cheers,
  Gerd






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]