aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/workspace.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-09-23 10:39:24 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-10-06 19:16:41 +1000
commitc620f76bea08bdab6cfa17a5b3128a4924c6df4d (patch)
treee574ca18b226531da7fc67dbcc4720cbfa2eedbb /sway/tree/workspace.c
parentMerge pull request #2771 from RyanDwyer/swaylock-seat-capabilities (diff)
downloadsway-c620f76bea08bdab6cfa17a5b3128a4924c6df4d.tar.gz
sway-c620f76bea08bdab6cfa17a5b3128a4924c6df4d.tar.zst
sway-c620f76bea08bdab6cfa17a5b3128a4924c6df4d.zip
Move sticky containers when switching workspace via criteria
* Create a view on workspace 1 * Switch to workspace 2 (on the same output) and create a floating sticky view * Use criteria to focus the view on workspace 1 Previously, we only moved the sticky containers when using workspace_switch, but the above method of focusing doesn't call it. This patch relocates the sticky-moving code into seat_set_focus_warp. A side effect of this patch is that if you have a sticky container focused and then switch workspaces, the sticky container will no longer be focused. It would previously retain focus. In seat_set_focus_warp, new_output_last_ws was only set when changing outputs, but now it's always set. This means new_output_last_ws and last_workspace might point to the same workspace, which means we have to make sure we don't destroy it twice. It now checks to make sure they're different, and to make this more obvious I've moved both calls to workspace_consider_destroy to be next to each other.
Diffstat (limited to 'sway/tree/workspace.c')
-rw-r--r--sway/tree/workspace.c22
1 files changed, 0 insertions, 22 deletions
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c
index e9e5dfa2..b357d83d 100644
--- a/sway/tree/workspace.c
+++ b/sway/tree/workspace.c
@@ -369,7 +369,6 @@ struct sway_workspace *workspace_prev(struct sway_workspace *current) {
369bool workspace_switch(struct sway_workspace *workspace, 369bool workspace_switch(struct sway_workspace *workspace,
370 bool no_auto_back_and_forth) { 370 bool no_auto_back_and_forth) {
371 struct sway_seat *seat = input_manager_current_seat(input_manager); 371 struct sway_seat *seat = input_manager_current_seat(input_manager);
372 struct sway_node *focus = seat_get_focus_inactive(seat, &root->node);
373 struct sway_workspace *active_ws = seat_get_focused_workspace(seat); 372 struct sway_workspace *active_ws = seat_get_focused_workspace(seat);
374 373
375 if (!no_auto_back_and_forth && config->auto_back_and_forth 374 if (!no_auto_back_and_forth && config->auto_back_and_forth
@@ -392,27 +391,6 @@ bool workspace_switch(struct sway_workspace *workspace,
392 strcpy(prev_workspace_name, active_ws->name); 391 strcpy(prev_workspace_name, active_ws->name);
393 } 392 }
394 393
395 // Move sticky containers to new workspace
396 struct sway_output *next_output = workspace->output;
397 struct sway_workspace *next_output_prev_ws =
398 output_get_active_workspace(next_output);
399 if (workspace != next_output_prev_ws) {
400 for (int i = 0; i < next_output_prev_ws->floating->length; ++i) {
401 struct sway_container *floater =
402 next_output_prev_ws->floating->items[i];
403 if (floater->is_sticky) {
404 container_detach(floater);
405 workspace_add_floating(workspace, floater);
406 if (&floater->node == focus) {
407 seat_set_focus(seat, NULL);
408 seat_set_focus_container(seat, floater);
409 cursor_send_pointer_motion(seat->cursor, 0, true);
410 }
411 --i;
412 }
413 }
414 }
415
416 wlr_log(WLR_DEBUG, "Switching to workspace %p:%s", 394 wlr_log(WLR_DEBUG, "Switching to workspace %p:%s",
417 workspace, workspace->name); 395 workspace, workspace->name);
418 struct sway_node *next = seat_get_focus_inactive(seat, &workspace->node); 396 struct sway_node *next = seat_get_focus_inactive(seat, &workspace->node);