Module: wine Branch: master Commit: 1d1f8e2a2c861567cf9785c8a6a1a61037ea23d0 URL: http://source.winehq.org/git/wine.git/?a=commit;h=1d1f8e2a2c861567cf9785c8a6...
Author: Alexandre Julliard julliard@winehq.org Date: Tue Dec 22 13:48:19 2009 +0100
user32: Move DestroyIcon32 implementation to user16.c.
---
dlls/user32/cursoricon.c | 57 +++++++++------------------------------------- dlls/user32/user16.c | 40 +++++++++++++++++++++++++++++++- dlls/user32/user32.spec | 5 ---- 3 files changed, 50 insertions(+), 52 deletions(-)
diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c index 118b8b6..1320523 100644 --- a/dlls/user32/cursoricon.c +++ b/dlls/user32/cursoricon.c @@ -84,10 +84,6 @@ typedef struct
#include "poppack.h"
-#define CID_RESOURCE 0x0001 -#define CID_WIN32 0x0004 -#define CID_NONSHARED 0x0008 - static RECT CURSOR_ClipRect; /* Cursor clipping rect */
static HDC screen_dc; @@ -1470,52 +1466,16 @@ HICON WINAPI CopyIcon( HICON hIcon ) }
-/********************************************************************** - * DestroyIcon32 (USER.610) - * - * This routine is actually exported from Win95 USER under the name - * DestroyIcon32 ... The behaviour implemented here should mimic - * the Win95 one exactly, especially the return values, which - * depend on the setting of various flags. - */ -WORD WINAPI DestroyIcon32( HGLOBAL16 handle, UINT16 flags ) -{ - WORD retv; - - TRACE_(icon)("(%04x, %04x)\n", handle, flags ); - - /* Check whether destroying active cursor */ - - if ( get_user_thread_info()->cursor == HICON_32(handle) ) - { - WARN_(cursor)("Destroying active cursor!\n" ); - return FALSE; - } - - /* Try shared cursor/icon first */ - - if ( !(flags & CID_NONSHARED) ) - { - INT count = CURSORICON_DelSharedIcon(HICON_32(handle)); - - if ( count != -1 ) - return (flags & CID_WIN32)? TRUE : (count == 0); - - /* FIXME: OEM cursors/icons should be recognized */ - } - - /* Now assume non-shared cursor/icon */ - - retv = GlobalFree16( handle ); - return (flags & CID_RESOURCE)? retv : TRUE; -} - /*********************************************************************** * DestroyIcon (USER32.@) */ BOOL WINAPI DestroyIcon( HICON hIcon ) { - return DestroyIcon32(HICON_16(hIcon), CID_WIN32); + TRACE_(icon)("%p\n", hIcon ); + + if (CURSORICON_DelSharedIcon( hIcon ) == -1) + GlobalFree16( HICON_16(hIcon) ); + return TRUE; }
@@ -1524,7 +1484,12 @@ BOOL WINAPI DestroyIcon( HICON hIcon ) */ BOOL WINAPI DestroyCursor( HCURSOR hCursor ) { - return DestroyIcon32(HCURSOR_16(hCursor), CID_WIN32); + if (get_user_thread_info()->cursor == hCursor) + { + WARN_(cursor)("Destroying active cursor!\n" ); + return FALSE; + } + return DestroyIcon( hCursor ); }
/*********************************************************************** diff --git a/dlls/user32/user16.c b/dlls/user32/user16.c index 4daaafd..6305945 100644 --- a/dlls/user32/user16.c +++ b/dlls/user32/user16.c @@ -55,7 +55,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(user); #define USUD_LOCALHEAP 0x0004 #define USUD_FIRSTCLASS 0x0005
-WORD WINAPI DestroyIcon32(HGLOBAL16, UINT16); +#define CID_RESOURCE 0x0001 +#define CID_WIN32 0x0004 +#define CID_NONSHARED 0x0008
WORD USER_HeapSel = 0; /* USER heap selector */
@@ -2854,6 +2856,42 @@ DWORD WINAPI FormatMessage16( #undef ADD_TO_T
+/********************************************************************** + * DestroyIcon32 (USER.610) + * + * This routine is actually exported from Win95 USER under the name + * DestroyIcon32 ... The behaviour implemented here should mimic + * the Win95 one exactly, especially the return values, which + * depend on the setting of various flags. + */ +WORD WINAPI DestroyIcon32( HGLOBAL16 handle, UINT16 flags ) +{ + WORD retv; + + /* Check whether destroying active cursor */ + + if (GetCursor16() == handle) + { + WARN("Destroying active cursor!\n" ); + return FALSE; + } + + /* Try shared cursor/icon first */ + + if (!(flags & CID_NONSHARED)) + { + INT count = release_shared_icon( handle ); + if (count != -1) + return (flags & CID_WIN32) ? TRUE : (count == 0); + } + + /* Now assume non-shared cursor/icon */ + + retv = GlobalFree16( handle ); + return (flags & CID_RESOURCE)? retv : TRUE; +} + + /*********************************************************************** * ChangeDisplaySettings (USER.620) */ diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec index 4492e58..7f87a20 100644 --- a/dlls/user32/user32.spec +++ b/dlls/user32/user32.spec @@ -772,11 +772,6 @@ @ stdcall wvsprintfW(ptr wstr ptr)
################################################################ -# Wine extensions: Win16 functions that are needed by other dlls -# -@ stdcall DestroyIcon32(long long) - -################################################################ # Wine dll separation hacks, these will go away, don't use them # @ cdecl HOOK_CallHooks(long long long long long)