Skip to content

Commit

Permalink
* fix taskbar icons visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
deadem committed Mar 14, 2024
1 parent 3cb5c83 commit 1738813
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions MinimizeWindows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

struct State {
HWND m_window;
WINDOWPLACEMENT m_placement;
};


Expand Down Expand Up @@ -40,7 +41,11 @@ BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM) {
return TRUE;
}

allWindows.emplace_back(State{ hwnd });
State state{ hwnd };
state.m_placement.length = sizeof(state.m_placement);
GetWindowPlacement(hwnd, &state.m_placement);

allWindows.emplace_back(state);
return TRUE;
}

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

if (allWindows.empty()) {
for (auto i = lastWindows.rbegin(); i != lastWindows.rend(); ++i) {
SetWindowPos(i->m_window, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_SHOWWINDOW);
SetWindowPlacement(i->m_window, &i->m_placement);
}
}
else {
for (const auto& state : allWindows) {
SetWindowPos(state.m_window, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_HIDEWINDOW);
auto placement = state.m_placement;
placement.showCmd = SW_SHOWMINNOACTIVE;
SetWindowPlacement(state.m_window, &placement);
}
}

Expand Down

0 comments on commit 1738813

Please sign in to comment.