From 5b062a58ac76b39c2dc6a7e1543affdf43dc7ee7 Mon Sep 17 00:00:00 2001
From: Apollon Oikonomopoulos <apoikos@gmail.com>
Date: Wed, 24 Mar 2010 17:40:31 +0200
Subject: [PATCH] Add -usbdevice tablet to KVM when using vnc

When using VNC, it is recommended to use a tablet-style
input device instead of a mouse. This allows most VNC viewers
to send proper mouse coordinates to the virtual machine's desktop
resulting in perfectly aligned guest and host mouse pointers.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
---
 lib/hypervisor/hv_kvm.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py
index 1fa6f1e91..469f857f6 100644
--- a/lib/hypervisor/hv_kvm.py
+++ b/lib/hypervisor/hv_kvm.py
@@ -497,6 +497,10 @@ class KVMHypervisor(hv_base.BaseHypervisor):
         vnc_arg = 'unix:%s/%s.vnc' % (vnc_bind_address, instance.name)
 
       kvm_cmd.extend(['-vnc', vnc_arg])
+
+      # Also add a tablet USB device to act as a mouse
+      # This solves various mouse alignment issues
+      kvm_cmd.extend(['-usbdevice', 'tablet'])
     else:
       kvm_cmd.extend(['-nographic'])
 
-- 
GitLab