Module: wine
Branch: master
Commit: e9aafe0b8a81e33dbe27011db46cf76fedb040bf
URL: https://gitlab.winehq.org/wine/wine/-/commit/e9aafe0b8a81e33dbe27011db46cf7…
Author: Brendan Shanks <bshanks(a)codeweavers.com>
Date: Wed May 10 16:17:09 2023 -0700
winemac: Fix window scaling in high-res/retina mode when using a non-retina monitor.
---
dlls/winemac.drv/cocoa_window.m | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m
index 67e178c8ad3..ad0c97fb6b2 100644
--- a/dlls/winemac.drv/cocoa_window.m
+++ b/dlls/winemac.drv/cocoa_window.m
@@ -685,7 +685,20 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
- (BOOL) layer:(CALayer*)layer shouldInheritContentsScale:(CGFloat)newScale fromWindow:(NSWindow*)window
{
- return (_retinaMode || newScale == 1.0);
+ /* This method is invoked when the contentsScale of the layer is not
+ * equal to the contentsScale of the window.
+ * (Initially when the layer is first created, and later if the window
+ * contentsScale changes, i.e. moved between retina/non-retina monitors).
+ *
+ * We usually want to return YES, so the "moving windows between
+ * retina/non-retina monitors" case works right.
+ * But return NO when we need an intentional mismatch between the
+ * window and layer contentsScale
+ * (non-retina mode with a retina monitor, and vice-versa).
+ */
+ if (layer.contentsScale != window.backingScaleFactor)
+ return NO;
+ return YES;
}
- (void) viewDidHide