From ea466fa985f251bdd4a5afe19a41ee28ac91035d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Sun, 11 Sep 2016 15:18:00 +0200 Subject: introduce autotabplacement --- src/Screen.cc | 2 ++ src/ScreenPlacement.cc | 25 +++++++++++++++++-------- src/ScreenPlacement.hh | 3 ++- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/Screen.cc b/src/Screen.cc index dbbc875..a4a0922 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -1138,6 +1138,8 @@ FluxboxWindow *BScreen::createWindow(Window client) { // check if it should be grouped with something else WinClient* other = findGroupLeft(*winclient); + if (!other && m_placement_strategy->placementPolicy() == ScreenPlacement::AUTOTABPLACEMENT) + other = FocusControl::focusedWindow(); FluxboxWindow* win = other ? other->fbwindow() : 0; if (other && win) { diff --git a/src/ScreenPlacement.cc b/src/ScreenPlacement.cc index 79149a0..19ddf78 100644 --- a/src/ScreenPlacement.cc +++ b/src/ScreenPlacement.cc @@ -82,6 +82,9 @@ bool ScreenPlacement::placeWindow(const FluxboxWindow &win, int head, case UNDERMOUSEPLACEMENT: m_strategy.reset(new UnderMousePlacement()); break; + case AUTOTABPLACEMENT: + m_strategy.reset(0); + break; } } @@ -96,14 +99,16 @@ bool ScreenPlacement::placeWindow(const FluxboxWindow &win, int head, place_y = head_top; bool placed = false; - try { - placed = m_strategy->placeWindow(win, head, place_x, place_y); - } catch (std::bad_cast & cast) { - // This should not happen. - // If for some reason we change the PlacementStrategy in Screen - // from ScreenPlacement to something else then we might get - // bad_cast from some placement strategies. - cerr<<"Failed to place window: "<placeWindow(win, head, place_x, place_y); + } catch (std::bad_cast & cast) { + // This should not happen. + // If for some reason we change the PlacementStrategy in Screen + // from ScreenPlacement to something else then we might get + // bad_cast from some placement strategies. + cerr<<"Failed to place window: "<::getString() const return "UnderMousePlacement"; case ScreenPlacement::CASCADEPLACEMENT: return "CascadePlacement"; + case ScreenPlacement::AUTOTABPLACEMENT: + return "AutotabPlacement"; } return "RowSmartPlacement"; @@ -213,6 +220,8 @@ void FbTk::Resource::setFromString(const char *(*this) = ScreenPlacement::UNDERMOUSEPLACEMENT; else if (strcasecmp("CascadePlacement", str) == 0) *(*this) = ScreenPlacement::CASCADEPLACEMENT; + else if (strcasecmp("AutotabPlacement", str) == 0) + *(*this) = ScreenPlacement::AUTOTABPLACEMENT; else setDefaultValue(); } diff --git a/src/ScreenPlacement.hh b/src/ScreenPlacement.hh index ceec2d2..0f210d9 100644 --- a/src/ScreenPlacement.hh +++ b/src/ScreenPlacement.hh @@ -48,7 +48,8 @@ public: COLMINOVERLAPPLACEMENT, ROWMINOVERLAPPLACEMENT, CASCADEPLACEMENT, - UNDERMOUSEPLACEMENT + UNDERMOUSEPLACEMENT, + AUTOTABPLACEMENT }; enum RowDirection { -- cgit v0.11.2