utmapp / UTM

Virtual machines for iOS and macOS
https://getutm.app
Apache License 2.0
27.02k stars 1.35k forks source link

Scroll Sensitivity Issue #3417

Open gabrielipcarvalho opened 2 years ago

gabrielipcarvalho commented 2 years ago

Describe the issue Hi everyone! So I installed Debian (11), Ubuntu (20) and Windows (11) in my MacBook Air M1. All OSs are running fine, and they are all using the ARM64 architecture.

But there is a common issue I'm facing in all three guests: there must be some problem for the UTM to send over the mouse/trackpad scrolling inputs to the guests OSs. In sum, while in any of these guests, I have to slide my fingers in the built in trackpad for some distance before the page (be it a system page or any app) "jumps" either down or up, left or right. I then tried out using my Magic Mouse, same issue... I also have a regular bluetooth mouse with the traditional wheel on it. When I connected it, I could assert having to scroll about 10-12 wheel "clicks" for the guest system to input what should be one wheel "click".

I have had the same issue once with VMWare Fusion, in there I could fix the issue adding these bellow lines in the .vmx file of each guest OS:

mouse.vusb.enable = "TRUE"
mouse.vusb.useBasicMouse = "FALSE"
mks.mouse.pixelScrollSensitivity = "1"

I tried searching online for some solution on UTM, but haven't had any luck so far, the closest I got was this thread https://github.com/utmapp/UTM/issues/2400, but it didn't quite addresses my issues here.

Configuration

