diff options
author | Ronan Pigott <ronan@rjp.ie> | 2022-11-16 15:50:34 -0700 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2022-11-26 09:48:58 +0100 |
commit | 864b3a9a18f236f92f1898bb44ab977ceaebfd68 (patch) | |
tree | bab0ea888c50af46725c94fe5c0c024bdf432a69 /include | |
parent | launcher: rename pid_workspace to launcher_ctx (diff) | |
download | sway-864b3a9a18f236f92f1898bb44ab977ceaebfd68.tar.gz sway-864b3a9a18f236f92f1898bb44ab977ceaebfd68.tar.zst sway-864b3a9a18f236f92f1898bb44ab977ceaebfd68.zip |
view: associate launch contexts with views
Views now maintain a reference to a launch context which, as a last
resort, is populated at map time with a context associated with its pid.
This opens the possibility of populating it before map via another
source, e.g. xdga-tokens or configuration.
Diffstat (limited to 'include')
-rw-r--r-- | include/sway/desktop/launcher.h | 22 | ||||
-rw-r--r-- | include/sway/tree/view.h | 3 |
2 files changed, 22 insertions, 3 deletions
diff --git a/include/sway/desktop/launcher.h b/include/sway/desktop/launcher.h index 7802bee1..927d7a37 100644 --- a/include/sway/desktop/launcher.h +++ b/include/sway/desktop/launcher.h | |||
@@ -3,10 +3,26 @@ | |||
3 | 3 | ||
4 | #include <stdlib.h> | 4 | #include <stdlib.h> |
5 | 5 | ||
6 | struct sway_workspace *workspace_for_pid(pid_t pid); | 6 | struct launcher_ctx { |
7 | pid_t pid; | ||
8 | char *name; | ||
9 | struct wlr_xdg_activation_token_v1 *token; | ||
10 | struct wl_listener token_destroy; | ||
7 | 11 | ||
8 | void launcher_ctx_create(pid_t pid); | 12 | struct sway_node *node; |
13 | struct wl_listener node_destroy; | ||
14 | |||
15 | struct wl_list link; // sway_server::pending_launcher_ctxs | ||
16 | }; | ||
17 | |||
18 | struct launcher_ctx *launcher_ctx_find_pid(pid_t pid); | ||
19 | |||
20 | struct sway_workspace *launcher_ctx_get_workspace(struct launcher_ctx *ctx); | ||
9 | 21 | ||
10 | void remove_workspace_pid(pid_t pid); | 22 | void launcher_ctx_consume(struct launcher_ctx *ctx); |
23 | |||
24 | void launcher_ctx_destroy(struct launcher_ctx *ctx); | ||
25 | |||
26 | void launcher_ctx_create(pid_t pid); | ||
11 | 27 | ||
12 | #endif | 28 | #endif |
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index 0dcbf1aa..ca099431 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h | |||
@@ -74,6 +74,7 @@ struct sway_view { | |||
74 | struct sway_xdg_decoration *xdg_decoration; | 74 | struct sway_xdg_decoration *xdg_decoration; |
75 | 75 | ||
76 | pid_t pid; | 76 | pid_t pid; |
77 | struct launcher_ctx *ctx; | ||
77 | 78 | ||
78 | // The size the view would want to be if it weren't tiled. | 79 | // The size the view would want to be if it weren't tiled. |
79 | // Used when changing a view from tiled to floating. | 80 | // Used when changing a view from tiled to floating. |
@@ -372,4 +373,6 @@ void view_save_buffer(struct sway_view *view); | |||
372 | 373 | ||
373 | bool view_is_transient_for(struct sway_view *child, struct sway_view *ancestor); | 374 | bool view_is_transient_for(struct sway_view *child, struct sway_view *ancestor); |
374 | 375 | ||
376 | void view_assign_ctx(struct sway_view *view, struct launcher_ctx *ctx); | ||
377 | |||
375 | #endif | 378 | #endif |