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
|
// check if it should be grouped with something else
|
||||||
WinClient* other = findGroupLeft(*winclient);
|
WinClient* other = findGroupLeft(*winclient);
|
||||||
|
if (!other && m_placement_strategy->placementPolicy() == ScreenPlacement::AUTOTABPLACEMENT)
|
||||||
|
other = FocusControl::focusedWindow();
|
||||||
FluxboxWindow* win = other ? other->fbwindow() : 0;
|
FluxboxWindow* win = other ? other->fbwindow() : 0;
|
||||||
|
|
||||||
if (other && win) {
|
if (other && win) {
|
||||||
|
|
|
@ -82,6 +82,9 @@ bool ScreenPlacement::placeWindow(const FluxboxWindow &win, int head,
|
||||||
case UNDERMOUSEPLACEMENT:
|
case UNDERMOUSEPLACEMENT:
|
||||||
m_strategy.reset(new UnderMousePlacement());
|
m_strategy.reset(new UnderMousePlacement());
|
||||||
break;
|
break;
|
||||||
|
case AUTOTABPLACEMENT:
|
||||||
|
m_strategy.reset(0);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,6 +99,7 @@ bool ScreenPlacement::placeWindow(const FluxboxWindow &win, int head,
|
||||||
place_y = head_top;
|
place_y = head_top;
|
||||||
|
|
||||||
bool placed = false;
|
bool placed = false;
|
||||||
|
if (m_strategy) {
|
||||||
try {
|
try {
|
||||||
placed = m_strategy->placeWindow(win, head, place_x, place_y);
|
placed = m_strategy->placeWindow(win, head, place_x, place_y);
|
||||||
} catch (std::bad_cast & cast) {
|
} catch (std::bad_cast & cast) {
|
||||||
|
@ -105,6 +109,7 @@ bool ScreenPlacement::placeWindow(const FluxboxWindow &win, int head,
|
||||||
// bad_cast from some placement strategies.
|
// bad_cast from some placement strategies.
|
||||||
cerr<<"Failed to place window: "<<cast.what()<<endl;
|
cerr<<"Failed to place window: "<<cast.what()<<endl;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!placed) {
|
if (!placed) {
|
||||||
// Create fallback strategy, when we need it the first time
|
// Create fallback strategy, when we need it the first time
|
||||||
|
@ -194,6 +199,8 @@ std::string FbTk::Resource<ScreenPlacement::PlacementPolicy>::getString() const
|
||||||
return "UnderMousePlacement";
|
return "UnderMousePlacement";
|
||||||
case ScreenPlacement::CASCADEPLACEMENT:
|
case ScreenPlacement::CASCADEPLACEMENT:
|
||||||
return "CascadePlacement";
|
return "CascadePlacement";
|
||||||
|
case ScreenPlacement::AUTOTABPLACEMENT:
|
||||||
|
return "AutotabPlacement";
|
||||||
}
|
}
|
||||||
|
|
||||||
return "RowSmartPlacement";
|
return "RowSmartPlacement";
|
||||||
|
@ -213,6 +220,8 @@ void FbTk::Resource<ScreenPlacement::PlacementPolicy>::setFromString(const char
|
||||||
*(*this) = ScreenPlacement::UNDERMOUSEPLACEMENT;
|
*(*this) = ScreenPlacement::UNDERMOUSEPLACEMENT;
|
||||||
else if (strcasecmp("CascadePlacement", str) == 0)
|
else if (strcasecmp("CascadePlacement", str) == 0)
|
||||||
*(*this) = ScreenPlacement::CASCADEPLACEMENT;
|
*(*this) = ScreenPlacement::CASCADEPLACEMENT;
|
||||||
|
else if (strcasecmp("AutotabPlacement", str) == 0)
|
||||||
|
*(*this) = ScreenPlacement::AUTOTABPLACEMENT;
|
||||||
else
|
else
|
||||||
setDefaultValue();
|
setDefaultValue();
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,8 @@ public:
|
||||||
COLMINOVERLAPPLACEMENT,
|
COLMINOVERLAPPLACEMENT,
|
||||||
ROWMINOVERLAPPLACEMENT,
|
ROWMINOVERLAPPLACEMENT,
|
||||||
CASCADEPLACEMENT,
|
CASCADEPLACEMENT,
|
||||||
UNDERMOUSEPLACEMENT
|
UNDERMOUSEPLACEMENT,
|
||||||
|
AUTOTABPLACEMENT
|
||||||
};
|
};
|
||||||
|
|
||||||
enum RowDirection {
|
enum RowDirection {
|
||||||
|
|
Loading…
Reference in a new issue