Also removes the unused `cgsize_win_from_mac()`.
From: Marc-Aurel Zent mzent@codeweavers.com
--- dlls/winemac.drv/cocoa_app.m | 2 +- dlls/winemac.drv/cocoa_window.m | 16 ++++++++-------- dlls/winemac.drv/macdrv_cocoa.h | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m index de3a23a5d2d..c20f897d1b6 100644 --- a/dlls/winemac.drv/cocoa_app.m +++ b/dlls/winemac.drv/cocoa_app.m @@ -2573,7 +2573,7 @@ int macdrv_clip_cursor(CGRect r) CGRect rect = r;
if (!CGRectIsInfinite(rect)) - rect = cgrect_mac_from_win(rect); + rect = cgrect_mac_from_win(rect, retina_on);
if (!CGRectIsInfinite(rect)) { diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m index 1655ea98ef7..b286a8e0091 100644 --- a/dlls/winemac.drv/cocoa_window.m +++ b/dlls/winemac.drv/cocoa_window.m @@ -926,7 +926,7 @@ - (NSRect) firstRectForCharacterRange:(NSRange)aRange actualRange:(NSRangePointe if ([window.queue query:query timeout:0.3 flags:WineQueryNoPreemptWait]) { aRange = NSMakeRange(query->ime_char_rect.range.location, query->ime_char_rect.range.length); - ret = NSRectFromCGRect(cgrect_mac_from_win(query->ime_char_rect.rect)); + ret = NSRectFromCGRect(cgrect_mac_from_win(query->ime_char_rect.rect, retina_on)); [[WineApplicationController sharedController] flipRect:&ret]; } else @@ -3114,7 +3114,7 @@ - (NSSize) windowWillResize:(NSWindow*)sender toSize:(NSSize)frameSize
if ([self.queue query:query timeout:0.1]) { - rect = NSRectFromCGRect(cgrect_mac_from_win(query->resize_size.rect)); + rect = NSRectFromCGRect(cgrect_mac_from_win(query->resize_size.rect, retina_on)); rect = [self frameRectForContentRect:rect]; frameSize = rect.size; } @@ -3300,7 +3300,7 @@ macdrv_window macdrv_create_cocoa_window(const struct macdrv_window_features* wf
OnMainThread(^{ window = [[WineWindow createWindowWithFeatures:wf - windowFrame:NSRectFromCGRect(cgrect_mac_from_win(frame)) + windowFrame:NSRectFromCGRect(cgrect_mac_from_win(frame, retina_on)) hwnd:hwnd queue:(WineEventQueue*)queue] retain]; }); @@ -3445,7 +3445,7 @@ void macdrv_set_cocoa_window_frame(macdrv_window w, const CGRect* new_frame) WineWindow* window = (WineWindow*)w;
OnMainThread(^{ - [window setFrameFromWine:NSRectFromCGRect(cgrect_mac_from_win(*new_frame))]; + [window setFrameFromWine:NSRectFromCGRect(cgrect_mac_from_win(*new_frame, retina_on))]; }); }
@@ -3511,7 +3511,7 @@ void macdrv_window_needs_display(macdrv_window w, CGRect rect) WineWindow* window = (WineWindow*)w;
OnMainThreadAsync(^{ - [[window contentView] setNeedsDisplayInRect:NSRectFromCGRect(cgrect_mac_from_win(rect))]; + [[window contentView] setNeedsDisplayInRect:NSRectFromCGRect(cgrect_mac_from_win(rect, retina_on))]; }); } } @@ -3541,7 +3541,7 @@ void macdrv_set_window_shape(macdrv_window w, const CGRect *rects, int count)
path = CGPathCreateMutable(); for (i = 0; i < count; i++) - CGPathAddRect(path, NULL, cgrect_mac_from_win(rects[i])); + CGPathAddRect(path, NULL, cgrect_mac_from_win(rects[i], retina_on)); [window setShape:path]; CGPathRelease(path); } @@ -3662,7 +3662,7 @@ macdrv_view macdrv_create_view(CGRect rect) OnMainThread(^{ NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
- view = [[WineContentView alloc] initWithFrame:NSRectFromCGRect(cgrect_mac_from_win(rect))]; + view = [[WineContentView alloc] initWithFrame:NSRectFromCGRect(cgrect_mac_from_win(rect, retina_on))]; [view setAutoresizingMask:NSViewNotSizable]; [view setHidden:YES]; [view setWantsBestResolutionOpenGLSurface:retina_on]; @@ -3720,7 +3720,7 @@ void macdrv_set_view_frame(macdrv_view v, CGRect rect) if (CGRectIsNull(rect)) rect = CGRectZero;
OnMainThreadAsync(^{ - NSRect newFrame = NSRectFromCGRect(cgrect_mac_from_win(rect)); + NSRect newFrame = NSRectFromCGRect(cgrect_mac_from_win(rect, retina_on)); NSRect oldFrame = [view frame];
if (!NSEqualRects(oldFrame, newFrame)) diff --git a/dlls/winemac.drv/macdrv_cocoa.h b/dlls/winemac.drv/macdrv_cocoa.h index 3a977f68955..39cf6128bad 100644 --- a/dlls/winemac.drv/macdrv_cocoa.h +++ b/dlls/winemac.drv/macdrv_cocoa.h @@ -159,9 +159,9 @@ extern int retina_on; /* Whether Retina mode is currently active (enabled and display is in default mode). */ extern int enable_app_nap;
-static inline CGRect cgrect_mac_from_win(CGRect rect) +static inline CGRect cgrect_mac_from_win(CGRect rect, int retina_scale) { - if (retina_on) + if (retina_scale) { rect.origin.x /= 2; rect.origin.y /= 2;
From: Marc-Aurel Zent mzent@codeweavers.com
--- dlls/winemac.drv/cocoa_display.m | 4 ++-- dlls/winemac.drv/cocoa_window.m | 10 +++++----- dlls/winemac.drv/gdi.c | 2 +- dlls/winemac.drv/macdrv_cocoa.h | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/dlls/winemac.drv/cocoa_display.m b/dlls/winemac.drv/cocoa_display.m index fbbe16efcbf..7cec9dbd842 100644 --- a/dlls/winemac.drv/cocoa_display.m +++ b/dlls/winemac.drv/cocoa_display.m @@ -86,8 +86,8 @@ int macdrv_get_displays(struct macdrv_display** displays, int* count) convert_display_rect(&disps[i].frame, frame, primary_frame); convert_display_rect(&disps[i].work_frame, visible_frame, primary_frame); - disps[i].frame = cgrect_win_from_mac(disps[i].frame); - disps[i].work_frame = cgrect_win_from_mac(disps[i].work_frame); + disps[i].frame = cgrect_win_from_mac(disps[i].frame, retina_on); + disps[i].work_frame = cgrect_win_from_mac(disps[i].work_frame, retina_on); }
*displays = disps; diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m index b286a8e0091..ddb769ff77a 100644 --- a/dlls/winemac.drv/cocoa_window.m +++ b/dlls/winemac.drv/cocoa_window.m @@ -2204,7 +2204,7 @@ - (void) postWindowFrameChanged:(NSRect)frame fullscreen:(BOOL)isFullscreen resi forWindow:self];
event = macdrv_create_event(WINDOW_FRAME_CHANGED, self); - event->window_frame_changed.frame = cgrect_win_from_mac(NSRectToCGRect(frame)); + event->window_frame_changed.frame = cgrect_win_from_mac(NSRectToCGRect(frame), retina_on); event->window_frame_changed.fullscreen = isFullscreen; event->window_frame_changed.in_resize = resizing; event->window_frame_changed.skip_size_move_loop = skipSizeMove; @@ -2584,7 +2584,7 @@ - (void) sendEvent:(NSEvent*)event
event = macdrv_create_event(WINDOW_RESTORE_REQUESTED, self); event->window_restore_requested.keep_frame = TRUE; - event->window_restore_requested.frame = cgrect_win_from_mac(NSRectToCGRect(frame)); + event->window_restore_requested.frame = cgrect_win_from_mac(NSRectToCGRect(frame), retina_on); [queue postEvent:event]; macdrv_release_event(event);
@@ -3108,7 +3108,7 @@ - (NSSize) windowWillResize:(NSWindow*)sender toSize:(NSSize)frameSize query = macdrv_create_query(); query->type = QUERY_RESIZE_SIZE; query->window = (macdrv_window)[self retain]; - query->resize_size.rect = cgrect_win_from_mac(NSRectToCGRect(rect)); + query->resize_size.rect = cgrect_win_from_mac(NSRectToCGRect(rect), retina_on); query->resize_size.from_left = resizingFromLeft; query->resize_size.from_top = resizingFromTop;
@@ -3138,7 +3138,7 @@ - (void) windowWillStartLiveResize:(NSNotification *)notification
event = macdrv_create_event(WINDOW_RESTORE_REQUESTED, self); event->window_restore_requested.keep_frame = TRUE; - event->window_restore_requested.frame = cgrect_win_from_mac(NSRectToCGRect(frame)); + event->window_restore_requested.frame = cgrect_win_from_mac(NSRectToCGRect(frame), retina_on); [queue postEvent:event]; macdrv_release_event(event); } @@ -3463,7 +3463,7 @@ void macdrv_get_cocoa_window_frame(macdrv_window w, CGRect* out_frame)
frame = [window contentRectForFrameRect:[window wine_fractionalFrame]]; [[WineApplicationController sharedController] flipRect:&frame]; - *out_frame = cgrect_win_from_mac(NSRectToCGRect(frame)); + *out_frame = cgrect_win_from_mac(NSRectToCGRect(frame), retina_on); }); }
diff --git a/dlls/winemac.drv/gdi.c b/dlls/winemac.drv/gdi.c index 137945c4b74..b2418919033 100644 --- a/dlls/winemac.drv/gdi.c +++ b/dlls/winemac.drv/gdi.c @@ -73,7 +73,7 @@ static void compute_desktop_rect(void)
for (i = 0; i < count; i++) desktop_rect = CGRectUnion(desktop_rect, CGDisplayBounds(displayIDs[i])); - desktop_rect = cgrect_win_from_mac(desktop_rect); + desktop_rect = cgrect_win_from_mac(desktop_rect, retina_on); }
diff --git a/dlls/winemac.drv/macdrv_cocoa.h b/dlls/winemac.drv/macdrv_cocoa.h index 39cf6128bad..b78d1ca4b6e 100644 --- a/dlls/winemac.drv/macdrv_cocoa.h +++ b/dlls/winemac.drv/macdrv_cocoa.h @@ -172,9 +172,9 @@ static inline CGRect cgrect_mac_from_win(CGRect rect, int retina_scale) return rect; }
-static inline CGRect cgrect_win_from_mac(CGRect rect) +static inline CGRect cgrect_win_from_mac(CGRect rect, int retina_scale) { - if (retina_on) + if (retina_scale) { rect.origin.x *= 2; rect.origin.y *= 2;
From: Marc-Aurel Zent mzent@codeweavers.com
--- dlls/winemac.drv/cocoa_app.m | 2 +- dlls/winemac.drv/cocoa_window.m | 2 +- dlls/winemac.drv/macdrv_cocoa.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m index c20f897d1b6..f57e4b2f27a 100644 --- a/dlls/winemac.drv/cocoa_app.m +++ b/dlls/winemac.drv/cocoa_app.m @@ -1017,7 +1017,7 @@ - (void) setCursor NSDictionary* frame = cursorFrames[cursorFrame]; CGImageRef cgimage = (CGImageRef)frame[@"image"]; CGSize size = CGSizeMake(CGImageGetWidth(cgimage), CGImageGetHeight(cgimage)); - NSImage* image = [[NSImage alloc] initWithCGImage:cgimage size:NSSizeFromCGSize(cgsize_mac_from_win(size))]; + NSImage* image = [[NSImage alloc] initWithCGImage:cgimage size:NSSizeFromCGSize(cgsize_mac_from_win(size, retina_on))]; CFDictionaryRef hotSpotDict = (CFDictionaryRef)frame[@"hotSpot"]; CGPoint hotSpot;
diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m index ddb769ff77a..a88a717dc2b 100644 --- a/dlls/winemac.drv/cocoa_window.m +++ b/dlls/winemac.drv/cocoa_window.m @@ -3640,7 +3640,7 @@ void macdrv_set_window_min_max_sizes(macdrv_window w, CGSize min_size, CGSize ma WineWindow* window = (WineWindow*)w;
OnMainThread(^{ - [window setWineMinSize:NSSizeFromCGSize(cgsize_mac_from_win(min_size)) maxSize:NSSizeFromCGSize(cgsize_mac_from_win(max_size))]; + [window setWineMinSize:NSSizeFromCGSize(cgsize_mac_from_win(min_size, retina_on)) maxSize:NSSizeFromCGSize(cgsize_mac_from_win(max_size, retina_on))]; }); }
diff --git a/dlls/winemac.drv/macdrv_cocoa.h b/dlls/winemac.drv/macdrv_cocoa.h index b78d1ca4b6e..d1225f65e05 100644 --- a/dlls/winemac.drv/macdrv_cocoa.h +++ b/dlls/winemac.drv/macdrv_cocoa.h @@ -185,9 +185,9 @@ static inline CGRect cgrect_win_from_mac(CGRect rect, int retina_scale) return rect; }
-static inline CGSize cgsize_mac_from_win(CGSize size) +static inline CGSize cgsize_mac_from_win(CGSize size, int retina_scale) { - if (retina_on) + if (retina_scale) { size.width /= 2; size.height /= 2;
From: Marc-Aurel Zent mzent@codeweavers.com
--- dlls/winemac.drv/cocoa_app.m | 4 ++-- dlls/winemac.drv/macdrv_cocoa.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m index f57e4b2f27a..a9cb75bf7d1 100644 --- a/dlls/winemac.drv/cocoa_app.m +++ b/dlls/winemac.drv/cocoa_app.m @@ -1023,7 +1023,7 @@ - (void) setCursor
if (!CGPointMakeWithDictionaryRepresentation(hotSpotDict, &hotSpot)) hotSpot = CGPointZero; - hotSpot = cgpoint_mac_from_win(hotSpot); + hotSpot = cgpoint_mac_from_win(hotSpot, retina_on); self.cursor = [[[NSCursor alloc] initWithImage:image hotSpot:NSPointFromCGPoint(hotSpot)] autorelease]; [image release]; [self unhideCursor]; @@ -2550,7 +2550,7 @@ int macdrv_set_cursor_position(CGPoint pos) __block int ret;
OnMainThread(^{ - ret = [[WineApplicationController sharedController] setCursorPosition:cgpoint_mac_from_win(pos)]; + ret = [[WineApplicationController sharedController] setCursorPosition:cgpoint_mac_from_win(pos, retina_on)]; });
return ret; diff --git a/dlls/winemac.drv/macdrv_cocoa.h b/dlls/winemac.drv/macdrv_cocoa.h index d1225f65e05..870fcae6691 100644 --- a/dlls/winemac.drv/macdrv_cocoa.h +++ b/dlls/winemac.drv/macdrv_cocoa.h @@ -207,9 +207,9 @@ static inline CGSize cgsize_win_from_mac(CGSize size) return size; }
-static inline CGPoint cgpoint_mac_from_win(CGPoint point) +static inline CGPoint cgpoint_mac_from_win(CGPoint point, int retina_scale) { - if (retina_on) + if (retina_scale) { point.x /= 2; point.y /= 2;
From: Marc-Aurel Zent mzent@codeweavers.com
--- dlls/winemac.drv/cocoa_app.m | 8 ++++---- dlls/winemac.drv/cocoa_event.m | 2 +- dlls/winemac.drv/cocoa_status_item.m | 4 ++-- dlls/winemac.drv/cocoa_window.m | 4 ++-- dlls/winemac.drv/macdrv_cocoa.h | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m index a9cb75bf7d1..2105d09903f 100644 --- a/dlls/winemac.drv/cocoa_app.m +++ b/dlls/winemac.drv/cocoa_app.m @@ -1448,7 +1448,7 @@ - (void) handleMouseMove:(NSEvent*)anEvent { if (self.clippingCursor) [clipCursorHandler clipCursorLocation:&point]; - point = cgpoint_win_from_mac(point); + point = cgpoint_win_from_mac(point, retina_on);
event = macdrv_create_event(MOUSE_MOVED_ABSOLUTE, targetWindow); event->mouse_moved.x = floor(point.x); @@ -1593,7 +1593,7 @@ - (void) handleMouseButton:(NSEvent*)theEvent { macdrv_event* event;
- pt = cgpoint_win_from_mac(pt); + pt = cgpoint_win_from_mac(pt, retina_on);
event = macdrv_create_event(MOUSE_BUTTON, window); event->mouse_button.button = [theEvent buttonNumber]; @@ -1676,7 +1676,7 @@ - (void) handleScrollWheel:(NSEvent*)theEvent double x, y; BOOL continuous = FALSE;
- pt = cgpoint_win_from_mac(pt); + pt = cgpoint_win_from_mac(pt, retina_on);
event = macdrv_create_event(MOUSE_SCROLL, window); event->mouse_scroll.x = floor(pt.x); @@ -2533,7 +2533,7 @@ int macdrv_get_cursor_position(CGPoint *pos) OnMainThread(^{ NSPoint location = [NSEvent mouseLocation]; location = [[WineApplicationController sharedController] flippedMouseLocation:location]; - *pos = cgpoint_win_from_mac(NSPointToCGPoint(location)); + *pos = cgpoint_win_from_mac(NSPointToCGPoint(location), retina_on); });
return TRUE; diff --git a/dlls/winemac.drv/cocoa_event.m b/dlls/winemac.drv/cocoa_event.m index 11dd9c3c784..59318191c2a 100644 --- a/dlls/winemac.drv/cocoa_event.m +++ b/dlls/winemac.drv/cocoa_event.m @@ -348,7 +348,7 @@ - (void) resetMouseEventPositions:(CGPoint)pos { MacDrvEvent* event;
- pos = cgpoint_win_from_mac(pos); + pos = cgpoint_win_from_mac(pos, retina_on);
[eventsLock lock];
diff --git a/dlls/winemac.drv/cocoa_status_item.m b/dlls/winemac.drv/cocoa_status_item.m index 31f8a668d81..8431a27493f 100644 --- a/dlls/winemac.drv/cocoa_status_item.m +++ b/dlls/winemac.drv/cocoa_status_item.m @@ -114,7 +114,7 @@ - (void) postMouseButtonEvent:(NSEvent*)nsevent; NSUInteger typeMask = NSEventMaskFromType([nsevent type]); CGPoint point = CGEventGetLocation([nsevent CGEvent]);
- point = cgpoint_win_from_mac(point); + point = cgpoint_win_from_mac(point, retina_on);
event = macdrv_create_event(STATUS_ITEM_MOUSE_BUTTON, nil); event->status_item_mouse_button.item = (macdrv_status_item)self; @@ -175,7 +175,7 @@ - (void) mouseMoved:(NSEvent*)nsevent macdrv_event* event; CGPoint point = CGEventGetLocation([nsevent CGEvent]);
- point = cgpoint_win_from_mac(point); + point = cgpoint_win_from_mac(point, retina_on);
event = macdrv_create_event(STATUS_ITEM_MOUSE_MOVE, nil); event->status_item_mouse_move.item = (macdrv_status_item)self; diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m index a88a717dc2b..c77079a6b4a 100644 --- a/dlls/winemac.drv/cocoa_window.m +++ b/dlls/winemac.drv/cocoa_window.m @@ -3238,7 +3238,7 @@ - (NSDragOperation) draggingUpdated:(id <NSDraggingInfo>)sender { NSDragOperation ret; NSPoint pt = [[self contentView] convertPoint:[sender draggingLocation] fromView:nil]; - CGPoint cgpt = cgpoint_win_from_mac(NSPointToCGPoint(pt)); + CGPoint cgpt = cgpoint_win_from_mac(NSPointToCGPoint(pt), retina_on); NSPasteboard* pb = [sender draggingPasteboard];
macdrv_query* query = macdrv_create_query(); @@ -3261,7 +3261,7 @@ - (BOOL) performDragOperation:(id <NSDraggingInfo>)sender { BOOL ret; NSPoint pt = [[self contentView] convertPoint:[sender draggingLocation] fromView:nil]; - CGPoint cgpt = cgpoint_win_from_mac(NSPointToCGPoint(pt)); + CGPoint cgpt = cgpoint_win_from_mac(NSPointToCGPoint(pt), retina_on); NSPasteboard* pb = [sender draggingPasteboard];
macdrv_query* query = macdrv_create_query(); diff --git a/dlls/winemac.drv/macdrv_cocoa.h b/dlls/winemac.drv/macdrv_cocoa.h index 870fcae6691..26102f6534c 100644 --- a/dlls/winemac.drv/macdrv_cocoa.h +++ b/dlls/winemac.drv/macdrv_cocoa.h @@ -218,9 +218,9 @@ static inline CGPoint cgpoint_mac_from_win(CGPoint point, int retina_scale) return point; }
-static inline CGPoint cgpoint_win_from_mac(CGPoint point) +static inline CGPoint cgpoint_win_from_mac(CGPoint point, int retina_scale) { - if (retina_on) + if (retina_scale) { point.x *= 2; point.y *= 2;
From: Marc-Aurel Zent mzent@codeweavers.com
--- dlls/winemac.drv/macdrv_cocoa.h | 11 ----------- 1 file changed, 11 deletions(-)
diff --git a/dlls/winemac.drv/macdrv_cocoa.h b/dlls/winemac.drv/macdrv_cocoa.h index 26102f6534c..8d7272ef6c1 100644 --- a/dlls/winemac.drv/macdrv_cocoa.h +++ b/dlls/winemac.drv/macdrv_cocoa.h @@ -196,17 +196,6 @@ static inline CGSize cgsize_mac_from_win(CGSize size, int retina_scale) return size; }
-static inline CGSize cgsize_win_from_mac(CGSize size) -{ - if (retina_on) - { - size.width *= 2; - size.height *= 2; - } - - return size; -} - static inline CGPoint cgpoint_mac_from_win(CGPoint point, int retina_scale) { if (retina_scale)