diff options
-rw-r--r-- | src/Screen.cc | 2 | ||||
-rw-r--r-- | src/ScreenPlacement.cc | 25 | ||||
-rw-r--r-- | 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) { | |||
1138 | 1138 | ||
1139 | // check if it should be grouped with something else | 1139 | // check if it should be grouped with something else |
1140 | WinClient* other = findGroupLeft(*winclient); | 1140 | WinClient* other = findGroupLeft(*winclient); |
1141 | if (!other && m_placement_strategy->placementPolicy() == ScreenPlacement::AUTOTABPLACEMENT) | ||
1142 | other = FocusControl::focusedWindow(); | ||
1141 | FluxboxWindow* win = other ? other->fbwindow() : 0; | 1143 | FluxboxWindow* win = other ? other->fbwindow() : 0; |
1142 | 1144 | ||
1143 | if (other && win) { | 1145 | 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, | |||
82 | case UNDERMOUSEPLACEMENT: | 82 | case UNDERMOUSEPLACEMENT: |
83 | m_strategy.reset(new UnderMousePlacement()); | 83 | m_strategy.reset(new UnderMousePlacement()); |
84 | break; | 84 | break; |
85 | case AUTOTABPLACEMENT: | ||
86 | m_strategy.reset(0); | ||
87 | break; | ||
85 | } | 88 | } |
86 | } | 89 | } |
87 | 90 | ||
@@ -96,14 +99,16 @@ bool ScreenPlacement::placeWindow(const FluxboxWindow &win, int head, | |||
96 | place_y = head_top; | 99 | place_y = head_top; |
97 | 100 | ||
98 | bool placed = false; | 101 | bool placed = false; |
99 | try { | 102 | if (m_strategy) { |
100 | placed = m_strategy->placeWindow(win, head, place_x, place_y); | 103 | try { |
101 | } catch (std::bad_cast & cast) { | 104 | placed = m_strategy->placeWindow(win, head, place_x, place_y); |
102 | // This should not happen. | 105 | } catch (std::bad_cast & cast) { |
103 | // If for some reason we change the PlacementStrategy in Screen | 106 | // This should not happen. |
104 | // from ScreenPlacement to something else then we might get | 107 | // If for some reason we change the PlacementStrategy in Screen |
105 | // bad_cast from some placement strategies. | 108 | // from ScreenPlacement to something else then we might get |
106 | cerr<<"Failed to place window: "<<cast.what()<<endl; | 109 | // bad_cast from some placement strategies. |
110 | cerr<<"Failed to place window: "<<cast.what()<<endl; | ||
111 | } | ||
107 | } | 112 | } |
108 | 113 | ||
109 | if (!placed) { | 114 | if (!placed) { |
@@ -194,6 +199,8 @@ std::string FbTk::Resource<ScreenPlacement::PlacementPolicy>::getString() const | |||
194 | return "UnderMousePlacement"; | 199 | return "UnderMousePlacement"; |
195 | case ScreenPlacement::CASCADEPLACEMENT: | 200 | case ScreenPlacement::CASCADEPLACEMENT: |
196 | return "CascadePlacement"; | 201 | return "CascadePlacement"; |
202 | case ScreenPlacement::AUTOTABPLACEMENT: | ||
203 | return "AutotabPlacement"; | ||
197 | } | 204 | } |
198 | 205 | ||
199 | return "RowSmartPlacement"; | 206 | return "RowSmartPlacement"; |
@@ -213,6 +220,8 @@ void FbTk::Resource<ScreenPlacement::PlacementPolicy>::setFromString(const char | |||
213 | *(*this) = ScreenPlacement::UNDERMOUSEPLACEMENT; | 220 | *(*this) = ScreenPlacement::UNDERMOUSEPLACEMENT; |
214 | else if (strcasecmp("CascadePlacement", str) == 0) | 221 | else if (strcasecmp("CascadePlacement", str) == 0) |
215 | *(*this) = ScreenPlacement::CASCADEPLACEMENT; | 222 | *(*this) = ScreenPlacement::CASCADEPLACEMENT; |
223 | else if (strcasecmp("AutotabPlacement", str) == 0) | ||
224 | *(*this) = ScreenPlacement::AUTOTABPLACEMENT; | ||
216 | else | 225 | else |
217 | setDefaultValue(); | 226 | setDefaultValue(); |
218 | } | 227 | } |
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: | |||
48 | COLMINOVERLAPPLACEMENT, | 48 | COLMINOVERLAPPLACEMENT, |
49 | ROWMINOVERLAPPLACEMENT, | 49 | ROWMINOVERLAPPLACEMENT, |
50 | CASCADEPLACEMENT, | 50 | CASCADEPLACEMENT, |
51 | UNDERMOUSEPLACEMENT | 51 | UNDERMOUSEPLACEMENT, |
52 | AUTOTABPLACEMENT | ||
52 | }; | 53 | }; |
53 | 54 | ||
54 | enum RowDirection { | 55 | enum RowDirection { |