From f57db8a3deafd5613232736c00fefd6e541b6a1d Mon Sep 17 00:00:00 2001 From: Ken Thomases Date: Tue, 4 Jun 2013 04:59:45 -0500 Subject: [PATCH] winemac: Keep old window surface for minimized windows to allow redrawing. This improves the animation of the window unminimizing from the Dock in some cases. The window would often be blank or, for shaped windows, invisible during that animation. --- dlls/winemac.drv/macdrv.h | 1 + dlls/winemac.drv/window.c | 25 ++++++++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index 8e0b0f8bb36..085f7860fa3 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -135,6 +135,7 @@ static inline RECT rect_from_cgrect(CGRect cgrect) BOOL per_pixel_alpha : 1; /* is window using per-pixel alpha? */ BOOL minimized : 1; /* is window minimized? */ struct window_surface *surface; + struct window_surface *unminimized_surface; }; extern struct macdrv_win_data *get_win_data(HWND hwnd) DECLSPEC_HIDDEN; diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c index 33537493992..77d2ea0f061 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -535,6 +535,8 @@ static void destroy_cocoa_window(struct macdrv_win_data *data) data->color_key = CLR_INVALID; if (data->surface) window_surface_release(data->surface); data->surface = NULL; + if (data->unminimized_surface) window_surface_release(data->unminimized_surface); + data->unminimized_surface = NULL; } @@ -1108,6 +1110,11 @@ BOOL CDECL macdrv_UpdateLayeredWindow(HWND hwnd, const UPDATELAYEREDWINDOWINFO * set_window_surface(data->cocoa_window, data->surface); if (surface) window_surface_release(surface); surface = data->surface; + if (data->unminimized_surface) + { + window_surface_release(data->unminimized_surface); + data->unminimized_surface = NULL; + } } else set_surface_use_alpha(surface, TRUE); @@ -1333,7 +1340,23 @@ void CDECL macdrv_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags, if (!data->ulw_layered) { if (surface) window_surface_add_ref(surface); - set_window_surface(data->cocoa_window, surface); + if (new_style & WS_MINIMIZE) + { + if (!data->unminimized_surface && data->surface) + { + data->unminimized_surface = data->surface; + window_surface_add_ref(data->unminimized_surface); + } + } + else + { + set_window_surface(data->cocoa_window, surface); + if (data->unminimized_surface) + { + window_surface_release(data->unminimized_surface); + data->unminimized_surface = NULL; + } + } if (data->surface) window_surface_release(data->surface); data->surface = surface; }