Re: [gtk-vnc-devel] PATCH: key state tracking to avoid various bugs
- From: "Daniel P. Berrange" <berrange redhat com>
- To: gtk-vnc-devel <gtk-vnc-devel lists sourceforge net>
- Subject: Re: [gtk-vnc-devel] PATCH: key state tracking to avoid various bugs
- Date: Wed, 9 Jan 2008 20:33:17 +0000
On Wed, Jan 09, 2008 at 08:24:35PM +0000, 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
FYI I had pretty much identical code to this in the original virt-manager
VNC widget & it worked pretty reliably. The RealVNC viewer program also
has a near identical approach to this problem - albeit without need of
the GTK key-repeat hack since they don't use GTK.
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]