winemac: Keep stable surface for layered windows using UpdateLayeredWindow().

This commit is contained in:
Ken Thomases 2013-03-26 08:54:51 -05:00 committed by Alexandre Julliard
parent 7eec5ad781
commit 4ec2809e73
2 changed files with 11 additions and 5 deletions

View file

@ -127,6 +127,7 @@ static inline RECT rect_from_cgrect(CGRect cgrect)
BOOL on_screen : 1; /* is window ordered in? (minimized or not) */
BOOL shaped : 1; /* is window using a custom region shape? */
BOOL layered : 1; /* is window layered and with valid attributes? */
BOOL ulw_layered : 1; /* has UpdateLayeredWindow() been called for window? */
BOOL per_pixel_alpha : 1; /* is window using per-pixel alpha? */
BOOL minimized : 1; /* is window minimized? */
struct window_surface *surface;

View file

@ -971,6 +971,7 @@ void CDECL macdrv_SetWindowStyle(HWND hwnd, INT offset, STYLESTRUCT *style)
if (offset == GWL_EXSTYLE && (changed & WS_EX_LAYERED)) /* changing WS_EX_LAYERED resets attributes */
{
data->layered = FALSE;
data->ulw_layered = FALSE;
sync_window_opacity(data, 0, 0, FALSE, 0);
if (data->surface) set_surface_use_alpha(data->surface, FALSE);
}
@ -1092,6 +1093,7 @@ BOOL CDECL macdrv_UpdateLayeredWindow(HWND hwnd, const UPDATELAYEREDWINDOWINFO *
if (!(data = get_win_data(hwnd))) return FALSE;
data->layered = TRUE;
data->ulw_layered = TRUE;
rect = *window_rect;
OffsetRect(&rect, -window_rect->left, -window_rect->top);
@ -1271,6 +1273,7 @@ void CDECL macdrv_WindowPosChanging(HWND hwnd, HWND insert_after, UINT swp_flags
/* create the window surface if necessary */
if (!data->cocoa_window) goto done;
if (swp_flags & SWP_HIDEWINDOW) goto done;
if (data->ulw_layered) goto done;
if (*surface) window_surface_release(*surface);
*surface = NULL;
@ -1318,11 +1321,13 @@ void CDECL macdrv_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags,
data->window_rect = *window_rect;
data->whole_rect = *visible_rect;
data->client_rect = *client_rect;
if (surface)
window_surface_add_ref(surface);
set_window_surface(data->cocoa_window, surface);
if (data->surface) window_surface_release(data->surface);
data->surface = surface;
if (!data->ulw_layered)
{
if (surface) window_surface_add_ref(surface);
set_window_surface(data->cocoa_window, surface);
if (data->surface) window_surface_release(data->surface);
data->surface = surface;
}
TRACE("win %p/%p window %s whole %s client %s style %08x flags %08x surface %p\n",
hwnd, data->cocoa_window, wine_dbgstr_rect(window_rect),