break;
}
+ ystr("scratchpad_state");
+ switch (con->scratchpad_state) {
+ case SCRATCHPAD_NONE:
+ ystr("none");
+ break;
+ case SCRATCHPAD_FRESH:
+ ystr("fresh");
+ break;
+ case SCRATCHPAD_CHANGED:
+ ystr("changed");
+ break;
+ }
+
ystr("percent");
if (con->percent == 0.0)
y(null);
Con *output;
TAILQ_FOREACH(output, &(croot->nodes_head), nodes) {
+ if (output->name[0] == '_' && output->name[1] == '_')
+ continue;
Con *ws;
TAILQ_FOREACH(ws, &(output_get_content(output)->nodes_head), nodes) {
assert(ws->type == CT_WORKSPACE);
y(free);
}
+/*
+ * Formats the reply message for a GET_LOG_MARKERS request and sends it to the
+ * client.
+ *
+ */
+IPC_HANDLER(get_log_markers) {
+#if YAJL_MAJOR >= 2
+ yajl_gen gen = yajl_gen_alloc(NULL);
+#else
+ yajl_gen gen = yajl_gen_alloc(NULL, NULL);
+#endif
+
+ int offset_next_write, offset_last_wrap, logsize;
+ get_log_markers(&offset_next_write, &offset_last_wrap, &logsize);
+
+ y(map_open);
+ ystr("offset_next_write");
+ y(integer, offset_next_write);
+
+ ystr("offset_last_wrap");
+ y(integer, offset_last_wrap);
+
+ ystr("shmname");
+ ystr(shmlogname);
+
+ ystr("size");
+ y(integer, logsize);
+
+ y(map_close);
+
+ const unsigned char *payload;
+#if YAJL_MAJOR >= 2
+ size_t length;
+#else
+ unsigned int length;
+#endif
+ y(get_buf, &payload, &length);
+
+ ipc_send_message(fd, length, I3_IPC_REPLY_TYPE_LOG_MARKERS, payload);
+ y(free);
+}
+
/*
* Callback for the YAJL parser (will be called when a string is parsed).
*
/* The index of each callback function corresponds to the numeric
* value of the message type (see include/i3/ipc.h) */
-handler_t handlers[7] = {
+handler_t handlers[8] = {
handle_command,
handle_get_workspaces,
handle_subscribe,
handle_get_outputs,
handle_tree,
handle_get_marks,
- handle_get_bar_config
+ handle_get_bar_config,
+ handle_get_log_markers
};
/*
return;
}
+ /* Close this file descriptor on exec() */
+ (void)fcntl(client, F_SETFD, FD_CLOEXEC);
+
set_nonblock(client);
struct ev_io *package = scalloc(sizeof(struct ev_io));