aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/Container.cc
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2009-06-28 15:22:51 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2009-06-28 15:22:51 (GMT)
commit4e586cc1729fc1c7115dfc6d2499d40db559b8e1 (patch)
treeaf27f7170dcae0398f0466bbcb5c9ba524e069b0 /src/FbTk/Container.cc
parentf3d61235f32437d726ec00ff5ac7708b0adc8724 (diff)
downloadfluxbox-4e586cc1729fc1c7115dfc6d2499d40db559b8e1.zip
fluxbox-4e586cc1729fc1c7115dfc6d2499d40db559b8e1.tar.bz2
previous fix for reverting iconbar to relative broke external tabs
Diffstat (limited to 'src/FbTk/Container.cc')
-rw-r--r--src/FbTk/Container.cc46
1 files changed, 27 insertions, 19 deletions
diff --git a/src/FbTk/Container.cc b/src/FbTk/Container.cc
index 6a8f2a3..bcb6b01 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
@@ -328,7 +329,7 @@ void Container::repositionItems() {
328 } else 329 } else
329 max_width_per_client = 1; 330 max_width_per_client = 1;
330 } 331 }
331 if (total_width != cur_width) { 332 if (m_auto_resize && total_width != cur_width) {
332 // calling Container::resize here risks infinite loops 333 // calling Container::resize here risks infinite loops
333 unsigned int neww = total_width, newh = height; 334 unsigned int neww = total_width, newh = height;
334 translateSize(m_orientation, neww, newh); 335 translateSize(m_orientation, neww, newh);
@@ -410,24 +411,31 @@ void Container::repositionItems() {
410 411
411 412
412unsigned int Container::maxWidthPerClient() const { 413unsigned int Container::maxWidthPerClient() const {
413 unsigned int max_relative_size; 414 switch (alignment()) {
414 if (size() == 0) 415 case RIGHT:
415 max_relative_size = width(); 416 case CENTER:
416 else { 417 case LEFT:
417 unsigned int borderW = m_item_list.front()->borderWidth(); 418 return m_max_size_per_client;
418 // there're count-1 borders to fit in with the windows 419 break;
419 // -> 1 per window plus end 420 case RELATIVE:
420 unsigned int w = width(), h = height(); 421 if (size() == 0)
421 translateSize(m_orientation, w, h); 422 return width();
422 max_relative_size = w < (size()-1)*borderW ? 1 : 423 else {
423 (w - (size() - 1) * borderW) / size(); 424 unsigned int borderW = m_item_list.front()->borderWidth();
425 // there're count-1 borders to fit in with the windows
426 // -> 1 per window plus end
427 unsigned int w = width(), h = height();
428 translateSize(m_orientation, w, h);
429 if (w < (size()-1)*borderW)
430 return 1;
431 else
432 return (w - (size() - 1) * borderW) / size();
433 }
434 break;
424 } 435 }
425 436
426 if (alignment() == RELATIVE) 437 // this will never happen anyway
427 return max_relative_size; 438 return 1;
428
429 return (m_max_size_per_client < max_relative_size ?
430 m_max_size_per_client : max_relative_size);
431} 439}
432 440
433void Container::for_each(std::mem_fun_t<void, FbWindow> function) { 441void Container::for_each(std::mem_fun_t<void, FbWindow> function) {