aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/seat.c
diff options
context:
space:
mode:
authorLibravatar Michael Weiser <michael.weiser@gmx.de>2020-03-12 22:10:04 +0100
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2020-05-13 21:22:16 -0400
commit0f11aa037ad8765abf66e0c90052f9e4c37d56db (patch)
treee78523c566a1a96d53098bfc7c1d1f104043d373 /sway/input/seat.c
parentImplement pointer simulation if client hasn't bound to touch (diff)
downloadsway-0f11aa037ad8765abf66e0c90052f9e4c37d56db.tar.gz
sway-0f11aa037ad8765abf66e0c90052f9e4c37d56db.tar.zst
sway-0f11aa037ad8765abf66e0c90052f9e4c37d56db.zip
commands: Add per-view shortcuts_inhibitor command
Add a separate per-view shortcuts_inhibitor command that can be used with criteria to override the per-seat defaults. This allows to e.g. disable shortcuts inhibiting globally but enable it for specific, known-good virtualization and remote desktop software or, alternatively, to blacklist that one slightly broken piece of software that just doesn't seem to get it right but insists on trying. Add a flag to sway_view and handling logic in the input manager that respects that flag if configured but falls back to per-seat config otherwise. Add the actual command but with just enable and disable subcommands since there's no value in duplicating the per-seat activate/deactivate/toggle logic here. Split the inhibitor retrieval helper in two so we can use the backend half in the command to retrieve inhibitors for a specific surface and not just the currently focused one. Extend the manual page with documentation of the command and references to its per-seat sibling and usefulness with criteria. Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Diffstat (limited to 'sway/input/seat.c')
-rw-r--r--sway/input/seat.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c
index aa46940d..a4e06c57 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -1499,16 +1499,22 @@ bool seatop_allows_set_cursor(struct sway_seat *seat) {
1499} 1499}
1500 1500
1501struct sway_keyboard_shortcuts_inhibitor * 1501struct sway_keyboard_shortcuts_inhibitor *
1502keyboard_shortcuts_inhibitor_get_for_focused_surface( 1502keyboard_shortcuts_inhibitor_get_for_surface(
1503 const struct sway_seat *seat) { 1503 const struct sway_seat *seat,
1504 struct wlr_surface *focused_surface = 1504 const struct wlr_surface *surface) {
1505 seat->wlr_seat->keyboard_state.focused_surface;
1506 struct sway_keyboard_shortcuts_inhibitor *sway_inhibitor = NULL; 1505 struct sway_keyboard_shortcuts_inhibitor *sway_inhibitor = NULL;
1507 wl_list_for_each(sway_inhibitor, &seat->keyboard_shortcuts_inhibitors, link) { 1506 wl_list_for_each(sway_inhibitor, &seat->keyboard_shortcuts_inhibitors, link) {
1508 if (sway_inhibitor->inhibitor->surface == focused_surface) { 1507 if (sway_inhibitor->inhibitor->surface == surface) {
1509 return sway_inhibitor; 1508 return sway_inhibitor;
1510 } 1509 }
1511 } 1510 }
1512 1511
1513 return NULL; 1512 return NULL;
1514} 1513}
1514
1515struct sway_keyboard_shortcuts_inhibitor *
1516keyboard_shortcuts_inhibitor_get_for_focused_surface(
1517 const struct sway_seat *seat) {
1518 return keyboard_shortcuts_inhibitor_get_for_surface(seat,
1519 seat->wlr_seat->keyboard_state.focused_surface);
1520}