Ken Thomases : winemac: Extract a new class, WineBaseView, to be the superclass of WineContentView and future view classes.
Alexandre Julliard
julliard at winehq.org
Fri Jul 13 15:01:47 CDT 2018
Module: wine
Branch: master
Commit: e27abb0a3a3a5d43a12622fb99452f40c8b340ff
URL: https://source.winehq.org/git/wine.git/?a=commit;h=e27abb0a3a3a5d43a12622fb99452f40c8b340ff
Author: Ken Thomases <ken at codeweavers.com>
Date: Fri Jul 13 09:27:00 2018 -0500
winemac: Extract a new class, WineBaseView, to be the superclass of WineContentView and future view classes.
Signed-off-by: Ken Thomases <ken at codeweavers.com>
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/winemac.drv/cocoa_window.m | 96 +++++++++++++++++++++++------------------
1 file changed, 55 insertions(+), 41 deletions(-)
diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m
index e37e071..1e10c27 100644
--- a/dlls/winemac.drv/cocoa_window.m
+++ b/dlls/winemac.drv/cocoa_window.m
@@ -299,7 +299,11 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
@end
- at interface WineContentView : NSView <NSTextInputClient>
+ at interface WineBaseView : NSView
+ at end
+
+
+ at interface WineContentView : WineBaseView <NSTextInputClient>
{
NSMutableArray* glContexts;
NSMutableArray* pendingGlContexts;
@@ -366,6 +370,52 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
@end
+ at implementation WineBaseView
+
+ - (void) setRetinaMode:(int)mode
+ {
+ for (WineBaseView* subview in [self subviews])
+ {
+ if ([subview isKindOfClass:[WineBaseView class]])
+ [subview setRetinaMode:mode];
+ }
+ }
+
+ - (BOOL) acceptsFirstMouse:(NSEvent*)theEvent
+ {
+ return YES;
+ }
+
+ - (BOOL) preservesContentDuringLiveResize
+ {
+ // Returning YES from this tells Cocoa to keep our view's content during
+ // a Cocoa-driven resize. In theory, we're also supposed to override
+ // -setFrameSize: to mark exposed sections as needing redisplay, but
+ // user32 will take care of that in a roundabout way. This way, we don't
+ // redraw until the window surface is flushed.
+ //
+ // This doesn't do anything when we resize the window ourselves.
+ return YES;
+ }
+
+ - (BOOL)acceptsFirstResponder
+ {
+ return [[self window] contentView] == self;
+ }
+
+ - (BOOL) mouseDownCanMoveWindow
+ {
+ return NO;
+ }
+
+ - (NSFocusRingType) focusRingType
+ {
+ return NSFocusRingTypeNone;
+ }
+
+ at end
+
+
@implementation WineContentView
@synthesize everHadGLContext = _everHadGLContext;
@@ -537,7 +587,7 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
return YES;
for (WineContentView* view in [self subviews])
{
- if ([view hasGLDescendant])
+ if ([view isKindOfClass:[WineContentView class]] && [view hasGLDescendant])
return YES;
}
return NO;
@@ -589,38 +639,7 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
[self setFrame:frame];
[self updateGLContexts];
- for (WineContentView* subview in [self subviews])
- {
- if ([subview isKindOfClass:[WineContentView class]])
- [subview setRetinaMode:mode];
- }
- }
-
- - (BOOL) acceptsFirstMouse:(NSEvent*)theEvent
- {
- return YES;
- }
-
- - (BOOL) preservesContentDuringLiveResize
- {
- // Returning YES from this tells Cocoa to keep our view's content during
- // a Cocoa-driven resize. In theory, we're also supposed to override
- // -setFrameSize: to mark exposed sections as needing redisplay, but
- // user32 will take care of that in a roundabout way. This way, we don't
- // redraw until the window surface is flushed.
- //
- // This doesn't do anything when we resize the window ourselves.
- return YES;
- }
-
- - (BOOL)acceptsFirstResponder
- {
- return [[self window] contentView] == self;
- }
-
- - (BOOL) mouseDownCanMoveWindow
- {
- return NO;
+ [super setRetinaMode:mode];
}
- (void) viewDidHide
@@ -655,11 +674,6 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
[[self inputContext] discardMarkedText];
}
- - (NSFocusRingType) focusRingType
- {
- return NSFocusRingTypeNone;
- }
-
- (void) didAddSubview:(NSView*)subview
{
if ([subview isKindOfClass:[WineContentView class]])
@@ -2537,9 +2551,9 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
if (shape)
[shape transformUsingAffineTransform:transform];
- for (WineContentView* subview in [self.contentView subviews])
+ for (WineBaseView* subview in [self.contentView subviews])
{
- if ([subview isKindOfClass:[WineContentView class]])
+ if ([subview isKindOfClass:[WineBaseView class]])
[subview setRetinaMode:mode];
}
More information about the wine-cvs
mailing list