diff options
author | Thomas Lübking <thomas.luebking@gmail.com> | 2016-09-11 13:18:00 (GMT) |
---|---|---|
committer | Thomas Lübking <thomas.luebking@gmail.com> | 2016-09-11 13:26:12 (GMT) |
commit | ea466fa985f251bdd4a5afe19a41ee28ac91035d (patch) | |
tree | e32da64a63d6788ef7f242631c94cabe41d2112b /src/ScreenPlacement.cc | |
parent | 4be68df4b555015bff2fa5d44b1985bdede88792 (diff) | |
download | fluxbox-ea466fa985f251bdd4a5afe19a41ee28ac91035d.zip fluxbox-ea466fa985f251bdd4a5afe19a41ee28ac91035d.tar.bz2 |
introduce autotabplacement
Diffstat (limited to 'src/ScreenPlacement.cc')
-rw-r--r-- | src/ScreenPlacement.cc | 25 |
1 files changed, 17 insertions, 8 deletions
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 | } |