winemac.drv: Enable layer-backed views.
Signed-off-by: Chip Davis <cdavis@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
7284348985
commit
a5cf847aa4
|
@ -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
|
||||
|
@ -3573,6 +3591,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];
|
||||
|
|
Loading…
Reference in New Issue