diff options
author | emersion <contact@emersion.fr> | 2018-08-19 09:21:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-19 09:21:55 +0100 |
commit | 2c91afbb34f649fcd4de690be5bedba4d989a7f0 (patch) | |
tree | 681f45a530a1f8d5966161291c3cb482e52edb6e /sway/input | |
parent | 389d159c81502aa8b951895de11c3720bbd5ba7d (diff) | |
parent | 2b5a404ac920339a2b9ce32d4718272dee4668b9 (diff) |
Merge pull request #2487 from RyanDwyer/workspace-floating-list
Replace hacky L_FLOATING container with a list
Diffstat (limited to 'sway/input')
-rw-r--r-- | sway/input/cursor.c | 4 | ||||
-rw-r--r-- | sway/input/seat.c | 18 |
2 files changed, 9 insertions, 13 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 762b8081..ba5e0400 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -724,7 +724,7 @@ void dispatch_cursor_button(struct sway_cursor *cursor, uint32_t btn_move = config->floating_mod_inverse ? BTN_RIGHT : BTN_LEFT; if (button == btn_move && state == WLR_BUTTON_PRESSED && (mod_pressed || on_titlebar)) { - while (cont->parent->layout != L_FLOATING) { + while (cont->parent->type != C_WORKSPACE) { cont = cont->parent; } seat_begin_move(seat, cont, button); @@ -746,7 +746,7 @@ void dispatch_cursor_button(struct sway_cursor *cursor, BTN_LEFT : BTN_RIGHT; if (mod_pressed && button == btn_resize) { struct sway_container *floater = cont; - while (floater->parent->layout != L_FLOATING) { + while (floater->parent->type != C_WORKSPACE) { floater = floater->parent; } edge = 0; diff --git a/sway/input/seat.c b/sway/input/seat.c index d35c62a0..caee37a6 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -688,7 +688,8 @@ void seat_set_focus_warp(struct sway_seat *seat, // If we've focused a floating container, bring it to the front. // We do this by putting it at the end of the floating list. if (container && container_is_floating(container)) { - list_move_to_end(container->parent->children, container); + list_move_to_end( + container->parent->sway_workspace->floating, container); } // clean up unfocused empty workspace on new output @@ -850,7 +851,7 @@ void seat_set_exclusive_client(struct sway_seat *seat, struct sway_container *seat_get_focus_inactive(struct sway_seat *seat, struct sway_container *con) { if (con->type == C_WORKSPACE && !con->children->length && - !con->sway_workspace->floating->children->length) { + !con->sway_workspace->floating->length) { return con; } if (con->type == C_VIEW) { @@ -873,7 +874,7 @@ struct sway_container *seat_get_focus_inactive_tiling(struct sway_seat *seat, struct sway_seat_container *current; wl_list_for_each(current, &seat->focus_stack, link) { struct sway_container *con = current->container; - if (con->layout != L_FLOATING && !container_is_floating_or_child(con) && + if (!container_is_floating_or_child(con) && container_has_ancestor(current->container, ancestor)) { return con; } @@ -884,13 +885,13 @@ struct sway_container *seat_get_focus_inactive_tiling(struct sway_seat *seat, struct sway_container *seat_get_focus_inactive_floating(struct sway_seat *seat, struct sway_container *ancestor) { if (ancestor->type == C_WORKSPACE && - !ancestor->sway_workspace->floating->children->length) { + !ancestor->sway_workspace->floating->length) { return NULL; } struct sway_seat_container *current; wl_list_for_each(current, &seat->focus_stack, link) { struct sway_container *con = current->container; - if (con->layout != L_FLOATING && container_is_floating_or_child(con) && + if (container_is_floating_or_child(con) && container_has_ancestor(current->container, ancestor)) { return con; } @@ -898,11 +899,6 @@ struct sway_container *seat_get_focus_inactive_floating(struct sway_seat *seat, return NULL; } -static bool impl_focus_active_child(struct sway_container *con, void *data) { - struct sway_container *parent = data; - return con->parent == parent && con->layout != L_FLOATING; -} - struct sway_container *seat_get_active_child(struct sway_seat *seat, struct sway_container *parent) { if (parent->type == C_VIEW) { @@ -911,7 +907,7 @@ struct sway_container *seat_get_active_child(struct sway_seat *seat, struct sway_seat_container *current; wl_list_for_each(current, &seat->focus_stack, link) { struct sway_container *con = current->container; - if (con->parent == parent && con->layout != L_FLOATING) { + if (con->parent == parent) { return con; } } |