aboutsummaryrefslogtreecommitdiffstats
path: root/sway/ipc-json.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/ipc-json.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/ipc-json.c')
-rw-r--r--sway/ipc-json.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/sway/ipc-json.c b/sway/ipc-json.c
index 4c2bcc98..f40af043 100644
--- a/sway/ipc-json.c
+++ b/sway/ipc-json.c
@@ -23,8 +23,6 @@ static const char *ipc_json_layout_description(enum sway_container_layout l) {
23 return "tabbed"; 23 return "tabbed";
24 case L_STACKED: 24 case L_STACKED:
25 return "stacked"; 25 return "stacked";
26 case L_FLOATING:
27 return "floating";
28 case L_NONE: 26 case L_NONE:
29 break; 27 break;
30 } 28 }
@@ -180,10 +178,11 @@ static void ipc_json_describe_workspace(struct sway_container *workspace,
180 178
181 // Floating 179 // Floating
182 json_object *floating_array = json_object_new_array(); 180 json_object *floating_array = json_object_new_array();
183 struct sway_container *floating = workspace->sway_workspace->floating; 181 list_t *floating = workspace->sway_workspace->floating;
184 for (int i = 0; i < floating->children->length; ++i) { 182 for (int i = 0; i < floating->length; ++i) {
185 struct sway_container *floater = floating->children->items[i]; 183 struct sway_container *floater = floating->items[i];
186 json_object_array_add(floating_array, ipc_json_describe_container_recursive(floater)); 184 json_object_array_add(floating_array,
185 ipc_json_describe_container_recursive(floater));
187 } 186 }
188 json_object_object_add(object, "floating_nodes", floating_array); 187 json_object_object_add(object, "floating_nodes", floating_array);
189} 188}