mbox series

[v2,0/2] ui/cocoa: Adds native absolute pointer support

Message ID 20240625134931.92279-1-phil@philjordan.eu
Headers show
Series ui/cocoa: Adds native absolute pointer support | expand

Message

Phil Dennis-Jordan June 25, 2024, 1:49 p.m. UTC
This change implements passing guest cursors through to the native
Cocoa host NSCursor on macOS when using absolute pointing device
input.

The first pass at this was based purely on NSCursor, which drew
some criticism due to the somewhat complex nature of the code which
was required to generate correct relative pointer input events
after teleporting the host cursor.

This new version builds on Akihiko Odaki's work implementing CALayer
based cursors. We retain CALayer for compositing cursors when the
input is relative and the pointer thus completely captured by the
guest. When using absolute positioning of the pointer, we use the
fully host-integrated NSCursor, with no offsetting or teleporting
needed.

The first patch consists of a few reference counting fixes to the
existing CALayer patch, the second implements the NSCursor logic
and switches between CALayer and NSCursor depending on whether
relative or absolute input is used.

Based-on: <20240318-cursor-v1-2-0bbe6c382217@daynix.com>


Phil Dennis-Jordan (2):
  ui/cocoa: Minor fixes to CALayer based cursors
  ui/cocoa: Adds NSCursor absolute pointer support

 ui/cocoa.m | 93 +++++++++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 75 insertions(+), 18 deletions(-)