Hello, this moves some 16 bit functions out of windows/cursoricon.c to ease the cleanup of that file. License: LGPL, X11 Changelog: Michael Stefaniuc <mstefani@redhat.com> - move some 16-bit functions from windows/cursoricon.c to dlls/user/user16.c bye michael -- Michael Stefaniuc Tel.: +49-711-96437-199 System Administration Fax.: +49-711-96437-111 Red Hat GmbH Email: mstefani@redhat.com Hauptstaetterstr. 58 http://www.redhat.de/ D-70178 Stuttgart
Index: dlls/user/user16.c =================================================================== RCS file: /home/wine/wine/dlls/user/user16.c,v retrieving revision 1.1 diff -u -r1.1 user16.c --- dlls/user/user16.c 28 Aug 2002 00:38:42 -0000 1.1 +++ dlls/user/user16.c 27 Sep 2002 18:44:53 -0000 @@ -20,6 +20,94 @@ #include "wine/winuser16.h" #include "winbase.h" +#include "wine/debug.h" + +WINE_DECLARE_DEBUG_CHANNEL(cursor); +WINE_DECLARE_DEBUG_CHANNEL(icon); + +/* handle to handle 16 conversions */ +#define HANDLE_16(h32) (LOWORD(h32)) +#define HBITMAP_16(h32) (LOWORD(h32)) +#define HCURSOR_16(h32) (LOWORD(h32)) +#define HICON_16(h32) (LOWORD(h32)) + +/* handle16 to handle conversions */ +#define HANDLE_32(h16) ((HANDLE)(ULONG_PTR)(h16)) +#define HBRUSH_32(h16) ((HBRUSH)(ULONG_PTR)(h16)) +#define HCURSOR_32(h16) ((HCURSOR)(ULONG_PTR)(h16)) +#define HDC_32(h16) ((HDC)(ULONG_PTR)(h16)) +#define HICON_32(h16) ((HICON)(ULONG_PTR)(h16)) +#define HINSTANCE_32(h16) ((HINSTANCE)(ULONG_PTR)(h16)) + +WORD WINAPI DestroyIcon32(HGLOBAL16, UINT16); + + +/*********************************************************************** + * SetCursor (USER.69) + */ +HCURSOR16 WINAPI SetCursor16(HCURSOR16 hCursor) +{ + return HCURSOR_16(SetCursor(HCURSOR_32(hCursor))); +} + +/*********************************************************************** + * ShowCursor (USER.71) + */ +INT16 WINAPI ShowCursor16(BOOL16 bShow) +{ + return ShowCursor(bShow); +} + +/*********************************************************************** + * DrawIcon (USER.84) + */ +BOOL16 WINAPI DrawIcon16(HDC16 hdc, INT16 x, INT16 y, HICON16 hIcon) +{ + return DrawIcon(HDC_32(hdc), x, y, HICON_32(hIcon)); +} + +/*********************************************************************** + * IconSize (USER.86) + * + * See "Undocumented Windows". Used by W2.0 paint.exe. + */ +DWORD WINAPI IconSize16(void) +{ + return MAKELONG(GetSystemMetrics(SM_CYICON), GetSystemMetrics(SM_CXICON)); +} + +/*********************************************************************** + * LoadCursor (USER.173) + */ +HCURSOR16 WINAPI LoadCursor16(HINSTANCE16 hInstance, LPCSTR name) +{ + return HCURSOR_16(LoadCursorA(HINSTANCE_32(hInstance), name)); +} + + +/*********************************************************************** + * LoadIcon (USER.174) + */ +HICON16 WINAPI LoadIcon16(HINSTANCE16 hInstance, LPCSTR name) +{ + return HICON_16(LoadIconA(HINSTANCE_32(hInstance), name)); +} + +/********************************************************************** + * LoadBitmap (USER.175) + */ +HBITMAP16 WINAPI LoadBitmap16(HINSTANCE16 hInstance, LPCSTR name) +{ + return HBITMAP_16(LoadBitmapA(HINSTANCE_32(hInstance), name)); +} + +/*********************************************************************** + * GetCursor (USER.247) + */ +HCURSOR16 WINAPI GetCursor16(void) +{ + return HCURSOR_16(GetCursor()); +} /*********************************************************************** * GlobalAddAtom (USER.268) @@ -51,4 +139,108 @@ UINT16 WINAPI GlobalGetAtomName16(ATOM nAtom, LPSTR lpBuffer, INT16 nSize) { return GlobalGetAtomNameA(nAtom, lpBuffer, nSize); +} + +/*********************************************************************** + * LoadImage (USER.389) + * + */ +HANDLE16 WINAPI LoadImage16(HINSTANCE16 hinst, LPCSTR name, UINT16 type, + INT16 desiredx, INT16 desiredy, UINT16 loadflags) +{ + return HANDLE_16(LoadImageA(HINSTANCE_32(hinst), name, type, desiredx, + desiredy, loadflags)); +} + +/****************************************************************************** + * CopyImage (USER.390) Creates new image and copies attributes to it + * + */ +HICON16 WINAPI CopyImage16(HANDLE16 hnd, UINT16 type, INT16 desiredx, + INT16 desiredy, UINT16 flags) +{ + return HICON_16(CopyImage(HANDLE_32(hnd), (UINT)type, (INT)desiredx, + (INT)desiredy, (UINT)flags)); +} + +/********************************************************************** + * DrawIconEx (USER.394) + */ +BOOL16 WINAPI DrawIconEx16(HDC16 hdc, INT16 xLeft, INT16 yTop, HICON16 hIcon, + INT16 cxWidth, INT16 cyWidth, UINT16 istep, + HBRUSH16 hbr, UINT16 flags) +{ + return DrawIconEx(HDC_32(hdc), xLeft, yTop, HICON_32(hIcon), cxWidth, cyWidth, + istep, HBRUSH_32(hbr), flags); +} + +/********************************************************************** + * GetIconInfo (USER.395) + */ +BOOL16 WINAPI GetIconInfo16(HICON16 hIcon, LPICONINFO16 iconinfo) +{ + ICONINFO ii32; + BOOL16 ret = GetIconInfo(HICON_32(hIcon), &ii32); + + iconinfo->fIcon = ii32.fIcon; + iconinfo->xHotspot = ii32.xHotspot; + iconinfo->yHotspot = ii32.yHotspot; + iconinfo->hbmMask = ii32.hbmMask; + iconinfo->hbmColor = ii32.hbmColor; + return ret; +} + +/*********************************************************************** + * CreateCursor (USER.406) + */ +HCURSOR16 WINAPI CreateCursor16(HINSTANCE16 hInstance, + INT16 xHotSpot, INT16 yHotSpot, + INT16 nWidth, INT16 nHeight, + LPCVOID lpANDbits, LPCVOID lpXORbits) +{ + CURSORICONINFO info; + + TRACE_(cursor) ("%dx%d spot=%d,%d xor=%p and=%p\n", + nWidth, nHeight, xHotSpot, yHotSpot, lpXORbits, lpANDbits); + + info.ptHotSpot.x = xHotSpot; + info.ptHotSpot.y = yHotSpot; + info.nWidth = nWidth; + info.nHeight = nHeight; + info.nWidthBytes = 0; + info.bPlanes = 1; + info.bBitsPerPixel = 1; + + return CreateCursorIconIndirect16(HINSTANCE_32(hInstance), &info, lpANDbits, + lpXORbits); +} + +/********************************************************************** + * CreateIconFromResourceEx (USER.450) + * + * FIXME: not sure about exact parameter types + */ +HICON16 WINAPI CreateIconFromResourceEx16(LPBYTE bits, UINT16 cbSize, + BOOL16 bIcon, DWORD dwVersion, + INT16 width, INT16 height, + UINT16 cFlag) +{ + return HICON_16(CreateIconFromResourceEx(bits, cbSize, bIcon, dwVersion, + width, height, cFlag)); +} + +/*********************************************************************** + * DestroyIcon (USER.457) + */ +BOOL16 WINAPI DestroyIcon16(HICON16 hIcon) +{ + return DestroyIcon32(hIcon, 0); +} + +/*********************************************************************** + * DestroyCursor (USER.458) + */ +BOOL16 WINAPI DestroyCursor16(HCURSOR16 hCursor) +{ + return DestroyIcon32(hCursor, 0); } Index: windows/cursoricon.c =================================================================== RCS file: /home/wine/wine/windows/cursoricon.c,v retrieving revision 1.52 diff -u -r1.52 cursoricon.c --- windows/cursoricon.c 24 Sep 2002 18:29:40 -0000 1.52 +++ windows/cursoricon.c 27 Sep 2002 18:44:54 -0000 @@ -691,19 +691,6 @@ /********************************************************************** - * CreateIconFromResourceEx (USER.450) - * - * FIXME: not sure about exact parameter types - */ -HICON16 WINAPI CreateIconFromResourceEx16( LPBYTE bits, UINT16 cbSize, BOOL16 bIcon, - DWORD dwVersion, INT16 width, INT16 height, UINT16 cFlag ) -{ - return CreateIconFromResourceEx(bits, cbSize, bIcon, dwVersion, - width, height, cFlag); -} - - -/********************************************************************** * CreateIconFromResource (USER32.@) */ HICON WINAPI CreateIconFromResource( LPBYTE bits, UINT cbSize, @@ -986,49 +973,6 @@ /*********************************************************************** - * LoadCursor (USER.173) - */ -HCURSOR16 WINAPI LoadCursor16( HINSTANCE16 hInstance, LPCSTR name ) -{ - return LoadCursorA( hInstance, name ); -} - - -/*********************************************************************** - * LoadIcon (USER.174) - */ -HICON16 WINAPI LoadIcon16( HINSTANCE16 hInstance, LPCSTR name ) -{ - return LoadIconA( hInstance, name ); -} - - -/*********************************************************************** - * CreateCursor (USER.406) - */ -HCURSOR16 WINAPI CreateCursor16( HINSTANCE16 hInstance, - INT16 xHotSpot, INT16 yHotSpot, - INT16 nWidth, INT16 nHeight, - LPCVOID lpANDbits, LPCVOID lpXORbits ) -{ - CURSORICONINFO info; - - TRACE_(cursor)("%dx%d spot=%d,%d xor=%p and=%p\n", - nWidth, nHeight, xHotSpot, yHotSpot, lpXORbits, lpANDbits); - - info.ptHotSpot.x = xHotSpot; - info.ptHotSpot.y = yHotSpot; - info.nWidth = nWidth; - info.nHeight = nHeight; - info.nWidthBytes = 0; - info.bPlanes = 1; - info.bBitsPerPixel = 1; - - return CreateCursorIconIndirect16( hInstance, &info, lpANDbits, lpXORbits ); -} - - -/*********************************************************************** * CreateCursor (USER32.@) */ HCURSOR WINAPI CreateCursor( HINSTANCE hInstance, @@ -1274,14 +1218,6 @@ } /*********************************************************************** - * DestroyIcon (USER.457) - */ -BOOL16 WINAPI DestroyIcon16( HICON16 hIcon ) -{ - return DestroyIcon32( hIcon, 0 ); -} - -/*********************************************************************** * DestroyIcon (USER32.@) */ BOOL WINAPI DestroyIcon( HICON hIcon ) @@ -1289,13 +1225,6 @@ return DestroyIcon32( hIcon, CID_WIN32 ); } -/*********************************************************************** - * DestroyCursor (USER.458) - */ -BOOL16 WINAPI DestroyCursor16( HCURSOR16 hCursor ) -{ - return DestroyIcon32( hCursor, 0 ); -} /*********************************************************************** * DestroyCursor (USER32.@) @@ -1307,15 +1236,6 @@ /*********************************************************************** - * DrawIcon (USER.84) - */ -BOOL16 WINAPI DrawIcon16( HDC16 hdc, INT16 x, INT16 y, HICON16 hIcon ) -{ - return DrawIcon( hdc, x, y, hIcon ); -} - - -/*********************************************************************** * DrawIcon (USER32.@) */ BOOL WINAPI DrawIcon( HDC hdc, INT x, INT y, HICON hIcon ) @@ -1352,18 +1272,6 @@ return TRUE; } - -/*********************************************************************** - * IconSize (USER.86) - * - * See "Undocumented Windows". Used by W2.0 paint.exe. - */ -DWORD WINAPI IconSize16( void ) -{ - return MAKELONG(GetSystemMetrics(SM_CYICON), GetSystemMetrics(SM_CXICON)); -} - - /*********************************************************************** * DumpIcon (USER.459) */ @@ -1384,15 +1292,6 @@ /*********************************************************************** - * SetCursor (USER.69) - */ -HCURSOR16 WINAPI SetCursor16( HCURSOR16 hCursor ) -{ - return (HCURSOR16)SetCursor( hCursor ); -} - - -/*********************************************************************** * SetCursor (USER32.@) * RETURNS: * A handle to the previous cursor shape. @@ -1415,16 +1314,6 @@ return hOldCursor; } - -/*********************************************************************** - * ShowCursor (USER.71) - */ -INT16 WINAPI ShowCursor16( BOOL16 bShow ) -{ - return ShowCursor( bShow ); -} - - /*********************************************************************** * ShowCursor (USER32.@) */ @@ -1450,16 +1339,6 @@ return queue->cursor_count; } - -/*********************************************************************** - * GetCursor (USER.247) - */ -HCURSOR16 WINAPI GetCursor16(void) -{ - return GetCursor(); -} - - /*********************************************************************** * GetCursor (USER32.@) */ @@ -1724,22 +1603,6 @@ } /********************************************************************** - * GetIconInfo (USER.395) - */ -BOOL16 WINAPI GetIconInfo16(HICON16 hIcon,LPICONINFO16 iconinfo) -{ - ICONINFO ii32; - BOOL16 ret = GetIconInfo((HICON)hIcon, &ii32); - - iconinfo->fIcon = ii32.fIcon; - iconinfo->xHotspot = ii32.xHotspot; - iconinfo->yHotspot = ii32.yHotspot; - iconinfo->hbmMask = ii32.hbmMask; - iconinfo->hbmColor = ii32.hbmColor; - return ret; -} - -/********************************************************************** * GetIconInfo (USER32.@) */ BOOL WINAPI GetIconInfo(HICON hIcon,PICONINFO iconinfo) { @@ -1826,19 +1689,6 @@ return hObj; } - -/********************************************************************** - * DrawIconEx (USER.394) - */ -BOOL16 WINAPI DrawIconEx16 (HDC16 hdc, INT16 xLeft, INT16 yTop, HICON16 hIcon, - INT16 cxWidth, INT16 cyWidth, UINT16 istep, - HBRUSH16 hbr, UINT16 flags) -{ - return DrawIconEx(hdc, xLeft, yTop, hIcon, cxWidth, cyWidth, - istep, hbr, flags); -} - - /****************************************************************************** * DrawIconEx (USER32.@) Draws an icon or cursor on device context * @@ -2108,17 +1958,6 @@ return hbitmap; } - -/*********************************************************************** - * LoadImage (USER.389) - * - */ -HANDLE16 WINAPI LoadImage16( HINSTANCE16 hinst, LPCSTR name, UINT16 type, - INT16 desiredx, INT16 desiredy, UINT16 loadflags) -{ - return LoadImageA( hinst, name, type, desiredx, desiredy, loadflags ); -} - /********************************************************************** * LoadImageA (USER32.@) * @@ -2219,18 +2058,6 @@ return 0; } - -/****************************************************************************** - * CopyImage (USER.390) Creates new image and copies attributes to it - * - */ -HICON16 WINAPI CopyImage16( HANDLE16 hnd, UINT16 type, INT16 desiredx, - INT16 desiredy, UINT16 flags ) -{ - return (HICON16)CopyImage((HANDLE)hnd, (UINT)type, (INT)desiredx, - (INT)desiredy, (UINT)flags); -} - /****************************************************************************** * CopyImage (USER32.@) Creates new image and copies attributes to it * @@ -2301,12 +2128,4 @@ HBITMAP WINAPI LoadBitmapA( HINSTANCE instance, LPCSTR name ) { return LoadImageA( instance, name, IMAGE_BITMAP, 0, 0, 0 ); -} - -/********************************************************************** - * LoadBitmap (USER.175) - */ -HBITMAP16 WINAPI LoadBitmap16( HINSTANCE16 instance, LPCSTR name ) -{ - return LoadBitmapA( instance, name ); }
Attachment:
pgp00051.pgp
Description: PGP signature