Re: [gtk-vnc-devel] PATCH: key state tracking to avoid various bugs



On Wed, Jan 09, 2008 at 09:04:59PM -0600, Anthony Liguori wrote:
> Daniel P. Berrange wrote:
> >There are various problems with the VNC protocol and GTK relating to key
> >state tracking. The VNC protocol has no concept of modifier keys, nor a
> >way to reset key state. So if a client looses focus while one or more
> >keys are pressed down, the server will never see any 'release' event for
> >them. This is particularly troublesome with modifiers because it will 
> >appear that Ctlr or Alt is stuck down and you'll get really wierd behaviour
> >with keyboard shortcuts in your guest activating.
> >
> >Second, GTK has the 'feature' where by it compresses  sequential 
> >press+release
> >events for the same key. So if you hold down the 'a' key long enough to get
> >keyboard repeat running, instead of down+up, down+up, down+up you'll merely
> >get down,down,down,...,down+up.  This seriously annoys some VNC servers,
> >in particular the Xen paravirt framebuffer will ignore the repeated down
> >events.  
> >
> >So this patch introduces  keystate tracking. This is then used in two cases
> >to send extra fake events. If we get two sequential down events for the 
> >same
> >key we will send an extra fake 'up' event before the extra down event. If
> >we get a focus-out event, we will send fake 'up' events for all currently 
> >held
> >down keys.  The state tracking also ensures that if the key is still held
> >when focusin occurs, we won't get duplicated 'up' events.
> >
> >I posted a similar patch quite a while ago, and Anthony suggested trying to
> >hook into the mapping-notify event, but GTK doesn't expose this to apps,
> >and we need to track state anyway to work around the GTK key repeat 
> >insanity
> 
> I'm happy with this approach.  I suspect this is the best way we can 
> handle this.  This has always been something that has annoyed me so I'm 
> happy to see it fixed.

Great, just pushed the change now.

Regards,
Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 




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