aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-12-11 11:00:39 -0500
committerDrew DeVault <sir@cmpwn.com>2019-12-12 10:37:30 -0500
commit2f3c6cccf5d6b2d6ffd3cee62e7b624dc80dc6e6 (patch)
tree69d3367cf7dbd7f756d45d89cd37e6016503a88d /include
parentf645f8efd688104cdeac01cd940b32a8ff978571 (diff)
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;
sway_cmd seat_cmd_cursor;
sway_cmd seat_cmd_fallback;
sway_cmd seat_cmd_hide_cursor;
+sway_cmd seat_cmd_idle_inhibit;
+sway_cmd seat_cmd_idle_wake;
sway_cmd seat_cmd_keyboard_grouping;
sway_cmd seat_cmd_pointer_constraint;
sway_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 {
KEYBOARD_GROUP_KEYMAP
};
+enum sway_input_idle_source {
+ IDLE_SOURCE_KEYBOARD = 1 << 0,
+ IDLE_SOURCE_POINTER = 1 << 1,
+ IDLE_SOURCE_TOUCH = 1 << 2,
+ IDLE_SOURCE_TABLET_PAD = 1 << 3,
+ IDLE_SOURCE_TABLET_TOOL = 1 << 4,
+ IDLE_SOURCE_SWITCH = 1 << 5,
+};
+
/**
* Options for multiseat and other misc device configurations
*/
@@ -192,6 +201,7 @@ struct seat_config {
int hide_cursor_timeout;
enum seat_config_allow_constrain allow_constrain;
enum seat_keyboard_grouping keyboard_grouping;
+ uint32_t idle_inhibit_sources, idle_wake_sources;
struct {
char *name;
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 @@
#include <wlr/types/wlr_layer_shell_v1.h>
#include <wlr/types/wlr_seat.h>
#include <wlr/util/edges.h>
+#include "sway/config.h"
#include "sway/input/input-manager.h"
struct sway_seat;
@@ -80,6 +81,8 @@ struct sway_seat {
uint32_t last_button_serial;
+ uint32_t idle_inhibit_sources, idle_wake_sources;
+
list_t *deferred_bindings; // struct sway_binding
struct wl_listener focus_destroy;
@@ -196,6 +199,9 @@ struct seat_config *seat_get_config(struct sway_seat *seat);
struct seat_config *seat_get_config_by_name(const char *name);
+void seat_idle_notify_activity(struct sway_seat *seat,
+ enum sway_input_idle_source source);
+
bool seat_is_input_allowed(struct sway_seat *seat, struct wlr_surface *surface);
void drag_icon_update_position(struct sway_drag_icon *icon);