Ken Thomases : winemac: Track whether a view has ever had an OpenGL context attached.
Alexandre Julliard
julliard at winehq.org
Fri Oct 20 07:19:57 CDT 2017
Module: wine
Branch: stable
Commit: 17c4db48e2b355a7a1745e793ff226249a90affe
URL: http://source.winehq.org/git/wine.git/?a=commit;h=17c4db48e2b355a7a1745e793ff226249a90affe
Author: Ken Thomases <ken at codeweavers.com>
Date: Mon May 8 15:31:48 2017 -0500
winemac: Track whether a view has ever had an OpenGL context attached.
... rather than whether it currently has one.
This is for OpenGLSurfaceMode=behind. In that mode, we need to make the window
transparent wherever a GL-rendered view should not be clipped by GDI-rendered
children or sibling views.
Some apps attach a GL context to the view only temporarily, do some rendering,
and then detach it. But the GL surface remains, with the rendered graphics.
In order for those to show, the window needs to remain transparent even though
none of its views has a GL context currently attached.
Signed-off-by: Ken Thomases <ken at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit b6a4b2f593503a105dde01e7bd11ffdde243117a)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
dlls/winemac.drv/cocoa_window.m | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m
index a68ba03..f951675 100644
--- a/dlls/winemac.drv/cocoa_window.m
+++ b/dlls/winemac.drv/cocoa_window.m
@@ -292,6 +292,7 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
{
NSMutableArray* glContexts;
NSMutableArray* pendingGlContexts;
+ BOOL _everHadGLContext;
BOOL _cachedHasGLDescendant;
BOOL _cachedHasGLDescendantValid;
BOOL clearedGlSurface;
@@ -302,6 +303,8 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
int backingSize[2];
}
+ at property (readonly, nonatomic) BOOL everHadGLContext;
+
- (void) addGLContext:(WineOpenGLContext*)context;
- (void) removeGLContext:(WineOpenGLContext*)context;
- (void) updateGLContexts;
@@ -354,6 +357,8 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
@implementation WineContentView
+ at synthesize everHadGLContext = _everHadGLContext;
+
- (void) dealloc
{
[markedText release];
@@ -463,7 +468,7 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
- (void) addGLContext:(WineOpenGLContext*)context
{
- BOOL hadContext = [self hasGLContext];
+ BOOL hadContext = _everHadGLContext;
if (!glContexts)
glContexts = [[NSMutableArray alloc] init];
if (!pendingGlContexts)
@@ -485,6 +490,7 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
[self setNeedsDisplay:YES];
}
+ _everHadGLContext = YES;
if (!hadContext)
[self invalidateHasGLDescendant];
[(WineWindow*)[self window] updateForGLSubviews];
@@ -492,11 +498,8 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
- (void) removeGLContext:(WineOpenGLContext*)context
{
- BOOL hadContext = [self hasGLContext];
[glContexts removeObjectIdenticalTo:context];
[pendingGlContexts removeObjectIdenticalTo:context];
- if (hadContext && ![self hasGLContext])
- [self invalidateHasGLDescendant];
[(WineWindow*)[self window] updateForGLSubviews];
}
@@ -506,16 +509,11 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
context.needsUpdate = TRUE;
}
- - (BOOL) hasGLContext
- {
- return [glContexts count] || [pendingGlContexts count];
- }
-
- (BOOL) _hasGLDescendant
{
if ([self isHidden])
return NO;
- if ([self hasGLContext])
+ if (_everHadGLContext)
return YES;
for (WineContentView* view in [self subviews])
{
@@ -2337,7 +2335,7 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
NSRect contentRect = [[self contentView] frame];
BOOL coveredByGLView = FALSE;
WineContentView* view = (WineContentView*)[[self contentView] hitTest:NSMakePoint(NSMidX(contentRect), NSMidY(contentRect))];
- if ([view isKindOfClass:[WineContentView class]] && [view hasGLContext])
+ if ([view isKindOfClass:[WineContentView class]] && view.everHadGLContext)
{
NSRect frame = [view convertRect:[view bounds] toView:nil];
if (NSContainsRect(frame, contentRect))
More information about the wine-cvs
mailing list