all repos — fluxbox @ 91963544bdb919f40d4b54f7acaf665373ca5170

custom fork of the fluxbox windowmanager

Only replace numbers with zeros when calculating clock width.
Otherwise width of things in proportional fonts can be way out.
sf.net bug #1545066.
simonb simonb
commit

91963544bdb919f40d4b54f7acaf665373ca5170

parent

b09aae8579d57defadaa39ebc5566ddb68799506

2 files changed, 16 insertions(+), 1 deletions(-)

jump to
M ChangeLogChangeLog

@@ -1,5 +1,10 @@

(Format: Year/Month/Day) Changes for 1.0.0: +*07/04/08: + * Only replace numbers with zeros when calculating clock width (Simon) + Otherwise width of things in proportional fonts can be way out. + sf.net bug #1545066. + ClockTool.cc *07/04/05: * Adjusted detection of Caps Lock key (Mark) FbTk/KeyUtil.cc/hh
M src/ClockTool.ccsrc/ClockTool.cc

@@ -220,7 +220,17 @@ void ClockTool::update(FbTk::Subject *subj) {

updateTime(); // + 2 to make the entire text fit inside - std::string text(m_button.text().size() + 2, '0'); + // we only replace numbers with zeros because everything else should be + // relatively static. If we replace all text with zeros then widths of + // proportional fonts with some strftime formats will be considerably off. + std::string text(m_button.text()); + + int textlen = text.size(); + for (int i=0; i < textlen; ++i) { + if (text[i] > '0' && text[i] <= '9') // don't bother replacing zeros + text[i] = '0'; + } + text.append("00"); // pad unsigned int new_width = m_button.width(); unsigned int new_height = m_button.height();