aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar lbonn <bonnans.l@gmail.com>2017-10-08 02:24:08 +0200
committerLibravatar lbonn <bonnans.l@gmail.com>2017-10-08 11:54:46 +0200
commit61005c3bdab54b2ee84365fed4894c0e34da6c5b (patch)
tree8550777f6cffe2f692831b5edb77c45c2867adc5
parentcommands: fail when criteria match nothing (diff)
downloadsway-61005c3bdab54b2ee84365fed4894c0e34da6c5b.tar.gz
sway-61005c3bdab54b2ee84365fed4894c0e34da6c5b.tar.zst
sway-61005c3bdab54b2ee84365fed4894c0e34da6c5b.zip
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
-rw-r--r--sway/handlers.c3
-rw-r--r--sway/ipc-server.c6
2 files changed, 3 insertions, 6 deletions
diff --git a/sway/handlers.c b/sway/handlers.c
index 4a2298cd..db0c5e24 100644
--- a/sway/handlers.c
+++ b/sway/handlers.c
@@ -557,6 +557,8 @@ static void handle_view_destroyed(wlc_handle handle) {
557 parent->fullscreen = NULL; 557 parent->fullscreen = NULL;
558 } 558 }
559 559
560 ipc_event_window(parent, "close");
561
560 // Destroy empty workspaces 562 // Destroy empty workspaces
561 if (parent->type == C_WORKSPACE && 563 if (parent->type == C_WORKSPACE &&
562 parent->children->length == 0 && 564 parent->children->length == 0 &&
@@ -567,7 +569,6 @@ static void handle_view_destroyed(wlc_handle handle) {
567 } 569 }
568 570
569 arrange_windows(parent, -1, -1); 571 arrange_windows(parent, -1, -1);
570 ipc_event_window(parent, "close");
571 } else { 572 } else {
572 // Is it unmanaged? 573 // Is it unmanaged?
573 int i; 574 int i;
diff --git a/sway/ipc-server.c b/sway/ipc-server.c
index 26d0be65..9122d548 100644
--- a/sway/ipc-server.c
+++ b/sway/ipc-server.c
@@ -792,11 +792,7 @@ void ipc_event_window(swayc_t *window, const char *change) {
792 sway_log(L_DEBUG, "Sending window::%s event", change); 792 sway_log(L_DEBUG, "Sending window::%s event", change);
793 json_object *obj = json_object_new_object(); 793 json_object *obj = json_object_new_object();
794 json_object_object_add(obj, "change", json_object_new_string(change)); 794 json_object_object_add(obj, "change", json_object_new_string(change));
795 if (strcmp(change, "close") == 0 || !window) { 795 json_object_object_add(obj, "container", ipc_json_describe_container_recursive(window));
796 json_object_object_add(obj, "container", NULL);
797 } else {
798 json_object_object_add(obj, "container", ipc_json_describe_container(window));
799 }
800 796
801 const char *json_string = json_object_to_json_string(obj); 797 const char *json_string = json_object_to_json_string(obj);
802 ipc_send_event(json_string, IPC_EVENT_WINDOW); 798 ipc_send_event(json_string, IPC_EVENT_WINDOW);