- button.c: Use NtUserAlterWindowStyle where wine uses WIN_SetStyle (usage and parameters were confirmed with windbg)

[NTUSER]
- Implement NtUserAlterWindowStyle.

Fixes remaining failures in user32:msg_controls test.

svn path=/trunk/; revision=66457
This commit is contained in:
Giannis Adamopoulos 2015-02-25 20:02:10 +00:00
parent 4ad9239209
commit 420ed9cda0
3 changed files with 52 additions and 30 deletions

View file

@ -1157,19 +1157,6 @@ NtUserQuerySendMessage(DWORD Unknown0)
return 0;
}
/*
* @unimplemented
*/
DWORD APIENTRY
NtUserAlterWindowStyle(DWORD Unknown0,
DWORD Unknown1,
DWORD Unknown2)
{
STUB
return(0);
}
BOOL APIENTRY NtUserAddClipboardFormatListener(
HWND hwnd
)

View file

@ -3537,8 +3537,8 @@ IntCheckFrameEdge(ULONG Style, ULONG ExStyle)
return FALSE;
}
LONG FASTCALL
co_UserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
static LONG
co_IntSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi, BOOL bAlter)
{
PWND Window, Parent;
PWINSTATION_OBJECT WindowStation;
@ -3597,6 +3597,7 @@ co_UserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
Style.styleNew &= ~WS_EX_WINDOWEDGE;
Window->ExStyle = (DWORD)Style.styleNew;
co_IntSendMessage(hWnd, WM_STYLECHANGED, GWL_EXSTYLE, (LPARAM) &Style);
break;
@ -3604,7 +3605,9 @@ co_UserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
OldValue = (LONG) Window->style;
Style.styleOld = OldValue;
Style.styleNew = NewValue;
co_IntSendMessage(hWnd, WM_STYLECHANGING, GWL_STYLE, (LPARAM) &Style);
if (!bAlter)
co_IntSendMessage(hWnd, WM_STYLECHANGING, GWL_STYLE, (LPARAM) &Style);
/* WS_CLIPSIBLINGS can't be reset on top-level windows */
if (Window->spwndParent == UserGetDesktopWindow()) Style.styleNew |= WS_CLIPSIBLINGS;
@ -3621,7 +3624,9 @@ co_UserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
DceResetActiveDCEs( Window );
}
Window->style = (DWORD)Style.styleNew;
co_IntSendMessage(hWnd, WM_STYLECHANGED, GWL_STYLE, (LPARAM) &Style);
if (!bAlter)
co_IntSendMessage(hWnd, WM_STYLECHANGED, GWL_STYLE, (LPARAM) &Style);
break;
case GWL_WNDPROC:
@ -3672,6 +3677,13 @@ co_UserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
return( OldValue);
}
LONG FASTCALL
co_UserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
{
return co_IntSetWindowLong(hWnd, Index, NewValue, Ansi, FALSE);
}
/*
* NtUserSetWindowLong
*
@ -3686,25 +3698,46 @@ co_UserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
LONG APIENTRY
NtUserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
{
DECLARE_RETURN(LONG);
LONG ret;
TRACE("Enter NtUserSetWindowLong\n");
UserEnterExclusive();
if (hWnd == IntGetDesktopWindow())
{
EngSetLastError(STATUS_ACCESS_DENIED);
RETURN( 0);
UserLeave();
return 0;
}
RETURN( co_UserSetWindowLong(hWnd, Index, NewValue, Ansi));
ret = co_IntSetWindowLong(hWnd, Index, NewValue, Ansi, FALSE);
CLEANUP:
TRACE("Leave NtUserSetWindowLong, ret=%i\n",_ret_);
UserLeave();
END_CLEANUP;
return ret;
}
DWORD APIENTRY
NtUserAlterWindowStyle(HWND hWnd, DWORD Index, LONG NewValue)
{
LONG ret;
UserEnterExclusive();
if (hWnd == IntGetDesktopWindow())
{
EngSetLastError(STATUS_ACCESS_DENIED);
UserLeave();
return 0;
}
ret = co_IntSetWindowLong(hWnd, Index, NewValue, FALSE, TRUE);
UserLeave();
return ret;
}
/*
* NtUserSetWindowWord
*

View file

@ -298,11 +298,10 @@ LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
/* XP turns a BS_USERBUTTON into BS_PUSHBUTTON */
if (btn_type == BS_USERBUTTON )
{
style = (style & ~BS_TYPEMASK) | BS_PUSHBUTTON;
#ifdef __REACTOS__
style = (style & ~BS_TYPEMASK) | BS_PUSHBUTTON;
SetWindowLongPtrW( hWnd, GWL_STYLE, style );
NtUserAlterWindowStyle(hWnd, GWL_STYLE, style );
#else
style = (style & ~BS_TYPEMASK) | BS_PUSHBUTTON;
WIN_SetStyle( hWnd, style, BS_TYPEMASK & ~style );
#endif
}
@ -508,8 +507,11 @@ LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
if ((wParam & BS_TYPEMASK) >= MAX_BTN_TYPE) break;
btn_type = wParam & BS_TYPEMASK;
style = (style & ~BS_TYPEMASK) | btn_type;
SetWindowLongPtrW( hWnd, GWL_STYLE, style );
//WIN_SetStyle( hWnd, style, BS_TYPEMASK & ~style );
#ifdef __REACTOS__
NtUserAlterWindowStyle(hWnd, GWL_STYLE, style );
#else
WIN_SetStyle( hWnd, style, BS_TYPEMASK & ~style );
#endif
/* Only redraw if lParam flag is set.*/
if (lParam)
@ -565,7 +567,7 @@ LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
#ifdef __REACTOS__
if (wParam) style |= WS_TABSTOP;
else style &= ~WS_TABSTOP;
SetWindowLongPtrW( hWnd, GWL_STYLE, style );
NtUserAlterWindowStyle(hWnd, GWL_STYLE, style );
#else
if (wParam) WIN_SetStyle( hWnd, WS_TABSTOP, 0 );
else WIN_SetStyle( hWnd, 0, WS_TABSTOP );