Debug log I'm not really sure if this log is going to help, basically I just enabled Debug Log in my Debian VM, turned it on, opened Firefox, scrolled down a bit, verified the occurrence of the issue, powered off the VM and exported the log, it follows bellow: ``` Running: -L /Applications/UTM.app/Contents/Resources/qemu -S -qmp tcp:127.0.0.1:4000,server,nowait -nodefaults -vga none -spice "unix=on,addr=/Users/gabriel/Library/Group Containers/WDNLXAD4W8.com.utmapp.UTM/E69A7C1C-F7ED-4EC2-89C0-D1C735D9509B.spice,disable-ticketing=on,image-compression=off,playback-compression=off,streaming-video=off,gl=on" -device virtio-ramfb-gl -cpu cortex-a72 -smp cpus=4,sockets=1,cores=4,threads=1 -machine virt,highmem=off -accel hvf -accel tcg,thread=multi,tb-size=1024 -drive if=pflash,format=raw,unit=0,file=/Applications/UTM.app/Contents/Resources/qemu/edk2-aarch64-code.fd,readonly=on -drive if=pflash,format=raw,unit=1,file=/Users/gabriel/Library/Containers/com.utmapp.UTM/Data/Documents/Debian.utm/Images/efi_vars.fd -boot menu=on -m 4096 -device intel-hda -device hda-duplex -name Debian -device qemu-xhci,id=usb-bus -device usb-tablet,bus=usb-bus.0 -device usb-mouse,bus=usb-bus.0 -device usb-kbd,bus=usb-bus.0 -device ich9-usb-ehci1,id=usb-controller-0 -device ich9-usb-uhci1,masterbus=usb-controller-0.0,firstport=0,multifunction=on -device ich9-usb-uhci2,masterbus=usb-controller-0.0,firstport=2,multifunction=on -device ich9-usb-uhci3,masterbus=usb-controller-0.0,firstport=4,multifunction=on -chardev spicevmc,name=usbredir,id=usbredirchardev0 -device usb-redir,chardev=usbredirchardev0,id=usbredirdev0,bus=usb-controller-0.0 -chardev spicevmc,name=usbredir,id=usbredirchardev1 -device usb-redir,chardev=usbredirchardev1,id=usbredirdev1,bus=usb-controller-0.0 -chardev spicevmc,name=usbredir,id=usbredirchardev2 -device usb-redir,chardev=usbredirchardev2,id=usbredirdev2,bus=usb-controller-0.0 -device nvme,drive=drive0,serial=drive0,bootindex=0 -drive if=none,media=disk,id=drive0,file=/Users/gabriel/Library/Containers/com.utmapp.UTM/Data/Documents/Debian.utm/Images/disk-0.qcow2,cache=writethrough -device usb-storage,drive=drive1,removable=true,bootindex=1,bus=usb-bus.0 -drive if=none,media=cdrom,id=drive1 -device virtio-net-pci,mac=8A:08:55:F6:6C:B5,netdev=net0 -netdev vmnet-macos,mode=shared,id=net0 -device virtio-serial -device virtserialport,chardev=vdagent,name=com.redhat.spice.0 -chardev spicevmc,id=vdagent,debug=0,name=vdagent -device virtserialport,chardev=charchannel1,id=channel1,name=org.spice-space.webdav.0 -chardev spiceport,name=org.spice-space.webdav.0,id=charchannel1 -uuid E69A7C1C-F7ED-4EC2-89C0-D1C735D9509B -rtc base=localtime qemu-aarch64-softmmu: -netdev vmnet-macos,mode=shared,id=net0: info: Started vmnet interface with configuration: qemu-aarch64-softmmu: -netdev vmnet-macos,mode=shared,id=net0: info: MTU: 1500 qemu-aarch64-softmmu: -netdev vmnet-macos,mode=shared,id=net0: info: Max packet size: 1514 qemu-aarch64-softmmu: -netdev vmnet-macos,mode=shared,id=net0: info: MAC: 4a:34:43:ca:d5:39 qemu-aarch64-softmmu: -netdev vmnet-macos,mode=shared,id=net0: info: DHCP IPv4 start: 192.168.64.1 qemu-aarch64-softmmu: -netdev vmnet-macos,mode=shared,id=net0: info: DHCP IPv4 end: 192.168.64.254 qemu-aarch64-softmmu: -netdev vmnet-macos,mode=shared,id=net0: info: IPv4 subnet mask: 255.255.255.0 qemu-aarch64-softmmu: -netdev vmnet-macos,mode=shared,id=net0: info: UUID: 1AF6D5C3-23C9-497E-8B53-DC7EC3B18240 qemu-aarch64-softmmu: warning: Spice: playback:0 (0x1558d0120): setsockopt failed, Operation not supported on socket qemu-aarch64-softmmu: warning: Spice: record:0 (0x1558d01d0): setsockopt failed, Operation not supported on socket gl_version 30 - es profile enabled WARNING: running without ARB/KHR robustness in place may crash vrend_renderer_fill_caps: Entering with stale GL error: 1280 GLSL feature level 130 ```
VM Config I'll be attaching bellow the config.plist of all my guest OSs. **Debian 11** ```xml ConfigurationVersion 2 Debug DebugLog IgnoreAllConfiguration Display ConsoleFont Menlo ConsoleFontSize 12 ConsoleOnly ConsoleTheme Default DisplayCard virtio-ramfb-gl DisplayDownscaler linear DisplayFitScreen DisplayRetina DisplayUpscaler linear Drives DriveName drive0 ImagePath disk-0.qcow2 ImageType disk InterfaceType nvme DriveName drive1 ImageType cd InterfaceType usb Removable DriveName 408A57DB-5FC0-47A1-B8C4-1B6FFAD9AE34 ImagePath efi_vars.fd ImageType none InterfaceType Info Icon debian IconCustom Input InputLegacy Networking NetworkCard virtio-net-pci NetworkCardMAC 8A:08:55:F6:6C:B5 NetworkMode shared Printing Sharing ClipboardSharing DirectorySharing Usb3Support UsbRedirectMax 3 Sound SoundCard intel-hda SoundEnabled System AddArgs Architecture aarch64 BootDevice BootUefi CPU cortex-a72 CPUCount 4 ForceMulticore JITCacheSize 0 MachineProperties highmem=off Memory 4096 SystemUUID E69A7C1C-F7ED-4EC2-89C0-D1C735D9509B Target virt ``` ____ **Ubuntu 20** ```xml ConfigurationVersion 2 Debug Display ConsoleFont Menlo ConsoleFontSize 12 ConsoleOnly ConsoleTheme Default DisplayCard virtio-ramfb-gl DisplayDownscaler linear DisplayFitScreen DisplayUpscaler linear Drives DriveName drive0 ImagePath disk-0.qcow2 ImageType disk InterfaceType nvme DriveName drive1 ImageType cd InterfaceType usb Removable DriveName EEED43A1-440B-4977-BFDE-C15863D644C1 ImagePath efi_vars.fd ImageType none InterfaceType Info Icon ubuntu IconCustom Input InputInvertScroll InputLegacy Networking NetworkCard virtio-net-pci NetworkCardMAC 6E:8A:11:ED:84:C9 NetworkMode shared Printing Sharing ClipboardSharing DirectorySharing Usb3Support UsbRedirectMax 3 Sound SoundCard intel-hda SoundEnabled System Architecture aarch64 BootDevice BootUefi CPU cortex-a72 CPUCount 4 ForceMulticore JITCacheSize 0 MachineProperties highmem=off Memory 4096 SystemUUID 9F3B496B-D294-44FC-AADF-5FDC736BB1FC Target virt ``` ____ **Windows 11** ```xml ConfigurationVersion 2 Debug Display ConsoleFont Menlo ConsoleFontSize 12 ConsoleOnly ConsoleTheme Default DisplayCard virtio-ramfb-gl DisplayDownscaler linear DisplayFitScreen DisplayRetina DisplayUpscaler linear Drives DriveName drive0 ImagePath disk-0.qcow2 ImageType disk InterfaceType nvme DriveName drive1 ImageType cd InterfaceType none Removable DriveName 7B3E7C43-91B4-4CCB-97F1-52656B41D524 ImagePath efi_vars.fd ImageType none InterfaceType Info Icon windows IconCustom Input InputInvertScroll InputLegacy Networking NetworkCard virtio-net-pci NetworkCardMAC EA:0B:EA:66:FF:A4 NetworkMode shared Printing Sharing ClipboardSharing DirectorySharing Usb3Support UsbRedirectMax 3 Sound SoundCard intel-hda SoundEnabled System AddArgs -device usb-storage,drive=drive1,removable=true,bootindex=1,bus=usb-bus.0 Architecture aarch64 BootDevice BootUefi CPU default CPUCount 4 ForceMulticore JITCacheSize 0 MachineProperties highmem=off,virtualization=on Memory 4096 SystemUUID 751BB571-C919-4740-ADF6-EDB49785B02D Target virt ```
conath commented 2 years ago

