snowcone-ltd / libmatoya

Cross-platform application development.
MIT License
592 stars 52 forks source link

Use the scale param from PNG cursor to set the cursor scale on macOS #91

Closed ammon-c closed 1 year ago

ammon-c commented 1 year ago

This is a re-up of an older PR that was way out of date and closed.

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

How this impacts libmatoya: Previously, cursor images were always assumed to be 1:1 with display pixels (no scaling). Now when the app sends the cursor to libmatoya, it is passing the cursor scale parameter as a private PNG tag at the end of the PNG cursor object. On macOS, we need the MTY_AppSetPNGCursor function to apply that scale parameter to the NSImage object that it creates from the PNG cursor image so it will get rendered at the proper scale. This PR implements that change. (Note that on Windows or Linux the final cursor scale is always 1x so this only matters on Mac).

chrisd1100 commented 1 year ago

Looks like we're going to achieve this in a different way.