aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2019-12-11 11:00:39 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2019-12-12 10:37:30 -0500
commit2f3c6cccf5d6b2d6ffd3cee62e7b624dc80dc6e6 (patch)
tree69d3367cf7dbd7f756d45d89cd37e6016503a88d /include
parentFix lingering workspace with scratchpad show (diff)
downloadsway-2f3c6cccf5d6b2d6ffd3cee62e7b624dc80dc6e6.tar.gz
sway-2f3c6cccf5d6b2d6ffd3cee62e7b624dc80dc6e6.tar.zst
sway-2f3c6cccf5d6b2d6ffd3cee62e7b624dc80dc6e6.zip
Add seat <seat> idle_{inhibit,wake} <sources...>
This adds seat configuration options which can be used to configure what events affect the idle behavior of sway. An example use-case is mobile devices: you would remove touch from the list of idle_wake events. This allows the phone to stay on while you're actively using it, but doesn't wake from idle on touch events while it's sleeping in your pocket.
Diffstat (limited to 'include')
-rw-r--r--include/sway/commands.h2
-rw-r--r--include/sway/config.h10
-rw-r--r--include/sway/input/seat.h6
3 files changed, 18 insertions, 0 deletions
diff --git a/include/sway/commands.h b/include/sway/commands.h
index 5f249980..982125c1 100644
--- a/include/sway/commands.h
+++ b/include/sway/commands.h
@@ -285,6 +285,8 @@ sway_cmd seat_cmd_attach;
285sway_cmd seat_cmd_cursor; 285sway_cmd seat_cmd_cursor;
286sway_cmd seat_cmd_fallback; 286sway_cmd seat_cmd_fallback;
287sway_cmd seat_cmd_hide_cursor; 287sway_cmd seat_cmd_hide_cursor;
288sway_cmd seat_cmd_idle_inhibit;
289sway_cmd seat_cmd_idle_wake;
288sway_cmd seat_cmd_keyboard_grouping; 290sway_cmd seat_cmd_keyboard_grouping;
289sway_cmd seat_cmd_pointer_constraint; 291sway_cmd seat_cmd_pointer_constraint;
290sway_cmd seat_cmd_xcursor_theme; 292sway_cmd seat_cmd_xcursor_theme;
diff --git a/include/sway/config.h b/include/sway/config.h
index 9a00ccb5..3e3d2725 100644
--- a/include/sway/config.h
+++ b/include/sway/config.h
@@ -182,6 +182,15 @@ enum seat_keyboard_grouping {
182 KEYBOARD_GROUP_KEYMAP 182 KEYBOARD_GROUP_KEYMAP
183}; 183};
184 184
185enum sway_input_idle_source {
186 IDLE_SOURCE_KEYBOARD = 1 << 0,
187 IDLE_SOURCE_POINTER = 1 << 1,
188 IDLE_SOURCE_TOUCH = 1 << 2,
189 IDLE_SOURCE_TABLET_PAD = 1 << 3,
190 IDLE_SOURCE_TABLET_TOOL = 1 << 4,
191 IDLE_SOURCE_SWITCH = 1 << 5,
192};
193
185/** 194/**
186 * Options for multiseat and other misc device configurations 195 * Options for multiseat and other misc device configurations
187 */ 196 */
@@ -192,6 +201,7 @@ struct seat_config {
192 int hide_cursor_timeout; 201 int hide_cursor_timeout;
193 enum seat_config_allow_constrain allow_constrain; 202 enum seat_config_allow_constrain allow_constrain;
194 enum seat_keyboard_grouping keyboard_grouping; 203 enum seat_keyboard_grouping keyboard_grouping;
204 uint32_t idle_inhibit_sources, idle_wake_sources;
195 struct { 205 struct {
196 char *name; 206 char *name;
197 int size; 207 int size;
diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h
index 32795b03..9c3028c5 100644
--- a/include/sway/input/seat.h
+++ b/include/sway/input/seat.h
@@ -4,6 +4,7 @@
4#include <wlr/types/wlr_layer_shell_v1.h> 4#include <wlr/types/wlr_layer_shell_v1.h>
5#include <wlr/types/wlr_seat.h> 5#include <wlr/types/wlr_seat.h>
6#include <wlr/util/edges.h> 6#include <wlr/util/edges.h>
7#include "sway/config.h"
7#include "sway/input/input-manager.h" 8#include "sway/input/input-manager.h"
8 9
9struct sway_seat; 10struct sway_seat;
@@ -80,6 +81,8 @@ struct sway_seat {
80 81
81 uint32_t last_button_serial; 82 uint32_t last_button_serial;
82 83
84 uint32_t idle_inhibit_sources, idle_wake_sources;
85
83 list_t *deferred_bindings; // struct sway_binding 86 list_t *deferred_bindings; // struct sway_binding
84 87
85 struct wl_listener focus_destroy; 88 struct wl_listener focus_destroy;
@@ -196,6 +199,9 @@ struct seat_config *seat_get_config(struct sway_seat *seat);
196 199
197struct seat_config *seat_get_config_by_name(const char *name); 200struct seat_config *seat_get_config_by_name(const char *name);
198 201
202void seat_idle_notify_activity(struct sway_seat *seat,
203 enum sway_input_idle_source source);
204
199bool seat_is_input_allowed(struct sway_seat *seat, struct wlr_surface *surface); 205bool seat_is_input_allowed(struct sway_seat *seat, struct wlr_surface *surface);
200 206
201void drag_icon_update_position(struct sway_drag_icon *icon); 207void drag_icon_update_position(struct sway_drag_icon *icon);