Skip to content

Commit 1738813

Browse files
committed
* fix taskbar icons visibility
1 parent 3cb5c83 commit 1738813

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

MinimizeWindows.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
struct State {
66
HWND m_window;
7+
WINDOWPLACEMENT m_placement;
78
};
89

910

@@ -40,7 +41,11 @@ BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM) {
4041
return TRUE;
4142
}
4243

43-
allWindows.emplace_back(State{ hwnd });
44+
State state{ hwnd };
45+
state.m_placement.length = sizeof(state.m_placement);
46+
GetWindowPlacement(hwnd, &state.m_placement);
47+
48+
allWindows.emplace_back(state);
4449
return TRUE;
4550
}
4651

@@ -57,12 +62,14 @@ LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam) {
5762

5863
if (allWindows.empty()) {
5964
for (auto i = lastWindows.rbegin(); i != lastWindows.rend(); ++i) {
60-
SetWindowPos(i->m_window, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_SHOWWINDOW);
65+
SetWindowPlacement(i->m_window, &i->m_placement);
6166
}
6267
}
6368
else {
6469
for (const auto& state : allWindows) {
65-
SetWindowPos(state.m_window, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_HIDEWINDOW);
70+
auto placement = state.m_placement;
71+
placement.showCmd = SW_SHOWMINNOACTIVE;
72+
SetWindowPlacement(state.m_window, &placement);
6673
}
6774
}
6875

0 commit comments

Comments
 (0)