diff options
author | Tony Crisci <tony@dubstepdish.com> | 2018-03-31 00:44:17 -0400 |
---|---|---|
committer | Tony Crisci <tony@dubstepdish.com> | 2018-03-31 15:37:16 -0400 |
commit | 7706d83160267be61accb1b6f7bdc2f43299cae7 (patch) | |
tree | 64b9751ee7edf613c9e3a06d1f5446501f4ddbaf /sway/input | |
parent | Merge pull request #1684 from swaywm/follow-warp (diff) | |
download | sway-7706d83160267be61accb1b6f7bdc2f43299cae7.tar.gz sway-7706d83160267be61accb1b6f7bdc2f43299cae7.tar.zst sway-7706d83160267be61accb1b6f7bdc2f43299cae7.zip |
basic split containers
Diffstat (limited to 'sway/input')
-rw-r--r-- | sway/input/seat.c | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c index 9aa34aca..e0fd314a 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -1,4 +1,5 @@ | |||
1 | #define _XOPEN_SOURCE 700 | 1 | #define _XOPEN_SOURCE 700 |
2 | #include <assert.h> | ||
2 | #include <wlr/types/wlr_cursor.h> | 3 | #include <wlr/types/wlr_cursor.h> |
3 | #include <wlr/types/wlr_output_layout.h> | 4 | #include <wlr/types/wlr_output_layout.h> |
4 | #include <wlr/types/wlr_xcursor_manager.h> | 5 | #include <wlr/types/wlr_xcursor_manager.h> |
@@ -378,6 +379,18 @@ void sway_seat_set_focus(struct sway_seat *seat, | |||
378 | } | 379 | } |
379 | 380 | ||
380 | struct sway_container *sway_seat_get_focus_inactive(struct sway_seat *seat, struct sway_container *container) { | 381 | struct sway_container *sway_seat_get_focus_inactive(struct sway_seat *seat, struct sway_container *container) { |
382 | return sway_seat_get_focus_by_type(seat, container, C_TYPES); | ||
383 | } | ||
384 | |||
385 | struct sway_container *sway_seat_get_focus(struct sway_seat *seat) { | ||
386 | if (!seat->has_focus) { | ||
387 | return NULL; | ||
388 | } | ||
389 | return sway_seat_get_focus_inactive(seat, &root_container); | ||
390 | } | ||
391 | |||
392 | struct sway_container *sway_seat_get_focus_by_type(struct sway_seat *seat, | ||
393 | struct sway_container *container, enum sway_container_type type) { | ||
381 | struct sway_seat_container *current = NULL; | 394 | struct sway_seat_container *current = NULL; |
382 | struct sway_container *parent = NULL; | 395 | struct sway_container *parent = NULL; |
383 | wl_list_for_each(current, &seat->focus_stack, link) { | 396 | wl_list_for_each(current, &seat->focus_stack, link) { |
@@ -388,7 +401,7 @@ struct sway_container *sway_seat_get_focus_inactive(struct sway_seat *seat, stru | |||
388 | } | 401 | } |
389 | 402 | ||
390 | while (parent) { | 403 | while (parent) { |
391 | if (parent == container) { | 404 | if (parent == container && (type == C_TYPES || current->container->type == type)) { |
392 | return current->container; | 405 | return current->container; |
393 | } | 406 | } |
394 | parent = parent->parent; | 407 | parent = parent->parent; |
@@ -398,23 +411,6 @@ struct sway_container *sway_seat_get_focus_inactive(struct sway_seat *seat, stru | |||
398 | return NULL; | 411 | return NULL; |
399 | } | 412 | } |
400 | 413 | ||
401 | struct sway_container *sway_seat_get_focus(struct sway_seat *seat) { | ||
402 | if (!seat->has_focus) { | ||
403 | return NULL; | ||
404 | } | ||
405 | return sway_seat_get_focus_inactive(seat, &root_container); | ||
406 | } | ||
407 | |||
408 | struct sway_container *sway_seat_get_focus_by_type(struct sway_seat *seat, | ||
409 | enum sway_container_type type) { | ||
410 | struct sway_container *focus = sway_seat_get_focus_inactive(seat, &root_container); | ||
411 | if (focus->type == type) { | ||
412 | return focus; | ||
413 | } | ||
414 | |||
415 | return container_parent(focus, type); | ||
416 | } | ||
417 | |||
418 | void sway_seat_set_config(struct sway_seat *seat, | 414 | void sway_seat_set_config(struct sway_seat *seat, |
419 | struct seat_config *seat_config) { | 415 | struct seat_config *seat_config) { |
420 | // clear configs | 416 | // clear configs |