From 88339aa831161a7e22601814feb20afd7b9ab77c Mon Sep 17 00:00:00 2001 From: James Tabor Date: Wed, 30 Mar 2011 08:19:52 +0000 Subject: [PATCH] [User32|Win32k] - Move EnableWindow to Win32k. - Fix sign in class function. svn path=/trunk/; revision=51203 --- reactos/dll/win32/user32/windows/class.c | 2 +- reactos/dll/win32/user32/windows/input.c | 37 +--------------- .../subsystems/win32/win32k/include/window.h | 2 + .../win32/win32k/ntuser/simplecall.c | 3 +- .../subsystems/win32/win32k/ntuser/window.c | 44 +++++++++++++++++++ 5 files changed, 49 insertions(+), 39 deletions(-) diff --git a/reactos/dll/win32/user32/windows/class.c b/reactos/dll/win32/user32/windows/class.c index 6770b6d6d0b..0d9ae490b69 100644 --- a/reactos/dll/win32/user32/windows/class.c +++ b/reactos/dll/win32/user32/windows/class.c @@ -933,7 +933,7 @@ RealGetWindowClassA( WCHAR tmpbuf[MAX_ATOM_LEN + 1]; UINT len; - if (cchType <= 0) return 0; + if ((INT)cchType <= 0) return 0; if (!RealGetWindowClassW( hwnd, tmpbuf, sizeof(tmpbuf)/sizeof(WCHAR) )) return 0; RtlUnicodeToMultiByteN( pszType, cchType - 1, (PULONG)&len, tmpbuf, strlenW(tmpbuf) * sizeof(WCHAR) ); pszType[len] = 0; diff --git a/reactos/dll/win32/user32/windows/input.c b/reactos/dll/win32/user32/windows/input.c index 63f266eb492..e9189576963 100644 --- a/reactos/dll/win32/user32/windows/input.c +++ b/reactos/dll/win32/user32/windows/input.c @@ -100,7 +100,6 @@ DragDetect( #endif } - /* * @implemented */ @@ -108,43 +107,9 @@ BOOL WINAPI EnableWindow(HWND hWnd, BOOL bEnable) { - // This will soon be moved to win32k. - BOOL Update; - LONG Style = GetWindowLongPtrW(hWnd, GWL_STYLE); - /* check if updating is needed */ - UINT bIsDisabled = (Style & WS_DISABLED); - Update = bIsDisabled; - - if (bEnable) - { - Style &= ~WS_DISABLED; - } - else - { - Update = !bIsDisabled; - - SendMessageW( hWnd, WM_CANCELMODE, 0, 0); - - /* Remove keyboard focus from that window if it had focus */ - if (hWnd == GetFocus()) - { - SetFocus(NULL); - } - Style |= WS_DISABLED; - } - - NtUserSetWindowLong(hWnd, GWL_STYLE, Style, FALSE); - - if (Update) - { - IntNotifyWinEvent(EVENT_OBJECT_STATECHANGE, hWnd, OBJID_WINDOW, CHILDID_SELF, 0); - SendMessageW(hWnd, WM_ENABLE, (LPARAM)bEnable, 0); - } - // Return nonzero if it was disabled, or zero if it wasn't: - return bIsDisabled; + return NtUserCallTwoParam((DWORD_PTR)hWnd, (DWORD_PTR)bEnable, TWOPARAM_ROUTINE_ENABLEWINDOW); } - /* * @implemented */ diff --git a/reactos/subsystems/win32/win32k/include/window.h b/reactos/subsystems/win32/win32k/include/window.h index 0e2073d3df1..44e6a8c86db 100644 --- a/reactos/subsystems/win32/win32k/include/window.h +++ b/reactos/subsystems/win32/win32k/include/window.h @@ -111,4 +111,6 @@ VOID FASTCALL IntNotifyWinEvent(DWORD, PWND, LONG, LONG, DWORD); PWND FASTCALL co_UserCreateWindowEx(CREATESTRUCTW*, PUNICODE_STRING, PLARGE_STRING); WNDPROC FASTCALL IntGetWindowProc(PWND,BOOL); +BOOL FASTCALL IntEnableWindow(HWND,BOOL); + /* EOF */ diff --git a/reactos/subsystems/win32/win32k/ntuser/simplecall.c b/reactos/subsystems/win32/win32k/ntuser/simplecall.c index d4a1a14f403..21109806fe9 100644 --- a/reactos/subsystems/win32/win32k/ntuser/simplecall.c +++ b/reactos/subsystems/win32/win32k/ntuser/simplecall.c @@ -436,8 +436,7 @@ NtUserCallTwoParam( } case TWOPARAM_ROUTINE_ENABLEWINDOW: - UNIMPLEMENTED - RETURN( 0); + RETURN( IntEnableWindow((HWND)Param1, (BOOL)Param2)); case TWOPARAM_ROUTINE_SHOWOWNEDPOPUPS: { diff --git a/reactos/subsystems/win32/win32k/ntuser/window.c b/reactos/subsystems/win32/win32k/ntuser/window.c index acd8a1aa14b..21aecf32546 100644 --- a/reactos/subsystems/win32/win32k/ntuser/window.c +++ b/reactos/subsystems/win32/win32k/ntuser/window.c @@ -176,6 +176,50 @@ IntGetParent(PWND Wnd) return NULL; } +BOOL +FASTCALL +IntEnableWindow( HWND hWnd, BOOL bEnable ) +{ + BOOL Update; + PWND pWnd; + UINT bIsDisabled; + + if(!(pWnd = UserGetWindowObject(hWnd))) + { + return FALSE; + } + + /* check if updating is needed */ + bIsDisabled = (pWnd->style & WS_DISABLED); + Update = bIsDisabled; + + if (bEnable) + { + pWnd->style &= ~WS_DISABLED; + } + else + { + Update = !bIsDisabled; + + co_IntSendMessage( hWnd, WM_CANCELMODE, 0, 0); + + /* Remove keyboard focus from that window if it had focus */ + if (hWnd == IntGetThreadFocusWindow()) + { + co_UserSetFocus(NULL); + } + pWnd->style |= WS_DISABLED; + } + + if (Update) + { + IntNotifyWinEvent(EVENT_OBJECT_STATECHANGE, pWnd, OBJID_WINDOW, CHILDID_SELF, 0); + co_IntSendMessage(hWnd, WM_ENABLE, (LPARAM)bEnable, 0); + } + // Return nonzero if it was disabled, or zero if it wasn't: + return bIsDisabled; +} + /* * IntWinListChildren *