[virt-tools-list] [virt-manager] keyboard grabbing behaviour

Daniel P. Berrange berrange at redhat.com
Thu Nov 12 20:09:13 UTC 2009


On Thu, Nov 12, 2009 at 08:38:01PM +0100, Jon Nordby wrote:
> When setting the "Grab Keyboard Input" preference to "Never" my keyboard is
> grabbed when my pointer is grabbed (by pressing ctrl+alt or clicking on the
> console). Is this expected behaviour? I expected that even when I forced a
> pointer grab (ctrl + alt) I would still be able to switch virtual desktops
> in the host using the keyboard.

This is complicated :-)

There are two modes of using pointers with VNC

 - Absolute mode
 - Relative mode

Traditionally all VNC servers used absolute mode. This turns out to suck
for virtualization though, because the pointer exported to the guest is
a relative pointer (PS/2 mouse). So QEMU introduced a relative mode
extension to VNC which is activated whenever a relative mouse like PS2
is given to the guest.  If using a USB tablet, then QEMU will stick with
absolute mode if its used by the guest.

Now, in absolute mode, the host & guest pointers move 1-for-1 in lockstep
so no pointer grab is ever required, and thus no keyboard grab is done by
default.

In relative mode, we have to grab the host poiinter and hide it, because
its motion bears little resemblance to motion of the guest pointer & its
confusing to have 2 pointers at once ! When we grab the pointer, we also
grab the keyboard.

This logic I've described is all done in GTK-VNC.

virt-manager then has its own extra preferences ontop of this, but it
cannot ever stop the GTK-VNC behaviour - only add to it.

So if GTK-VNC has grabbed the keyboard, due to the pointer grab it needs
in relative mode, then no virt-manager preference can override it.

The virt-manager preference will thus only be effective when the mouse
is in absolute mode (ie guest is using a USB Tablet), or when the pointer
is not grabbed in relative mode.


Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the virt-tools-list mailing list