Ken Thomases : winemac: Create views hidden initially and add macdrv_set_view_hidden() to change that.
Alexandre Julliard
julliard at wine.codeweavers.com
Sat May 14 10:07:28 CDT 2016
Module: wine
Branch: master
Commit: ca49b8070cb0bdc2dc95ad751085b8d4be1e0f44
URL: http://source.winehq.org/git/wine.git/?a=commit;h=ca49b8070cb0bdc2dc95ad751085b8d4be1e0f44
Author: Ken Thomases <ken at codeweavers.com>
Date: Thu May 12 18:50:42 2016 -0500
winemac: Create views hidden initially and add macdrv_set_view_hidden() to change that.
Signed-off-by: Ken Thomases <ken at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/winemac.drv/cocoa_window.m | 24 ++++++++++++++++++++++++
dlls/winemac.drv/macdrv_cocoa.h | 1 +
dlls/winemac.drv/opengl.c | 1 +
3 files changed, 26 insertions(+)
diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m
index d0b92f1..29c6de9 100644
--- a/dlls/winemac.drv/cocoa_window.m
+++ b/dlls/winemac.drv/cocoa_window.m
@@ -506,6 +506,8 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
- (BOOL) _hasGLDescendant
{
+ if ([self isHidden])
+ return NO;
if ([self hasGLContext])
return YES;
for (WineContentView* view in [self subviews])
@@ -624,6 +626,12 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
[super willRemoveSubview:subview];
}
+ - (void) setHidden:(BOOL)hidden
+ {
+ [super setHidden:hidden];
+ [self invalidateHasGLDescendant];
+ }
+
/*
* ---------- NSTextInputClient methods ----------
*/
@@ -3221,6 +3229,7 @@ macdrv_view macdrv_create_view(macdrv_window w, CGRect rect)
view = [[WineContentView alloc] initWithFrame:NSRectFromCGRect(cgrect_mac_from_win(rect))];
[view setAutoresizesSubviews:NO];
+ [view setHidden:YES];
[nc addObserver:view
selector:@selector(updateGLContexts)
name:NSViewGlobalFrameDidChangeNotification
@@ -3355,6 +3364,21 @@ void macdrv_set_view_superview(macdrv_view v, macdrv_view s, macdrv_window w, ma
}
/***********************************************************************
+ * macdrv_set_view_hidden
+ */
+void macdrv_set_view_hidden(macdrv_view v, int hidden)
+{
+ NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
+ WineContentView* view = (WineContentView*)v;
+
+ OnMainThread(^{
+ [view setHidden:hidden];
+ });
+
+ [pool release];
+}
+
+/***********************************************************************
* macdrv_add_view_opengl_context
*
* Add an OpenGL context to the list being tracked for each view.
diff --git a/dlls/winemac.drv/macdrv_cocoa.h b/dlls/winemac.drv/macdrv_cocoa.h
index 331fca7..d422985 100644
--- a/dlls/winemac.drv/macdrv_cocoa.h
+++ b/dlls/winemac.drv/macdrv_cocoa.h
@@ -515,6 +515,7 @@ extern macdrv_view macdrv_create_view(macdrv_window w, CGRect rect) DECLSPEC_HID
extern void macdrv_dispose_view(macdrv_view v) DECLSPEC_HIDDEN;
extern void macdrv_set_view_frame(macdrv_view v, CGRect rect) DECLSPEC_HIDDEN;
extern void macdrv_set_view_superview(macdrv_view v, macdrv_view s, macdrv_window w, macdrv_view p, macdrv_view n) DECLSPEC_HIDDEN;
+extern void macdrv_set_view_hidden(macdrv_view v, int hidden) DECLSPEC_HIDDEN;
extern void macdrv_add_view_opengl_context(macdrv_view v, macdrv_opengl_context c) DECLSPEC_HIDDEN;
extern void macdrv_remove_view_opengl_context(macdrv_view v, macdrv_opengl_context c) DECLSPEC_HIDDEN;
extern int macdrv_get_view_backing_size(macdrv_view v, int backing_size[2]) DECLSPEC_HIDDEN;
diff --git a/dlls/winemac.drv/opengl.c b/dlls/winemac.drv/opengl.c
index f6a656f..ed96c7d 100644
--- a/dlls/winemac.drv/opengl.c
+++ b/dlls/winemac.drv/opengl.c
@@ -1606,6 +1606,7 @@ static BOOL set_win_format(struct macdrv_win_data *data, int format)
WARN("failed to create GL view for window %p rect %s\n", cocoa_window, wine_dbgstr_rect(&data->gl_rect));
return FALSE;
}
+ macdrv_set_view_hidden(data->gl_view, FALSE);
TRACE("created GL view %p in window %p at %s\n", data->gl_view, cocoa_window,
wine_dbgstr_rect(&data->gl_rect));
More information about the wine-cvs
mailing list