Huw Davies : shell32: Use the imagelist to determine the icon size.
Alexandre Julliard
julliard at winehq.org
Wed Apr 19 14:49:38 CDT 2017
Module: wine
Branch: master
Commit: 734dc8f200dfdec1a7bd746200fba72e870b5f82
URL: http://source.winehq.org/git/wine.git/?a=commit;h=734dc8f200dfdec1a7bd746200fba72e870b5f82
Author: Huw Davies <huw at codeweavers.com>
Date: Wed Apr 19 13:13:40 2017 +0100
shell32: Use the imagelist to determine the icon size.
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/shell32/iconcache.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/dlls/shell32/iconcache.c b/dlls/shell32/iconcache.c
index 7beb479..737f4d5 100644
--- a/dlls/shell32/iconcache.c
+++ b/dlls/shell32/iconcache.c
@@ -298,6 +298,17 @@ static INT SIC_IconAppend (LPCWSTR sSourceFile, INT dwSourceIndex, HICON hSmallI
LeaveCriticalSection(&SHELL32_SicCS);
return ret;
}
+
+static BOOL get_imagelist_icon_size(int list, SIZE *size)
+{
+ HIMAGELIST image_list;
+
+ if (list < SHIL_LARGE || list > SHIL_SMALL) return FALSE;
+ image_list = (list == SHIL_LARGE) ? ShellBigIconList : ShellSmallIconList;
+
+ return ImageList_GetIconSize( image_list, &size->cx, &size->cy );
+}
+
/****************************************************************************
* SIC_LoadIcon [internal]
*
@@ -311,11 +322,12 @@ static INT SIC_LoadIcon (LPCWSTR sSourceFile, INT dwSourceIndex, DWORD dwFlags)
HICON hiconLargeShortcut;
HICON hiconSmallShortcut;
int ret;
+ SIZE size;
- PrivateExtractIconsW( sSourceFile, dwSourceIndex, GetSystemMetrics(SM_CXICON),
- GetSystemMetrics(SM_CYICON), &hiconLarge, 0, 1, 0 );
- PrivateExtractIconsW( sSourceFile, dwSourceIndex, GetSystemMetrics(SM_CXSMICON),
- GetSystemMetrics(SM_CYSMICON), &hiconSmall, 0, 1, 0 );
+ get_imagelist_icon_size( SHIL_LARGE, &size );
+ PrivateExtractIconsW( sSourceFile, dwSourceIndex, size.cx, size.cy, &hiconLarge, 0, 1, 0 );
+ get_imagelist_icon_size( SHIL_SMALL, &size );
+ PrivateExtractIconsW( sSourceFile, dwSourceIndex, size.cx, size.cy, &hiconSmall, 0, 1, 0 );
if ( !hiconLarge || !hiconSmall)
{
More information about the wine-cvs
mailing list