aboutsummaryrefslogtreecommitdiff
path: root/src/Toolbar.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Toolbar.cc')
-rw-r--r--src/Toolbar.cc24
1 files changed, 9 insertions, 15 deletions
diff --git a/src/Toolbar.cc b/src/Toolbar.cc
index 6063b5e..1305279 100644
--- a/src/Toolbar.cc
+++ b/src/Toolbar.cc
@@ -976,7 +976,6 @@ void Toolbar::rearrangeItems() {
976 ItemList::iterator item_it_end = m_item_list.end(); 976 ItemList::iterator item_it_end = m_item_list.end();
977 int bevel_width = theme().bevelWidth(); 977 int bevel_width = theme().bevelWidth();
978 int fixed_width = bevel_width; // combined size of all fixed items 978 int fixed_width = bevel_width; // combined size of all fixed items
979 int fixed_items = 0; // number of fixed items
980 int relative_items = 0; 979 int relative_items = 0;
981 int last_bw = 0; // we show the largest border of adjoining items 980 int last_bw = 0; // we show the largest border of adjoining items
982 bool first = true; 981 bool first = true;
@@ -1013,28 +1012,23 @@ void Toolbar::rearrangeItems() {
1013 1012
1014 if ((*item_it)->type() == ToolbarItem::FIXED) { 1013 if ((*item_it)->type() == ToolbarItem::FIXED) {
1015 fixed_width += tmpw; 1014 fixed_width += tmpw;
1016 fixed_items++;
1017 } else if ((*item_it)->type() == ToolbarItem::SQUARE) { 1015 } else if ((*item_it)->type() == ToolbarItem::SQUARE) {
1018 fixed_width += tmph; 1016 fixed_width += height;
1019 //if (bevel_width != 0) fixed_width -= 2*borderW; 1017 if (bevel_width)
1020 fixed_items++; 1018 fixed_width -= 2*(borderW + bevel_width);
1021 } else { 1019 } else {
1022 relative_items++; 1020 relative_items++;
1023 } 1021 }
1024 } 1022 }
1025 1023
1026 // calculate what's going to be le ft over to the relative sized items 1024 // calculate what's going to be left over to the relative sized items
1027 int relative_width = 0; 1025 int relative_width = 0;
1028 int rounding_error = 0; 1026 int rounding_error = 0;
1029 if (fixed_items == 0) // no fixed items, then the rest is the entire width 1027 if (relative_items == 0)
1030 relative_width = width; 1028 relative_width = 0;
1031 else { 1029 else { // size left after fixed items / number of relative items
1032 if (relative_items == 0) 1030 relative_width = (width - fixed_width) / relative_items;
1033 relative_width = 0; 1031 rounding_error = width - fixed_width - relative_items * relative_width;
1034 else { // size left after fixed items / number of relative items
1035 relative_width = (width - fixed_width)/relative_items;
1036 rounding_error = width - fixed_width - relative_items*(relative_width);
1037 }
1038 } 1032 }
1039 1033
1040 // now move and resize the items 1034 // now move and resize the items