user32: Always go through set_window_pos when the WS_VISIBLE style is changed.

This commit is contained in:
Alexandre Julliard 2012-08-29 18:08:37 +02:00
parent 4890964e31
commit d35fc4369f
2 changed files with 20 additions and 15 deletions

View File

@ -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 );
}

View File

@ -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 );