snowcone-ltd / libmatoya

Cross-platform application development.
MIT License
578 stars 50 forks source link

API to set cursor magnifcation scale on macOS #112

Closed ammon-c closed 10 months ago

ammon-c commented 1 year ago

This libmatoya PR is associated with the following PR in the Parsec app: https://github.com/parsec-cloud/parsec/pull/1276

How this impacts libmatoya: Previously, cursor images were always assumed to be 1:1 with display pixels (no scaling). Now the app may call new API MTY_AppSetCursorMagnify to specify an alternate cursor scale that is to be applied to any subsequent cursors. On macOS, libmatoya now applies this magnify scale parameter to the rendered dimensions of the NSImage object that it creates from the app's cursor image, such that it will get rendered at the proper scale on a Retina display. (Note that on Windows and Linux the final cursor image scale is always 1x so this feature is only required on Mac at this time. The new API currently does nothing on the other platforms).