I can not reproduce this on my M1 MacBook Pro running UTM 2.4.1 and macOS 12.1.

In a Windows 8.1 VM, scrolling is slightly jumpy when using the Trackpad, but it might just be general system lag from emulation.

In a Ubuntu 21.04 ARM VM with Ubuntu Desktop installed, scrolling works perfectly fine.

On both systems I installed the appropriate guest tools.

gabrielipcarvalho commented 2 years ago

Thanks!

I have the guest tools installed in all three guests too.

Considering it is a very isolated issue, I'm guessing there might be an app installed in my machine which could be messing/controlling the mouse/trackpad scrolling inputs, while macOS might not have a problem with it, UTM might be understanding the inputs differently.

I have an intel MacBook Pro 2017, I'll be testing the scrolling behavior there and I'll report back here!

Edit:

So, I picked my Intel MacBook Pro, wiped it out of all installed applications, including chrome, leaving it with only those preinstalled stuff that it came with. Rebooted. Downloaded UTM and the x86 iso files from both Ubuntu and Debian. Installed them and....

To my immense surprise, the issue remains!

Trying to clarify a little, on Ubuntu, for example in the Desktop switching interface (after pressing command/OS button on keyboard), I then slide my fingers either left or right, for the guest OS to switch between workspaces, but it barely works! A quick slide won't do anything. I have to almost slide my fingers all across the trackpad for it to switch. I also used my regular bluetooth mouse, with the scroll wheel, and again I need to do 10 scrolls for the guest OS to recognise one scroll. This is happening in both Debian and Ubuntu OS (I honestly didn't feel like going through all the way to install windows too).

This is mind-blowing to me, I thought it was an isolated issue considering no-one seems to be pointing it out, but it is happening to me in both M1 and Intel chips, on two machines, one without any app installed besides the base packages.

I don't believe it is a hardware problem, specially considering both mouse and trackpad, on both machines, inputs perfectly in the macOS host. Every single scroll "click" with my regular mouse inputs one scroll to the macOS, for example.

