From d0b902b962535fc71be03aac13b2a8b6ee3e04df Mon Sep 17 00:00:00 2001
From: Dominique Martinet <asmadeus@codewreck.org>
Date: Wed, 27 Jun 2018 19:19:56 +0900
Subject: 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.
---
 include/wlr/types/wlr_idle.h | 9 +++++++++
 1 file changed, 9 insertions(+)

(limited to 'include/wlr')

diff --git a/include/wlr/types/wlr_idle.h b/include/wlr/types/wlr_idle.h
index 45f350be..aca9146c 100644
--- a/include/wlr/types/wlr_idle.h
+++ b/include/wlr/types/wlr_idle.h
@@ -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
-- 
cgit v1.2.3