aboutsummaryrefslogtreecommitdiff
path: root/sway/input
diff options
context:
space:
mode:
authorRyan Dwyer <ryandwyer1@gmail.com>2018-08-19 15:07:07 +1000
committerRyan Dwyer <ryandwyer1@gmail.com>2018-08-19 16:18:33 +1000
commit2b5a404ac920339a2b9ce32d4718272dee4668b9 (patch)
tree681f45a530a1f8d5966161291c3cb482e52edb6e /sway/input
parent389d159c81502aa8b951895de11c3720bbd5ba7d (diff)
downloadsway-2b5a404ac920339a2b9ce32d4718272dee4668b9.tar.xz
Replace hacky L_FLOATING container with a list
Workspaces previously had a magical `workspace->floating` container, which had a layout of L_FLOATING and whose children were actual floating views. This allowed some conveniences, but was a hacky solution because the container has to be exempt from focus, coordinate transactions with the workspace, and omit emitting IPC events (which we didn't do). This commit changes it to be a list directly in the sway_workspace. The L_FLOATING layout is no longer used so this has been removed as well. * Fixes incorrect check in the swap command (it checked if the containers had the L_FLOATING layout, but this layout applied to the magical container). * Introduces workspace_add_floating
Diffstat (limited to 'sway/input')
-rw-r--r--sway/input/cursor.c4
-rw-r--r--sway/input/seat.c18
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;
}
}