Well, I thought, let's try VMWare Fusion then, for comparison. I downloaded and installed it on my intel chip machine, then installed Debian OS on it. Not to my surprise, at this point, the issue was there. Slightly less intense though, for example I have to wheel "click" only about 7 to 8 times before the guest OS recognises one scroll. In VMWare Fusion the solution is the one mentioned above, I just had to add the bellow lines into the guest OS .vmx file:

mouse.vusb.enable = "TRUE"
mouse.vusb.useBasicMouse = "FALSE"
mks.mouse.pixelScrollSensitivity = "1"

In this case scenario, after adding the above lines, I powered on the VM and voilà! Guest OS recognises trackpad's two fingers very smoothly, and for every single mouse wheel scroll I make, the guest OS receives the corresponding one input.

It remains to find a solution for UTM though.

I hope these tests I did might help in someway to find a solution. If you would like, I can try to record a video showing the issues and upload it to a google drive link.

bradsevy commented 2 years ago

I also have the same problem. Ubuntu 21.10 arm, Debian 11 and Testing arm. This is occurring on MacBook Air M1 on macoS 12.1.

vincent-olivert-riera commented 2 years ago

Same problem here. MacOS arm64 as host, Debian arm64 as guest. The mouse wheel is not very responsive and I need to do multiple "clicks" fast to make it work. On the host OS (Mac), I can spin the mouse wheel very slowly (one "click" every 5 seconds, for instance), and it reacts on every single one. However, doing that on the guest OS (Debian), all the "clicks" are just ignored. It seems that it needs a certain quantity of mouse wheel "clicks" per unit of time in order to react and actually perform a scroll action.

Tested with both the MacBook Pro M1 trackpad and a USB mouse.

In a Ubuntu 21.04 ARM VM with Ubuntu Desktop installed, scrolling works perfectly fine.

@conath , really? So if you spin your mouse wheel slowly, one "click" at a time, like I described above, does Ubuntu react on every single "click"?

szymek116 commented 1 year ago

same thing for me, is there an option to modify qemu params in UTM to experiment whether any of them causes this effect ? I saw I can add them and tried few things around msmouse protocol but without effect. I checked the same on VMware virtualzation and there mouse works correctly (the same M1 box). I tried to run pure qemu to see whether it will be reproducible there but no luck yet (I am starting to discover why we need things like UTM to work with it :D)

vincent-olivert-riera commented 1 year ago

Same problem here. MacOS arm64 as host, Debian arm64 as guest. The mouse wheel is not very responsive and I need to do multiple "clicks" fast to make it work. On the host OS (Mac), I can spin the mouse wheel very slowly (one "click" every 5 seconds, for instance), and it reacts on every single one. However, doing that on the guest OS (Debian), all the "clicks" are just ignored. It seems that it needs a certain quantity of mouse wheel "clicks" per unit of time in order to react and actually perform a scroll action.

Tested with both the MacBook Pro M1 trackpad and a USB mouse.

In a Ubuntu 21.04 ARM VM with Ubuntu Desktop installed, scrolling works perfectly fine.

@conath , really? So if you spin your mouse wheel slowly, one "click" at a time, like I described above, does Ubuntu react on every single "click"?

For the record, exactly the same happens when using Apple Virtualization.

JeffSweeting commented 1 year ago

For the record I'm having the same issue too. Brand new M2 MacBook Pro. Latest UTM running latest Debian 12 RISC version with XFCE. UTM Guest tools installed. You have to scroll the mouse scroll wheel 'rapidly' before it registers and scrolls the page in any Debian app. Other than that the virtual machine is blazing fast. Mouse scroll wheel works great in native OSX.

vincent-olivert-riera commented 1 year ago

For the record I'm having the same issue too. Brand new M2 MacBook Pro. Latest UTM running latest Debian 12 RISC version with XFCE. UTM Guest tools installed. You have to scroll the mouse scroll wheel 'rapidly' before it registers and scrolls the page in any Debian app. Other than that the virtual machine is blazing fast. Mouse scroll wheel works great in native OSX.

@JeffSweeting Check this comment https://github.com/utmapp/UTM/issues/5124#issuecomment-1501901886 And the one above it on the same issue. You may find it interesting. Since I started using qemu directly I don't have that mouse scroll issue.

