aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsimonb <simonb>2007-04-08 01:53:19 (GMT)
committersimonb <simonb>2007-04-08 01:53:19 (GMT)
commit91963544bdb919f40d4b54f7acaf665373ca5170 (patch)
tree009109f584d3be5ddfedaea88e0988657d1c5dd8
parentb09aae8579d57defadaa39ebc5566ddb68799506 (diff)
downloadfluxbox_paul-91963544bdb919f40d4b54f7acaf665373ca5170.zip
fluxbox_paul-91963544bdb919f40d4b54f7acaf665373ca5170.tar.bz2
Only replace numbers with zeros when calculating clock width.
Otherwise width of things in proportional fonts can be way out. sf.net bug #1545066.
-rw-r--r--ChangeLog5
-rw-r--r--src/ClockTool.cc12
2 files changed, 16 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 3bf652a..dadd00c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
1 (Format: Year/Month/Day) 1 (Format: Year/Month/Day)
2Changes for 1.0.0: 2Changes for 1.0.0:
3*07/04/08:
4 * Only replace numbers with zeros when calculating clock width (Simon)
5 Otherwise width of things in proportional fonts can be way out.
6 sf.net bug #1545066.
7 ClockTool.cc
3*07/04/05: 8*07/04/05:
4 * Adjusted detection of Caps Lock key (Mark) 9 * Adjusted detection of Caps Lock key (Mark)
5 FbTk/KeyUtil.cc/hh 10 FbTk/KeyUtil.cc/hh
diff --git a/src/ClockTool.cc b/src/ClockTool.cc
index 6e06ed6..99cbb06 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 (text[i] > '0' && text[i] <= '9') // 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();