diff options
author | simonb <simonb> | 2006-04-17 13:36:59 (GMT) |
---|---|---|
committer | simonb <simonb> | 2006-04-17 13:36:59 (GMT) |
commit | a211ca912da6e17cfeee8a8fdde9d4eeff7c51a7 (patch) | |
tree | 96556240742312296b7f053aa07c1088a94f09c9 | |
parent | 9ff23f01ca0a0a6c83a3a5e5d933fffbb59dfab8 (diff) | |
download | fluxbox_paul-a211ca912da6e17cfeee8a8fdde9d4eeff7c51a7.zip fluxbox_paul-a211ca912da6e17cfeee8a8fdde9d4eeff7c51a7.tar.bz2 |
grow the clock if the text gets too big
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | src/ClockTool.cc | 10 |
2 files changed, 12 insertions, 1 deletions
@@ -1,6 +1,9 @@ | |||
1 | (Format: Year/Month/Day) | 1 | (Format: Year/Month/Day) |
2 | Changes for 0.9.16: | 2 | Changes for 0.9.16: |
3 | *06/04/17: | 3 | *06/04/17: |
4 | * Resize the clock if the text gets too big, sf.net patch #1436406 | ||
5 | (thanks Geoff Lywood - glywood at users.sourceforge.net) | ||
6 | ClockTool.cc | ||
4 | * Fix some rotated toolbar+textbutton issues (Simon) | 7 | * Fix some rotated toolbar+textbutton issues (Simon) |
5 | Toolbar.cc IconbarTool.cc FbTk/TextButton.cc | 8 | Toolbar.cc IconbarTool.cc FbTk/TextButton.cc |
6 | * Fix /bin/sh portability for fbsetbg and startfluxbox (Simon) | 9 | * Fix /bin/sh portability for fbsetbg and startfluxbox (Simon) |
diff --git a/src/ClockTool.cc b/src/ClockTool.cc index 8a5077b..851973c 100644 --- a/src/ClockTool.cc +++ b/src/ClockTool.cc | |||
@@ -249,14 +249,22 @@ void ClockTool::updateTime() { | |||
249 | 249 | ||
250 | if (the_time != -1) { | 250 | if (the_time != -1) { |
251 | char time_string[255]; | 251 | char time_string[255]; |
252 | int time_string_len; | ||
252 | struct tm *time_type = localtime(&the_time); | 253 | struct tm *time_type = localtime(&the_time); |
253 | if (time_type == 0) | 254 | if (time_type == 0) |
254 | return; | 255 | return; |
255 | 256 | ||
256 | #ifdef HAVE_STRFTIME | 257 | #ifdef HAVE_STRFTIME |
257 | if (!strftime(time_string, 255, m_timeformat->c_str(), time_type) || m_button.text() == time_string) | 258 | time_string_len = strftime(time_string, 255, m_timeformat->c_str(), time_type); |
259 | if( time_string_len == 0 || m_button.text() == time_string) | ||
258 | return; | 260 | return; |
259 | m_button.setText(time_string); | 261 | m_button.setText(time_string); |
262 | |||
263 | int new_width = m_theme.font().textWidth(time_string, time_string_len) + 2; | ||
264 | if (new_width > m_button.width()) { | ||
265 | resize(new_width, m_button.height()); | ||
266 | resizeSig().notify(); | ||
267 | } | ||
260 | #else // dont have strftime so we have to set it to hour:minut | 268 | #else // dont have strftime so we have to set it to hour:minut |
261 | // sprintf(time_string, "%d:%d", ); | 269 | // sprintf(time_string, "%d:%d", ); |
262 | #endif // HAVE_STRFTIME | 270 | #endif // HAVE_STRFTIME |