aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarkt <markt>2007-03-19 05:03:12 (GMT)
committermarkt <markt>2007-03-19 05:03:12 (GMT)
commit063468ea6603aaf866e5d52d4f06bfb0714f1b2f (patch)
tree1dba6549da3a12596c4d883927c25428c283a58e
parentb3f7488a8deb5b51cdbbc3673eb26b1611ef5110 (diff)
downloadfluxbox-063468ea6603aaf866e5d52d4f06bfb0714f1b2f.zip
fluxbox-063468ea6603aaf866e5d52d4f06bfb0714f1b2f.tar.bz2
size of relative items in toolbar wasn't being calculated properly
-rw-r--r--ChangeLog3
-rw-r--r--src/Toolbar.cc24
2 files changed, 12 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index 898ef24..d46c3fa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
1 (Format: Year/Month/Day) 1 (Format: Year/Month/Day)
2Changes for 1.0rc3: 2Changes for 1.0rc3:
3*07/03/19:
4 * Fixed some problems with toolbar sizing (Mark + thanks Julien Trolet)
5 Toolbar.cc
3*07/03/18: 6*07/03/18:
4 * Changed position remembering so it only remembers position relative to the 7 * Changed position remembering so it only remembers position relative to the
5 current head (Mark) 8 current head (Mark)
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