diff options
Diffstat (limited to 'sway/input/seat.c')
-rw-r--r-- | sway/input/seat.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c index bc72ff0c..371de56e 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <time.h> | 6 | #include <time.h> |
7 | #include <wlr/types/wlr_cursor.h> | 7 | #include <wlr/types/wlr_cursor.h> |
8 | #include <wlr/types/wlr_data_device.h> | 8 | #include <wlr/types/wlr_data_device.h> |
9 | #include <wlr/types/wlr_idle.h> | ||
9 | #include <wlr/types/wlr_output_layout.h> | 10 | #include <wlr/types/wlr_output_layout.h> |
10 | #include <wlr/types/wlr_primary_selection.h> | 11 | #include <wlr/types/wlr_primary_selection.h> |
11 | #include <wlr/types/wlr_tablet_v2.h> | 12 | #include <wlr/types/wlr_tablet_v2.h> |
@@ -71,6 +72,25 @@ static void seat_node_destroy(struct sway_seat_node *seat_node) { | |||
71 | free(seat_node); | 72 | free(seat_node); |
72 | } | 73 | } |
73 | 74 | ||
75 | void seat_idle_notify_activity(struct sway_seat *seat, | ||
76 | enum sway_input_idle_source source) { | ||
77 | uint32_t mask = seat->idle_inhibit_sources; | ||
78 | struct wlr_idle_timeout *timeout; | ||
79 | int ntimers = 0, nidle = 0; | ||
80 | wl_list_for_each(timeout, &server.idle->idle_timers, link) { | ||
81 | ++ntimers; | ||
82 | if (timeout->idle_state) { | ||
83 | ++nidle; | ||
84 | } | ||
85 | } | ||
86 | if (nidle == ntimers) { | ||
87 | mask = seat->idle_wake_sources; | ||
88 | } | ||
89 | if ((source & mask) > 0) { | ||
90 | wlr_idle_notify_activity(server.idle, seat->wlr_seat); | ||
91 | } | ||
92 | } | ||
93 | |||
74 | /** | 94 | /** |
75 | * Activate all views within this container recursively. | 95 | * Activate all views within this container recursively. |
76 | */ | 96 | */ |
@@ -491,6 +511,14 @@ struct sway_seat *seat_create(const char *seat_name) { | |||
491 | return NULL; | 511 | return NULL; |
492 | } | 512 | } |
493 | 513 | ||
514 | seat->idle_inhibit_sources = seat->idle_wake_sources = | ||
515 | IDLE_SOURCE_KEYBOARD | | ||
516 | IDLE_SOURCE_POINTER | | ||
517 | IDLE_SOURCE_TOUCH | | ||
518 | IDLE_SOURCE_TABLET_PAD | | ||
519 | IDLE_SOURCE_TABLET_TOOL | | ||
520 | IDLE_SOURCE_SWITCH; | ||
521 | |||
494 | // init the focus stack | 522 | // init the focus stack |
495 | wl_list_init(&seat->focus_stack); | 523 | wl_list_init(&seat->focus_stack); |
496 | 524 | ||
@@ -1325,6 +1353,9 @@ void seat_apply_config(struct sway_seat *seat, | |||
1325 | return; | 1353 | return; |
1326 | } | 1354 | } |
1327 | 1355 | ||
1356 | seat->idle_inhibit_sources = seat_config->idle_inhibit_sources; | ||
1357 | seat->idle_wake_sources = seat_config->idle_wake_sources; | ||
1358 | |||
1328 | wl_list_for_each(seat_device, &seat->devices, link) { | 1359 | wl_list_for_each(seat_device, &seat->devices, link) { |
1329 | seat_configure_device(seat, seat_device->input_device); | 1360 | seat_configure_device(seat, seat_device->input_device); |
1330 | } | 1361 | } |