Fix ipc syntax

This commit is contained in:
project-repo 2022-12-28 15:03:37 +01:00
commit f2ebea72de
2 changed files with 13 additions and 15 deletions

View file

@ -336,10 +336,8 @@ ipc_send_event_client(struct cg_ipc_client *client, const char *payload,
memcpy(data, ipc_magic, sizeof(ipc_magic));
// Terminating null character
payload_length+=1;
while(client->write_buffer_len + IPC_HEADER_SIZE + payload_length >=
// +1 for terminating null character
while(client->write_buffer_len + IPC_HEADER_SIZE + payload_length +1 >=
client->write_buffer_size) {
client->write_buffer_size *= 2;
}

View file

@ -835,13 +835,13 @@ print_view(struct cg_view *view) {
char *title_str = view->impl->get_title(view);
print_str(&outp_str, "\"title\": \"%s\",\n",
title_str == NULL ? "" : title_str);
print_str(&outp_str, "\"coords\": [\"x\":%d,\"y\":%d],\n", view->ox,
print_str(&outp_str, "\"coords\": {\"x\":%d,\"y\":%d},\n", view->ox,
view->oy);
#if CG_HAS_XWAYLAND
print_str(&outp_str, "\"type\": \"%s\",\n",
print_str(&outp_str, "\"type\": \"%s\"\n",
view->type == CG_XWAYLAND_VIEW ? "xwayland" : "xdg");
#else
print_str(&outp_str, "\"type\": \"xdg\",\n");
print_str(&outp_str, "\"type\": \"xdg\"\n");
#endif
return dyn_str_to_str(&outp_str);
}
@ -854,11 +854,11 @@ print_tile(struct cg_tile *tile) {
uint32_t nmemb = 4;
outp_str.str_arr = calloc(nmemb, sizeof(char *));
print_str(&outp_str, "\"id\": %d,\n", tile->id);
print_str(&outp_str, "\"coords\": [\"x\":%d,\"y\":%d],\n", tile->tile.x,
print_str(&outp_str, "\"coords\": {\"x\":%d,\"y\":%d},\n", tile->tile.x,
tile->tile.y);
print_str(&outp_str, "\"size\": [\"width\":%d,\"height\":%d],\n",
print_str(&outp_str, "\"size\": {\"width\":%d,\"height\":%d},\n",
tile->tile.width, tile->tile.height);
print_str(&outp_str, "\"view\": \"%d\",\n",
print_str(&outp_str, "\"view\": \"%d\"\n",
tile->view == NULL ? -1 : (int)tile->view->id);
return dyn_str_to_str(&outp_str);
}
@ -962,7 +962,7 @@ print_workspaces(struct cg_output *outp) {
free(ws);
}
}
print_str(&outp_str, "],\n");
print_str(&outp_str, "]\n");
return dyn_str_to_str(&outp_str);
}
@ -992,7 +992,7 @@ print_outputs(struct cg_server *server) {
outp_str.len = 0;
outp_str.cur_pos = 0;
outp_str.str_arr = calloc((2 * noutps - 1) + 2, sizeof(char *));
print_str(&outp_str, "\"outputs\": [");
print_str(&outp_str, "\"outputs\": {");
struct cg_output *it;
uint32_t count = 0;
wl_list_for_each(it, &server->outputs, link) {
@ -1007,7 +1007,7 @@ print_outputs(struct cg_server *server) {
print_str(&outp_str, "%s", outp);
free(outp);
}
print_str(&outp_str, "],\n");
print_str(&outp_str, "},\n");
return dyn_str_to_str(&outp_str);
}
@ -1025,13 +1025,13 @@ keybinding_dump(struct cg_server *server) {
server->bg_color[1], server->bg_color[2], server->bg_color[3]);
print_str(&str, "\"views_curr_id\":%d,\n", server->views_curr_id);
print_str(&str, "\"tiles_curr_id\":%d,\n", server->tiles_curr_id);
print_str(&str, "\"curr_output\":%s,\n",
print_str(&str, "\"curr_output\":\"%s\",\n",
server->curr_output->wlr_output->name);
print_modes(&str, server->modes);
char *outps_str = print_outputs(server);
print_str(&str, "%s", outps_str);
free(outps_str);
print_str(&str, "\"cursor_coords\":{\"x\":%f,\"y\":%f},\n",
print_str(&str, "\"cursor_coords\":{\"x\":%f,\"y\":%f}\n",
server->seat->cursor->x, server->seat->cursor->y);
print_str(&str, "}");