xsecurelock: check clock more often

timeout_add is using a monotonic clock and therefore, we need to check
for updates more often.
This commit is contained in:
Vincent Bernat 2021-12-09 17:52:44 +01:00
parent 2447dcb575
commit 505786cefe

View file

@ -129,9 +129,11 @@ def on_background_change(monitor, f1, f2, event, ctx):
def on_clock_change(ctx):
now = datetime.datetime.now()
ctx.clock = now.strftime("%H:%M")
ctx.overlay.queue_draw()
GLib.timeout_add((60 - now.second) * 1000, on_clock_change, ctx)
new_clock = now.strftime("%H:%M")
if new_clock != ctx.clock:
ctx.clock = new_clock
ctx.overlay.queue_draw()
GLib.timeout_add(min(60 - now.second, 3) * 1000, on_clock_change, ctx)
def on_weather_change(monitor, f1, f2, event, ctx):