Skip to content

Commit 683b2d0

Browse files
committed
Use tablet instead of mouse when using vnc display
There is the occasional offset between the software and hardware cursor when using mouse with a VNC display... By using a tablet instead of a mouse, this is avoided. It sends all positions as absolute instead of relative. Signed-off-by: Anders F Björklund <[email protected]>
1 parent ca85513 commit 683b2d0

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

pkg/qemu/qemu.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,9 @@ func Cmdline(cfg Config) (string, []string, error) {
762762
// virtio-rng-pci accelerates starting up the OS, according to https://wiki.gentoo.org/wiki/QEMU/Options
763763
args = append(args, "-device", "virtio-rng-pci")
764764

765+
// Input
766+
input := "mouse"
767+
765768
// Sound
766769
if *y.Audio.Device != "" {
767770
id := "default"
@@ -780,24 +783,27 @@ func Cmdline(cfg Config) (string, []string, error) {
780783
if display == "vnc" {
781784
display += "=" + *y.Video.VNC.Display
782785
display += ",password=on"
786+
// use tablet to avoid double cursors
787+
input = "tablet"
783788
}
784789
args = appendArgsIfNoConflict(args, "-display", display)
785790
}
791+
786792
switch *y.Arch {
787793
case limayaml.X8664, limayaml.RISCV64:
788794
args = append(args, "-device", "virtio-vga")
789795
args = append(args, "-device", "virtio-keyboard-pci")
790-
args = append(args, "-device", "virtio-mouse-pci")
796+
args = append(args, "-device", "virtio-"+input+"-pci")
791797
args = append(args, "-device", "qemu-xhci,id=usb-bus")
792798
case limayaml.AARCH64, limayaml.ARMV7L:
793799
if features.VersionGEQ7 {
794800
args = append(args, "-device", "virtio-gpu")
795801
args = append(args, "-device", "virtio-keyboard-pci")
796-
args = append(args, "-device", "virtio-mouse-pci")
802+
args = append(args, "-device", "virtio-"+input+"-pci")
797803
} else { // kernel panic with virtio and old versions of QEMU
798804
args = append(args, "-vga", "none", "-device", "ramfb")
799805
args = append(args, "-device", "usb-kbd,bus=usb-bus.0")
800-
args = append(args, "-device", "usb-mouse,bus=usb-bus.0")
806+
args = append(args, "-device", "usb-"+input+",bus=usb-bus.0")
801807
}
802808
args = append(args, "-device", "qemu-xhci,id=usb-bus")
803809
}

0 commit comments

Comments
 (0)