diff --git a/dlls/user32/win.c b/dlls/user32/win.c index cc8461a7546..66fc8cc5641 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -641,8 +641,16 @@ ULONG WIN_SetStyle( HWND hwnd, ULONG set_bits, ULONG clear_bits ) WIN_ReleasePtr( win ); if (ok) { + if ((style.styleOld ^ style.styleNew) & WS_VISIBLE) + { + RECT window_rect, client_rect; + UINT flags = style.styleNew & WS_VISIBLE ? SWP_SHOWWINDOW : 0; /* we don't hide it */ + + WIN_GetRectangles( hwnd, COORDS_PARENT, &window_rect, &client_rect ); + set_window_pos( hwnd, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE | + SWP_NOZORDER | SWP_NOACTIVATE | flags, &window_rect, &client_rect, NULL ); + } USER_Driver->pSetWindowStyle( hwnd, GWL_STYLE, &style ); - if ((style.styleOld ^ style.styleNew) & WS_VISIBLE) invalidate_dce( hwnd, NULL ); } return style.styleOld; } @@ -2334,6 +2342,15 @@ LONG_PTR WIN_SetWindowLong( HWND hwnd, INT offset, UINT size, LONG_PTR newval, B { style.styleOld = retval; style.styleNew = newval; + if (offset == GWL_STYLE && ((style.styleOld ^ style.styleNew) & WS_VISIBLE)) + { + RECT window_rect, client_rect; + UINT flags = style.styleNew & WS_VISIBLE ? SWP_SHOWWINDOW : 0; /* we don't hide it */ + + WIN_GetRectangles( hwnd, COORDS_PARENT, &window_rect, &client_rect ); + set_window_pos( hwnd, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE | + SWP_NOZORDER | SWP_NOACTIVATE | flags, &window_rect, &client_rect, NULL ); + } USER_Driver->pSetWindowStyle( hwnd, offset, &style ); SendMessageW( hwnd, WM_STYLECHANGED, offset, (LPARAM)&style ); } diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 9070669bcb4..5840e85dc41 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1807,22 +1807,10 @@ void CDECL X11DRV_SetWindowStyle( HWND hwnd, INT offset, STYLESTRUCT *style ) DWORD changed; if (hwnd == GetDesktopWindow()) return; - changed = style->styleNew ^ style->styleOld; - - /* if WS_VISIBLE was set through WM_SETREDRAW, map the window if it's the first time */ - if (offset == GWL_STYLE && (changed & WS_VISIBLE) && (style->styleNew & WS_VISIBLE) && !data) - { - if (!(data = X11DRV_create_win_data( hwnd ))) return; - - if (data->whole_window && is_window_rect_mapped( &data->window_rect )) - { - Display *display = thread_display(); - set_wm_hints( display, data ); - if (!data->mapped) map_window( display, data, style->styleNew ); - } - } if (!data || !data->whole_window) return; + changed = style->styleNew ^ style->styleOld; + if (offset == GWL_STYLE && (changed & WS_DISABLED)) set_wm_hints( thread_display(), data );