diff options
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) { | |||
522 | 522 | ||
523 | static void ipc_get_workspaces_callback(struct sway_container *workspace, | 523 | static void ipc_get_workspaces_callback(struct sway_container *workspace, |
524 | void *data) { | 524 | void *data) { |
525 | if (workspace->type != C_WORKSPACE) { | 525 | if (!sway_assert(workspace->type == C_WORKSPACE, "Expected a workspace")) { |
526 | return; | 526 | return; |
527 | } | 527 | } |
528 | json_object *workspace_json = ipc_json_describe_container(workspace); | 528 | json_object *workspace_json = ipc_json_describe_container(workspace); |
@@ -631,8 +631,7 @@ void ipc_client_handle_command(struct ipc_client *client) { | |||
631 | case IPC_GET_WORKSPACES: | 631 | case IPC_GET_WORKSPACES: |
632 | { | 632 | { |
633 | json_object *workspaces = json_object_new_array(); | 633 | json_object *workspaces = json_object_new_array(); |
634 | container_for_each_descendant(&root_container, | 634 | root_for_each_workspace(ipc_get_workspaces_callback, workspaces); |
635 | ipc_get_workspaces_callback, workspaces); | ||
636 | const char *json_string = json_object_to_json_string(workspaces); | 635 | const char *json_string = json_object_to_json_string(workspaces); |
637 | client_valid = | 636 | client_valid = |
638 | ipc_send_reply(client, json_string, (uint32_t)strlen(json_string)); | 637 | ipc_send_reply(client, json_string, (uint32_t)strlen(json_string)); |
@@ -729,8 +728,7 @@ void ipc_client_handle_command(struct ipc_client *client) { | |||
729 | case IPC_GET_MARKS: | 728 | case IPC_GET_MARKS: |
730 | { | 729 | { |
731 | json_object *marks = json_object_new_array(); | 730 | json_object *marks = json_object_new_array(); |
732 | container_descendants(&root_container, C_VIEW, ipc_get_marks_callback, | 731 | root_for_each_container(ipc_get_marks_callback, marks); |
733 | marks); | ||
734 | const char *json_string = json_object_to_json_string(marks); | 732 | const char *json_string = json_object_to_json_string(marks); |
735 | client_valid = | 733 | client_valid = |
736 | ipc_send_reply(client, json_string, (uint32_t)strlen(json_string)); | 734 | ipc_send_reply(client, json_string, (uint32_t)strlen(json_string)); |