1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-09-29 21:49:07 +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:
luebking 2016-04-13 19:33:33 +02:00 committed by Brenden Matthews
parent 7d7e9b6fd8
commit 06f87b9c26
2 changed files with 16 additions and 1 deletions

View File

@ -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);
}

View File

@ -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;
}