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 /src | |
parent | 9ff23f01ca0a0a6c83a3a5e5d933fffbb59dfab8 (diff) | |
download | fluxbox_lack-a211ca912da6e17cfeee8a8fdde9d4eeff7c51a7.zip fluxbox_lack-a211ca912da6e17cfeee8a8fdde9d4eeff7c51a7.tar.bz2 |
grow the clock if the text gets too big
Diffstat (limited to 'src')
-rw-r--r-- | src/ClockTool.cc | 10 |
1 files changed, 9 insertions, 1 deletions
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 |