aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/scratchpad.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-08-19 15:07:07 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-08-19 16:18:33 +1000
commit2b5a404ac920339a2b9ce32d4718272dee4668b9 (patch)
tree681f45a530a1f8d5966161291c3cb482e52edb6e /sway/commands/scratchpad.c
parentMerge pull request #2453 from ianyfan/commands (diff)
downloadsway-2b5a404ac920339a2b9ce32d4718272dee4668b9.tar.gz
sway-2b5a404ac920339a2b9ce32d4718272dee4668b9.tar.zst
sway-2b5a404ac920339a2b9ce32d4718272dee4668b9.zip
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/commands/scratchpad.c')
-rw-r--r--sway/commands/scratchpad.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/sway/commands/scratchpad.c b/sway/commands/scratchpad.c
index 0e573aeb..7da20015 100644
--- a/sway/commands/scratchpad.c
+++ b/sway/commands/scratchpad.c
@@ -16,7 +16,7 @@ static void scratchpad_toggle_auto(void) {
16 // If the focus is in a floating split container, 16 // If the focus is in a floating split container,
17 // operate on the split container instead of the child. 17 // operate on the split container instead of the child.
18 if (container_is_floating_or_child(focus)) { 18 if (container_is_floating_or_child(focus)) {
19 while (focus->parent->layout != L_FLOATING) { 19 while (focus->parent->type != C_WORKSPACE) {
20 focus = focus->parent; 20 focus = focus->parent;
21 } 21 }
22 } 22 }
@@ -33,9 +33,8 @@ static void scratchpad_toggle_auto(void) {
33 33
34 // Check if there is an unfocused scratchpad window on the current workspace 34 // Check if there is an unfocused scratchpad window on the current workspace
35 // and focus it. 35 // and focus it.
36 for (int i = 0; i < ws->sway_workspace->floating->children->length; ++i) { 36 for (int i = 0; i < ws->sway_workspace->floating->length; ++i) {
37 struct sway_container *floater = 37 struct sway_container *floater = ws->sway_workspace->floating->items[i];
38 ws->sway_workspace->floating->children->items[i];
39 if (floater->scratchpad && focus != floater) { 38 if (floater->scratchpad && focus != floater) {
40 wlr_log(WLR_DEBUG, 39 wlr_log(WLR_DEBUG,
41 "Focusing other scratchpad window (%s) in this workspace", 40 "Focusing other scratchpad window (%s) in this workspace",
@@ -103,7 +102,7 @@ struct cmd_results *cmd_scratchpad(int argc, char **argv) {
103 // If the container is in a floating split container, 102 // If the container is in a floating split container,
104 // operate on the split container instead of the child. 103 // operate on the split container instead of the child.
105 if (container_is_floating_or_child(con)) { 104 if (container_is_floating_or_child(con)) {
106 while (con->parent->layout != L_FLOATING) { 105 while (con->parent->type != C_WORKSPACE) {
107 con = con->parent; 106 con = con->parent;
108 } 107 }
109 } 108 }