diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-08-18 10:29:46 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-18 10:29:46 -0400 |
commit | 744724b3cb28c2ee9d265dcbf78b1cbf2b2e3fef (patch) | |
tree | 7a5ebeae1d5e15f047f09698978fa84f61756faa /sway/ipc-server.c | |
parent | d4a32800d5eb938a769d7802b23f4a0f43cadaef (diff) | |
parent | d6cd79c342495738fc23fbfbf19a01e73cdc42dc (diff) | |
download | sway-744724b3cb28c2ee9d265dcbf78b1cbf2b2e3fef.tar.xz |
Merge pull request #2473 from RyanDwyer/iterators-per-type
Implement iterators per container type
Diffstat (limited to 'sway/ipc-server.c')
-rw-r--r-- | sway/ipc-server.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/sway/ipc-server.c b/sway/ipc-server.c index dad1f310..34e940ad 100644 --- a/sway/ipc-server.c +++ b/sway/ipc-server.c @@ -522,7 +522,7 @@ void ipc_client_disconnect(struct ipc_client *client) { static void ipc_get_workspaces_callback(struct sway_container *workspace, void *data) { - if (workspace->type != C_WORKSPACE) { + if (!sway_assert(workspace->type == C_WORKSPACE, "Expected a workspace")) { return; } json_object *workspace_json = ipc_json_describe_container(workspace); @@ -631,8 +631,7 @@ void ipc_client_handle_command(struct ipc_client *client) { case IPC_GET_WORKSPACES: { json_object *workspaces = json_object_new_array(); - container_for_each_descendant(&root_container, - ipc_get_workspaces_callback, workspaces); + root_for_each_workspace(ipc_get_workspaces_callback, workspaces); const char *json_string = json_object_to_json_string(workspaces); client_valid = ipc_send_reply(client, json_string, (uint32_t)strlen(json_string)); @@ -729,8 +728,7 @@ void ipc_client_handle_command(struct ipc_client *client) { case IPC_GET_MARKS: { json_object *marks = json_object_new_array(); - container_descendants(&root_container, C_VIEW, ipc_get_marks_callback, - marks); + root_for_each_container(ipc_get_marks_callback, marks); const char *json_string = json_object_to_json_string(marks); client_valid = ipc_send_reply(client, json_string, (uint32_t)strlen(json_string)); |