Skip to content

Commit

Permalink
Merge pull request #2676 from ianyfan/ipc
Browse files Browse the repository at this point in the history
ipc: add pid information for views in layout tree
  • Loading branch information
ddevault authored Sep 19, 2018
2 parents f0fb27a + 81f3fda commit 6ec3626
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/sway/tree/view.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ struct sway_view {
struct sway_container *container; // NULL if unmapped and transactions finished
struct wlr_surface *surface; // NULL for unmapped views

pid_t pid;

// Geometry of the view itself (excludes borders) in layout coordinates
double x, y;
int width, height;
Expand Down
2 changes: 2 additions & 0 deletions sway/ipc-json.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ static const char *describe_container_border(enum sway_container_border border)
}

static void ipc_json_describe_view(struct sway_container *c, json_object *object) {
json_object_object_add(object, "pid", json_object_new_int(c->view->pid));

const char *app_id = view_get_app_id(c->view);
json_object_object_add(object, "app_id",
app_id ? json_object_new_string(app_id) : NULL);
Expand Down
1 change: 1 addition & 0 deletions sway/tree/view.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,7 @@ static struct sway_workspace *select_workspace(struct sway_view *view) {
wl_resource_get_client(view->surface->resource);
wl_client_get_credentials(client, &pid, NULL, NULL);
#endif
view->pid = pid;
ws = root_workspace_for_pid(pid);
if (ws) {
return ws;
Expand Down

0 comments on commit 6ec3626

Please sign in to comment.