aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarkt <markt>2007-04-08 18:12:08 (GMT)
committermarkt <markt>2007-04-08 18:12:08 (GMT)
commit2566f7014db4dc1dc42ea19b28f945bf018cdd51 (patch)
treebfe547371c484ce29d9bf42af691b67b87d9f4fd
parent863eca5517b4f91e26d889d598f41816acf60a40 (diff)
downloadfluxbox-2566f7014db4dc1dc42ea19b28f945bf018cdd51.zip
fluxbox-2566f7014db4dc1dc42ea19b28f945bf018cdd51.tar.bz2
fix for determining the width of clock (copied from Simon's commit to trunk)
-rw-r--r--ChangeLog4
-rw-r--r--src/ClockTool.cc12
2 files changed, 15 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index d77590b..4ed32dc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,10 @@ Changes for 1.1:
10 * Buttons with different textures when pressed weren't getting reset 10 * Buttons with different textures when pressed weren't getting reset
11 properly (Mark) 11 properly (Mark)
12 FbTk/Button.cc 12 FbTk/Button.cc
13 * Only replace numbers with zeros when calculating clock width (Simon)
14 Otherwise width of things in proportional fonts can be way out.
15 sf.net bug #1545066.
16 ClockTool.cc
13*07/04/06: 17*07/04/06:
14 * More changes to theme handling (Mark) 18 * More changes to theme handling (Mark)
15 - introduced window.label.(un)focused.{justify,border{Color,Width}}, 19 - introduced window.label.(un)focused.{justify,border{Color,Width}},
diff --git a/src/ClockTool.cc b/src/ClockTool.cc
index 6e06ed6..0bfa136 100644
--- a/src/ClockTool.cc
+++ b/src/ClockTool.cc
@@ -220,7 +220,17 @@ void ClockTool::update(FbTk::Subject *subj) {
220 updateTime(); 220 updateTime();
221 221
222 // + 2 to make the entire text fit inside 222 // + 2 to make the entire text fit inside
223 std::string text(m_button.text().size() + 2, '0'); 223 // we only replace numbers with zeros because everything else should be
224 // relatively static. If we replace all text with zeros then widths of
225 // proportional fonts with some strftime formats will be considerably off.
226 std::string text(m_button.text());
227
228 int textlen = text.size();
229 for (int i=0; i < textlen; ++i) {
230 if (isdigit(text[i])) // don't bother replacing zeros
231 text[i] = '0';
232 }
233 text.append("00"); // pad
224 234
225 unsigned int new_width = m_button.width(); 235 unsigned int new_width = m_button.width();
226 unsigned int new_height = m_button.height(); 236 unsigned int new_height = m_button.height();