From 1b51ef3d0e4645d9a0d2dd2497d9fa3dd9fccad5 Mon Sep 17 00:00:00 2001 From: Ioannis Tsakpinis Date: Mon, 7 Sep 2015 16:04:27 +0300 Subject: [PATCH] Create a single HICON if the small and big icon images are the same --- src/win32_window.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/win32_window.c b/src/win32_window.c index 0d511c16e..b11861ace 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -1040,14 +1040,15 @@ void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window, void _glfwPlatformSetWindowIcons(_GLFWwindow* window, GLFWimage* icons, int count) { - GLFWimage* normalicon; - GLFWimage* smallicon; + GLFWimage* imgBig; + GLFWimage* imgSmall; - normalicon = bestFit(icons, count, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON)); - smallicon = bestFit(icons, count, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON)); + imgBig = bestFit(icons, count, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON)); + imgSmall = bestFit(icons, count, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON)); - SendMessage(window->win32.handle, WM_SETICON, ICON_BIG, (LPARAM) createIcon(normalicon)); - SendMessage(window->win32.handle, WM_SETICON, ICON_SMALL, (LPARAM) createIcon(smallicon)); + HICON icon = createIcon(imgBig); + SendMessage(window->win32.handle, WM_SETICON, ICON_BIG, (LPARAM) icon); + SendMessage(window->win32.handle, WM_SETICON, ICON_SMALL, (LPARAM) (imgSmall == imgBig ? icon : createIcon(imgSmall))); } void _glfwPlatformIconifyWindow(_GLFWwindow* window)