From d6615e0e844265d60e4624afa12b2bba1f967e57 Mon Sep 17 00:00:00 2001 From: Ilia Bozhinov Date: Wed, 17 Apr 2019 07:48:43 +0200 Subject: idle: enable the compositors to add custom idle timeouts (#1655) * idle: enable the compositors to add custom idle timeouts * idle: add a private constructor which also creates the resource * idle: move resource creation to the idle implementation callback --- include/wlr/types/wlr_idle.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'include/wlr') diff --git a/include/wlr/types/wlr_idle.h b/include/wlr/types/wlr_idle.h index d8c81a60..da268555 100644 --- a/include/wlr/types/wlr_idle.h +++ b/include/wlr/types/wlr_idle.h @@ -46,6 +46,12 @@ struct wlr_idle_timeout { bool enabled; uint32_t timeout; // milliseconds + struct { + struct wl_signal idle; + struct wl_signal resume; + struct wl_signal destroy; + } events; + struct wl_listener input_listener; struct wl_listener seat_destroy; @@ -68,4 +74,15 @@ void wlr_idle_notify_activity(struct wlr_idle *idle, struct wlr_seat *seat); */ void wlr_idle_set_enabled(struct wlr_idle *idle, struct wlr_seat *seat, bool enabled); + +/** + * Create a new timer on the given seat. The idle event will be called after + * the given amount of milliseconds of inactivity, and the resumed event will + * be sent at the first user activty after the fired event. + */ +struct wlr_idle_timeout *wlr_idle_timeout_create(struct wlr_idle *idle, + struct wlr_seat *seat, uint32_t timeout); + +void wlr_idle_timeout_destroy(struct wlr_idle_timeout *timeout); + #endif -- cgit v1.2.3