mirror of
https://gitlab.freedesktop.org/wayland/weston
synced 2024-09-30 05:09:04 +00:00
clients/desktop-shell: Reset panel clock timer everytime
In case of the system time changed in between. Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
This commit is contained in:
parent
ce1705435f
commit
523a2b75f1
|
@ -425,12 +425,16 @@ panel_launcher_tablet_tool_button_handler(struct widget *widget,
|
|||
panel_launcher_activate(launcher);
|
||||
}
|
||||
|
||||
static int clock_timer_reset(struct panel_clock *clock);
|
||||
|
||||
static void
|
||||
clock_func(struct toytimer *tt)
|
||||
{
|
||||
struct panel_clock *clock = container_of(tt, struct panel_clock, timer);
|
||||
|
||||
widget_schedule_redraw(clock->widget);
|
||||
|
||||
clock_timer_reset(clock);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -481,7 +485,7 @@ clock_timer_reset(struct panel_clock *clock)
|
|||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
tm = localtime(&ts.tv_sec);
|
||||
|
||||
its.it_interval.tv_sec = clock->refresh_timer;
|
||||
its.it_interval.tv_sec = 0;
|
||||
its.it_interval.tv_nsec = 0;
|
||||
its.it_value.tv_sec = clock->refresh_timer - tm->tm_sec % clock->refresh_timer;
|
||||
its.it_value.tv_nsec = 10000000; /* 10 ms late to ensure the clock digit has actually changed */
|
||||
|
|
Loading…
Reference in a new issue