mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-17 10:35:10 +00:00
Update immediately when the root pixmap changes (#230)
* use CLOCK_MONOTONIC if supported get_time is used to control the update interval etc. so there's no need to query the system time * repaint immediately when the root pixmap changed Original patch by pweisenburger, In addition resets the next_update_time to ensure "now" FIXES: #48
This commit is contained in:
parent
7d7e9b6fd8
commit
06f87b9c26
@ -122,8 +122,11 @@ int update_uname(void)
|
||||
double get_time(void)
|
||||
{
|
||||
struct timespec tv;
|
||||
|
||||
#ifdef _POSIX_MONOTONIC_CLOCK
|
||||
clock_gettime(CLOCK_MONOTONIC, &tv);
|
||||
#else
|
||||
clock_gettime(CLOCK_REALTIME, &tv);
|
||||
#endif
|
||||
return tv.tv_sec + (tv.tv_nsec * 1e-9);
|
||||
}
|
||||
|
||||
|
12
src/conky.cc
12
src/conky.cc
@ -2242,6 +2242,18 @@ static void main_loop(void)
|
||||
if ( ev.xproperty.state == PropertyNewValue ) {
|
||||
get_x11_desktop_info( ev.xproperty.display, ev.xproperty.atom );
|
||||
}
|
||||
#ifdef USE_ARGB
|
||||
if (!have_argb_visual) {
|
||||
#endif
|
||||
if ( ev.xproperty.atom == ATOM(_XROOTPMAP_ID)
|
||||
|| ev.xproperty.atom == ATOM(_XROOTMAP_ID)) {
|
||||
draw_stuff();
|
||||
next_update_time = get_time();
|
||||
need_to_update = 1;
|
||||
}
|
||||
#ifdef USE_ARGB
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user