Author: dchapyshev Date: Sat Sep 20 08:45:10 2008 New Revision: 36348
URL: http://svn.reactos.org/svn/reactos?rev=36348&view=rev Log: - Fix formatting. No code change
Modified: trunk/reactos/dll/win32/user32/windows/caret.c trunk/reactos/dll/win32/user32/windows/clipboard.c trunk/reactos/dll/win32/user32/windows/cursor.c trunk/reactos/dll/win32/user32/windows/dc.c trunk/reactos/dll/win32/user32/windows/rect.c
Modified: trunk/reactos/dll/win32/user32/windows/caret.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/ca... ============================================================================== --- trunk/reactos/dll/win32/user32/windows/caret.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/caret.c [iso-8859-1] Sat Sep 20 08:45:10 2008 @@ -33,95 +33,120 @@ #include <wine/debug.h> /* FUNCTIONS *****************************************************************/
-void DrawCaret(HWND hWnd, PTHRDCARETINFO CaretInfo) +void +DrawCaret(HWND hWnd, + PTHRDCARETINFO CaretInfo) { - HDC hDC, hComp; + HDC hDC, hComp;
- hDC = GetDC(hWnd); - if(hDC) - { - if(CaretInfo->Bitmap && GetBitmapDimensionEx(CaretInfo->Bitmap, &CaretInfo->Size)) + hDC = GetDC(hWnd); + if(hDC) { - hComp = CreateCompatibleDC(hDC); - if(hComp) - { - SelectObject(hComp, CaretInfo->Bitmap); - BitBlt(hDC, CaretInfo->Pos.x, CaretInfo->Pos.y, CaretInfo->Size.cx, CaretInfo->Size.cy, hComp, 0, 0, SRCINVERT); - DeleteDC(hComp); - } - else - PatBlt(hDC, CaretInfo->Pos.x, CaretInfo->Pos.y, CaretInfo->Size.cx, CaretInfo->Size.cy, DSTINVERT); + if(CaretInfo->Bitmap && GetBitmapDimensionEx(CaretInfo->Bitmap, &CaretInfo->Size)) + { + hComp = CreateCompatibleDC(hDC); + if(hComp) + { + SelectObject(hComp, CaretInfo->Bitmap); + BitBlt(hDC, + CaretInfo->Pos.x, + CaretInfo->Pos.y, + CaretInfo->Size.cx, + CaretInfo->Size.cy, + hComp, + 0, + 0, + SRCINVERT); + DeleteDC(hComp); + } + else + PatBlt(hDC, + CaretInfo->Pos.x, + CaretInfo->Pos.y, + CaretInfo->Size.cx, + CaretInfo->Size.cy, + DSTINVERT); + } + else + { + PatBlt(hDC, + CaretInfo->Pos.x, + CaretInfo->Pos.y, + CaretInfo->Size.cx, + CaretInfo->Size.cy, + DSTINVERT); + } + ReleaseDC(hWnd, hDC); } - else - { - PatBlt(hDC, CaretInfo->Pos.x, CaretInfo->Pos.y, CaretInfo->Size.cx, CaretInfo->Size.cy, DSTINVERT); - } - ReleaseDC(hWnd, hDC); - } }
/* * @implemented */ -BOOL STDCALL +BOOL +STDCALL CreateCaret(HWND hWnd, - HBITMAP hBitmap, - int nWidth, - int nHeight) + HBITMAP hBitmap, + int nWidth, + int nHeight) { - return (BOOL)NtUserCreateCaret(hWnd, hBitmap, nWidth, nHeight); + return (BOOL)NtUserCreateCaret(hWnd, hBitmap, nWidth, nHeight); }
/* * @implemented */ -BOOL STDCALL +BOOL +STDCALL DestroyCaret(VOID) { - return (BOOL)NtUserCallNoParam(NOPARAM_ROUTINE_DESTROY_CARET); + return (BOOL)NtUserCallNoParam(NOPARAM_ROUTINE_DESTROY_CARET); }
/* * @implemented */ -UINT STDCALL +UINT +STDCALL GetCaretBlinkTime(VOID) { - return NtUserGetCaretBlinkTime(); + return NtUserGetCaretBlinkTime(); }
/* * @implemented */ -BOOL STDCALL +BOOL +STDCALL GetCaretPos(LPPOINT lpPoint) { - return (BOOL)NtUserGetCaretPos(lpPoint); + return (BOOL)NtUserGetCaretPos(lpPoint); }
/* * @implemented */ -BOOL STDCALL +BOOL +STDCALL SetCaretBlinkTime(UINT uMSeconds) { - return NtUserSetCaretBlinkTime(uMSeconds); + return NtUserSetCaretBlinkTime(uMSeconds); }
/* * @implemented */ -BOOL STDCALL +BOOL +STDCALL SetCaretPos(int X, - int Y) + int Y) { - return NtUserSetCaretPos(X, Y); + return NtUserSetCaretPos(X, Y); }
- /* EOF */
Modified: trunk/reactos/dll/win32/user32/windows/clipboard.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/cl... ============================================================================== --- trunk/reactos/dll/win32/user32/windows/clipboard.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/clipboard.c [iso-8859-1] Sat Sep 20 08:45:10 2008 @@ -26,17 +26,19 @@ /* * @implemented */ -BOOL STDCALL +BOOL +STDCALL OpenClipboard(HWND hWndNewOwner) { - BOOL ret = NtUserOpenClipboard(hWndNewOwner, 0); - return ret; -} - -/* - * @implemented - */ -BOOL STDCALL + BOOL ret = NtUserOpenClipboard(hWndNewOwner, 0); + return ret; +} + +/* + * @implemented + */ +BOOL +STDCALL CloseClipboard(VOID) { BOOL ret; @@ -47,7 +49,8 @@ /* * @implemented */ -INT STDCALL +INT +STDCALL CountClipboardFormats(VOID) { INT ret = NtUserCountClipboardFormats(); @@ -57,7 +60,8 @@ /* * @implemented */ -BOOL STDCALL +BOOL +STDCALL EmptyClipboard(VOID) { return NtUserEmptyClipboard(); @@ -66,7 +70,8 @@ /* * @implemented */ -UINT STDCALL +UINT +STDCALL EnumClipboardFormats(UINT format) { UINT ret = NtUserCallOneParam(format, ONEPARAM_ROUTINE_ENUMCLIPBOARDFORMATS); @@ -76,7 +81,8 @@ /* * @implemented */ -HANDLE STDCALL +HANDLE +STDCALL GetClipboardData(UINT uFormat) { HGLOBAL hGlobal = NULL; @@ -109,8 +115,11 @@ /* * @implemented */ -INT STDCALL -GetClipboardFormatNameA(UINT format, LPSTR lpszFormatName, int cchMaxCount) +INT +STDCALL +GetClipboardFormatNameA(UINT format, + LPSTR lpszFormatName, + int cchMaxCount) { LPWSTR lpBuffer; UNICODE_STRING FormatName; @@ -123,32 +132,35 @@ return 0; }
- FormatName.Length = 0; - FormatName.MaximumLength = cchMaxCount * sizeof(WCHAR); - FormatName.Buffer = lpBuffer; + FormatName.Length = 0; + FormatName.MaximumLength = cchMaxCount * sizeof(WCHAR); + FormatName.Buffer = lpBuffer;
/* we need a UNICODE string */ - Length = NtUserGetClipboardFormatName(format, &FormatName, cchMaxCount); - - if (Length != 0) - { - if (!WideCharToMultiByte(CP_ACP, 0, lpBuffer, Length, lpszFormatName, cchMaxCount, NULL, NULL)) - { - /* clear result string */ - Length = 0; - } - lpszFormatName[Length] = '\0'; - } - - RtlFreeHeap(RtlGetProcessHeap(), 0, lpBuffer); - return Length; -} - -/* - * @implemented - */ -INT STDCALL -GetClipboardFormatNameW(UINT format, LPWSTR lpszFormatName, INT cchMaxCount) + Length = NtUserGetClipboardFormatName(format, &FormatName, cchMaxCount); + + if (Length != 0) + { + if (!WideCharToMultiByte(CP_ACP, 0, lpBuffer, Length, lpszFormatName, cchMaxCount, NULL, NULL)) + { + /* clear result string */ + Length = 0; + } + lpszFormatName[Length] = '\0'; + } + + RtlFreeHeap(RtlGetProcessHeap(), 0, lpBuffer); + return Length; +} + +/* + * @implemented + */ +INT +STDCALL +GetClipboardFormatNameW(UINT format, + LPWSTR lpszFormatName, + INT cchMaxCount) { UNICODE_STRING FormatName; ULONG Ret; @@ -164,43 +176,48 @@ /* * @implemented */ -HWND STDCALL +HWND +STDCALL GetClipboardOwner(VOID) { - return NtUserGetClipboardOwner(); -} - -/* - * @implemented - */ -DWORD STDCALL + return NtUserGetClipboardOwner(); +} + +/* + * @implemented + */ +DWORD +STDCALL GetClipboardSequenceNumber(VOID) { - return NtUserGetClipboardSequenceNumber(); -} - -/* - * @implemented - */ -HWND STDCALL + return NtUserGetClipboardSequenceNumber(); +} + +/* + * @implemented + */ +HWND +STDCALL GetClipboardViewer(VOID) { - return NtUserGetClipboardViewer(); -} - -/* - * @implemented - */ -HWND STDCALL + return NtUserGetClipboardViewer(); +} + +/* + * @implemented + */ +HWND +STDCALL GetOpenClipboardWindow(VOID) { - return NtUserGetOpenClipboardWindow(); -} - -/* - * @implemented - */ -INT STDCALL + return NtUserGetOpenClipboardWindow(); +} + +/* + * @implemented + */ +INT +STDCALL GetPriorityClipboardFormat(UINT *paFormatPriorityList, INT cFormats) { INT ret = NtUserGetPriorityClipboardFormat(paFormatPriorityList, cFormats); @@ -210,7 +227,8 @@ /* * @implemented */ -BOOL STDCALL +BOOL +STDCALL IsClipboardFormatAvailable(UINT format) { BOOL ret = NtUserIsClipboardFormatAvailable(format); @@ -221,7 +239,8 @@ * @implemented */
-UINT STDCALL +UINT +STDCALL RegisterClipboardFormatA(LPCSTR lpszFormat) { UINT ret = 0; @@ -253,7 +272,8 @@ /* * @implemented */ -UINT STDCALL +UINT +STDCALL RegisterClipboardFormatW(LPCWSTR lpszFormat) { UINT ret = 0; @@ -278,71 +298,73 @@ return ret; }
-HGLOBAL renderLocale (DWORD Locale) -{ - DWORD* pLocale; - HGLOBAL hGlobal; - - hGlobal = GlobalAlloc(GMEM_DDESHARE | GMEM_MOVEABLE, sizeof(DWORD)); - - if(!hGlobal) - { - return hGlobal; - } +HGLOBAL +renderLocale(DWORD Locale) +{ + DWORD* pLocale; + HGLOBAL hGlobal; + + hGlobal = GlobalAlloc(GMEM_DDESHARE | GMEM_MOVEABLE, sizeof(DWORD)); + + if(!hGlobal) + { + return hGlobal; + }
pLocale = (DWORD*)GlobalLock(hGlobal);
- *pLocale = Locale; - - GlobalUnlock(hGlobal); - - return hGlobal; -} - -/* - * @implemented - */ -HANDLE STDCALL + *pLocale = Locale; + + GlobalUnlock(hGlobal); + + return hGlobal; +} + +/* + * @implemented + */ +HANDLE +STDCALL SetClipboardData(UINT uFormat, HANDLE hMem) { - DWORD size; - LPVOID pMem; - HANDLE ret = NULL; - - if (hMem == NULL) - { - return NtUserSetClipboardData(uFormat, 0, 0); - } - - if (uFormat == CF_BITMAP) - { - /* GlobalLock should return 0 for GDI handles - pMem = GlobalLock(hMem); - if (pMem) - { - // not a GDI handle - GlobalUnlock(hMem); - return ret; - } - else - { - */ - /* check if this GDI handle is a HBITMAP */ - /* GetObject for HBITMAP not implemented in ReactOS */ - //if (GetObject(hMem, 0, NULL) == sifeof(BITMAP)) - //{ - return NtUserSetClipboardData(CF_BITMAP, hMem, 0); - //} - /*}*/ - } + DWORD size; + LPVOID pMem; + HANDLE ret = NULL; + + if (hMem == NULL) + { + return NtUserSetClipboardData(uFormat, 0, 0); + } + + if (uFormat == CF_BITMAP) + { + /* GlobalLock should return 0 for GDI handles + pMem = GlobalLock(hMem); + if (pMem) + { + // not a GDI handle + GlobalUnlock(hMem); + return ret; + } + else + { + */ + /* check if this GDI handle is a HBITMAP */ + /* GetObject for HBITMAP not implemented in ReactOS */ + //if (GetObject(hMem, 0, NULL) == sifeof(BITMAP)) + //{ + return NtUserSetClipboardData(CF_BITMAP, hMem, 0); + //} + /*}*/ + }
size = GlobalSize(hMem); pMem = GlobalLock(hMem);
- if ((pMem) && (size)) - { - size = GlobalSize(hMem); - ret = NtUserSetClipboardData(uFormat, pMem, size); + if ((pMem) && (size)) + { + size = GlobalSize(hMem); + ret = NtUserSetClipboardData(uFormat, pMem, size); //should i unlock hMem? GlobalUnlock(hMem); } @@ -358,25 +380,29 @@ /* * @implemented */ -HWND STDCALL +HWND +STDCALL SetClipboardViewer(HWND hWndNewViewer) { - return NtUserSetClipboardViewer(hWndNewViewer); -} - -/* - * @implemented - */ -BOOL STDCALL -ChangeClipboardChain(HWND hWndRemove, HWND hWndNewNext) -{ - return NtUserChangeClipboardChain(hWndRemove, hWndNewNext); + return NtUserSetClipboardViewer(hWndNewViewer); +} + +/* + * @implemented + */ +BOOL +STDCALL +ChangeClipboardChain(HWND hWndRemove, + HWND hWndNewNext) +{ + return NtUserChangeClipboardChain(hWndRemove, hWndNewNext); }
/* * @unimplemented */ -BOOL STDCALL +BOOL +STDCALL AddClipboardFormatListener(HWND hwnd) { UNIMPLEMENTED; @@ -385,7 +411,8 @@ /* * @unimplemented */ -BOOL STDCALL +BOOL +STDCALL RemoveClipboardFormatListener(HWND hwnd) { UNIMPLEMENTED; @@ -395,11 +422,11 @@ /* * @unimplemented */ -BOOL STDCALL -GetUpdatedClipboardFormats( - PUINT lpuiFormats, - UINT cFormats, - PUINT pcFormatsOut) +BOOL +STDCALL +GetUpdatedClipboardFormats(PUINT lpuiFormats, + UINT cFormats, + PUINT pcFormatsOut) { UNIMPLEMENTED; return FALSE;
Modified: trunk/reactos/dll/win32/user32/windows/cursor.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/cu... ============================================================================== --- trunk/reactos/dll/win32/user32/windows/cursor.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/cursor.c [iso-8859-1] Sat Sep 20 08:45:10 2008 @@ -42,25 +42,27 @@ /* INTERNAL ******************************************************************/
/* This callback routine is called directly after switching to gui mode */ -NTSTATUS STDCALL -User32SetupDefaultCursors(PVOID Arguments, ULONG ArgumentLength) -{ - BOOL *DefaultCursor = (BOOL*)Arguments; - LRESULT Result = TRUE; - - if(*DefaultCursor) - { - /* set default cursor */ - SetCursor(LoadCursorW(0, (LPCWSTR)IDC_ARROW)); - } - else - { - /* FIXME load system cursor scheme */ - SetCursor(0); - SetCursor(LoadCursorW(0, (LPCWSTR)IDC_ARROW)); - } - - return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS)); +NTSTATUS +STDCALL +User32SetupDefaultCursors(PVOID Arguments, + ULONG ArgumentLength) +{ + BOOL *DefaultCursor = (BOOL*)Arguments; + LRESULT Result = TRUE; + + if(*DefaultCursor) + { + /* set default cursor */ + SetCursor(LoadCursorW(0, (LPCWSTR)IDC_ARROW)); + } + else + { + /* FIXME load system cursor scheme */ + SetCursor(0); + SetCursor(LoadCursorW(0, (LPCWSTR)IDC_ARROW)); + } + + return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS)); }
/* FUNCTIONS *****************************************************************/ @@ -69,270 +71,301 @@ /* * @implemented */ -HCURSOR STDCALL +HCURSOR +STDCALL CopyCursor(HCURSOR pcur) { - ICONINFO IconInfo; - - if(GetIconInfo((HANDLE)pcur, &IconInfo)) - { + ICONINFO IconInfo; + + if(GetIconInfo((HANDLE)pcur, &IconInfo)) + { + return (HCURSOR)NtUserCreateCursorIconHandle(&IconInfo, FALSE); + } + return (HCURSOR)0; +} + +/* + * @implemented + */ +HCURSOR +STDCALL +CreateCursor(HINSTANCE hInst, + int xHotSpot, + int yHotSpot, + int nWidth, + int nHeight, + CONST VOID *pvANDPlane, + CONST VOID *pvXORPlane) +{ + ICONINFO IconInfo; + BYTE BitmapInfoBuffer[sizeof(BITMAPINFOHEADER) + 2 * sizeof(RGBQUAD)]; + BITMAPINFO *bwBIH = (BITMAPINFO *)BitmapInfoBuffer; + HDC hScreenDc; + + hScreenDc = CreateCompatibleDC(NULL); + if (hScreenDc == NULL) + return NULL; + + bwBIH->bmiHeader.biBitCount = 1; + bwBIH->bmiHeader.biWidth = nWidth; + bwBIH->bmiHeader.biHeight = -nHeight * 2; + bwBIH->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bwBIH->bmiHeader.biPlanes = 1; + bwBIH->bmiHeader.biSizeImage = 0; + bwBIH->bmiHeader.biCompression = BI_RGB; + bwBIH->bmiHeader.biClrImportant = 0; + bwBIH->bmiHeader.biClrUsed = 0; + bwBIH->bmiHeader.biXPelsPerMeter = 0; + bwBIH->bmiHeader.biYPelsPerMeter = 0; + + bwBIH->bmiColors[0].rgbBlue = 0; + bwBIH->bmiColors[0].rgbGreen = 0; + bwBIH->bmiColors[0].rgbRed = 0; + bwBIH->bmiColors[0].rgbReserved = 0; + + bwBIH->bmiColors[1].rgbBlue = 0xff; + bwBIH->bmiColors[1].rgbGreen = 0xff; + bwBIH->bmiColors[1].rgbRed = 0xff; + bwBIH->bmiColors[1].rgbReserved = 0; + + IconInfo.hbmMask = CreateDIBitmap(hScreenDc, &bwBIH->bmiHeader, 0, + NULL, bwBIH, DIB_RGB_COLORS); + if (IconInfo.hbmMask) + { + SetDIBits(hScreenDc, IconInfo.hbmMask, 0, nHeight, + pvXORPlane, bwBIH, DIB_RGB_COLORS); + SetDIBits(hScreenDc, IconInfo.hbmMask, nHeight, nHeight, + pvANDPlane, bwBIH, DIB_RGB_COLORS); + } + else + { + return NULL; + } + + DeleteDC(hScreenDc); + + IconInfo.fIcon = FALSE; + IconInfo.xHotspot = xHotSpot; + IconInfo.yHotspot = yHotSpot; + IconInfo.hbmColor = 0; + return (HCURSOR)NtUserCreateCursorIconHandle(&IconInfo, FALSE); - } - return (HCURSOR)0; -} - -/* - * @implemented - */ -HCURSOR STDCALL -CreateCursor(HINSTANCE hInst, - int xHotSpot, - int yHotSpot, - int nWidth, - int nHeight, - CONST VOID *pvANDPlane, - CONST VOID *pvXORPlane) -{ - ICONINFO IconInfo; - BYTE BitmapInfoBuffer[sizeof(BITMAPINFOHEADER) + 2 * sizeof(RGBQUAD)]; - BITMAPINFO *bwBIH = (BITMAPINFO *)BitmapInfoBuffer; - HDC hScreenDc; - - hScreenDc = CreateCompatibleDC(NULL); - if (hScreenDc == NULL) - return NULL; - - bwBIH->bmiHeader.biBitCount = 1; - bwBIH->bmiHeader.biWidth = nWidth; - bwBIH->bmiHeader.biHeight = -nHeight * 2; - bwBIH->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - bwBIH->bmiHeader.biPlanes = 1; - bwBIH->bmiHeader.biSizeImage = 0; - bwBIH->bmiHeader.biCompression = BI_RGB; - bwBIH->bmiHeader.biClrImportant = 0; - bwBIH->bmiHeader.biClrUsed = 0; - bwBIH->bmiHeader.biXPelsPerMeter = 0; - bwBIH->bmiHeader.biYPelsPerMeter = 0; - - bwBIH->bmiColors[0].rgbBlue = 0; - bwBIH->bmiColors[0].rgbGreen = 0; - bwBIH->bmiColors[0].rgbRed = 0; - bwBIH->bmiColors[0].rgbReserved = 0; - - bwBIH->bmiColors[1].rgbBlue = 0xff; - bwBIH->bmiColors[1].rgbGreen = 0xff; - bwBIH->bmiColors[1].rgbRed = 0xff; - bwBIH->bmiColors[1].rgbReserved = 0; - - IconInfo.hbmMask = CreateDIBitmap(hScreenDc, &bwBIH->bmiHeader, 0, - NULL, bwBIH, DIB_RGB_COLORS); - if (IconInfo.hbmMask) - { - SetDIBits(hScreenDc, IconInfo.hbmMask, 0, nHeight, - pvXORPlane, bwBIH, DIB_RGB_COLORS); - SetDIBits(hScreenDc, IconInfo.hbmMask, nHeight, nHeight, - pvANDPlane, bwBIH, DIB_RGB_COLORS); - } - else - { - return NULL; - } - - DeleteDC(hScreenDc); - - IconInfo.fIcon = FALSE; - IconInfo.xHotspot = xHotSpot; - IconInfo.yHotspot = yHotSpot; - IconInfo.hbmColor = 0; - - return (HCURSOR)NtUserCreateCursorIconHandle(&IconInfo, FALSE); -} - - -/* - * @implemented - */ -BOOL STDCALL +} + + +/* + * @implemented + */ +BOOL +STDCALL DestroyCursor(HCURSOR hCursor) { - return (BOOL)NtUserDestroyCursor((HANDLE)hCursor, 0); -} - - -/* - * @implemented - */ -BOOL STDCALL + return (BOOL)NtUserDestroyCursor((HANDLE)hCursor, 0); +} + + +/* + * @implemented + */ +BOOL +STDCALL GetClipCursor(LPRECT lpRect) { - return NtUserGetClipCursor(lpRect); -} - - -/* - * @implemented - */ -HCURSOR STDCALL + return NtUserGetClipCursor(lpRect); +} + + +/* + * @implemented + */ +HCURSOR +STDCALL GetCursor(VOID) { - CURSORINFO ci; - ci.cbSize = sizeof(CURSORINFO); - if(NtUserGetCursorInfo(&ci)) - return ci.hCursor; - else - return (HCURSOR)0; -} - - -/* - * @implemented - */ -BOOL STDCALL + CURSORINFO ci; + ci.cbSize = sizeof(CURSORINFO); + if(NtUserGetCursorInfo(&ci)) + return ci.hCursor; + else + return (HCURSOR)0; +} + + +/* + * @implemented + */ +BOOL +STDCALL GetCursorInfo(PCURSORINFO pci) { - return (BOOL)NtUserGetCursorInfo(pci); -} - - -/* - * @implemented - */ -BOOL STDCALL + return (BOOL)NtUserGetCursorInfo(pci); +} + + +/* + * @implemented + */ +BOOL +STDCALL GetCursorPos(LPPOINT lpPoint) { - BOOL res; - /* Windows doesn't check if lpPoint == NULL, we do */ - if(!lpPoint) - { - SetLastError(ERROR_INVALID_PARAMETER); + BOOL res; + /* Windows doesn't check if lpPoint == NULL, we do */ + if(!lpPoint) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + res = NtUserGetCursorPos(lpPoint); + + return res; +} + + +/* + * @implemented + */ +HCURSOR +STDCALL +LoadCursorA(HINSTANCE hInstance, + LPCSTR lpCursorName) +{ + return(LoadImageA(hInstance, + lpCursorName, + IMAGE_CURSOR, + 0, + 0, + LR_SHARED | LR_DEFAULTSIZE)); +} + + +/* + * @implemented + */ +HCURSOR +STDCALL +LoadCursorFromFileA(LPCSTR lpFileName) +{ + UNICODE_STRING FileName; + HCURSOR Result; + RtlCreateUnicodeStringFromAsciiz(&FileName, (LPSTR)lpFileName); + Result = LoadImageW(0, + FileName.Buffer, + IMAGE_CURSOR, + 0, + 0, + LR_LOADFROMFILE | LR_DEFAULTSIZE); + RtlFreeUnicodeString(&FileName); + return(Result); +} + + +/* + * @implemented + */ +HCURSOR +STDCALL +LoadCursorFromFileW(LPCWSTR lpFileName) +{ + return(LoadImageW(0, + lpFileName, + IMAGE_CURSOR, + 0, + 0, + LR_LOADFROMFILE | LR_DEFAULTSIZE)); +} + + +/* + * @implemented + */ +HCURSOR +STDCALL +LoadCursorW(HINSTANCE hInstance, + LPCWSTR lpCursorName) +{ + return(LoadImageW(hInstance, + lpCursorName, + IMAGE_CURSOR, + 0, + 0, + LR_SHARED | LR_DEFAULTSIZE)); +} + + +/* + * @implemented + */ +BOOL +STDCALL +ClipCursor(CONST RECT *lpRect) +{ + return NtUserClipCursor((RECT *)lpRect); +} + + +/* + * @implemented + */ +HCURSOR +STDCALL +SetCursor(HCURSOR hCursor) +{ + return NtUserSetCursor(hCursor); +} + + +/* + * @implemented + */ +BOOL +STDCALL +SetCursorPos(int X, + int Y) +{ + INPUT Input; + + Input.type = INPUT_MOUSE; + Input.mi.dx = (LONG)X; + Input.mi.dy = (LONG)Y; + Input.mi.mouseData = 0; + Input.mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE; + Input.mi.time = 0; + Input.mi.dwExtraInfo = 0; + + NtUserSendInput(1, &Input, sizeof(INPUT)); + return TRUE; +} + + +/* + * @unimplemented + */ +BOOL +STDCALL +SetSystemCursor(HCURSOR hcur, + DWORD id) +{ + UNIMPLEMENTED; return FALSE; - } - - res = NtUserGetCursorPos(lpPoint); - - return res; -} - - -/* - * @implemented - */ -HCURSOR STDCALL -LoadCursorA(HINSTANCE hInstance, - LPCSTR lpCursorName) -{ - return(LoadImageA(hInstance, lpCursorName, IMAGE_CURSOR, 0, 0, - LR_SHARED | LR_DEFAULTSIZE)); -} - - -/* - * @implemented - */ -HCURSOR STDCALL -LoadCursorFromFileA(LPCSTR lpFileName) -{ - UNICODE_STRING FileName; - HCURSOR Result; - RtlCreateUnicodeStringFromAsciiz(&FileName, (LPSTR)lpFileName); - Result = LoadImageW(0, FileName.Buffer, IMAGE_CURSOR, 0, 0, - LR_LOADFROMFILE | LR_DEFAULTSIZE); - RtlFreeUnicodeString(&FileName); - return(Result); -} - - -/* - * @implemented - */ -HCURSOR STDCALL -LoadCursorFromFileW(LPCWSTR lpFileName) -{ - return(LoadImageW(0, lpFileName, IMAGE_CURSOR, 0, 0, - LR_LOADFROMFILE | LR_DEFAULTSIZE)); -} - - -/* - * @implemented - */ -HCURSOR STDCALL -LoadCursorW(HINSTANCE hInstance, - LPCWSTR lpCursorName) -{ - return(LoadImageW(hInstance, lpCursorName, IMAGE_CURSOR, 0, 0, - LR_SHARED | LR_DEFAULTSIZE)); -} - - -/* - * @implemented - */ -BOOL -STDCALL -ClipCursor( - CONST RECT *lpRect) -{ - return NtUserClipCursor((RECT *)lpRect); -} - - -/* - * @implemented - */ -HCURSOR STDCALL -SetCursor(HCURSOR hCursor) -{ - return NtUserSetCursor(hCursor); -} - - -/* - * @implemented - */ -BOOL STDCALL -SetCursorPos(int X, - int Y) -{ - INPUT Input; - - Input.type = INPUT_MOUSE; - Input.mi.dx = (LONG)X; - Input.mi.dy = (LONG)Y; - Input.mi.mouseData = 0; - Input.mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE; - Input.mi.time = 0; - Input.mi.dwExtraInfo = 0; - - NtUserSendInput(1, &Input, sizeof(INPUT)); - return TRUE; -} - - -/* - * @unimplemented - */ -BOOL STDCALL -SetSystemCursor(HCURSOR hcur, - DWORD id) -{ - UNIMPLEMENTED; - return FALSE; -} - - -/* - * @implemented - */ -int STDCALL +} + + +/* + * @implemented + */ +int +STDCALL ShowCursor(BOOL bShow) { - return NtUserShowCursor(bShow); -} - -HCURSOR -CursorIconToCursor(HICON hIcon, BOOL SemiTransparent) -{ - UNIMPLEMENTED; - return 0; -} + return NtUserShowCursor(bShow); +} + +HCURSOR +CursorIconToCursor(HICON hIcon, + BOOL SemiTransparent) +{ + UNIMPLEMENTED; + return 0; +}
Modified: trunk/reactos/dll/win32/user32/windows/dc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/dc... ============================================================================== --- trunk/reactos/dll/win32/user32/windows/dc.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/dc.c [iso-8859-1] Sat Sep 20 08:45:10 2008 @@ -39,10 +39,9 @@ */ HDC STDCALL -GetDC( - HWND hWnd) +GetDC(HWND hWnd) { - return NtUserGetDC(hWnd); + return NtUserGetDC(hWnd); }
@@ -51,12 +50,11 @@ */ HDC STDCALL -GetDCEx( - HWND hWnd, - HRGN hrgnClip, - DWORD flags) +GetDCEx(HWND hWnd, + HRGN hrgnClip, + DWORD flags) { - return NtUserGetDCEx(hWnd, hrgnClip, flags); + return NtUserGetDCEx(hWnd, hrgnClip, flags); }
@@ -65,32 +63,32 @@ */ HDC STDCALL -GetWindowDC( - HWND hWnd) +GetWindowDC(HWND hWnd) { - return (HDC)NtUserGetWindowDC(hWnd); + return (HDC)NtUserGetWindowDC(hWnd); }
-BOOL STDCALL GdiReleaseDC(HDC hdc); +BOOL +STDCALL +GdiReleaseDC(HDC hdc);
/* * @implemented */ int STDCALL -ReleaseDC( - HWND hWnd, - HDC hDC) +ReleaseDC(HWND hWnd, + HDC hDC) { - // From msdn: if the DC was not released return zero. - // if the DC was released return one. + // From msdn: if the DC was not released return zero. + // if the DC was released return one.
- if (!hDC) return FALSE; // Null hDC return zero. + if (!hDC) return FALSE; // Null hDC return zero.
- GdiReleaseDC ( hDC ); // Release locals. - // Win 3.1 throw back, hWnd is ignored and not used. - return NtUserCallOneParam( (DWORD) hDC, ONEPARAM_ROUTINE_RELEASEDC); + GdiReleaseDC ( hDC ); // Release locals. + // Win 3.1 throw back, hWnd is ignored and not used. + return NtUserCallOneParam((DWORD) hDC, ONEPARAM_ROUTINE_RELEASEDC); }
@@ -99,8 +97,7 @@ */ HWND STDCALL -WindowFromDC( - HDC hDC) +WindowFromDC(HDC hDC) { - return NtUserWindowFromDC(hDC); + return NtUserWindowFromDC(hDC); }
Modified: trunk/reactos/dll/win32/user32/windows/rect.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/re... ============================================================================== --- trunk/reactos/dll/win32/user32/windows/rect.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/rect.c [iso-8859-1] Sat Sep 20 08:45:10 2008 @@ -37,202 +37,227 @@ /* * @implemented */ -BOOL STDCALL -CopyRect(LPRECT lprcDst, CONST RECT *lprcSrc) -{ - if(lprcDst == NULL || lprcSrc == NULL) - return(FALSE); - - *lprcDst = *lprcSrc; - return(TRUE); -} - - -/* - * @implemented - */ -BOOL STDCALL -EqualRect( - CONST RECT *lprc1, - CONST RECT *lprc2) -{ - if (lprc1 == NULL || lprc2 == NULL) - return FALSE; - - return (lprc1->left == lprc2->left) && (lprc1->top == lprc2->top) && - (lprc1->right == lprc2->right) && (lprc1->bottom == lprc2->bottom); -} - - -/* - * @implemented - */ -BOOL STDCALL -InflateRect(LPRECT rect, int dx, int dy) -{ - rect->left -= dx; - rect->top -= dy; - rect->right += dx; - rect->bottom += dy; - return(TRUE); -} - - -/* - * @implemented - */ -BOOL STDCALL +BOOL +STDCALL +CopyRect(LPRECT lprcDst, + CONST RECT *lprcSrc) +{ + if(lprcDst == NULL || lprcSrc == NULL) + return(FALSE); + + *lprcDst = *lprcSrc; + return(TRUE); +} + + +/* + * @implemented + */ +BOOL +STDCALL +EqualRect(CONST RECT *lprc1, + CONST RECT *lprc2) +{ + if (lprc1 == NULL || lprc2 == NULL) + return FALSE; + + return (lprc1->left == lprc2->left) && (lprc1->top == lprc2->top) && + (lprc1->right == lprc2->right) && (lprc1->bottom == lprc2->bottom); +} + + +/* + * @implemented + */ +BOOL +STDCALL +InflateRect(LPRECT rect, + int dx, + int dy) +{ + rect->left -= dx; + rect->top -= dy; + rect->right += dx; + rect->bottom += dy; + return(TRUE); +} + + +/* + * @implemented + */ +BOOL +STDCALL IntersectRect(LPRECT lprcDst, - CONST RECT *lprcSrc1, - CONST RECT *lprcSrc2) -{ - if (IsRectEmpty(lprcSrc1) || IsRectEmpty(lprcSrc2) || - lprcSrc1->left >= lprcSrc2->right || - lprcSrc2->left >= lprcSrc1->right || - lprcSrc1->top >= lprcSrc2->bottom || - lprcSrc2->top >= lprcSrc1->bottom) - { - SetRectEmpty(lprcDst); - return(FALSE); - } - lprcDst->left = max(lprcSrc1->left, lprcSrc2->left); - lprcDst->right = min(lprcSrc1->right, lprcSrc2->right); - lprcDst->top = max(lprcSrc1->top, lprcSrc2->top); - lprcDst->bottom = min(lprcSrc1->bottom, lprcSrc2->bottom); - return(TRUE); -} - - -/* - * @implemented - */ -BOOL STDCALL + CONST RECT *lprcSrc1, + CONST RECT *lprcSrc2) +{ + if (IsRectEmpty(lprcSrc1) || IsRectEmpty(lprcSrc2) || + lprcSrc1->left >= lprcSrc2->right || + lprcSrc2->left >= lprcSrc1->right || + lprcSrc1->top >= lprcSrc2->bottom || + lprcSrc2->top >= lprcSrc1->bottom) + { + SetRectEmpty(lprcDst); + return(FALSE); + } + lprcDst->left = max(lprcSrc1->left, lprcSrc2->left); + lprcDst->right = min(lprcSrc1->right, lprcSrc2->right); + lprcDst->top = max(lprcSrc1->top, lprcSrc2->top); + lprcDst->bottom = min(lprcSrc1->bottom, lprcSrc2->bottom); + return(TRUE); +} + + +/* + * @implemented + */ +BOOL +STDCALL IsRectEmpty(CONST RECT *lprc) { - return((lprc->left >= lprc->right) || (lprc->top >= lprc->bottom)); -} - - -/* - * @implemented - */ -BOOL STDCALL -OffsetRect(LPRECT rect, int dx, int dy) -{ - if(rect == NULL) - return(FALSE); - - rect->left += dx; - rect->top += dy; - rect->right += dx; - rect->bottom += dy; - return(TRUE); -} - - -/* - * @implemented - */ -BOOL STDCALL -PtInRect(CONST RECT *lprc, POINT pt) -{ - return((pt.x >= lprc->left) && (pt.x < lprc->right) && - (pt.y >= lprc->top) && (pt.y < lprc->bottom)); -} - -BOOL STDCALL -SetRect(LPRECT lprc, int xLeft, int yTop, int xRight, int yBottom) -{ - lprc->left = xLeft; - lprc->top = yTop; - lprc->right = xRight; - lprc->bottom = yBottom; - return(TRUE); -} - - -/* - * @implemented - */ -BOOL STDCALL + return((lprc->left >= lprc->right) || (lprc->top >= lprc->bottom)); +} + + +/* + * @implemented + */ +BOOL +STDCALL +OffsetRect(LPRECT rect, + int dx, + int dy) +{ + if(rect == NULL) + return(FALSE); + + rect->left += dx; + rect->top += dy; + rect->right += dx; + rect->bottom += dy; + return(TRUE); +} + + +/* + * @implemented + */ +BOOL +STDCALL +PtInRect(CONST RECT *lprc, + POINT pt) +{ + return((pt.x >= lprc->left) && (pt.x < lprc->right) && + (pt.y >= lprc->top) && (pt.y < lprc->bottom)); +} + +BOOL +STDCALL +SetRect(LPRECT lprc, + int xLeft, + int yTop, + int xRight, + int yBottom) +{ + lprc->left = xLeft; + lprc->top = yTop; + lprc->right = xRight; + lprc->bottom = yBottom; + return(TRUE); +} + + +/* + * @implemented + */ +BOOL +STDCALL SetRectEmpty(LPRECT lprc) { - lprc->left = lprc->right = lprc->top = lprc->bottom = 0; - return(TRUE); -} - - -/* - * @implemented - */ -BOOL STDCALL -SubtractRect(LPRECT lprcDst, CONST RECT *lprcSrc1, CONST RECT *lprcSrc2) -{ - RECT tempRect; - - if(lprcDst == NULL || lprcSrc1 == NULL || lprcSrc2 == NULL) - return(FALSE); - - CopyRect(lprcDst, lprcSrc1); - - if(!IntersectRect(&tempRect, lprcSrc1, lprcSrc2)) - return(TRUE); - - if (EqualRect(&tempRect, lprcDst)) - { - SetRectEmpty(lprcDst); - return FALSE; - } - if(lprcDst->top == tempRect.top && lprcDst->bottom == tempRect.bottom) - { - if(lprcDst->left == tempRect.left) - lprcDst->left = tempRect.right; - else if(lprcDst->right == tempRect.right) - lprcDst->right = tempRect.left; - } - else if(lprcDst->left == tempRect.left && lprcDst->right == tempRect.right) - { - if(lprcDst->top == tempRect.top) - lprcDst->top = tempRect.bottom; - else if(lprcDst->right == tempRect.right) - lprcDst->right = tempRect.left; - } - - return(TRUE); -} - - -/* - * @implemented - */ -BOOL STDCALL -UnionRect(LPRECT lprcDst, CONST RECT *lprcSrc1, CONST RECT *lprcSrc2) -{ - if (IsRectEmpty(lprcSrc1)) - { - if (IsRectEmpty(lprcSrc2)) - { - SetRectEmpty(lprcDst); - return(FALSE); - } - else - { - *lprcDst = *lprcSrc2; - } - } - else - { - if (IsRectEmpty(lprcSrc2)) - { - *lprcDst = *lprcSrc1; - } - else - { - lprcDst->left = min(lprcSrc1->left, lprcSrc2->left); - lprcDst->top = min(lprcSrc1->top, lprcSrc2->top); - lprcDst->right = max(lprcSrc1->right, lprcSrc2->right); - lprcDst->bottom = max(lprcSrc1->bottom, lprcSrc2->bottom); - } - } - return(TRUE); -} + lprc->left = lprc->right = lprc->top = lprc->bottom = 0; + return(TRUE); +} + + +/* + * @implemented + */ +BOOL +STDCALL +SubtractRect(LPRECT lprcDst, + CONST RECT *lprcSrc1, + CONST RECT *lprcSrc2) +{ + RECT tempRect; + + if(lprcDst == NULL || lprcSrc1 == NULL || lprcSrc2 == NULL) + return(FALSE); + + CopyRect(lprcDst, lprcSrc1); + + if(!IntersectRect(&tempRect, lprcSrc1, lprcSrc2)) + return(TRUE); + + if (EqualRect(&tempRect, lprcDst)) + { + SetRectEmpty(lprcDst); + return FALSE; + } + if(lprcDst->top == tempRect.top && lprcDst->bottom == tempRect.bottom) + { + if(lprcDst->left == tempRect.left) + lprcDst->left = tempRect.right; + else if(lprcDst->right == tempRect.right) + lprcDst->right = tempRect.left; + } + else if(lprcDst->left == tempRect.left && lprcDst->right == tempRect.right) + { + if(lprcDst->top == tempRect.top) + lprcDst->top = tempRect.bottom; + else if(lprcDst->right == tempRect.right) + lprcDst->right = tempRect.left; + } + + return(TRUE); +} + + +/* + * @implemented + */ +BOOL +STDCALL +UnionRect(LPRECT lprcDst, + CONST RECT *lprcSrc1, + CONST RECT *lprcSrc2) +{ + if (IsRectEmpty(lprcSrc1)) + { + if (IsRectEmpty(lprcSrc2)) + { + SetRectEmpty(lprcDst); + return(FALSE); + } + else + { + *lprcDst = *lprcSrc2; + } + } + else + { + if (IsRectEmpty(lprcSrc2)) + { + *lprcDst = *lprcSrc1; + } + else + { + lprcDst->left = min(lprcSrc1->left, lprcSrc2->left); + lprcDst->top = min(lprcSrc1->top, lprcSrc2->top); + lprcDst->right = max(lprcSrc1->right, lprcSrc2->right); + lprcDst->bottom = max(lprcSrc1->bottom, lprcSrc2->bottom); + } + } + + return(TRUE); +}