introduce autotabplacement

This commit is contained in:
Thomas Lübking 2016-09-11 15:18:00 +02:00
parent 4be68df4b5
commit ea466fa985
3 changed files with 21 additions and 9 deletions

View file

@ -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) {

View file

@ -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: "<<cast.what()<<endl;
if (m_strategy) {
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: "<<cast.what()<<endl;
}
}
if (!placed) {
@ -194,6 +199,8 @@ std::string FbTk::Resource<ScreenPlacement::PlacementPolicy>::getString() const
return "UnderMousePlacement";
case ScreenPlacement::CASCADEPLACEMENT:
return "CascadePlacement";
case ScreenPlacement::AUTOTABPLACEMENT:
return "AutotabPlacement";
}
return "RowSmartPlacement";
@ -213,6 +220,8 @@ void FbTk::Resource<ScreenPlacement::PlacementPolicy>::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();
}

View file

@ -48,7 +48,8 @@ public:
COLMINOVERLAPPLACEMENT,
ROWMINOVERLAPPLACEMENT,
CASCADEPLACEMENT,
UNDERMOUSEPLACEMENT
UNDERMOUSEPLACEMENT,
AUTOTABPLACEMENT
};
enum RowDirection {