aboutsummaryrefslogtreecommitdiff
path: root/src/Container.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Container.cc')
-rw-r--r--src/Container.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/Container.cc b/src/Container.cc
index 9cef92c..76d8d52 100644
--- a/src/Container.cc
+++ b/src/Container.cc
@@ -264,10 +264,16 @@ void Container::setMaxSizePerClient(unsigned int size) {
264} 264}
265 265
266void Container::setMaxTotalSize(unsigned int size) { 266void Container::setMaxTotalSize(unsigned int size) {
267 if (m_max_total_size == size)
268 return;
269
270 unsigned int old = m_max_total_size;
267 m_max_total_size = size; 271 m_max_total_size = size;
268 272
269 if (m_max_total_size && width() > m_max_total_size) { 273 if (m_max_total_size && width() > m_max_total_size) {
270 resize(m_max_total_size, height()); 274 resize(m_max_total_size, height());
275 } else if (!m_max_total_size && old) { // going from restricted to unrestricted
276 repositionItems();
271 } else { 277 } else {
272 // this is a bit of duplication from repositionItems 278 // this is a bit of duplication from repositionItems
273 // for when we are allowed to grow ourself 279 // for when we are allowed to grow ourself
@@ -286,7 +292,6 @@ void Container::setMaxTotalSize(unsigned int size) {
286 if (preferred_width != width()) 292 if (preferred_width != width())
287 repositionItems(); 293 repositionItems();
288 } 294 }
289
290 } 295 }
291} 296}
292 297
@@ -381,7 +386,10 @@ void Container::repositionItems() {
381 } 386 }
382 if (total_width != width()) { 387 if (total_width != width()) {
383 // calling Container::resize here risks infinite loops 388 // calling Container::resize here risks infinite loops
384 FbTk::FbWindow::resize(total_width, height()); 389 if (align == RIGHT)
390 FbTk::FbWindow::moveResize(x() - (total_width - width()), y(), total_width, height());
391 else
392 FbTk::FbWindow::resize(total_width, height());
385 } 393 }
386 } 394 }
387 395
@@ -396,7 +404,7 @@ void Container::repositionItems() {
396 int direction = 1; 404 int direction = 1;
397 if (align == RIGHT) { 405 if (align == RIGHT) {
398 direction = -1; 406 direction = -1;
399 next_x = total_width - max_width_per_client + borderW; 407 next_x = total_width - max_width_per_client - borderW;
400 } 408 }
401 409
402 for (; it != it_end; ++it, next_x += direction*(max_width_per_client + borderW + extra)) { 410 for (; it != it_end; ++it, next_x += direction*(max_width_per_client + borderW + extra)) {