summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ralls <jralls@ceridwen.us>2022-01-26 21:41:45 -0800
committerJohn Ralls <jralls@ceridwen.us>2022-01-26 21:41:45 -0800
commit1b77a4dba9b326f4d34f5c1e93b16db55b02ce27 (patch)
tree5a6a5584c89c7c48f68266ac522ef123326037c3
parentf49bb510c7705ed1cdf05286294e4fe5df4004e9 (diff)
parent021cdf382d6f12adcfc2ed1259fda8245c120347 (diff)
downloadgtk+-1b77a4dba9b326f4d34f5c1e93b16db55b02ce27.tar.gz
Merge Lukas Oberhuber's 'fix-retina-cursors' into gtk-3-24.
-rw-r--r--gdk/quartz/gdkcursor-quartz.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gdk/quartz/gdkcursor-quartz.c b/gdk/quartz/gdkcursor-quartz.c
index ad9228f90c..0a938e093d 100644
--- a/gdk/quartz/gdkcursor-quartz.c
+++ b/gdk/quartz/gdkcursor-quartz.c
@@ -261,14 +261,21 @@ _gdk_quartz_display_get_cursor_for_surface (GdkDisplay *display,
NSCursor *nscursor;
GdkCursor *cursor;
GdkPixbuf *pixbuf;
+ double x_scale;
+ double y_scale;
GDK_QUARTZ_ALLOC_POOL;
pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0,
cairo_image_surface_get_width (surface),
cairo_image_surface_get_height (surface));
+ cairo_surface_get_device_scale (surface,
+ &x_scale,
+ &y_scale);
image = gdk_quartz_pixbuf_to_ns_image_libgtk_only (pixbuf);
- nscursor = [[NSCursor alloc] initWithImage:image hotSpot:NSMakePoint(x, y)];
+ NSImageRep *rep = [[image representations] objectAtIndex:0];
+ [image setSize:NSMakeSize(rep.pixelsWide / x_scale, rep.pixelsHigh / y_scale)];
+ nscursor = [[NSCursor alloc] initWithImage:image hotSpot:NSMakePoint(x / x_scale, y / y_scale)];
cursor = gdk_quartz_cursor_new_from_nscursor (nscursor, GDK_CURSOR_IS_PIXMAP);