window manager: inverting all windows' visibility

Introducing a method that makes all visible windows invisible and vice-
versa.
This commit is contained in:
Christian Burger 2022-05-20 20:41:45 +02:00
parent 870fa80fc7
commit ba378b2a43
3 changed files with 26 additions and 0 deletions

View file

@ -130,6 +130,10 @@ namespace krikkel::NCurses
windowManager->updateLayout();
windowManager->refresh();
break;
case KEY_F(4):
windowManager->invertWindowsVisibility();
windowManager->updateLayout();
windowManager->refresh();
case KEY_F(5):
windowManager->refresh();
break;

View file

@ -65,6 +65,27 @@ namespace krikkel::NCurses
}
}
void TilingWindowManager::invertWindowsVisibility()
{
list<WindowStackElement> originallyVisibleStack(visibleStack);
list<WindowStackElement>::iterator originallyVisibleStackIterator = originallyVisibleStack.begin();
visibleStack.clear();
for(WindowStackElement currentWindowElement : stack)
if(originallyVisibleStackIterator != originallyVisibleStack.end()
&& currentWindowElement == *originallyVisibleStackIterator)
{
currentWindowElement.first->hidden = true;
++originallyVisibleStackIterator;
continue;
}
else
{
currentWindowElement.first->hidden = false;
visibleStack.push_back(currentWindowElement);
}
}
int TilingWindowManager::resize(int rows, int cols)
{
int result = Window::resize(rows, cols);

View file

@ -45,6 +45,7 @@ namespace krikkel::NCurses
void hideWindow(Window *window);
void showWindow(Window *window);
void invertWindowsVisibility();
protected:
/// @todo rename to `nCursesMutex`?