From: Rémi Bernon rbernon@codeweavers.com
--- dlls/user32/button.c | 13 ++++--------- dlls/user32/user_private.h | 1 - dlls/user32/win.c | 14 -------------- dlls/win32u/tests/win32u.c | 18 +++++++++--------- dlls/win32u/window.c | 13 ++++--------- include/ntuser.h | 2 -- 6 files changed, 17 insertions(+), 44 deletions(-)
diff --git a/dlls/user32/button.c b/dlls/user32/button.c index 75885be0f17..f4dbec7767c 100644 --- a/dlls/user32/button.c +++ b/dlls/user32/button.c @@ -195,11 +195,7 @@ LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, return -1; /* abort */
/* XP turns a BS_USERBUTTON into BS_PUSHBUTTON */ - if (btn_type == BS_USERBUTTON ) - { - style = (style & ~BS_TYPEMASK) | BS_PUSHBUTTON; - WIN_SetStyle( hWnd, style, BS_TYPEMASK & ~style ); - } + if (btn_type == BS_USERBUTTON ) NtUserAlterWindowStyle( hWnd, BS_TYPEMASK, BS_PUSHBUTTON ); set_button_state( hWnd, BST_UNCHECKED ); return 0;
@@ -408,8 +404,7 @@ LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
case BM_SETSTYLE: btn_type = wParam & BS_TYPEMASK; - style = (style & ~BS_TYPEMASK) | btn_type; - WIN_SetStyle( hWnd, style, BS_TYPEMASK & ~style ); + NtUserAlterWindowStyle( hWnd, BS_TYPEMASK, btn_type );
NtUserNotifyWinEvent( EVENT_OBJECT_STATECHANGE, hWnd, OBJID_CLIENT, 0 );
@@ -452,8 +447,8 @@ LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, state = get_button_state( hWnd ); if ((btn_type == BS_RADIOBUTTON) || (btn_type == BS_AUTORADIOBUTTON)) { - if (wParam) WIN_SetStyle( hWnd, WS_TABSTOP, 0 ); - else WIN_SetStyle( hWnd, 0, WS_TABSTOP ); + if (wParam) NtUserAlterWindowStyle( hWnd, WS_TABSTOP, WS_TABSTOP ); + else NtUserAlterWindowStyle( hWnd, WS_TABSTOP, 0 ); } if ((state & 3) != wParam) { diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h index fbf6cd7bc23..a324968400f 100644 --- a/dlls/user32/user_private.h +++ b/dlls/user32/user_private.h @@ -173,7 +173,6 @@ BOOL is_desktop_window( HWND hwnd ); HWND WIN_GetFullHandle( HWND hwnd ); HWND WIN_IsCurrentProcess( HWND hwnd ); HWND WIN_IsCurrentThread( HWND hwnd ); -ULONG WIN_SetStyle( HWND hwnd, ULONG set_bits, ULONG clear_bits ); HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module, BOOL unicode ); HWND *WIN_ListChildren( HWND hwnd ); void MDI_CalcDefaultChildPos( HWND hwndClient, INT total, LPPOINT lpPos, INT delta, UINT *id ); diff --git a/dlls/user32/win.c b/dlls/user32/win.c index bfb0681a8f2..8741c07a671 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -150,20 +150,6 @@ HWND WIN_GetFullHandle( HWND hwnd ) }
-/*********************************************************************** - * WIN_SetStyle - * - * Change the style of a window. - */ -ULONG WIN_SetStyle( HWND hwnd, ULONG set_bits, ULONG clear_bits ) -{ - /* FIXME: Use SetWindowLong or move callers to win32u instead. - * We use STYLESTRUCT to pass params, but meaning of its field does not match our usage. */ - STYLESTRUCT style = { .styleNew = set_bits, .styleOld = clear_bits }; - return NtUserCallHwndParam( hwnd, (UINT_PTR)&style, NtUserSetWindowStyle ); -} - - /*********************************************************************** * dump_window_styles */ diff --git a/dlls/win32u/tests/win32u.c b/dlls/win32u/tests/win32u.c index 71ceabfd3b4..3f0fe8d55bb 100644 --- a/dlls/win32u/tests/win32u.c +++ b/dlls/win32u/tests/win32u.c @@ -294,37 +294,37 @@ static void test_NtUserAlterWindowStyle(void) ok( style == expect_style, "got %#x\n", style );
ret = NtUserAlterWindowStyle( hwnd, 0, 0 ); - todo_wine ok( ret == 1, "got %#Ix\n", ret ); + ok( ret == 1, "got %#Ix\n", ret ); style = GetWindowLongW( hwnd, GWL_STYLE ); ok( style == expect_style, "got %#x\n", style );
ret = NtUserAlterWindowStyle( hwnd, -1, -1 ); - todo_wine ok( ret == 1, "got %#Ix\n", ret ); + ok( ret == 1, "got %#Ix\n", ret ); style = GetWindowLongW( hwnd, GWL_STYLE ); - todo_wine ok( style == (expect_style | 0x23f), "got %#x\n", style ); + ok( style == (expect_style | 0x23f), "got %#x\n", style );
ret = NtUserAlterWindowStyle( hwnd, -1, 0 ); - todo_wine ok( ret == 1, "got %#Ix\n", ret ); + ok( ret == 1, "got %#Ix\n", ret ); style = GetWindowLongW( hwnd, GWL_STYLE ); todo_wine ok( style == (expect_style & ~(WS_VSCROLL | WS_HSCROLL)), "got %#x\n", style );
ret = NtUserAlterWindowStyle( hwnd, 0, -1 ); - todo_wine ok( ret == 1, "got %#Ix\n", ret ); + ok( ret == 1, "got %#Ix\n", ret ); style = GetWindowLongW( hwnd, GWL_STYLE ); todo_wine ok( style == (expect_style & ~(WS_VSCROLL | WS_HSCROLL)), "got %#x\n", style );
ret = NtUserAlterWindowStyle( hwnd, -1, 0xe1e1e1e1 ); - todo_wine ok( ret == 1, "got %#Ix\n", ret ); + ok( ret == 1, "got %#Ix\n", ret ); style = GetWindowLongW( hwnd, GWL_STYLE ); - todo_wine ok( style == ((expect_style & ~WS_HSCROLL) | 0x21), "got %#x\n", style ); + ok( style == ((expect_style & ~WS_HSCROLL) | 0x21), "got %#x\n", style );
ret = NtUserAlterWindowStyle( hwnd, -1, 0 ); - todo_wine ok( ret == 1, "got %#Ix\n", ret ); + ok( ret == 1, "got %#Ix\n", ret ); style = GetWindowLongW( hwnd, GWL_STYLE ); todo_wine ok( style == (expect_style & ~(WS_VSCROLL | WS_HSCROLL)), "got %#x\n", style );
ret = NtUserAlterWindowStyle( hwnd, 0x20, 0xe1e1e1e1 ); - todo_wine ok( ret == 1, "got %#Ix\n", ret ); + ok( ret == 1, "got %#Ix\n", ret ); style = GetWindowLongW( hwnd, GWL_STYLE ); todo_wine ok( style == ((expect_style & ~(WS_VSCROLL | WS_HSCROLL)) | 0x20), "got %#x\n", style );
diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 1fc7f779b89..3cc3addc298 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -1170,8 +1170,10 @@ UINT set_window_style_bits( HWND hwnd, UINT set_bits, UINT clear_bits ) */ ULONG WINAPI NtUserAlterWindowStyle( HWND hwnd, UINT mask, UINT style ) { - FIXME( "hwnd %p, mask %#x, style %#x stub!\n", hwnd, mask, style ); - return 0; + TRACE( "hwnd %p, mask %#x, style %#x\n", hwnd, mask, style ); + /* FIXME: WS_TABSTOP shouldn't be there but we need it for BM_SETCHECK */ + mask &= WS_TABSTOP | WS_VSCROLL | WS_HSCROLL | 0x23f; + return !!set_window_style_bits( hwnd, style & mask, mask & ~style ); }
static DWORD fix_exstyle( DWORD style, DWORD exstyle ) @@ -5959,13 +5961,6 @@ ULONG_PTR WINAPI NtUserCallHwndParam( HWND hwnd, DWORD_PTR param, DWORD code ) return set_raw_window_pos( hwnd, params->rect, params->flags, params->internal ); }
- /* temporary exports */ - case NtUserSetWindowStyle: - { - STYLESTRUCT *style = (void *)param; - return set_window_style_bits( hwnd, style->styleNew, style->styleOld ); - } - default: FIXME( "invalid code %u\n", code ); return 0; diff --git a/include/ntuser.h b/include/ntuser.h index f4480bb650b..41c9fc84cd2 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -1398,8 +1398,6 @@ enum NtUserCallHwndParam_ExposeWindowSurface, NtUserCallHwndParam_GetWinMonitorDpi, NtUserCallHwndParam_SetRawWindowPos, - /* temporary exports */ - NtUserSetWindowStyle, };
struct get_window_rects_params