qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 3/3] ui/cocoa: Adds support for mouse cursors


From: Akihiko Odaki
Subject: Re: [PATCH 3/3] ui/cocoa: Adds support for mouse cursors
Date: Sun, 9 Jun 2024 18:06:24 +0900
User-agent: Mozilla Thunderbird

On 2024/06/09 5:20, Phil Dennis-Jordan wrote:
This change implements the callbacks dpy_cursor_define and dpy_mouse_set
for the Cocoa UI. The incoming mouse cursor image is converted into an
NSCursor object, allowing the guest mouse cursor to be rendered as the
host's native OS cursor on macOS.

This is straightforward in absolute pointing mode, but rather trickier
with a relative pointing device:

  1. The cursor position in Qemu's coordinate system must be translated
     and converted into macOS's Core Graphics/Quartz coordinates when
     positioning the cursor. Additionally, the position already includes
     the hotspot offset; we'd prefer to use the host OS's hotspot support
     so we need subtract the hotspot vector off again.
  2. Setting the cursor position programmatically on macOS biases the
     next mouse movement event by the amount the cursor was shifted.
     If we didn't reverse that bias when forwarding the next event
     back into Qemu's input stack, this would create a feedback loop.
     (The behaviour of affecting mouse events makes sense for e.g.
     setting the cursor position in a remote access system.)

This change slightly improves the user experience when using virtual
display adapter implementations which check for UI back-end cursor
support, and fixes the issue of no visible mouse cursor when using one
which does not. (Such as virtio-vga)

Thanks for working on ui/cocoa, but I already have submitted a patch for this particular problem:
https://patchew.org/QEMU/20240318-cursor-v1-0-0bbe6c382217@daynix.com/

The difference between these patches is that my patch does not use warping at all. I thought reversing the mouse movement bias is a fragile approach that depends on the details of how Quartz works.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]