aboutsummaryrefslogtreecommitdiffstats
path: root/include/sway/input/seat.h
diff options
context:
space:
mode:
authorLibravatar Michael Weiser <michael.weiser@gmx.de>2020-02-15 20:55:33 +0100
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2020-03-11 23:51:37 -0400
commiteeac0aa170d4ee19111df072ea361b56c802cf34 (patch)
tree58327ead389b1c396117e55af9f766e8c38e0995 /include/sway/input/seat.h
parentconfig: Fix typo in reload bindsym flag bitmask (diff)
downloadsway-eeac0aa170d4ee19111df072ea361b56c802cf34.tar.gz
sway-eeac0aa170d4ee19111df072ea361b56c802cf34.tar.zst
sway-eeac0aa170d4ee19111df072ea361b56c802cf34.zip
input: Add support for keyboard shortcuts inhibit
Adding support for the keyboard shortcuts inhibit protocol allows remote desktop and virtualisation software to receive all keyboard input in order to pass it through to their clients so users can fully interact the their remote/virtual session. The software usually provides its own key combination to release its "grab" to all keyboard input. The inhibitor can be deactivated by the user by removing focus from the surface using another input device such as the pointer. Use support for the procotol in wlroots to add support to sway. Extend the input manager with handlers for inhibitor creation and destruction and appropriate bookkeeping. Attach the inhibitors to the seats they apply to to avoid having to search the list of all currently existing inhibitors on every keystroke and passing the inhibitor manager around. Add a helper function to retrieve the inhibitor applying to the currently focused surface of a seat, if one exists. Extend bindsym with a flag for bindings that should be processed even if an inhibitor is active. Conversely this disables all normal shortcuts if an inhibitor is found for the currently focused surface in keyboard::handle_key_event() since they don't have that flag set. Use above helper function to determine if an inhibitor exists for the surface that would eventually receive input. Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Diffstat (limited to 'include/sway/input/seat.h')
-rw-r--r--include/sway/input/seat.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h
index 9c3028c5..49b9d09b 100644
--- a/include/sway/input/seat.h
+++ b/include/sway/input/seat.h
@@ -1,6 +1,7 @@
1#ifndef _SWAY_INPUT_SEAT_H 1#ifndef _SWAY_INPUT_SEAT_H
2#define _SWAY_INPUT_SEAT_H 2#define _SWAY_INPUT_SEAT_H
3 3
4#include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h>
4#include <wlr/types/wlr_layer_shell_v1.h> 5#include <wlr/types/wlr_layer_shell_v1.h>
5#include <wlr/types/wlr_seat.h> 6#include <wlr/types/wlr_seat.h>
6#include <wlr/util/edges.h> 7#include <wlr/util/edges.h>
@@ -94,6 +95,8 @@ struct sway_seat {
94 95
95 struct wl_list devices; // sway_seat_device::link 96 struct wl_list devices; // sway_seat_device::link
96 struct wl_list keyboard_groups; // sway_keyboard_group::link 97 struct wl_list keyboard_groups; // sway_keyboard_group::link
98 struct wl_list keyboard_shortcuts_inhibitors;
99 // sway_keyboard_shortcuts_inhibitor::link
97 100
98 struct wl_list link; // input_manager::seats 101 struct wl_list link; // input_manager::seats
99}; 102};
@@ -104,6 +107,14 @@ struct sway_pointer_constraint {
104 struct wl_listener destroy; 107 struct wl_listener destroy;
105}; 108};
106 109
110struct sway_keyboard_shortcuts_inhibitor {
111 struct wlr_keyboard_shortcuts_inhibitor_v1 *inhibitor;
112
113 struct wl_listener destroy;
114
115 struct wl_list link; // sway_seat::keyboard_shortcuts_inhibitors
116};
117
107struct sway_seat *seat_create(const char *seat_name); 118struct sway_seat *seat_create(const char *seat_name);
108 119
109void seat_destroy(struct sway_seat *seat); 120void seat_destroy(struct sway_seat *seat);
@@ -269,4 +280,11 @@ void seatop_render(struct sway_seat *seat, struct sway_output *output,
269 280
270bool seatop_allows_set_cursor(struct sway_seat *seat); 281bool seatop_allows_set_cursor(struct sway_seat *seat);
271 282
283/**
284 * Returns the keyboard shortcuts inhibitor that applies to the currently
285 * focused surface of a seat or NULL if none exists.
286 */
287struct sway_keyboard_shortcuts_inhibitor *
288keyboard_shortcuts_inhibitor_get_for_focused_surface(const struct sway_seat *seat);
289
272#endif 290#endif