[PATCH weston 2/6] libweston: Use the monotonic clock in weston_compositor_get_time

Daniel Stone daniel at fooishbar.org
Tue Dec 6 11:32:33 UTC 2016


Hi,

On 5 December 2016 at 03:36, Dima Ryazanov <dima at gmail.com> wrote:
> (This is kind of a workaround, but perhaps the right thing to do anyways.)
>
> The menu implementation in window.c needs to know the time of the event that
> triggered the menu - however, the xdg-shell's show_window_menu API does not
> give us that info. There doesn't seem to be an easy way to fake it because
> different compositors use different times when sending events:
> - compositor-drm uses the monotonic clock
> - compositor-x11 uses weston_compositor_get_time
> - compositor-wayland uses the event times in got from the parent compositor
> - GNOME appears to use the monotonic clock
>
> Switching weston_compositor_get_time to use the monotonic clock works around
> this issue - though things would break in compositor-wayland if its parent
> uses something else.
>
> Signed-off-by: Dima Ryazanov <dima at gmail.com>

I think we may want a check that CLOCK_MONOTONIC actually works (i.e.
the first time this function is called, assert that ret == 0). But
yes, it's definitely the right thing to do, so with that:
Reviewed-by: Daniel Stone <daniels at collabora.com>

Cheers,
Daniel


More information about the wayland-devel mailing list