]> git.sur5r.net Git - i3/i3/commitdiff
Merge branch 'master' into next
authorMichael Stapelberg <michael@stapelberg.de>
Mon, 26 Sep 2011 19:12:07 +0000 (20:12 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Mon, 26 Sep 2011 19:12:07 +0000 (20:12 +0100)
1  2 
src/ipc.c

diff --combined src/ipc.c
index e5034939a78bc2aa3b1503e517bd773c16b88bdf,e03bdcbd07ccdc712a6c5e90459cf58b810a90b1..031ee9ab5d78bea6369b740bdc84f760fb734c99
+++ b/src/ipc.c
@@@ -205,11 -205,6 +205,11 @@@ void dump_node(yajl_gen gen, struct Co
      ystr("urgent");
      y(bool, con->urgent);
  
 +    if (con->mark != NULL) {
 +        ystr("mark");
 +        ystr(con->mark);
 +    }
 +
      ystr("focused");
      y(bool, (con == focused));
  
  
      ystr("focus");
      y(array_open);
-     TAILQ_FOREACH(node, &(con->focus_head), nodes) {
+     TAILQ_FOREACH(node, &(con->focus_head), focused) {
          y(integer, (long int)node);
      }
      y(array_close);
@@@ -343,7 -338,6 +343,7 @@@ IPC_HANDLER(tree) 
      y(free);
  }
  
 +
  /*
   * Formats the reply message for a GET_WORKSPACES request and sends it to the
   * client
@@@ -474,38 -468,6 +474,38 @@@ IPC_HANDLER(get_outputs) 
      y(free);
  }
  
 +/*
 + * Formats the reply message for a GET_MARKS request and sends it to the
 + * client
 + *
 + */
 +IPC_HANDLER(get_marks) {
 +#if YAJL_MAJOR >= 2
 +    yajl_gen gen = yajl_gen_alloc(NULL);
 +#else
 +    yajl_gen gen = yajl_gen_alloc(NULL, NULL);
 +#endif
 +    y(array_open);
 +
 +    Con *con;
 +    TAILQ_FOREACH(con, &all_cons, all_cons)
 +        if (con->mark != NULL)
 +            ystr(con->mark);
 +
 +    y(array_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, payload, I3_IPC_REPLY_TYPE_MARKS, length);
 +    y(free);
 +}
 +
  /*
   * Callback for the YAJL parser (will be called when a string is parsed).
   *
@@@ -593,13 -555,12 +593,13 @@@ IPC_HANDLER(subscribe) 
  
  /* The index of each callback function corresponds to the numeric
   * value of the message type (see include/i3/ipc.h) */
 -handler_t handlers[5] = {
 +handler_t handlers[6] = {
      handle_command,
      handle_get_workspaces,
      handle_subscribe,
      handle_get_outputs,
 -    handle_tree
 +    handle_tree,
 +    handle_get_marks
  };
  
  /*
@@@ -722,7 -683,7 +722,7 @@@ void ipc_new_client(EV_P_ struct ev_io 
      ev_io_init(package, ipc_receive_message, client, EV_READ);
      ev_io_start(EV_A_ package);
  
 -    DLOG("IPC: new client connected\n");
 +    DLOG("IPC: new client connected on fd %d\n", w->fd);
  
      ipc_client *new = scalloc(sizeof(ipc_client));
      new->fd = client;