summaryrefslogtreecommitdiff
path: root/src/FbTk/Container.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/Container.cc')
-rw-r--r--src/FbTk/Container.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/FbTk/Container.cc b/src/FbTk/Container.cc
index 3374266..ce143ef 100644
--- a/src/FbTk/Container.cc
+++ b/src/FbTk/Container.cc
@@ -33,13 +33,14 @@ namespace FbTk {
33 33
34typedef CompareEqual_base<FbWindow, Window> CompareWindow; 34typedef CompareEqual_base<FbWindow, Window> CompareWindow;
35 35
36Container::Container(const FbWindow &parent): 36Container::Container(const FbWindow &parent, bool auto_resize):
37 FbWindow(parent, 0, 0, 1, 1, ExposureMask), 37 FbWindow(parent, 0, 0, 1, 1, ExposureMask),
38 m_orientation(ROT0), 38 m_orientation(ROT0),
39 m_align(RELATIVE), 39 m_align(RELATIVE),
40 m_max_size_per_client(60), 40 m_max_size_per_client(60),
41 m_max_total_size(0), 41 m_max_total_size(0),
42 m_update_lock(false) { 42 m_update_lock(false),
43 m_auto_resize(auto_resize) {
43 EventManager::instance()->add(*this, *this); 44 EventManager::instance()->add(*this, *this);
44} 45}
45 46
@@ -228,7 +229,10 @@ void Container::setMaxTotalSize(unsigned int size) {
228} 229}
229 230
230void Container::setAlignment(Container::Alignment a) { 231void Container::setAlignment(Container::Alignment a) {
231 m_align = a; 232 if (m_align != a) {
233 m_align = a;
234 repositionItems();
235 }
232} 236}
233 237
234void Container::exposeEvent(XExposeEvent &event) { 238void Container::exposeEvent(XExposeEvent &event) {
@@ -328,7 +332,7 @@ void Container::repositionItems() {
328 } else 332 } else
329 max_width_per_client = 1; 333 max_width_per_client = 1;
330 } 334 }
331 if (total_width != cur_width) { 335 if (m_auto_resize && total_width != cur_width) {
332 // calling Container::resize here risks infinite loops 336 // calling Container::resize here risks infinite loops
333 unsigned int neww = total_width, newh = height; 337 unsigned int neww = total_width, newh = height;
334 translateSize(m_orientation, neww, newh); 338 translateSize(m_orientation, neww, newh);