diff options
author | Tony Crisci <tony@dubstepdish.com> | 2018-04-07 16:06:36 -0400 |
---|---|---|
committer | Tony Crisci <tony@dubstepdish.com> | 2018-04-07 16:06:36 -0400 |
commit | c0f9ee7bd1fc70672dcf64a19c9fbbf5a80b12b0 (patch) | |
tree | 90e2f7261e5e9191bea374459a9b5c7fc0acedf3 /sway/input/seat.c | |
parent | 4b200869b2769a41d087c70e3e80124b2ed51064 (diff) |
seat get focus inactive view
Diffstat (limited to 'sway/input/seat.c')
-rw-r--r-- | sway/input/seat.c | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c index b94e3291..1a646715 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -86,6 +86,31 @@ static void seat_send_focus(struct sway_seat *seat, } } +static struct sway_container *seat_get_focus_by_type(struct sway_seat *seat, + struct sway_container *container, enum sway_container_type type) { + if (container->type == C_VIEW || container->children->length == 0) { + return container; + } + + struct sway_seat_container *current = NULL; + wl_list_for_each(current, &seat->focus_stack, link) { + if (current->container->type != type && type != C_TYPES) { + continue; + } + + if (container_has_child(container, current->container)) { + return current->container; + } + } + + return NULL; +} + +struct sway_container *seat_get_focus_inactive_view(struct sway_seat *seat, + struct sway_container *container) { + return seat_get_focus_by_type(seat, container, C_VIEW); +} + static void handle_seat_container_destroy(struct wl_listener *listener, void *data) { struct sway_seat_container *seat_con = @@ -549,26 +574,6 @@ struct sway_container *sway_seat_get_focus(struct sway_seat *seat) { return seat_get_focus_inactive(seat, &root_container); } -struct sway_container *seat_get_focus_by_type(struct sway_seat *seat, - struct sway_container *container, enum sway_container_type type) { - if (container->type == C_VIEW || container->children->length == 0) { - return container; - } - - struct sway_seat_container *current = NULL; - wl_list_for_each(current, &seat->focus_stack, link) { - if (current->container->type != type && type != C_TYPES) { - continue; - } - - if (container_has_child(container, current->container)) { - return current->container; - } - } - - return NULL; -} - struct sway_container *seat_get_focus(struct sway_seat *seat) { if (!seat->has_focus) { return NULL; |