diff options
author | Ian Fan <ianfan0@gmail.com> | 2018-09-19 22:21:09 +0100 |
---|---|---|
committer | Ian Fan <ianfan0@gmail.com> | 2018-09-19 22:21:09 +0100 |
commit | 81f3fda6fa9b0789c8b40582a4b85b2e9501c185 (patch) | |
tree | e31bf430e22c75dd53a857357bfbaa07f6177f1f | |
parent | swaybar: add debugging statements for handling i3bar json (diff) | |
download | sway-81f3fda6fa9b0789c8b40582a4b85b2e9501c185.tar.gz sway-81f3fda6fa9b0789c8b40582a4b85b2e9501c185.tar.zst sway-81f3fda6fa9b0789c8b40582a4b85b2e9501c185.zip |
ipc: add pid information for views in layout tree
-rw-r--r-- | include/sway/tree/view.h | 2 | ||||
-rw-r--r-- | sway/ipc-json.c | 2 | ||||
-rw-r--r-- | sway/tree/view.c | 1 |
3 files changed, 5 insertions, 0 deletions
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index 439dc1bf..d10251dd 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h | |||
@@ -61,6 +61,8 @@ struct sway_view { | |||
61 | struct sway_container *container; // NULL if unmapped and transactions finished | 61 | struct sway_container *container; // NULL if unmapped and transactions finished |
62 | struct wlr_surface *surface; // NULL for unmapped views | 62 | struct wlr_surface *surface; // NULL for unmapped views |
63 | 63 | ||
64 | pid_t pid; | ||
65 | |||
64 | // Geometry of the view itself (excludes borders) in layout coordinates | 66 | // Geometry of the view itself (excludes borders) in layout coordinates |
65 | double x, y; | 67 | double x, y; |
66 | int width, height; | 68 | int width, height; |
diff --git a/sway/ipc-json.c b/sway/ipc-json.c index 52278be2..f054ac9f 100644 --- a/sway/ipc-json.c +++ b/sway/ipc-json.c | |||
@@ -221,6 +221,8 @@ static const char *describe_container_border(enum sway_container_border border) | |||
221 | } | 221 | } |
222 | 222 | ||
223 | static void ipc_json_describe_view(struct sway_container *c, json_object *object) { | 223 | static void ipc_json_describe_view(struct sway_container *c, json_object *object) { |
224 | json_object_object_add(object, "pid", json_object_new_int(c->view->pid)); | ||
225 | |||
224 | const char *app_id = view_get_app_id(c->view); | 226 | const char *app_id = view_get_app_id(c->view); |
225 | json_object_object_add(object, "app_id", | 227 | json_object_object_add(object, "app_id", |
226 | app_id ? json_object_new_string(app_id) : NULL); | 228 | app_id ? json_object_new_string(app_id) : NULL); |
diff --git a/sway/tree/view.c b/sway/tree/view.c index e4e1c161..4398f518 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -470,6 +470,7 @@ static struct sway_workspace *select_workspace(struct sway_view *view) { | |||
470 | wl_resource_get_client(view->surface->resource); | 470 | wl_resource_get_client(view->surface->resource); |
471 | wl_client_get_credentials(client, &pid, NULL, NULL); | 471 | wl_client_get_credentials(client, &pid, NULL, NULL); |
472 | #endif | 472 | #endif |
473 | view->pid = pid; | ||
473 | ws = root_workspace_for_pid(pid); | 474 | ws = root_workspace_for_pid(pid); |
474 | if (ws) { | 475 | if (ws) { |
475 | return ws; | 476 | return ws; |