diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m index d0b92f1d872..29c6de98bb8 100644 --- a/dlls/winemac.drv/cocoa_window.m +++ b/dlls/winemac.drv/cocoa_window.m @@ -506,6 +506,8 @@ - (BOOL) hasGLContext - (BOOL) _hasGLDescendant { + if ([self isHidden]) + return NO; if ([self hasGLContext]) return YES; for (WineContentView* view in [self subviews]) @@ -624,6 +626,12 @@ - (void) willRemoveSubview:(NSView*)subview [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 @@ -3354,6 +3363,21 @@ void macdrv_set_view_superview(macdrv_view v, macdrv_view s, macdrv_window w, ma [pool release]; } +/*********************************************************************** + * 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 * diff --git a/dlls/winemac.drv/macdrv_cocoa.h b/dlls/winemac.drv/macdrv_cocoa.h index 331fca7cf53..d4229858675 100644 --- a/dlls/winemac.drv/macdrv_cocoa.h +++ b/dlls/winemac.drv/macdrv_cocoa.h @@ -515,6 +515,7 @@ extern void macdrv_set_window_color_key(macdrv_window w, CGFloat keyRed, CGFloat 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 f6a656fd3df..ed96c7d50f7 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));