pmb.qemu: add --tablet option for QEMU tablet input device (!1886)

The QEMU 'tablet' input device reports absolute positions instead
of relative mouse pointer movements. This can be used to automatically
grab/release the mouse pointer when entering/leaving the QEMU window,
instead of having to release it with CTRL + ALT + G manually.

This is quite convenient and should be the default option normally,
but at least on my PC the mouse pointer is reported with some vertical
offset for some reason (you can't reach the top and it extends below
the QEMU window...). Let's add it as an optional --tablet option for now.
This commit is contained in:
Minecrell 2020-03-05 23:49:33 +01:00 committed by Oliver Smith
parent 240e10816d
commit f602df0140
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
2 changed files with 11 additions and 1 deletions

View File

@ -123,6 +123,13 @@ def arguments_qemu(subparser):
ret.add_argument("--flavor", help="name of the kernel flavor (run 'pmbootstrap flasher list_flavors'"
" to get a list of all installed flavors")
ret.add_argument("--tablet", dest="qemu_tablet", action='store_true',
default=False, help="Use 'tablet' instead of 'mouse' input "
"for QEMU. The tablet input device automatically grabs/releases "
"the mouse when moving in/out of the QEMU window. "
"(Note: For some reason the mouse position is not reported "
"correctly with this in some cases...)")
ret.add_argument("--display", dest="qemu_display", choices=["sdl", "gtk", "none"],
help="QEMU's display parameter (default: sdl,gl=on)",
default="sdl", nargs="?")

View File

@ -119,7 +119,10 @@ def command_qemu(args, arch, img_path):
command += ["-serial", "stdio"]
command += ["-drive", "file=" + img_path + ",format=raw,if=virtio"]
command += ["-device", "virtio-mouse-pci"]
if args.qemu_tablet:
command += ["-device", "virtio-tablet-pci"]
else:
command += ["-device", "virtio-mouse-pci"]
command += ["-device", "virtio-keyboard-pci"]
command += ["-nic",
"user,model=virtio-net-pci,"