summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2016-03-14 11:21:30 +0000
committerJon Turney <jon.turney@dronecode.org.uk>2016-03-14 21:59:08 +0000
commit2af7ef3b00adf63fdf45de99b9f19faf43c80bdc (patch)
tree4dbe60ea8a8c4f690050fd3843207fac5ce93faa
parent5f6ac52bf5954f7e89d50669e96ac3104bc1e75d (diff)
Fix sometimes missing sysmenu icon on Vista and later
It seems we must always send WM_SETICON to update the icon *after* we have updated the style to include WM_SYSMENU for the icon to be actually used. Always do that, using the default icons if none specified for the window.
-rw-r--r--src/wndproc.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/wndproc.c b/src/wndproc.c
index 611ece8..cf75463 100644
--- a/src/wndproc.c
+++ b/src/wndproc.c
@@ -731,6 +731,11 @@ UpdateIcon(xcwm_window_t *window)
hIconSmall = NULL;
}
+ /* If we still need an icon, use the default icon */
+ if (!hIcon) {
+ winSelectIcons(&hIcon, &hIconSmall);
+ }
+
if (hIcon)
{
/* Set the large icon */
@@ -1568,13 +1573,6 @@ winCreateWindowsWindow(xcwm_window_t *window)
/* save the HWND into the context */
xcwm_window_set_local_data(window, hWnd);
- /* Set default icon */
- HICON hIcon;
- HICON hIconSmall;
- winSelectIcons(&hIcon, &hIconSmall);
- if (hIcon) SendMessage (hWnd, WM_SETICON, ICON_BIG, (LPARAM) hIcon);
- if (hIconSmall) SendMessage (hWnd, WM_SETICON, ICON_SMALL, (LPARAM) hIconSmall);
-
/* Change style back to popup, already placed... */
SetWindowLongPtr(hWnd, GWL_STYLE, WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
SetWindowPos(hWnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
@@ -1615,8 +1613,8 @@ winCreateWindowsWindow(xcwm_window_t *window)
/* Apply all properties which effect the window appearance or behaviour */
UpdateName(window);
- UpdateIcon(window);
UpdateStyle(window);
+ UpdateIcon(window);
UpdateShape(window);
UpdateState(window);