Signed-off-by: Chip Davis cdavis@codeweavers.com --- dlls/winemac.drv/cocoa_window.m | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m index d5434b8a966..bc06a9506ee 100644 --- a/dlls/winemac.drv/cocoa_window.m +++ b/dlls/winemac.drv/cocoa_window.m @@ -311,6 +311,16 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi @end
+#ifndef MAC_OS_X_VERSION_10_14 +@protocol NSViewLayerContentScaleDelegate <NSObject> +@optional + + - (BOOL) layer:(CALayer*)layer shouldInheritContentsScale:(CGFloat)newScale fromWindow:(NSWindow*)window; + +@end +#endif + + @interface WineBaseView : NSView @end
@@ -327,7 +337,7 @@ - (id) initWithFrame:(NSRect)frame device:(id<MTLDevice>)device; #endif
-@interface WineContentView : WineBaseView <NSTextInputClient> +@interface WineContentView : WineBaseView <NSTextInputClient, NSViewLayerContentScaleDelegate> { NSMutableArray* glContexts; NSMutableArray* pendingGlContexts; @@ -339,6 +349,7 @@ @interface WineContentView : WineBaseView <NSTextInputClient> NSMutableAttributedString* markedText; NSRange markedTextSelection;
+ BOOL _retinaMode; int backingSize[2];
#ifdef HAVE_METAL_METAL_H @@ -688,9 +699,15 @@ - (void) setRetinaMode:(int)mode [self setWantsBestResolutionOpenGLSurface:mode]; [self updateGLContexts];
+ _retinaMode = !!mode; [super setRetinaMode:mode]; }
+ - (BOOL) layer:(CALayer*)layer shouldInheritContentsScale:(CGFloat)newScale fromWindow:(NSWindow*)window + { + return (_retinaMode || newScale == 1.0); + } + - (void) viewDidHide { [super viewDidHide]; @@ -1002,6 +1019,7 @@ + (WineWindow*) createWindowWithFeatures:(const struct macdrv_window_features*)w contentView = [[[WineContentView alloc] initWithFrame:NSZeroRect] autorelease]; if (!contentView) return nil; + [contentView setWantsLayer:YES]; [contentView setAutoresizesSubviews:NO];
/* We use tracking areas in addition to setAcceptsMouseMovedEvents:YES @@ -3576,6 +3594,7 @@ macdrv_view macdrv_create_view(CGRect rect) NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
view = [[WineContentView alloc] initWithFrame:NSRectFromCGRect(cgrect_mac_from_win(rect))]; + [view setWantsLayer:YES]; [view setAutoresizesSubviews:NO]; [view setAutoresizingMask:NSViewNotSizable]; [view setHidden:YES];