user32: Fall back to downscaling the big icon for ICON_SMALL2.

This commit is contained in:
Alex Henrie 2015-05-14 01:37:57 -06:00 committed by Alexandre Julliard
parent 0768a62f2c
commit 5c48752784
4 changed files with 32 additions and 10 deletions

View File

@ -605,10 +605,32 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
{
case ICON_SMALL:
ret = wndPtr->hIconSmall;
if (ret && !lParam && wndPtr->hIcon)
{
wndPtr->hIconSmall2 = CopyImage( wndPtr->hIcon, IMAGE_ICON,
GetSystemMetrics( SM_CXSMICON ),
GetSystemMetrics( SM_CYSMICON ), 0 );
}
else if (lParam && wndPtr->hIconSmall2)
{
DestroyIcon( wndPtr->hIconSmall2 );
wndPtr->hIconSmall2 = NULL;
}
wndPtr->hIconSmall = (HICON)lParam;
break;
case ICON_BIG:
ret = wndPtr->hIcon;
if (wndPtr->hIconSmall2)
{
DestroyIcon( wndPtr->hIconSmall2 );
wndPtr->hIconSmall2 = NULL;
}
if (lParam && !wndPtr->hIconSmall)
{
wndPtr->hIconSmall2 = CopyImage( (HICON)lParam, IMAGE_ICON,
GetSystemMetrics( SM_CXSMICON ),
GetSystemMetrics( SM_CYSMICON ), 0 );
}
wndPtr->hIcon = (HICON)lParam;
break;
default:
@ -639,7 +661,7 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
ret = wndPtr->hIcon;
break;
case ICON_SMALL2:
ret = wndPtr->hIconSmall;
ret = wndPtr->hIconSmall ? wndPtr->hIconSmall : wndPtr->hIconSmall2;
break;
default:
ret = 0;

View File

@ -2007,23 +2007,20 @@ static void test_icons(void)
res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_SMALL, 0 );
ok( res == 0, "wrong small icon %p/0\n", res );
/* this test is XP specific */
/*res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_SMALL2, 0 );
ok( res != 0, "wrong small icon %p\n", res );*/
res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_SMALL2, 0 );
ok( (res && res != small_icon && res != icon2) || broken(!res), "wrong small2 icon %p\n", res );
res = (HICON)SendMessageA( hwnd, WM_SETICON, ICON_SMALL, (LPARAM)icon );
ok( res == 0, "wrong previous small icon %p/0\n", res );
res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_SMALL, 0 );
ok( res == icon, "wrong small icon after set %p/%p\n", res, icon );
/* this test is XP specific */
/*res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_SMALL2, 0 );
ok( res == icon, "wrong small icon after set %p/%p\n", res, icon );*/
res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_SMALL2, 0 );
ok( res == icon || broken(!res), "wrong small2 icon after set %p/%p\n", res, icon );
res = (HICON)SendMessageA( hwnd, WM_SETICON, ICON_SMALL, (LPARAM)small_icon );
ok( res == icon, "wrong previous small icon %p/%p\n", res, icon );
res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_SMALL, 0 );
ok( res == small_icon, "wrong small icon after set %p/%p\n", res, small_icon );
/* this test is XP specific */
/*res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_SMALL2, 0 );
ok( res == small_icon, "wrong small icon after set %p/%p\n", res, small_icon );*/
res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_SMALL2, 0 );
ok( res == small_icon || broken(!res), "wrong small2 icon after set %p/%p\n", res, small_icon );
/* make sure the big icon hasn't changed */
res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_BIG, 0 );

View File

@ -978,6 +978,7 @@ LRESULT WIN_DestroyWindow( HWND hwnd )
wndPtr->text = NULL;
HeapFree( GetProcessHeap(), 0, wndPtr->pScroll );
wndPtr->pScroll = NULL;
DestroyIcon( wndPtr->hIconSmall2 );
surface = wndPtr->surface;
wndPtr->surface = NULL;
WIN_ReleasePtr( wndPtr );
@ -1468,6 +1469,7 @@ HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module,
wndPtr->userdata = 0;
wndPtr->hIcon = 0;
wndPtr->hIconSmall = 0;
wndPtr->hIconSmall2 = 0;
wndPtr->hSysMenu = 0;
wndPtr->min_pos.x = wndPtr->min_pos.y = -1;

View File

@ -60,6 +60,7 @@ typedef struct tagWND
HMENU hSysMenu; /* window's copy of System Menu */
HICON hIcon; /* window's icon */
HICON hIconSmall; /* window's small icon */
HICON hIconSmall2; /* window's secondary small icon, derived from hIcon */
struct window_surface *surface; /* Window surface if any */
struct tagDIALOGINFO *dlgInfo;/* Dialog additional info (dialogs only) */
int pixel_format; /* Pixel format set by the graphics driver */