Include workspace con in workspace event

Send the affected workspace in the "current" property for each workspace
event for any type of workspace event that affects a particular
workspace.

fixes #1411
This commit is contained in:
Tony Crisci
2014-12-19 23:43:47 -05:00
committed by Michael Stapelberg
parent 04fa40d3e5
commit 823b46a544
9 changed files with 90 additions and 41 deletions

View File

@ -12,6 +12,7 @@
*
*/
#include "all.h"
#include "yajl_utils.h"
static void con_on_remove_child(Con *con);
@ -1435,8 +1436,15 @@ static void con_on_remove_child(Con *con) {
if (con->type == CT_WORKSPACE) {
if (TAILQ_EMPTY(&(con->focus_head)) && !workspace_is_visible(con)) {
LOG("Closing old workspace (%p / %s), it is empty\n", con, con->name);
yajl_gen gen = ipc_marshal_workspace_event("empty", con, NULL);
tree_close(con, DONT_KILL_WINDOW, false, false);
ipc_send_event("workspace", I3_IPC_EVENT_WORKSPACE, "{\"change\":\"empty\"}");
const unsigned char *payload;
ylength length;
y(get_buf, &payload, &length);
ipc_send_event("workspace", I3_IPC_EVENT_WORKSPACE, (const char *)payload);
y(free);
}
return;
}