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
This commit is contained in:
Ilia Bozhinov 2019-04-17 07:48:43 +02:00 committed by Simon Ser
parent dc5d1d08ef
commit d6615e0e84
2 changed files with 91 additions and 38 deletions

View file

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