Ken Thomases : winemac: Scale cursors for Retina mode, now that user32 scales them with DPI.

Alexandre Julliard julliard at winehq.org
Mon Jul 31 15:06:29 CDT 2017


Module: wine
Branch: master
Commit: 611c15953e8297ac1762abfb5aeca6665985fc0f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=611c15953e8297ac1762abfb5aeca6665985fc0f

Author: Ken Thomases <ken at codeweavers.com>
Date:   Mon Jul 31 14:44:08 2017 -0500

winemac: Scale cursors for Retina mode, now that user32 scales them with DPI.

When they were always 32x32, treating that size as though it were in Cocoa's
virtual "points" rather than pixels produced good results even though it wasn't
really correct.

Signed-off-by: Ken Thomases <ken at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winemac.drv/cocoa_app.m | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m
index 2cf67f1..46176f7 100644
--- a/dlls/winemac.drv/cocoa_app.m
+++ b/dlls/winemac.drv/cocoa_app.m
@@ -992,12 +992,14 @@ static NSString* WineLocalizedString(unsigned int stringID)
     {
         NSDictionary* frame = [cursorFrames objectAtIndex:cursorFrame];
         CGImageRef cgimage = (CGImageRef)[frame objectForKey:@"image"];
-        NSImage* image = [[NSImage alloc] initWithCGImage:cgimage size:NSZeroSize];
+        CGSize size = CGSizeMake(CGImageGetWidth(cgimage), CGImageGetHeight(cgimage));
+        NSImage* image = [[NSImage alloc] initWithCGImage:cgimage size:NSSizeFromCGSize(cgsize_mac_from_win(size))];
         CFDictionaryRef hotSpotDict = (CFDictionaryRef)[frame objectForKey:@"hotSpot"];
         CGPoint hotSpot;
 
         if (!CGPointMakeWithDictionaryRepresentation(hotSpotDict, &hotSpot))
             hotSpot = CGPointZero;
+        hotSpot = cgpoint_mac_from_win(hotSpot);
         self.cursor = [[[NSCursor alloc] initWithImage:image hotSpot:NSPointFromCGPoint(hotSpot)] autorelease];
         [image release];
         [self unhideCursor];




More information about the wine-cvs mailing list