diff options
Diffstat (limited to 'sway/input')
-rw-r--r-- | sway/input/input-manager.c | 22 | ||||
-rw-r--r-- | sway/input/seat.c | 16 |
2 files changed, 29 insertions, 9 deletions
diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c index 243f860b..dc07cbf0 100644 --- a/sway/input/input-manager.c +++ b/sway/input/input-manager.c @@ -15,6 +15,7 @@ #include "sway/input/cursor.h" #include "sway/ipc-server.h" #include "sway/server.h" +#include "sway/tree/view.h" #include "stringop.h" #include "list.h" #include "log.h" @@ -333,12 +334,25 @@ static void handle_keyboard_shortcuts_inhibit_new_inhibitor( struct sway_seat *seat = inhibitor->seat->data; wl_list_insert(&seat->keyboard_shortcuts_inhibitors, &sway_inhibitor->link); - struct seat_config *config = seat_get_config(seat); - if (!config) { - config = seat_get_config_by_name("*"); + // per-view, seat-agnostic config via criteria + struct sway_view *view = view_from_wlr_surface(inhibitor->surface); + enum seat_config_shortcuts_inhibit inhibit = SHORTCUTS_INHIBIT_DEFAULT; + if (view) { + inhibit = view->shortcuts_inhibit; } - if (config && config->shortcuts_inhibit == SHORTCUTS_INHIBIT_DISABLE) { + if (inhibit == SHORTCUTS_INHIBIT_DEFAULT) { + struct seat_config *config = seat_get_config(seat); + if (!config) { + config = seat_get_config_by_name("*"); + } + + if (config) { + inhibit = config->shortcuts_inhibit; + } + } + + if (inhibit == SHORTCUTS_INHIBIT_DISABLE) { /** * Here we deny to honour the inhibitor by never sending the * activate signal. We can not, however, destroy the inhibitor 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) { } struct sway_keyboard_shortcuts_inhibitor * -keyboard_shortcuts_inhibitor_get_for_focused_surface( - const struct sway_seat *seat) { - struct wlr_surface *focused_surface = - seat->wlr_seat->keyboard_state.focused_surface; +keyboard_shortcuts_inhibitor_get_for_surface( + const struct sway_seat *seat, + const struct wlr_surface *surface) { struct sway_keyboard_shortcuts_inhibitor *sway_inhibitor = NULL; wl_list_for_each(sway_inhibitor, &seat->keyboard_shortcuts_inhibitors, link) { - if (sway_inhibitor->inhibitor->surface == focused_surface) { + if (sway_inhibitor->inhibitor->surface == surface) { return sway_inhibitor; } } return NULL; } + +struct sway_keyboard_shortcuts_inhibitor * +keyboard_shortcuts_inhibitor_get_for_focused_surface( + const struct sway_seat *seat) { + return keyboard_shortcuts_inhibitor_get_for_surface(seat, + seat->wlr_seat->keyboard_state.focused_surface); +} |