winemac: Create views hidden initially and add macdrv_set_view_hidden() to change that.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Ken Thomases 2016-05-12 18:50:42 -05:00 committed by Alexandre Julliard
parent 587bdb8db7
commit ca49b8070c
3 changed files with 26 additions and 0 deletions

View File

@ -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
*

View File

@ -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;

View File

@ -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));