Author: jimtabor Date: Wed Mar 10 11:19:49 2010 New Revision: 46054
URL: http://svn.reactos.org/svn/reactos?rev=46054&view=rev Log: - [User32] Send WM_CANCELMODE in EnableWindow.
Modified: trunk/reactos/dll/win32/user32/windows/input.c
Modified: trunk/reactos/dll/win32/user32/windows/input.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/in... ============================================================================== --- trunk/reactos/dll/win32/user32/windows/input.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/input.c [iso-8859-1] Wed Mar 10 11:19:49 2010 @@ -109,30 +109,39 @@ 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); - if ( (bIsDisabled && bEnable) || (!bIsDisabled && !bEnable) ) - { - if (bEnable) - { - Style &= ~WS_DISABLED; - } - else - { - Style |= WS_DISABLED; - /* Remove keyboard focus from that window if it had focus */ - if (hWnd == GetFocus()) - { - SetFocus(NULL); - } - } - NtUserSetWindowLong(hWnd, GWL_STYLE, Style, FALSE); - - SendMessageA(hWnd, WM_ENABLE, (LPARAM) IsWindowEnabled(hWnd), 0); + 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) + { + SendMessageW(hWnd, WM_ENABLE, (LPARAM)bEnable, 0); } // Return nonzero if it was disabled, or zero if it wasn't: - return IsWindowEnabled(hWnd); + return bIsDisabled; }