Commit 5c487527 authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

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

parent 0768a62f
...@@ -605,10 +605,32 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa ...@@ -605,10 +605,32 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
{ {
case ICON_SMALL: case ICON_SMALL:
ret = wndPtr->hIconSmall; 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; wndPtr->hIconSmall = (HICON)lParam;
break; break;
case ICON_BIG: case ICON_BIG:
ret = wndPtr->hIcon; 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; wndPtr->hIcon = (HICON)lParam;
break; break;
default: default:
...@@ -639,7 +661,7 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa ...@@ -639,7 +661,7 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
ret = wndPtr->hIcon; ret = wndPtr->hIcon;
break; break;
case ICON_SMALL2: case ICON_SMALL2:
ret = wndPtr->hIconSmall; ret = wndPtr->hIconSmall ? wndPtr->hIconSmall : wndPtr->hIconSmall2;
break; break;
default: default:
ret = 0; ret = 0;
......
...@@ -2007,23 +2007,20 @@ static void test_icons(void) ...@@ -2007,23 +2007,20 @@ static void test_icons(void)
res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_SMALL, 0 ); res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_SMALL, 0 );
ok( res == 0, "wrong small icon %p/0\n", res ); ok( res == 0, "wrong small icon %p/0\n", res );
/* this test is XP specific */ res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_SMALL2, 0 );
/*res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_SMALL2, 0 ); ok( (res && res != small_icon && res != icon2) || broken(!res), "wrong small2 icon %p\n", res );
ok( res != 0, "wrong small icon %p\n", res );*/
res = (HICON)SendMessageA( hwnd, WM_SETICON, ICON_SMALL, (LPARAM)icon ); res = (HICON)SendMessageA( hwnd, WM_SETICON, ICON_SMALL, (LPARAM)icon );
ok( res == 0, "wrong previous small icon %p/0\n", res ); ok( res == 0, "wrong previous small icon %p/0\n", res );
res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_SMALL, 0 ); res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_SMALL, 0 );
ok( res == icon, "wrong small icon after set %p/%p\n", res, icon ); 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 );
/*res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_SMALL2, 0 ); ok( res == icon || broken(!res), "wrong small2 icon after set %p/%p\n", res, icon );
ok( res == icon, "wrong small icon after set %p/%p\n", res, icon );*/
res = (HICON)SendMessageA( hwnd, WM_SETICON, ICON_SMALL, (LPARAM)small_icon ); res = (HICON)SendMessageA( hwnd, WM_SETICON, ICON_SMALL, (LPARAM)small_icon );
ok( res == icon, "wrong previous small icon %p/%p\n", res, icon ); ok( res == icon, "wrong previous small icon %p/%p\n", res, icon );
res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_SMALL, 0 ); res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_SMALL, 0 );
ok( res == small_icon, "wrong small icon after set %p/%p\n", res, small_icon ); 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 );
/*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 );
ok( res == small_icon, "wrong small icon after set %p/%p\n", res, small_icon );*/
/* make sure the big icon hasn't changed */ /* make sure the big icon hasn't changed */
res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_BIG, 0 ); res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_BIG, 0 );
......
...@@ -978,6 +978,7 @@ LRESULT WIN_DestroyWindow( HWND hwnd ) ...@@ -978,6 +978,7 @@ LRESULT WIN_DestroyWindow( HWND hwnd )
wndPtr->text = NULL; wndPtr->text = NULL;
HeapFree( GetProcessHeap(), 0, wndPtr->pScroll ); HeapFree( GetProcessHeap(), 0, wndPtr->pScroll );
wndPtr->pScroll = NULL; wndPtr->pScroll = NULL;
DestroyIcon( wndPtr->hIconSmall2 );
surface = wndPtr->surface; surface = wndPtr->surface;
wndPtr->surface = NULL; wndPtr->surface = NULL;
WIN_ReleasePtr( wndPtr ); WIN_ReleasePtr( wndPtr );
...@@ -1468,6 +1469,7 @@ HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module, ...@@ -1468,6 +1469,7 @@ HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module,
wndPtr->userdata = 0; wndPtr->userdata = 0;
wndPtr->hIcon = 0; wndPtr->hIcon = 0;
wndPtr->hIconSmall = 0; wndPtr->hIconSmall = 0;
wndPtr->hIconSmall2 = 0;
wndPtr->hSysMenu = 0; wndPtr->hSysMenu = 0;
wndPtr->min_pos.x = wndPtr->min_pos.y = -1; wndPtr->min_pos.x = wndPtr->min_pos.y = -1;
......
...@@ -60,6 +60,7 @@ typedef struct tagWND ...@@ -60,6 +60,7 @@ typedef struct tagWND
HMENU hSysMenu; /* window's copy of System Menu */ HMENU hSysMenu; /* window's copy of System Menu */
HICON hIcon; /* window's icon */ HICON hIcon; /* window's icon */
HICON hIconSmall; /* window's small 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 window_surface *surface; /* Window surface if any */
struct tagDIALOGINFO *dlgInfo;/* Dialog additional info (dialogs only) */ struct tagDIALOGINFO *dlgInfo;/* Dialog additional info (dialogs only) */
int pixel_format; /* Pixel format set by the graphics driver */ int pixel_format; /* Pixel format set by the graphics driver */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment