diff options
Diffstat (limited to 'hw/xwin/winmultiwindowicons.c')
-rw-r--r-- | hw/xwin/winmultiwindowicons.c | 54 |
1 files changed, 24 insertions, 30 deletions
diff --git a/hw/xwin/winmultiwindowicons.c b/hw/xwin/winmultiwindowicons.c index 88416bb70..8200aad88 100644 --- a/hw/xwin/winmultiwindowicons.c +++ b/hw/xwin/winmultiwindowicons.c @@ -364,43 +364,37 @@ void winUpdateIcon (Window id) { WindowPtr pWin; - HICON hIcon, hiconOld; + HICON hIcon, hIconSmall=NULL, hIconOld; pWin = (WindowPtr) LookupIDByType (id, RT_WINDOW); if (!pWin) return; - hIcon = winOverrideIcon ((unsigned long)pWin); + winWindowPriv(pWin); + if (pWinPriv->hWnd) { + hIcon = winOverrideIcon ((unsigned long)pWin); + if (!hIcon) { + hIcon = winXIconToHICON (pWin, GetSystemMetrics(SM_CXICON)); + if (!hIcon) { + hIcon = g_hIconX; + hIconSmall = g_hSmallIconX; + } else { + /* Leave undefined if not found */ + hIconSmall = winXIconToHICON (pWin, GetSystemMetrics(SM_CXSMICON)); + } + } - if (!hIcon) - hIcon = winXIconToHICON (pWin, GetSystemMetrics(SM_CXICON)); + /* Set the large icon */ + hIconOld = (HICON) SendMessage (pWinPriv->hWnd, + WM_SETICON, ICON_BIG, (LPARAM) hIcon); - if (hIcon) - { - winWindowPriv(pWin); + /* Delete the icon if its not the default */ + winDestroyIcon(hIconOld); - if (pWinPriv->hWnd) - { - hiconOld = (HICON) SetClassLong (pWinPriv->hWnd, - GCL_HICON, - (int) hIcon); - - /* Delete the icon if its not the default */ - winDestroyIcon(hiconOld); - } - } - - hIcon = winXIconToHICON (pWin, GetSystemMetrics(SM_CXSMICON)); - if (hIcon) - { - winWindowPriv(pWin); + /* Same for the small icon */ + hIconOld = (HICON) SendMessage (pWinPriv->hWnd, + WM_SETICON, ICON_SMALL, (LPARAM) hIconSmall); + winDestroyIcon(hIconOld); - if (pWinPriv->hWnd) - { - hiconOld = (HICON) SetClassLong (pWinPriv->hWnd, - GCL_HICONSM, - (int) hIcon); - winDestroyIcon (hiconOld); - } - } + } } void winInitGlobalIcons (void) |