winemac: Set the parent of Cocoa views for child windows when they are created.

This fixes an oversight in commit d91e56863.  Some of the views created for
Win32 child windows were being left out of any view hierarchy.  OpenGL contexts
attached to such child windows and views were not able to render to screen,
leaving blank areas.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Ken Thomases 2016-12-01 19:38:41 -06:00 committed by Alexandre Julliard
parent 93ac04d608
commit b5194d6f83
1 changed files with 22 additions and 11 deletions

View File

@ -785,6 +785,25 @@ static void destroy_cocoa_view(struct macdrv_win_data *data)
}
/***********************************************************************
* set_cocoa_view_parent
*/
static void set_cocoa_view_parent(struct macdrv_win_data *data, HWND parent)
{
struct macdrv_win_data *parent_data = get_win_data(parent);
macdrv_window cocoa_window = parent_data ? parent_data->cocoa_window : NULL;
macdrv_view superview = parent_data ? parent_data->client_cocoa_view : NULL;
TRACE("win %p/%p parent %p/%p\n", data->hwnd, data->cocoa_view, parent, cocoa_window ? (void*)cocoa_window : (void*)superview);
if (!cocoa_window && !superview)
WARN("hwnd %p new parent %p has no Cocoa window or view in this process\n", data->hwnd, parent);
macdrv_set_view_superview(data->cocoa_view, superview, cocoa_window, NULL, NULL);
release_win_data(parent_data);
}
/***********************************************************************
* macdrv_create_win_data
*
@ -825,6 +844,8 @@ static struct macdrv_win_data *macdrv_create_win_data(HWND hwnd, const RECT *win
TRACE("win %p/%p window %s whole %s client %s\n",
hwnd, data->cocoa_view, wine_dbgstr_rect(&data->window_rect),
wine_dbgstr_rect(&data->whole_rect), wine_dbgstr_rect(&data->client_rect));
set_cocoa_view_parent(data, parent);
}
return data;
@ -1574,18 +1595,8 @@ void CDECL macdrv_SetParent(HWND hwnd, HWND parent, HWND old_parent)
destroy_cocoa_window(data);
create_cocoa_view(data);
}
else
{
struct macdrv_win_data *parent_data = get_win_data(parent);
macdrv_window cocoa_window = parent_data ? parent_data->cocoa_window : NULL;
macdrv_view superview = parent_data ? parent_data->client_cocoa_view : NULL;
if (!cocoa_window && !superview)
WARN("hwnd %p new parent %p has no Cocoa window or view in this process\n", hwnd, parent);
macdrv_set_view_superview(data->cocoa_view, superview, cocoa_window, NULL, NULL);
release_win_data(parent_data);
}
set_cocoa_view_parent(data, parent);
}
else /* new top level window */
{