diff options
Diffstat (limited to 'sway/tree/root.c')
-rw-r--r-- | sway/tree/root.c | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/sway/tree/root.c b/sway/tree/root.c index ebd185ec..8508e9eb 100644 --- a/sway/tree/root.c +++ b/sway/tree/root.c | |||
@@ -59,11 +59,11 @@ void root_scratchpad_add_container(struct sway_container *con, struct sway_works | |||
59 | return; | 59 | return; |
60 | } | 60 | } |
61 | 61 | ||
62 | struct sway_container *parent = con->parent; | 62 | struct sway_container *parent = con->pending.parent; |
63 | struct sway_workspace *workspace = con->workspace; | 63 | struct sway_workspace *workspace = con->pending.workspace; |
64 | 64 | ||
65 | // Clear the fullscreen mode when sending to the scratchpad | 65 | // Clear the fullscreen mode when sending to the scratchpad |
66 | if (con->fullscreen_mode != FULLSCREEN_NONE) { | 66 | if (con->pending.fullscreen_mode != FULLSCREEN_NONE) { |
67 | container_fullscreen_disable(con); | 67 | container_fullscreen_disable(con); |
68 | } | 68 | } |
69 | 69 | ||
@@ -117,7 +117,7 @@ void root_scratchpad_show(struct sway_container *con) { | |||
117 | sway_log(SWAY_DEBUG, "No focused workspace to show scratchpad on"); | 117 | sway_log(SWAY_DEBUG, "No focused workspace to show scratchpad on"); |
118 | return; | 118 | return; |
119 | } | 119 | } |
120 | struct sway_workspace *old_ws = con->workspace; | 120 | struct sway_workspace *old_ws = con->pending.workspace; |
121 | 121 | ||
122 | // If the current con or any of its parents are in fullscreen mode, we | 122 | // If the current con or any of its parents are in fullscreen mode, we |
123 | // first need to disable it before showing the scratchpad con. | 123 | // first need to disable it before showing the scratchpad con. |
@@ -134,15 +134,15 @@ void root_scratchpad_show(struct sway_container *con) { | |||
134 | workspace_consider_destroy(old_ws); | 134 | workspace_consider_destroy(old_ws); |
135 | } else { | 135 | } else { |
136 | // Act on the ancestor of scratchpad hidden split containers | 136 | // Act on the ancestor of scratchpad hidden split containers |
137 | while (con->parent) { | 137 | while (con->pending.parent) { |
138 | con = con->parent; | 138 | con = con->pending.parent; |
139 | } | 139 | } |
140 | } | 140 | } |
141 | workspace_add_floating(new_ws, con); | 141 | workspace_add_floating(new_ws, con); |
142 | 142 | ||
143 | // Make sure the container's center point overlaps this workspace | 143 | // Make sure the container's center point overlaps this workspace |
144 | double center_lx = con->x + con->width / 2; | 144 | double center_lx = con->pending.x + con->pending.width / 2; |
145 | double center_ly = con->y + con->height / 2; | 145 | double center_ly = con->pending.y + con->pending.height / 2; |
146 | 146 | ||
147 | struct wlr_box workspace_box; | 147 | struct wlr_box workspace_box; |
148 | workspace_get_box(new_ws, &workspace_box); | 148 | workspace_get_box(new_ws, &workspace_box); |
@@ -155,7 +155,7 @@ void root_scratchpad_show(struct sway_container *con) { | |||
155 | } | 155 | } |
156 | 156 | ||
157 | static void disable_fullscreen(struct sway_container *con, void *data) { | 157 | static void disable_fullscreen(struct sway_container *con, void *data) { |
158 | if (con->fullscreen_mode != FULLSCREEN_NONE) { | 158 | if (con->pending.fullscreen_mode != FULLSCREEN_NONE) { |
159 | container_fullscreen_disable(con); | 159 | container_fullscreen_disable(con); |
160 | } | 160 | } |
161 | } | 161 | } |
@@ -163,9 +163,9 @@ static void disable_fullscreen(struct sway_container *con, void *data) { | |||
163 | void root_scratchpad_hide(struct sway_container *con) { | 163 | void root_scratchpad_hide(struct sway_container *con) { |
164 | struct sway_seat *seat = input_manager_current_seat(); | 164 | struct sway_seat *seat = input_manager_current_seat(); |
165 | struct sway_node *focus = seat_get_focus_inactive(seat, &root->node); | 165 | struct sway_node *focus = seat_get_focus_inactive(seat, &root->node); |
166 | struct sway_workspace *ws = con->workspace; | 166 | struct sway_workspace *ws = con->pending.workspace; |
167 | 167 | ||
168 | if (con->fullscreen_mode == FULLSCREEN_GLOBAL && !con->workspace) { | 168 | if (con->pending.fullscreen_mode == FULLSCREEN_GLOBAL && !con->pending.workspace) { |
169 | // If the container was made fullscreen global while in the scratchpad, | 169 | // If the container was made fullscreen global while in the scratchpad, |
170 | // it should be shown until fullscreen has been disabled | 170 | // it should be shown until fullscreen has been disabled |
171 | return; | 171 | return; |
@@ -209,7 +209,7 @@ static pid_t get_parent_pid(pid_t child) { | |||
209 | FILE *stat = NULL; | 209 | FILE *stat = NULL; |
210 | size_t buf_size = 0; | 210 | size_t buf_size = 0; |
211 | 211 | ||
212 | sprintf(file_name, "/proc/%d/stat", child); | 212 | snprintf(file_name, sizeof(file_name), "/proc/%d/stat", child); |
213 | 213 | ||
214 | if ((stat = fopen(file_name, "r"))) { | 214 | if ((stat = fopen(file_name, "r"))) { |
215 | if (getline(&buffer, &buf_size, stat) != -1) { | 215 | if (getline(&buffer, &buf_size, stat) != -1) { |
@@ -270,7 +270,16 @@ found: | |||
270 | sway_log(SWAY_DEBUG, | 270 | sway_log(SWAY_DEBUG, |
271 | "Creating workspace %s for pid %d because it disappeared", | 271 | "Creating workspace %s for pid %d because it disappeared", |
272 | pw->workspace, pid); | 272 | pw->workspace, pid); |
273 | ws = workspace_create(pw->output, pw->workspace); | 273 | |
274 | struct sway_output *output = pw->output; | ||
275 | if (pw->output && !pw->output->enabled) { | ||
276 | sway_log(SWAY_DEBUG, | ||
277 | "Workspace output %s is disabled, trying another one", | ||
278 | pw->output->wlr_output->name); | ||
279 | output = NULL; | ||
280 | } | ||
281 | |||
282 | ws = workspace_create(output, pw->workspace); | ||
274 | } | 283 | } |
275 | 284 | ||
276 | pid_workspace_destroy(pw); | 285 | pid_workspace_destroy(pw); |
@@ -365,8 +374,8 @@ void root_for_each_container(void (*f)(struct sway_container *con, void *data), | |||
365 | } | 374 | } |
366 | 375 | ||
367 | // Saved workspaces | 376 | // Saved workspaces |
368 | for (int i = 0; i < root->noop_output->workspaces->length; ++i) { | 377 | for (int i = 0; i < root->fallback_output->workspaces->length; ++i) { |
369 | struct sway_workspace *ws = root->noop_output->workspaces->items[i]; | 378 | struct sway_workspace *ws = root->fallback_output->workspaces->items[i]; |
370 | workspace_for_each_container(ws, f, data); | 379 | workspace_for_each_container(ws, f, data); |
371 | } | 380 | } |
372 | } | 381 | } |
@@ -418,8 +427,8 @@ struct sway_container *root_find_container( | |||
418 | } | 427 | } |
419 | 428 | ||
420 | // Saved workspaces | 429 | // Saved workspaces |
421 | for (int i = 0; i < root->noop_output->workspaces->length; ++i) { | 430 | for (int i = 0; i < root->fallback_output->workspaces->length; ++i) { |
422 | struct sway_workspace *ws = root->noop_output->workspaces->items[i]; | 431 | struct sway_workspace *ws = root->fallback_output->workspaces->items[i]; |
423 | if ((result = workspace_find_container(ws, test, data))) { | 432 | if ((result = workspace_find_container(ws, test, data))) { |
424 | return result; | 433 | return result; |
425 | } | 434 | } |