introduce autotabplacement
This commit is contained in:
parent
4be68df4b5
commit
ea466fa985
3 changed files with 21 additions and 9 deletions
|
@ -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) {
|
||||
|
|
|
@ -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,6 +99,7 @@ bool ScreenPlacement::placeWindow(const FluxboxWindow &win, int head,
|
|||
place_y = head_top;
|
||||
|
||||
bool placed = false;
|
||||
if (m_strategy) {
|
||||
try {
|
||||
placed = m_strategy->placeWindow(win, head, place_x, place_y);
|
||||
} catch (std::bad_cast & cast) {
|
||||
|
@ -105,6 +109,7 @@ bool ScreenPlacement::placeWindow(const FluxboxWindow &win, int head,
|
|||
// bad_cast from some placement strategies.
|
||||
cerr<<"Failed to place window: "<<cast.what()<<endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (!placed) {
|
||||
// Create fallback strategy, when we need it the first time
|
||||
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -48,7 +48,8 @@ public:
|
|||
COLMINOVERLAPPLACEMENT,
|
||||
ROWMINOVERLAPPLACEMENT,
|
||||
CASCADEPLACEMENT,
|
||||
UNDERMOUSEPLACEMENT
|
||||
UNDERMOUSEPLACEMENT,
|
||||
AUTOTABPLACEMENT
|
||||
};
|
||||
|
||||
enum RowDirection {
|
||||
|
|
Loading…
Reference in a new issue