wlr_idle: add helper to enable/disable all timers

There was no way to tell wlr_idle to stop processing input events
and rearm timers all the time, such an API is required to have
some form of idle inhibitor.
This commit is contained in:
Dominique Martinet 2018-06-27 19:19:56 +09:00
parent 159835de24
commit d0b902b962
2 changed files with 38 additions and 2 deletions

View file

@ -17,6 +17,7 @@ struct wlr_idle {
struct wl_global *wl_global;
struct wl_list idle_timers; // wlr_idle_timeout::link
struct wl_event_loop *event_loop;
bool enabled;
struct wl_listener display_destroy;
struct {
@ -33,6 +34,7 @@ struct wlr_idle_timeout {
struct wl_event_source *idle_source;
bool idle_state;
bool enabled;
uint32_t timeout; // milliseconds
struct wl_listener input_listener;
@ -50,4 +52,11 @@ void wlr_idle_destroy(struct wlr_idle *idle);
* compositor when there is an user activity event on that seat.
*/
void wlr_idle_notify_activity(struct wlr_idle *idle, struct wlr_seat *seat);
/**
* Enable or disable timers for a given idle resource by seat.
* Passing a NULL seat means update timers for all seats.
*/
void wlr_idle_set_enabled(struct wlr_idle *idle, struct wlr_seat *seat,
bool enabled);
#endif