diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-04-02 21:07:46 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2018-04-02 21:09:09 -0400 |
commit | 56078edd65d05c1db1aa5d6e72134499e907063d (patch) | |
tree | 7848b49de2f3e7493b6d88aa23d849605c5c9a6d /sway/input/seat.c | |
parent | Identify topmost interactive layer post-arrange (diff) | |
download | sway-56078edd65d05c1db1aa5d6e72134499e907063d.tar.gz sway-56078edd65d05c1db1aa5d6e72134499e907063d.tar.zst sway-56078edd65d05c1db1aa5d6e72134499e907063d.zip |
Give exclusive focus to layers above shell layer
Diffstat (limited to 'sway/input/seat.c')
-rw-r--r-- | sway/input/seat.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c index c41f7b2e..cf519a82 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -352,8 +352,11 @@ void seat_configure_xcursor(struct sway_seat *seat) { | |||
352 | 352 | ||
353 | void seat_set_focus_warp(struct sway_seat *seat, | 353 | void seat_set_focus_warp(struct sway_seat *seat, |
354 | struct sway_container *container, bool warp) { | 354 | struct sway_container *container, bool warp) { |
355 | struct sway_container *last_focus = seat_get_focus(seat); | 355 | if (seat->focused_layer) { |
356 | return; | ||
357 | } | ||
356 | 358 | ||
359 | struct sway_container *last_focus = seat_get_focus(seat); | ||
357 | if (container && last_focus == container) { | 360 | if (container && last_focus == container) { |
358 | return; | 361 | return; |
359 | } | 362 | } |
@@ -419,6 +422,37 @@ void seat_set_focus(struct sway_seat *seat, | |||
419 | seat_set_focus_warp(seat, container, true); | 422 | seat_set_focus_warp(seat, container, true); |
420 | } | 423 | } |
421 | 424 | ||
425 | void seat_set_focus_layer(struct sway_seat *seat, | ||
426 | struct wlr_layer_surface *layer) { | ||
427 | if (!layer) { | ||
428 | seat->focused_layer = NULL; | ||
429 | return; | ||
430 | } | ||
431 | if (seat->focused_layer == layer) { | ||
432 | return; | ||
433 | } | ||
434 | if (seat->has_focus) { | ||
435 | struct sway_container *focus = seat_get_focus(seat); | ||
436 | if (focus->type == C_VIEW) { | ||
437 | wlr_seat_keyboard_clear_focus(seat->wlr_seat); | ||
438 | view_set_activated(focus->sway_view, false); | ||
439 | } | ||
440 | } | ||
441 | if (layer->layer >= ZWLR_LAYER_SHELL_V1_LAYER_TOP) { | ||
442 | seat->focused_layer = layer; | ||
443 | } | ||
444 | struct wlr_keyboard *keyboard = | ||
445 | wlr_seat_get_keyboard(seat->wlr_seat); | ||
446 | if (keyboard) { | ||
447 | wlr_seat_keyboard_notify_enter(seat->wlr_seat, | ||
448 | layer->surface, keyboard->keycodes, | ||
449 | keyboard->num_keycodes, &keyboard->modifiers); | ||
450 | } else { | ||
451 | wlr_seat_keyboard_notify_enter(seat->wlr_seat, | ||
452 | layer->surface, NULL, 0, NULL); | ||
453 | } | ||
454 | } | ||
455 | |||
422 | struct sway_container *seat_get_focus_inactive(struct sway_seat *seat, | 456 | struct sway_container *seat_get_focus_inactive(struct sway_seat *seat, |
423 | struct sway_container *container) { | 457 | struct sway_container *container) { |
424 | return seat_get_focus_by_type(seat, container, C_TYPES); | 458 | return seat_get_focus_by_type(seat, container, C_TYPES); |