diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-02-26 19:28:32 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-26 19:28:32 -0500 |
commit | caf28c0c9f6b7aa2caa0d9b71e58a96b9d4dae0b (patch) | |
tree | 68aedf3e2e0e5c0c274d469d429f6a94683c46a9 | |
parent | Fix wlr_render_with_matrix call (diff) | |
parent | ipc show focused container (diff) | |
download | sway-caf28c0c9f6b7aa2caa0d9b71e58a96b9d4dae0b.tar.gz sway-caf28c0c9f6b7aa2caa0d9b71e58a96b9d4dae0b.tar.zst sway-caf28c0c9f6b7aa2caa0d9b71e58a96b9d4dae0b.zip |
Merge pull request #1608 from acrisci/ipc-focused
ipc show focused container
-rw-r--r-- | sway/ipc-json.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sway/ipc-json.c b/sway/ipc-json.c index f0afdc9f..213c8fb6 100644 --- a/sway/ipc-json.c +++ b/sway/ipc-json.c | |||
@@ -5,6 +5,8 @@ | |||
5 | #include "sway/ipc-json.h" | 5 | #include "sway/ipc-json.h" |
6 | #include "sway/container.h" | 6 | #include "sway/container.h" |
7 | #include "sway/output.h" | 7 | #include "sway/output.h" |
8 | #include "sway/input/input-manager.h" | ||
9 | #include "sway/input/seat.h" | ||
8 | #include <wlr/types/wlr_box.h> | 10 | #include <wlr/types/wlr_box.h> |
9 | #include <wlr/types/wlr_output.h> | 11 | #include <wlr/types/wlr_output.h> |
10 | 12 | ||
@@ -95,11 +97,15 @@ json_object *ipc_json_describe_container(swayc_t *c) { | |||
95 | return NULL; | 97 | return NULL; |
96 | } | 98 | } |
97 | 99 | ||
100 | struct sway_seat *seat = sway_input_manager_get_default_seat(input_manager); | ||
101 | bool focused = sway_seat_get_focus(seat) == c; | ||
102 | |||
98 | json_object *object = json_object_new_object(); | 103 | json_object *object = json_object_new_object(); |
99 | 104 | ||
100 | json_object_object_add(object, "id", json_object_new_int((int)c->id)); | 105 | json_object_object_add(object, "id", json_object_new_int((int)c->id)); |
101 | json_object_object_add(object, "name", (c->name) ? json_object_new_string(c->name) : NULL); | 106 | json_object_object_add(object, "name", (c->name) ? json_object_new_string(c->name) : NULL); |
102 | json_object_object_add(object, "rect", ipc_json_create_rect(c)); | 107 | json_object_object_add(object, "rect", ipc_json_create_rect(c)); |
108 | json_object_object_add(object, "focused", json_object_new_boolean(focused)); | ||
103 | 109 | ||
104 | switch (c->type) { | 110 | switch (c->type) { |
105 | case C_ROOT: | 111 | case C_ROOT: |