Fixes a regression introduced by 8892b79118fde5f2307ecbbdb03a8d0c489c8b3d, because set_window_pos is called before UpdateLayeredWindow, which calls the driver's WindowPosChanged earlier.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51984 Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/winex11.drv/window.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 29473ce..843d10a 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -2713,10 +2713,10 @@ BOOL CDECL X11DRV_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO char buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )]; BITMAPINFO *bmi = (BITMAPINFO *)buffer; void *src_bits, *dst_bits; + BOOL mapped, ret = FALSE; RECT rect, src_rect; HDC hdc = 0; HBITMAP dib; - BOOL ret = FALSE;
if (!(data = get_win_data( hwnd ))) return FALSE;
@@ -2737,6 +2737,7 @@ BOOL CDECL X11DRV_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO else set_surface_color_key( surface, color_key );
if (surface) window_surface_add_ref( surface ); + mapped = data->mapped; release_win_data( data );
if (!surface) return FALSE; @@ -2778,6 +2779,15 @@ BOOL CDECL X11DRV_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO surface->funcs->unlock( surface ); surface->funcs->flush( surface );
+ /* layered windows are mapped only once their attributes are set */ + if (!mapped) + { + DWORD style = GetWindowLongW( hwnd, GWL_STYLE ); + + if ((style & WS_VISIBLE) && ((style & WS_MINIMIZE) || is_window_rect_mapped( window_rect ))) + map_window( hwnd, style ); + } + done: window_surface_release( surface ); if (hdc) DeleteDC( hdc );
Hi, is there anything wrong with the patch? To explain it briefly in case it's not clear why it's needed:
1) UpdateLayeredWindow sets data->layered to TRUE.
2) Before the commit that regressed, set_window_pos was called after the driver's UpdateLayeredWindow.
3) So when set_window_pos called the driver's WindowPosChanged, it saw data->layered == TRUE and mapped the window.
Now, since the regression commit, set_window_pos is called *before* the driver's UpdateLayeredWindow. This causes WindowPosChanged to be *possibly* called when data->layered == FALSE, even though it will be set to TRUE in UpdateLayeredWindow.
So we have to map it in UpdateLayeredWindow now, if it's still not mapped yet and the other conditions hold.