diff options
-rw-r--r-- | include/sway/config.h | 1 | ||||
-rw-r--r-- | include/sway/input/input-manager.h | 3 | ||||
-rw-r--r-- | include/sway/input/seat.h | 18 | ||||
-rw-r--r-- | sway/commands/bind.c | 5 | ||||
-rw-r--r-- | sway/input/input-manager.c | 47 | ||||
-rw-r--r-- | sway/input/keyboard.c | 41 | ||||
-rw-r--r-- | sway/input/seat.c | 16 | ||||
-rw-r--r-- | sway/sway.5.scd | 8 |
8 files changed, 129 insertions, 10 deletions
diff --git a/include/sway/config.h b/include/sway/config.h index 5f02e44f..fdd65efd 100644 --- a/include/sway/config.h +++ b/include/sway/config.h | |||
@@ -40,6 +40,7 @@ enum binding_flags { | |||
40 | BINDING_TITLEBAR=16, // mouse only; trigger on container titlebar | 40 | BINDING_TITLEBAR=16, // mouse only; trigger on container titlebar |
41 | BINDING_CODE=32, // keyboard only; convert keysyms into keycodes | 41 | BINDING_CODE=32, // keyboard only; convert keysyms into keycodes |
42 | BINDING_RELOAD=64, // switch only; (re)trigger binding on reload | 42 | BINDING_RELOAD=64, // switch only; (re)trigger binding on reload |
43 | BINDING_INHIBITED=128, // keyboard only: ignore shortcut inhibitor | ||
43 | }; | 44 | }; |
44 | 45 | ||
45 | /** | 46 | /** |
diff --git a/include/sway/input/input-manager.h b/include/sway/input/input-manager.h index a5392c6b..410d17a8 100644 --- a/include/sway/input/input-manager.h +++ b/include/sway/input/input-manager.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define _SWAY_INPUT_INPUT_MANAGER_H | 2 | #define _SWAY_INPUT_INPUT_MANAGER_H |
3 | #include <libinput.h> | 3 | #include <libinput.h> |
4 | #include <wlr/types/wlr_input_inhibitor.h> | 4 | #include <wlr/types/wlr_input_inhibitor.h> |
5 | #include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h> | ||
5 | #include <wlr/types/wlr_virtual_keyboard_v1.h> | 6 | #include <wlr/types/wlr_virtual_keyboard_v1.h> |
6 | #include <wlr/types/wlr_virtual_pointer_v1.h> | 7 | #include <wlr/types/wlr_virtual_pointer_v1.h> |
7 | #include "sway/server.h" | 8 | #include "sway/server.h" |
@@ -20,12 +21,14 @@ struct sway_input_manager { | |||
20 | struct wl_list seats; | 21 | struct wl_list seats; |
21 | 22 | ||
22 | struct wlr_input_inhibit_manager *inhibit; | 23 | struct wlr_input_inhibit_manager *inhibit; |
24 | struct wlr_keyboard_shortcuts_inhibit_manager_v1 *keyboard_shortcuts_inhibit; | ||
23 | struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard; | 25 | struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard; |
24 | struct wlr_virtual_pointer_manager_v1 *virtual_pointer; | 26 | struct wlr_virtual_pointer_manager_v1 *virtual_pointer; |
25 | 27 | ||
26 | struct wl_listener new_input; | 28 | struct wl_listener new_input; |
27 | struct wl_listener inhibit_activate; | 29 | struct wl_listener inhibit_activate; |
28 | struct wl_listener inhibit_deactivate; | 30 | struct wl_listener inhibit_deactivate; |
31 | struct wl_listener keyboard_shortcuts_inhibit_new_inhibitor; | ||
29 | struct wl_listener virtual_keyboard_new; | 32 | struct wl_listener virtual_keyboard_new; |
30 | struct wl_listener virtual_pointer_new; | 33 | struct wl_listener virtual_pointer_new; |
31 | }; | 34 | }; |
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 | ||
110 | struct 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 | |||
107 | struct sway_seat *seat_create(const char *seat_name); | 118 | struct sway_seat *seat_create(const char *seat_name); |
108 | 119 | ||
109 | void seat_destroy(struct sway_seat *seat); | 120 | void seat_destroy(struct sway_seat *seat); |
@@ -269,4 +280,11 @@ void seatop_render(struct sway_seat *seat, struct sway_output *output, | |||
269 | 280 | ||
270 | bool seatop_allows_set_cursor(struct sway_seat *seat); | 281 | bool 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 | */ | ||
287 | struct sway_keyboard_shortcuts_inhibitor * | ||
288 | keyboard_shortcuts_inhibitor_get_for_focused_surface(const struct sway_seat *seat); | ||
289 | |||
272 | #endif | 290 | #endif |
diff --git a/sway/commands/bind.c b/sway/commands/bind.c index 5ec89982..0ddee742 100644 --- a/sway/commands/bind.c +++ b/sway/commands/bind.c | |||
@@ -72,7 +72,8 @@ static bool binding_key_compare(struct sway_binding *binding_a, | |||
72 | } | 72 | } |
73 | 73 | ||
74 | uint32_t conflict_generating_flags = BINDING_RELEASE | BINDING_BORDER | 74 | uint32_t conflict_generating_flags = BINDING_RELEASE | BINDING_BORDER |
75 | | BINDING_CONTENTS | BINDING_TITLEBAR | BINDING_LOCKED; | 75 | | BINDING_CONTENTS | BINDING_TITLEBAR | BINDING_LOCKED |
76 | | BINDING_INHIBITED; | ||
76 | if ((binding_a->flags & conflict_generating_flags) != | 77 | if ((binding_a->flags & conflict_generating_flags) != |
77 | (binding_b->flags & conflict_generating_flags)) { | 78 | (binding_b->flags & conflict_generating_flags)) { |
78 | return false; | 79 | return false; |
@@ -354,6 +355,8 @@ static struct cmd_results *cmd_bindsym_or_bindcode(int argc, char **argv, | |||
354 | binding->flags |= BINDING_RELEASE; | 355 | binding->flags |= BINDING_RELEASE; |
355 | } else if (strcmp("--locked", argv[0]) == 0) { | 356 | } else if (strcmp("--locked", argv[0]) == 0) { |
356 | binding->flags |= BINDING_LOCKED; | 357 | binding->flags |= BINDING_LOCKED; |
358 | } else if (strcmp("--inhibited", argv[0]) == 0) { | ||
359 | binding->flags |= BINDING_INHIBITED; | ||
357 | } else if (strcmp("--whole-window", argv[0]) == 0) { | 360 | } else if (strcmp("--whole-window", argv[0]) == 0) { |
358 | binding->flags |= BINDING_BORDER | BINDING_CONTENTS | BINDING_TITLEBAR; | 361 | binding->flags |= BINDING_BORDER | BINDING_CONTENTS | BINDING_TITLEBAR; |
359 | } else if (strcmp("--border", argv[0]) == 0) { | 362 | } else if (strcmp("--border", argv[0]) == 0) { |
diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c index 4cc07fe6..af0f5afa 100644 --- a/sway/input/input-manager.c +++ b/sway/input/input-manager.c | |||
@@ -296,6 +296,46 @@ static void handle_inhibit_deactivate(struct wl_listener *listener, void *data) | |||
296 | } | 296 | } |
297 | } | 297 | } |
298 | 298 | ||
299 | static void handle_keyboard_shortcuts_inhibitor_destroy( | ||
300 | struct wl_listener *listener, void *data) { | ||
301 | struct sway_keyboard_shortcuts_inhibitor *sway_inhibitor = | ||
302 | wl_container_of(listener, sway_inhibitor, destroy); | ||
303 | |||
304 | sway_log(SWAY_DEBUG, "Removing keyboard shortcuts inhibitor"); | ||
305 | |||
306 | // sway_seat::keyboard_shortcuts_inhibitors | ||
307 | wl_list_remove(&sway_inhibitor->link); | ||
308 | wl_list_remove(&sway_inhibitor->destroy.link); | ||
309 | free(sway_inhibitor); | ||
310 | } | ||
311 | |||
312 | static void handle_keyboard_shortcuts_inhibit_new_inhibitor( | ||
313 | struct wl_listener *listener, void *data) { | ||
314 | struct sway_input_manager *input_manager = | ||
315 | wl_container_of(listener, input_manager, | ||
316 | keyboard_shortcuts_inhibit_new_inhibitor); | ||
317 | struct wlr_keyboard_shortcuts_inhibitor_v1 *inhibitor = data; | ||
318 | |||
319 | sway_log(SWAY_DEBUG, "Adding keyboard shortcuts inhibitor"); | ||
320 | |||
321 | struct sway_keyboard_shortcuts_inhibitor *sway_inhibitor = | ||
322 | calloc(1, sizeof(struct sway_keyboard_shortcuts_inhibitor)); | ||
323 | if (!sway_assert(sway_inhibitor, "could not allocate keyboard " | ||
324 | "shortcuts inhibitor")) { | ||
325 | return; | ||
326 | } | ||
327 | sway_inhibitor->inhibitor = inhibitor; | ||
328 | |||
329 | sway_inhibitor->destroy.notify = handle_keyboard_shortcuts_inhibitor_destroy; | ||
330 | wl_signal_add(&inhibitor->events.destroy, &sway_inhibitor->destroy); | ||
331 | |||
332 | // attach inhibitor to the seat it applies to | ||
333 | struct sway_seat *seat = inhibitor->seat->data; | ||
334 | wl_list_insert(&seat->keyboard_shortcuts_inhibitors, &sway_inhibitor->link); | ||
335 | |||
336 | wlr_keyboard_shortcuts_inhibitor_v1_activate(inhibitor); | ||
337 | } | ||
338 | |||
299 | void handle_virtual_keyboard(struct wl_listener *listener, void *data) { | 339 | void handle_virtual_keyboard(struct wl_listener *listener, void *data) { |
300 | struct sway_input_manager *input_manager = | 340 | struct sway_input_manager *input_manager = |
301 | wl_container_of(listener, input_manager, virtual_keyboard_new); | 341 | wl_container_of(listener, input_manager, virtual_keyboard_new); |
@@ -397,6 +437,13 @@ struct sway_input_manager *input_manager_create(struct sway_server *server) { | |||
397 | wl_signal_add(&input->inhibit->events.deactivate, | 437 | wl_signal_add(&input->inhibit->events.deactivate, |
398 | &input->inhibit_deactivate); | 438 | &input->inhibit_deactivate); |
399 | 439 | ||
440 | input->keyboard_shortcuts_inhibit = | ||
441 | wlr_keyboard_shortcuts_inhibit_v1_create(server->wl_display); | ||
442 | input->keyboard_shortcuts_inhibit_new_inhibitor.notify = | ||
443 | handle_keyboard_shortcuts_inhibit_new_inhibitor; | ||
444 | wl_signal_add(&input->keyboard_shortcuts_inhibit->events.new_inhibitor, | ||
445 | &input->keyboard_shortcuts_inhibit_new_inhibitor); | ||
446 | |||
400 | return input; | 447 | return input; |
401 | } | 448 | } |
402 | 449 | ||
diff --git a/sway/input/keyboard.c b/sway/input/keyboard.c index 2cfcd126..9c5f190e 100644 --- a/sway/input/keyboard.c +++ b/sway/input/keyboard.c | |||
@@ -150,16 +150,18 @@ static bool update_shortcut_state(struct sway_shortcut_state *state, | |||
150 | */ | 150 | */ |
151 | static void get_active_binding(const struct sway_shortcut_state *state, | 151 | static void get_active_binding(const struct sway_shortcut_state *state, |
152 | list_t *bindings, struct sway_binding **current_binding, | 152 | list_t *bindings, struct sway_binding **current_binding, |
153 | uint32_t modifiers, bool release, bool locked, const char *input, | 153 | uint32_t modifiers, bool release, bool locked, bool inhibited, |
154 | bool exact_input, xkb_layout_index_t group) { | 154 | const char *input, bool exact_input, xkb_layout_index_t group) { |
155 | for (int i = 0; i < bindings->length; ++i) { | 155 | for (int i = 0; i < bindings->length; ++i) { |
156 | struct sway_binding *binding = bindings->items[i]; | 156 | struct sway_binding *binding = bindings->items[i]; |
157 | bool binding_locked = (binding->flags & BINDING_LOCKED) != 0; | 157 | bool binding_locked = (binding->flags & BINDING_LOCKED) != 0; |
158 | bool binding_inhibited = (binding->flags & BINDING_INHIBITED) != 0; | ||
158 | bool binding_release = binding->flags & BINDING_RELEASE; | 159 | bool binding_release = binding->flags & BINDING_RELEASE; |
159 | 160 | ||
160 | if (modifiers ^ binding->modifiers || | 161 | if (modifiers ^ binding->modifiers || |
161 | release != binding_release || | 162 | release != binding_release || |
162 | locked > binding_locked || | 163 | locked > binding_locked || |
164 | inhibited > binding_inhibited || | ||
163 | (binding->group != XKB_LAYOUT_INVALID && | 165 | (binding->group != XKB_LAYOUT_INVALID && |
164 | binding->group != group) || | 166 | binding->group != group) || |
165 | (strcmp(binding->input, input) != 0 && | 167 | (strcmp(binding->input, input) != 0 && |
@@ -195,6 +197,8 @@ static void get_active_binding(const struct sway_shortcut_state *state, | |||
195 | 197 | ||
196 | bool current_locked = | 198 | bool current_locked = |
197 | ((*current_binding)->flags & BINDING_LOCKED) != 0; | 199 | ((*current_binding)->flags & BINDING_LOCKED) != 0; |
200 | bool current_inhibited = | ||
201 | ((*current_binding)->flags & BINDING_INHIBITED) != 0; | ||
198 | bool current_input = strcmp((*current_binding)->input, input) == 0; | 202 | bool current_input = strcmp((*current_binding)->input, input) == 0; |
199 | bool current_group_set = | 203 | bool current_group_set = |
200 | (*current_binding)->group != XKB_LAYOUT_INVALID; | 204 | (*current_binding)->group != XKB_LAYOUT_INVALID; |
@@ -203,6 +207,7 @@ static void get_active_binding(const struct sway_shortcut_state *state, | |||
203 | 207 | ||
204 | if (current_input == binding_input | 208 | if (current_input == binding_input |
205 | && current_locked == binding_locked | 209 | && current_locked == binding_locked |
210 | && current_inhibited == binding_inhibited | ||
206 | && current_group_set == binding_group_set) { | 211 | && current_group_set == binding_group_set) { |
207 | sway_log(SWAY_DEBUG, | 212 | sway_log(SWAY_DEBUG, |
208 | "Encountered conflicting bindings %d and %d", | 213 | "Encountered conflicting bindings %d and %d", |
@@ -224,11 +229,21 @@ static void get_active_binding(const struct sway_shortcut_state *state, | |||
224 | current_locked == locked) { | 229 | current_locked == locked) { |
225 | continue; // Prefer correct lock state for matching input+group | 230 | continue; // Prefer correct lock state for matching input+group |
226 | } | 231 | } |
232 | |||
233 | if (current_input == binding_input && | ||
234 | current_group_set == binding_group_set && | ||
235 | current_locked == binding_locked && | ||
236 | current_inhibited == inhibited) { | ||
237 | // Prefer correct inhibition state for matching | ||
238 | // input+group+locked | ||
239 | continue; | ||
240 | } | ||
227 | } | 241 | } |
228 | 242 | ||
229 | *current_binding = binding; | 243 | *current_binding = binding; |
230 | if (strcmp((*current_binding)->input, input) == 0 && | 244 | if (strcmp((*current_binding)->input, input) == 0 && |
231 | (((*current_binding)->flags & BINDING_LOCKED) == locked) && | 245 | (((*current_binding)->flags & BINDING_LOCKED) == locked) && |
246 | (((*current_binding)->flags & BINDING_INHIBITED) == inhibited) && | ||
232 | (*current_binding)->group == group) { | 247 | (*current_binding)->group == group) { |
233 | return; // If a perfect match is found, quit searching | 248 | return; // If a perfect match is found, quit searching |
234 | } | 249 | } |
@@ -328,6 +343,9 @@ static void handle_key_event(struct sway_keyboard *keyboard, | |||
328 | bool exact_identifier = wlr_device->keyboard->group != NULL; | 343 | bool exact_identifier = wlr_device->keyboard->group != NULL; |
329 | seat_idle_notify_activity(seat, IDLE_SOURCE_KEYBOARD); | 344 | seat_idle_notify_activity(seat, IDLE_SOURCE_KEYBOARD); |
330 | bool input_inhibited = seat->exclusive_client != NULL; | 345 | bool input_inhibited = seat->exclusive_client != NULL; |
346 | struct sway_keyboard_shortcuts_inhibitor *sway_inhibitor = | ||
347 | keyboard_shortcuts_inhibitor_get_for_focused_surface(seat); | ||
348 | bool shortcuts_inhibited = sway_inhibitor && sway_inhibitor->inhibitor->active; | ||
331 | 349 | ||
332 | // Identify new keycode, raw keysym(s), and translated keysym(s) | 350 | // Identify new keycode, raw keysym(s), and translated keysym(s) |
333 | xkb_keycode_t keycode = event->keycode + 8; | 351 | xkb_keycode_t keycode = event->keycode + 8; |
@@ -364,15 +382,18 @@ static void handle_key_event(struct sway_keyboard *keyboard, | |||
364 | struct sway_binding *binding_released = NULL; | 382 | struct sway_binding *binding_released = NULL; |
365 | get_active_binding(&keyboard->state_keycodes, | 383 | get_active_binding(&keyboard->state_keycodes, |
366 | config->current_mode->keycode_bindings, &binding_released, | 384 | config->current_mode->keycode_bindings, &binding_released, |
367 | code_modifiers, true, input_inhibited, device_identifier, | 385 | code_modifiers, true, input_inhibited, |
386 | shortcuts_inhibited, device_identifier, | ||
368 | exact_identifier, keyboard->effective_layout); | 387 | exact_identifier, keyboard->effective_layout); |
369 | get_active_binding(&keyboard->state_keysyms_raw, | 388 | get_active_binding(&keyboard->state_keysyms_raw, |
370 | config->current_mode->keysym_bindings, &binding_released, | 389 | config->current_mode->keysym_bindings, &binding_released, |
371 | raw_modifiers, true, input_inhibited, device_identifier, | 390 | raw_modifiers, true, input_inhibited, |
391 | shortcuts_inhibited, device_identifier, | ||
372 | exact_identifier, keyboard->effective_layout); | 392 | exact_identifier, keyboard->effective_layout); |
373 | get_active_binding(&keyboard->state_keysyms_translated, | 393 | get_active_binding(&keyboard->state_keysyms_translated, |
374 | config->current_mode->keysym_bindings, &binding_released, | 394 | config->current_mode->keysym_bindings, &binding_released, |
375 | translated_modifiers, true, input_inhibited, device_identifier, | 395 | translated_modifiers, true, input_inhibited, |
396 | shortcuts_inhibited, device_identifier, | ||
376 | exact_identifier, keyboard->effective_layout); | 397 | exact_identifier, keyboard->effective_layout); |
377 | 398 | ||
378 | // Execute stored release binding once no longer active | 399 | // Execute stored release binding once no longer active |
@@ -393,17 +414,19 @@ static void handle_key_event(struct sway_keyboard *keyboard, | |||
393 | if (event->state == WLR_KEY_PRESSED) { | 414 | if (event->state == WLR_KEY_PRESSED) { |
394 | get_active_binding(&keyboard->state_keycodes, | 415 | get_active_binding(&keyboard->state_keycodes, |
395 | config->current_mode->keycode_bindings, &binding, | 416 | config->current_mode->keycode_bindings, &binding, |
396 | code_modifiers, false, input_inhibited, device_identifier, | 417 | code_modifiers, false, input_inhibited, |
418 | shortcuts_inhibited, device_identifier, | ||
397 | exact_identifier, keyboard->effective_layout); | 419 | exact_identifier, keyboard->effective_layout); |
398 | get_active_binding(&keyboard->state_keysyms_raw, | 420 | get_active_binding(&keyboard->state_keysyms_raw, |
399 | config->current_mode->keysym_bindings, &binding, | 421 | config->current_mode->keysym_bindings, &binding, |
400 | raw_modifiers, false, input_inhibited, device_identifier, | 422 | raw_modifiers, false, input_inhibited, |
423 | shortcuts_inhibited, device_identifier, | ||
401 | exact_identifier, keyboard->effective_layout); | 424 | exact_identifier, keyboard->effective_layout); |
402 | get_active_binding(&keyboard->state_keysyms_translated, | 425 | get_active_binding(&keyboard->state_keysyms_translated, |
403 | config->current_mode->keysym_bindings, &binding, | 426 | config->current_mode->keysym_bindings, &binding, |
404 | translated_modifiers, false, input_inhibited, | 427 | translated_modifiers, false, input_inhibited, |
405 | device_identifier, exact_identifier, | 428 | shortcuts_inhibited, device_identifier, |
406 | keyboard->effective_layout); | 429 | exact_identifier, keyboard->effective_layout); |
407 | } | 430 | } |
408 | 431 | ||
409 | // Set up (or clear) keyboard repeat for a pressed binding. Since the | 432 | // Set up (or clear) keyboard repeat for a pressed binding. Since the |
diff --git a/sway/input/seat.c b/sway/input/seat.c index 371de56e..6739c163 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -557,6 +557,7 @@ struct sway_seat *seat_create(const char *seat_name) { | |||
557 | handle_request_set_primary_selection; | 557 | handle_request_set_primary_selection; |
558 | 558 | ||
559 | wl_list_init(&seat->keyboard_groups); | 559 | wl_list_init(&seat->keyboard_groups); |
560 | wl_list_init(&seat->keyboard_shortcuts_inhibitors); | ||
560 | 561 | ||
561 | wl_list_insert(&server.input->seats, &seat->link); | 562 | wl_list_insert(&server.input->seats, &seat->link); |
562 | 563 | ||
@@ -1473,3 +1474,18 @@ void seatop_render(struct sway_seat *seat, struct sway_output *output, | |||
1473 | bool seatop_allows_set_cursor(struct sway_seat *seat) { | 1474 | bool seatop_allows_set_cursor(struct sway_seat *seat) { |
1474 | return seat->seatop_impl->allow_set_cursor; | 1475 | return seat->seatop_impl->allow_set_cursor; |
1475 | } | 1476 | } |
1477 | |||
1478 | struct sway_keyboard_shortcuts_inhibitor * | ||
1479 | keyboard_shortcuts_inhibitor_get_for_focused_surface( | ||
1480 | const struct sway_seat *seat) { | ||
1481 | struct wlr_surface *focused_surface = | ||
1482 | seat->wlr_seat->keyboard_state.focused_surface; | ||
1483 | struct sway_keyboard_shortcuts_inhibitor *sway_inhibitor = NULL; | ||
1484 | wl_list_for_each(sway_inhibitor, &seat->keyboard_shortcuts_inhibitors, link) { | ||
1485 | if (sway_inhibitor->inhibitor->surface == focused_surface) { | ||
1486 | return sway_inhibitor; | ||
1487 | } | ||
1488 | } | ||
1489 | |||
1490 | return NULL; | ||
1491 | } | ||
diff --git a/sway/sway.5.scd b/sway/sway.5.scd index b8b838ab..a2c74e70 100644 --- a/sway/sway.5.scd +++ b/sway/sway.5.scd | |||
@@ -374,6 +374,14 @@ runtime. | |||
374 | and one has both _--input-device_ and _--locked_ and the other has neither, | 374 | and one has both _--input-device_ and _--locked_ and the other has neither, |
375 | the former will be preferred even when unlocked. | 375 | the former will be preferred even when unlocked. |
376 | 376 | ||
377 | Unless the flag _--inhibited_ is set, the command will not be run when | ||
378 | a keyboard shortcuts inhibitor is active for the currently focused | ||
379 | window. Such inhibitors are usually requested by remote desktop and | ||
380 | virtualization software to enable the user to send keyboard shortcuts | ||
381 | to the remote or virtual session. The _--inhibited_ flag allows to | ||
382 | define bindings which will be exempt from pass-through to such | ||
383 | software. The same preference logic as for _--locked_ applies. | ||
384 | |||
377 | Bindings to keysyms are layout-dependent. This can be changed with the | 385 | Bindings to keysyms are layout-dependent. This can be changed with the |
378 | _--to-code_ flag. In this case, the keysyms will be translated into the | 386 | _--to-code_ flag. In this case, the keysyms will be translated into the |
379 | corresponding keycodes in the first configured layout. | 387 | corresponding keycodes in the first configured layout. |