From 2f1121316868b79bfe01105b6a3814a17ec655d5 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 12 Sep 2008 14:55:07 +0200 Subject: [PATCH] user32: Notify the user driver about window extended style changes too. --- dlls/user32/driver.c | 6 +++--- dlls/user32/user_private.h | 2 +- dlls/user32/win.c | 26 ++++++++++++++------------ dlls/winex11.drv/window.c | 15 +++++++-------- dlls/winex11.drv/winex11.drv.spec | 2 +- 5 files changed, 26 insertions(+), 25 deletions(-) diff --git a/dlls/user32/driver.c b/dlls/user32/driver.c index c4522ebdad5..38e3c1b3691 100644 --- a/dlls/user32/driver.c +++ b/dlls/user32/driver.c @@ -388,7 +388,7 @@ static void nulldrv_SetWindowIcon( HWND hwnd, UINT type, HICON icon ) { } -static void nulldrv_SetWindowStyle( HWND hwnd, DWORD old_style ) +static void nulldrv_SetWindowStyle( HWND hwnd, INT offset, STYLESTRUCT *style ) { } @@ -723,9 +723,9 @@ static void loaderdrv_SetWindowIcon( HWND hwnd, UINT type, HICON icon ) load_driver()->pSetWindowIcon( hwnd, type, icon ); } -static void loaderdrv_SetWindowStyle( HWND hwnd, DWORD old_style ) +static void loaderdrv_SetWindowStyle( HWND hwnd, INT offset, STYLESTRUCT *style ) { - load_driver()->pSetWindowStyle( hwnd, old_style ); + load_driver()->pSetWindowStyle( hwnd, offset, style ); } static void loaderdrv_SetWindowText( HWND hwnd, LPCWSTR text ) diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h index 909686d5b4a..baf34753f2b 100644 --- a/dlls/user32/user_private.h +++ b/dlls/user32/user_private.h @@ -153,7 +153,7 @@ typedef struct tagUSER_DRIVER { void (*pSetParent)(HWND,HWND,HWND); int (*pSetWindowRgn)(HWND,HRGN,BOOL); void (*pSetWindowIcon)(HWND,UINT,HICON); - void (*pSetWindowStyle)(HWND,DWORD); + void (*pSetWindowStyle)(HWND,INT,STYLESTRUCT*); void (*pSetWindowText)(HWND,LPCWSTR); UINT (*pShowWindow)(HWND,INT,RECT*,UINT); LRESULT (*pSysCommand)(HWND,WPARAM,LPARAM); diff --git a/dlls/user32/win.c b/dlls/user32/win.c index 7756ab0f064..e1faae8c6c7 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -536,7 +536,7 @@ HWND WIN_SetOwner( HWND hwnd, HWND owner ) ULONG WIN_SetStyle( HWND hwnd, ULONG set_bits, ULONG clear_bits ) { BOOL ok; - ULONG new_style, old_style = 0; + STYLESTRUCT style; WND *win = WIN_GetPtr( hwnd ); if (!win || win == WND_DESKTOP) return 0; @@ -547,32 +547,33 @@ ULONG WIN_SetStyle( HWND hwnd, ULONG set_bits, ULONG clear_bits ) set_bits, clear_bits, hwnd ); return 0; } - new_style = (win->dwStyle | set_bits) & ~clear_bits; - if (new_style == win->dwStyle) + style.styleOld = win->dwStyle; + style.styleNew = (win->dwStyle | set_bits) & ~clear_bits; + if (style.styleNew == style.styleOld) { WIN_ReleasePtr( win ); - return new_style; + return style.styleNew; } SERVER_START_REQ( set_window_info ) { req->handle = hwnd; req->flags = SET_WIN_STYLE; - req->style = new_style; + req->style = style.styleNew; req->extra_offset = -1; if ((ok = !wine_server_call( req ))) { - old_style = reply->old_style; - win->dwStyle = new_style; + style.styleOld = reply->old_style; + win->dwStyle = style.styleNew; } } SERVER_END_REQ; WIN_ReleasePtr( win ); if (ok) { - USER_Driver->pSetWindowStyle( hwnd, old_style ); - if ((old_style ^ new_style) & WS_VISIBLE) invalidate_dce( hwnd, NULL ); + USER_Driver->pSetWindowStyle( hwnd, GWL_STYLE, &style ); + if ((style.styleOld ^ style.styleNew) & WS_VISIBLE) invalidate_dce( hwnd, NULL ); } - return old_style; + return style.styleOld; } @@ -2131,10 +2132,11 @@ LONG_PTR WIN_SetWindowLong( HWND hwnd, INT offset, UINT size, LONG_PTR newval, B if (!ok) return 0; - if (offset == GWL_STYLE) USER_Driver->pSetWindowStyle( hwnd, retval ); - if (offset == GWL_STYLE || offset == GWL_EXSTYLE) + { + USER_Driver->pSetWindowStyle( hwnd, offset, &style ); SendMessageW( hwnd, WM_STYLECHANGED, offset, (LPARAM)&style ); + } return retval; } diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 33adff4790f..0ba15e21125 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1455,16 +1455,15 @@ void X11DRV_SetWindowText( HWND hwnd, LPCWSTR text ) * * Update the X state of a window to reflect a style change */ -void X11DRV_SetWindowStyle( HWND hwnd, DWORD old_style ) +void X11DRV_SetWindowStyle( HWND hwnd, INT offset, STYLESTRUCT *style ) { struct x11drv_win_data *data; - DWORD new_style, changed; + DWORD changed; if (hwnd == GetDesktopWindow()) return; - new_style = GetWindowLongW( hwnd, GWL_STYLE ); - changed = new_style ^ old_style; + changed = style->styleNew ^ style->styleOld; - if ((changed & WS_VISIBLE) && (new_style & WS_VISIBLE)) + if (offset == GWL_STYLE && (changed & WS_VISIBLE) && (style->styleNew & WS_VISIBLE)) { /* we don't unmap windows, that causes trouble with the window manager */ if (!(data = X11DRV_get_win_data( hwnd )) && @@ -1474,17 +1473,17 @@ void X11DRV_SetWindowStyle( HWND hwnd, DWORD old_style ) { Display *display = thread_display(); set_wm_hints( display, data ); - if (!data->mapped) map_window( display, data, new_style ); + if (!data->mapped) map_window( display, data, style->styleNew ); } } - if (changed & WS_DISABLED) + if (offset == GWL_STYLE && (changed & WS_DISABLED)) { data = X11DRV_get_win_data( hwnd ); if (data && data->wm_hints) { wine_tsx11_lock(); - data->wm_hints->input = !(new_style & WS_DISABLED); + data->wm_hints->input = !(style->styleNew & WS_DISABLED); XSetWMHints( thread_display(), data->whole_window, data->wm_hints ); wine_tsx11_unlock(); } diff --git a/dlls/winex11.drv/winex11.drv.spec b/dlls/winex11.drv/winex11.drv.spec index cacc5b9b4b0..39dcc8ed4f5 100644 --- a/dlls/winex11.drv/winex11.drv.spec +++ b/dlls/winex11.drv/winex11.drv.spec @@ -109,7 +109,7 @@ @ cdecl SetParent(long long long) X11DRV_SetParent @ cdecl SetWindowIcon(long long long) X11DRV_SetWindowIcon @ cdecl SetWindowRgn(long long long) X11DRV_SetWindowRgn -@ cdecl SetWindowStyle(ptr long) X11DRV_SetWindowStyle +@ cdecl SetWindowStyle(ptr long ptr) X11DRV_SetWindowStyle @ cdecl SetWindowText(long wstr) X11DRV_SetWindowText @ cdecl ShowWindow(long long ptr long) X11DRV_ShowWindow @ cdecl SysCommand(long long long) X11DRV_SysCommand -- 2.11.4.GIT