ipc/window-event: fill "container" on close events

Also use the recursive description to include children as well

Careful: send the event before deleting the parent
This commit is contained in:
lbonn 2017-10-08 02:24:08 +02:00
parent b2d4caf6c3
commit 61005c3bda
2 changed files with 3 additions and 6 deletions

View file

@ -557,6 +557,8 @@ static void handle_view_destroyed(wlc_handle handle) {
parent->fullscreen = NULL; parent->fullscreen = NULL;
} }
ipc_event_window(parent, "close");
// Destroy empty workspaces // Destroy empty workspaces
if (parent->type == C_WORKSPACE && if (parent->type == C_WORKSPACE &&
parent->children->length == 0 && parent->children->length == 0 &&
@ -567,7 +569,6 @@ static void handle_view_destroyed(wlc_handle handle) {
} }
arrange_windows(parent, -1, -1); arrange_windows(parent, -1, -1);
ipc_event_window(parent, "close");
} else { } else {
// Is it unmanaged? // Is it unmanaged?
int i; int i;

View file

@ -792,11 +792,7 @@ void ipc_event_window(swayc_t *window, const char *change) {
sway_log(L_DEBUG, "Sending window::%s event", change); sway_log(L_DEBUG, "Sending window::%s event", change);
json_object *obj = json_object_new_object(); json_object *obj = json_object_new_object();
json_object_object_add(obj, "change", json_object_new_string(change)); json_object_object_add(obj, "change", json_object_new_string(change));
if (strcmp(change, "close") == 0 || !window) { json_object_object_add(obj, "container", ipc_json_describe_container_recursive(window));
json_object_object_add(obj, "container", NULL);
} else {
json_object_object_add(obj, "container", ipc_json_describe_container(window));
}
const char *json_string = json_object_to_json_string(obj); const char *json_string = json_object_to_json_string(obj);
ipc_send_event(json_string, IPC_EVENT_WINDOW); ipc_send_event(json_string, IPC_EVENT_WINDOW);