Author: rharabien Date: Tue Oct 18 18:12:35 2011 New Revision: 54192
URL: http://svn.reactos.org/svn/reactos?rev=54192&view=rev Log: [USER32] - Formatting. No code changes.
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] Tue Oct 18 18:12:35 2011 @@ -45,58 +45,58 @@ BOOL WINAPI DragDetect( - HWND hWnd, - POINT pt) -{ - return NtUserDragDetect(hWnd, pt); + HWND hWnd, + POINT pt) +{ + return NtUserDragDetect(hWnd, pt); #if 0 - MSG msg; - RECT rect; - POINT tmp; - ULONG dx = GetSystemMetrics(SM_CXDRAG); - ULONG dy = GetSystemMetrics(SM_CYDRAG); - - rect.left = pt.x - dx; - rect.right = pt.x + dx; - rect.top = pt.y - dy; - rect.bottom = pt.y + dy; - - SetCapture(hWnd); - - for (;;) - { - while ( - PeekMessageW(&msg, 0, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE) || - PeekMessageW(&msg, 0, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE) - ) + MSG msg; + RECT rect; + POINT tmp; + ULONG dx = GetSystemMetrics(SM_CXDRAG); + ULONG dy = GetSystemMetrics(SM_CYDRAG); + + rect.left = pt.x - dx; + rect.right = pt.x + dx; + rect.top = pt.y - dy; + rect.bottom = pt.y + dy; + + SetCapture(hWnd); + + for (;;) { - if (msg.message == WM_LBUTTONUP) - { - ReleaseCapture(); - return FALSE; - } - if (msg.message == WM_MOUSEMOVE) - { - tmp.x = LOWORD(msg.lParam); - tmp.y = HIWORD(msg.lParam); - if (!PtInRect(&rect, tmp)) + while ( + PeekMessageW(&msg, 0, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE) || + PeekMessageW(&msg, 0, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE) + ) { - ReleaseCapture(); - return TRUE; + if (msg.message == WM_LBUTTONUP) + { + ReleaseCapture(); + return FALSE; + } + if (msg.message == WM_MOUSEMOVE) + { + tmp.x = LOWORD(msg.lParam); + tmp.y = HIWORD(msg.lParam); + if (!PtInRect(&rect, tmp)) + { + ReleaseCapture(); + return TRUE; + } + } + if (msg.message == WM_KEYDOWN) + { + if (msg.wParam == VK_ESCAPE) + { + ReleaseCapture(); + return TRUE; + } + } } - } - if (msg.message == WM_KEYDOWN) - { - if (msg.wParam == VK_ESCAPE) - { - ReleaseCapture(); - return TRUE; - } - } + WaitMessage(); } - WaitMessage(); - } - return 0; + return 0; #endif }
@@ -106,7 +106,7 @@ BOOL WINAPI EnableWindow(HWND hWnd, BOOL bEnable) { - return NtUserxEnableWindow(hWnd, bEnable); + return NtUserxEnableWindow(hWnd, bEnable); }
/* @@ -115,9 +115,9 @@ SHORT WINAPI GetAsyncKeyState(int vKey) { - if (vKey < 0 || vKey > 256) - return 0; - return (SHORT) NtUserGetAsyncKeyState((DWORD) vKey); + if (vKey < 0 || vKey > 256) + return 0; + return (SHORT)NtUserGetAsyncKeyState((DWORD)vKey); }
@@ -127,7 +127,7 @@ HKL WINAPI GetKeyboardLayout(DWORD idThread) { - return NtUserxGetKeyboardLayout(idThread); + return NtUserxGetKeyboardLayout(idThread); }
@@ -137,7 +137,7 @@ UINT WINAPI GetKBCodePage(VOID) { - return GetOEMCP(); + return GetOEMCP(); }
@@ -146,27 +146,32 @@ */ int WINAPI GetKeyNameTextA(LONG lParam, - LPSTR lpString, - int nSize) -{ - LPWSTR intermediateString = - HeapAlloc(GetProcessHeap(),0,nSize * sizeof(WCHAR)); - int ret = 0; - UINT wstrLen = 0; - BOOL defChar = FALSE; - - if( !intermediateString ) return 0; - ret = GetKeyNameTextW(lParam,intermediateString,nSize); - if( ret == 0 ) { lpString[0] = 0; return 0; } - - wstrLen = wcslen( intermediateString ); - ret = WideCharToMultiByte(CP_ACP, 0, - intermediateString, wstrLen, - lpString, nSize, ".", &defChar ); - lpString[ret] = 0; - HeapFree(GetProcessHeap(),0,intermediateString); - - return ret; + LPSTR lpString, + int nSize) +{ + LPWSTR intermediateString = + HeapAlloc(GetProcessHeap(), 0, nSize * sizeof(WCHAR)); + int ret = 0; + UINT wstrLen = 0; + BOOL defChar = FALSE; + + if (!intermediateString) + return 0; + ret = GetKeyNameTextW(lParam, intermediateString, nSize); + if (ret == 0) + { + lpString[0] = 0; + return 0; + } + + wstrLen = wcslen(intermediateString); + ret = WideCharToMultiByte(CP_ACP, 0, + intermediateString, wstrLen, + lpString, nSize, ".", &defChar); + lpString[ret] = 0; + HeapFree(GetProcessHeap(), 0, intermediateString); + + return ret; }
/* @@ -174,10 +179,10 @@ */ int WINAPI GetKeyNameTextW(LONG lParam, - LPWSTR lpString, - int nSize) -{ - return NtUserGetKeyNameText( lParam, lpString, nSize ); + LPWSTR lpString, + int nSize) +{ + return NtUserGetKeyNameText(lParam, lpString, nSize); }
/* @@ -186,7 +191,7 @@ SHORT WINAPI GetKeyState(int nVirtKey) { - return (SHORT) NtUserGetKeyState((DWORD) nVirtKey); + return (SHORT)NtUserGetKeyState((DWORD)nVirtKey); }
/* @@ -195,11 +200,15 @@ BOOL WINAPI GetKeyboardLayoutNameA(LPSTR pwszKLID) { - WCHAR buf[KL_NAMELENGTH]; - - if (GetKeyboardLayoutNameW(buf)) - return WideCharToMultiByte( CP_ACP, 0, buf, -1, pwszKLID, KL_NAMELENGTH, NULL, NULL ) != 0; - return FALSE; + WCHAR buf[KL_NAMELENGTH]; + + if (!GetKeyboardLayoutNameW(buf)) + return FALSE; + + if (!WideCharToMultiByte(CP_ACP, 0, buf, -1, pwszKLID, KL_NAMELENGTH, NULL, NULL)); + return FALSE; + + return TRUE; }
@@ -209,7 +218,7 @@ BOOL WINAPI GetKeyboardLayoutNameW(LPWSTR pwszKLID) { - return NtUserGetKeyboardLayoutName( pwszKLID ); + return NtUserGetKeyboardLayoutName(pwszKLID); }
@@ -219,7 +228,7 @@ int WINAPI GetKeyboardType(int nTypeFlag) { - return NtUserxGetKeyboardType( nTypeFlag ); + return NtUserxGetKeyboardType(nTypeFlag); }
/* @@ -228,16 +237,16 @@ BOOL WINAPI GetLastInputInfo(PLASTINPUTINFO plii) { - TRACE("%p\n", plii); - - if (plii->cbSize != sizeof (*plii) ) - { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - - plii->dwTime = gpsi->dwLastRITEventTickCount; - return TRUE; + TRACE("%p\n", plii); + + if (plii->cbSize != sizeof (*plii)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + plii->dwTime = gpsi->dwLastRITEventTickCount; + return TRUE; }
/* @@ -245,11 +254,11 @@ */ HKL WINAPI LoadKeyboardLayoutA(LPCSTR pwszKLID, - UINT Flags) -{ - return NtUserLoadKeyboardLayoutEx( NULL, 0, NULL, NULL, NULL, - strtoul(pwszKLID, NULL, 16), - Flags); + UINT Flags) +{ + return NtUserLoadKeyboardLayoutEx(NULL, 0, NULL, NULL, NULL, + strtoul(pwszKLID, NULL, 16), + Flags); }
/* @@ -257,13 +266,13 @@ */ HKL WINAPI LoadKeyboardLayoutW(LPCWSTR pwszKLID, - UINT Flags) -{ - // Look at revision 25596 to see how it's done in windows. - // We will do things our own way. Also be compatible too! - return NtUserLoadKeyboardLayoutEx( NULL, 0, NULL, NULL, NULL, - wcstoul(pwszKLID, NULL, 16), - Flags); + UINT Flags) +{ + // Look at revision 25596 to see how it's done in windows. + // We will do things our own way. Also be compatible too! + return NtUserLoadKeyboardLayoutEx(NULL, 0, NULL, NULL, NULL, + wcstoul(pwszKLID, NULL, 16), + Flags); }
/* @@ -271,9 +280,9 @@ */ UINT WINAPI MapVirtualKeyA(UINT uCode, - UINT uMapType) -{ - return MapVirtualKeyExA( uCode, uMapType, GetKeyboardLayout( 0 ) ); + UINT uMapType) +{ + return MapVirtualKeyExA(uCode, uMapType, GetKeyboardLayout(0)); }
/* @@ -281,10 +290,10 @@ */ UINT WINAPI MapVirtualKeyExA(UINT uCode, - UINT uMapType, - HKL dwhkl) -{ - return MapVirtualKeyExW( uCode, uMapType, dwhkl ); + UINT uMapType, + HKL dwhkl) +{ + return MapVirtualKeyExW(uCode, uMapType, dwhkl); }
@@ -293,10 +302,10 @@ */ UINT WINAPI MapVirtualKeyExW(UINT uCode, - UINT uMapType, - HKL dwhkl) -{ - return NtUserMapVirtualKeyEx( uCode, uMapType, 0, dwhkl ); + UINT uMapType, + HKL dwhkl) +{ + return NtUserMapVirtualKeyEx(uCode, uMapType, 0, dwhkl); }
@@ -305,9 +314,9 @@ */ UINT WINAPI MapVirtualKeyW(UINT uCode, - UINT uMapType) -{ - return MapVirtualKeyExW( uCode, uMapType, GetKeyboardLayout( 0 ) ); + UINT uMapType) +{ + return MapVirtualKeyExW(uCode, uMapType, GetKeyboardLayout(0)); }
@@ -317,19 +326,19 @@ DWORD WINAPI OemKeyScan(WORD wOemChar) { - WCHAR p; - SHORT Vk; - UINT Scan; - - MultiByteToWideChar(CP_OEMCP, 0, (PCSTR)&wOemChar, 1, &p, 1); - Vk = VkKeyScanW(p); - Scan = MapVirtualKeyW((Vk & 0x00ff), 0); - if(!Scan) return -1; - /* - Page 450-1, MS W2k SuperBible by SAMS. Return, low word has the - scan code and high word has the shift state. - */ - return ((Vk & 0xff00) << 8) | Scan; + WCHAR p; + SHORT Vk; + UINT Scan; + + MultiByteToWideChar(CP_OEMCP, 0, (PCSTR)&wOemChar, 1, &p, 1); + Vk = VkKeyScanW(p); + Scan = MapVirtualKeyW((Vk & 0x00ff), 0); + if (!Scan) return -1; + /* + Page 450-1, MS W2k SuperBible by SAMS. Return, low word has the + scan code and high word has the shift state. + */ + return ((Vk & 0xff00) << 8) | Scan; }
@@ -339,10 +348,10 @@ BOOL WINAPI SetDoubleClickTime(UINT uInterval) { - return (BOOL)NtUserSystemParametersInfo(SPI_SETDOUBLECLICKTIME, - uInterval, - NULL, - 0); + return (BOOL)NtUserSystemParametersInfo(SPI_SETDOUBLECLICKTIME, + uInterval, + NULL, + 0); }
@@ -352,9 +361,9 @@ BOOL WINAPI SwapMouseButton( - BOOL fSwap) -{ - return NtUserxSwapMouseButton(fSwap); + BOOL fSwap) +{ + return NtUserxSwapMouseButton(fSwap); }
@@ -363,12 +372,12 @@ */ int WINAPI ToAscii(UINT uVirtKey, - UINT uScanCode, - CONST BYTE *lpKeyState, - LPWORD lpChar, - UINT uFlags) -{ - return ToAsciiEx(uVirtKey, uScanCode, lpKeyState, lpChar, uFlags, 0); + UINT uScanCode, + CONST BYTE *lpKeyState, + LPWORD lpChar, + UINT uFlags) +{ + return ToAsciiEx(uVirtKey, uScanCode, lpKeyState, lpChar, uFlags, 0); }
@@ -377,20 +386,20 @@ */ int WINAPI ToAsciiEx(UINT uVirtKey, - UINT uScanCode, - CONST BYTE *lpKeyState, - LPWORD lpChar, - UINT uFlags, - HKL dwhkl) -{ - WCHAR UniChars[2]; - int Ret, CharCount; - - Ret = ToUnicodeEx(uVirtKey, uScanCode, lpKeyState, UniChars, 2, uFlags, dwhkl); - CharCount = (Ret < 0 ? 1 : Ret); - WideCharToMultiByte(CP_ACP, 0, UniChars, CharCount, (LPSTR) lpChar, 2, NULL, NULL); - - return Ret; + UINT uScanCode, + CONST BYTE *lpKeyState, + LPWORD lpChar, + UINT uFlags, + HKL dwhkl) +{ + WCHAR UniChars[2]; + int Ret, CharCount; + + Ret = ToUnicodeEx(uVirtKey, uScanCode, lpKeyState, UniChars, 2, uFlags, dwhkl); + CharCount = (Ret < 0 ? 1 : Ret); + WideCharToMultiByte(CP_ACP, 0, UniChars, CharCount, (LPSTR)lpChar, 2, NULL, NULL); + + return Ret; }
@@ -399,14 +408,14 @@ */ int WINAPI ToUnicode(UINT wVirtKey, - UINT wScanCode, - CONST BYTE *lpKeyState, - LPWSTR pwszBuff, - int cchBuff, - UINT wFlags) -{ - return ToUnicodeEx( wVirtKey, wScanCode, lpKeyState, pwszBuff, cchBuff, - wFlags, 0 ); + UINT wScanCode, + CONST BYTE *lpKeyState, + LPWSTR pwszBuff, + int cchBuff, + UINT wFlags) +{ + return ToUnicodeEx(wVirtKey, wScanCode, lpKeyState, pwszBuff, cchBuff, + wFlags, 0); }
@@ -415,15 +424,15 @@ */ int WINAPI ToUnicodeEx(UINT wVirtKey, - UINT wScanCode, - CONST BYTE *lpKeyState, - LPWSTR pwszBuff, - int cchBuff, - UINT wFlags, - HKL dwhkl) -{ - return NtUserToUnicodeEx( wVirtKey, wScanCode, (PBYTE)lpKeyState, pwszBuff, cchBuff, - wFlags, dwhkl ); + UINT wScanCode, + CONST BYTE *lpKeyState, + LPWSTR pwszBuff, + int cchBuff, + UINT wFlags, + HKL dwhkl) +{ + return NtUserToUnicodeEx(wVirtKey, wScanCode, (PBYTE)lpKeyState, pwszBuff, cchBuff, + wFlags, dwhkl); }
@@ -434,12 +443,13 @@ SHORT WINAPI VkKeyScanA(CHAR ch) { - WCHAR wChar; - - if (IsDBCSLeadByte(ch)) return -1; - - MultiByteToWideChar(CP_ACP, 0, &ch, 1, &wChar, 1); - return VkKeyScanW(wChar); + WCHAR wChar; + + if (IsDBCSLeadByte(ch)) + return -1; + + MultiByteToWideChar(CP_ACP, 0, &ch, 1, &wChar, 1); + return VkKeyScanW(wChar); }
@@ -448,14 +458,15 @@ */ SHORT WINAPI VkKeyScanExA(CHAR ch, - HKL dwhkl) -{ - WCHAR wChar; - - if (IsDBCSLeadByte(ch)) return -1; - - MultiByteToWideChar(CP_ACP, 0, &ch, 1, &wChar, 1); - return VkKeyScanExW(wChar, dwhkl); + HKL dwhkl) +{ + WCHAR wChar; + + if (IsDBCSLeadByte(ch)) + return -1; + + MultiByteToWideChar(CP_ACP, 0, &ch, 1, &wChar, 1); + return VkKeyScanExW(wChar, dwhkl); }
@@ -464,9 +475,9 @@ */ SHORT WINAPI VkKeyScanExW(WCHAR ch, - HKL dwhkl) -{ - return (SHORT) NtUserVkKeyScanEx(ch, dwhkl, TRUE); + HKL dwhkl) +{ + return (SHORT) NtUserVkKeyScanEx(ch, dwhkl, TRUE); }
@@ -476,7 +487,7 @@ SHORT WINAPI VkKeyScanW(WCHAR ch) { - return (SHORT) NtUserVkKeyScanEx(ch, 0, FALSE); + return (SHORT) NtUserVkKeyScanEx(ch, 0, FALSE); }
@@ -486,23 +497,23 @@ VOID WINAPI keybd_event( - BYTE bVk, - BYTE bScan, - DWORD dwFlags, - ULONG_PTR dwExtraInfo) - - -{ - INPUT Input; - - Input.type = INPUT_KEYBOARD; - Input.ki.wVk = bVk; - Input.ki.wScan = bScan; - Input.ki.dwFlags = dwFlags; - Input.ki.time = 0; - Input.ki.dwExtraInfo = dwExtraInfo; - - NtUserSendInput(1, &Input, sizeof(INPUT)); + BYTE bVk, + BYTE bScan, + DWORD dwFlags, + ULONG_PTR dwExtraInfo) + + +{ + INPUT Input; + + Input.type = INPUT_KEYBOARD; + Input.ki.wVk = bVk; + Input.ki.wScan = bScan; + Input.ki.dwFlags = dwFlags; + Input.ki.time = 0; + Input.ki.dwExtraInfo = dwExtraInfo; + + NtUserSendInput(1, &Input, sizeof(INPUT)); }
@@ -512,23 +523,23 @@ VOID WINAPI mouse_event( - DWORD dwFlags, - DWORD dx, - DWORD dy, - DWORD dwData, - ULONG_PTR dwExtraInfo) -{ - INPUT Input; - - Input.type = INPUT_MOUSE; - Input.mi.dx = dx; - Input.mi.dy = dy; - Input.mi.mouseData = dwData; - Input.mi.dwFlags = dwFlags; - Input.mi.time = 0; - Input.mi.dwExtraInfo = dwExtraInfo; - - NtUserSendInput(1, &Input, sizeof(INPUT)); + DWORD dwFlags, + DWORD dx, + DWORD dy, + DWORD dwData, + ULONG_PTR dwExtraInfo) +{ + INPUT Input; + + Input.type = INPUT_MOUSE; + Input.mi.dx = dx; + Input.mi.dy = dy; + Input.mi.mouseData = dwData; + Input.mi.dwFlags = dwFlags; + Input.mi.time = 0; + Input.mi.dwExtraInfo = dwExtraInfo; + + NtUserSendInput(1, &Input, sizeof(INPUT)); }
/* EOF */