porjo commented 1 year ago

Same issue here:

Sijiahui commented 10 months ago

Check this comment https://github.com/utmapp/UTM/issues/5693 This issue is caused by spice driver and occurs when using a Bluetooth mouse. The scroll wheel works fine when using a wired device.

vincent-olivert-riera commented 10 months ago

Check this comment https://github.com/utmapp/UTM/issues/5693 This issue is caused by spice driver and occurs when using a Bluetooth mouse. The scroll wheel works fine when using a wired device.

I don't think that's correct. I was using a wired mouse when I experienced that issue. I do not own any bluetooth mouse.

sokurenko commented 8 months ago

I have same issue

j3ko commented 5 months ago

Not a fix for the underlying issue, but if you're on linux using Firefox or a Chrome variant you can lower the sensitivity for just the browser:

https://askubuntu.com/a/1458258 https://askubuntu.com/a/1432270

At the very least you're browser isn't teleporting you pages at a time while you search for a permanent fix.

hotdogthemovie commented 5 months ago

I have been using UTM for over year, MBP M2 and Mac Mini M2 hosting Ubuntu 22.04 and now 24.04 vms. Bluetooth mice work fine in Mac OS, but there is an annoying scroll wheel lag in the vms. I have not experienced lag with mouse movement, only with scroll wheel movement.

cristianadam commented 5 months ago

I'm having the same issue with a Logi bluetooth mouse on a Macbook Pro M1 Max. I'm using Windows 11 / Ubuntu 22.04 and I haven't found a way to make scrolling not scroll too much.

I've set scrolling on Windows 11 to 1 line, didn't help.

cristianadam commented 5 months ago

I'm having the same issue with a Logi bluetooth mouse on a Macbook Pro M1 Max. I'm using Windows 11 / Ubuntu 22.04 and I haven't found a way to make scrolling not scroll too much.

I've set scrolling on Windows 11 to 1 line, didn't help.

I've added to MOS a custom setting for UTM: minimum step and duration for scrolling. Now I can use the mouse on Windows! 🎉

bcostdolby commented 3 months ago

Finding the same issue using a basic usb mouse on the m3. However using the magic mouse, seems better (though there are no wheel "ticks").

I.e. The normal mouse, a single tick of mouse wheel doesn't move terminal scrolling in the VM at all but then more velocity on the wheel does. There is nothing and then there is a massive movement.

I am going to look into tools like: https://github.com/emreyolcu/discrete-scroll

Or the MOS one above. I have tried a few ideas from: https://apple.stackexchange.com/questions/253111/how-to-disable-scroll-acceleration-in-macos-sierra

Could this be that macos is doing some interpretation of the mouse wheel to apply some form of acceleration/inertia, and then ubuntu is then doing the same so its applying the acceleration logic twice for the wheel?

I can confirm that using https://github.com/ther0n/UnnaturalScrollWheels fixed the issue for me

mvysny commented 1 month ago

I can also reproduce the issue, on UTM Version 4.5.4 (100) and Ubuntu 24.10. Finally found https://linearmouse.app which helped, but it reconfigured the mouse scrolling behavior for the entire MacOS, which may not be what you want.

To reproduce this bug:

  1. Plug in an USB Microsoft Mouse to your MacBook
  2. Start Ubuntu in UTM
  3. Open Firefox in Ubuntu/UTM and open any web page.
  4. Scroll with one "wheel click" and observe that nothing is scrolled in Firefox/Ubuntu/UTM

The reason for that is that MacBook uses scroll acceleration by default: one wheel click emits a very small value while multitude of wheel clicks in succession emits a much higher scrolling value which finally gets registered by Linux/UTM.

Workaround is to install https://linearmouse.app . Then:

  1. Set "Scrolling" / "Scrolling mode" to "By Lines"
  2. Set "Distance" to 3 or more.

Observation: LinearMouse needs to obtain the Accessibility permission, in "System Settings"/"Privacy & Security"/"Accessibility". I noticed that Parallels did the very same thing. The mouse scrolling works very well in Parallels - the hypothesis is that Parallels obtains the accessibility permission and then reconfigures the scroll acceleration for Parallels windows... but this is pure speculation.