aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Ronan Pigott <rpigott@berkeley.edu>2020-01-14 17:50:55 -0700
committerLibravatar Drew DeVault <sir@cmpwn.com>2020-01-22 13:30:52 -0500
commita4fad12d7048c2d1ad83e2d20c157674d970b157 (patch)
tree0bdd5234898a374061bc52fa2a725fa54173541b
parentFix crash when showing scratchpad hidden split containers (diff)
downloadsway-a4fad12d7048c2d1ad83e2d20c157674d970b157.tar.gz
sway-a4fad12d7048c2d1ad83e2d20c157674d970b157.tar.zst
sway-a4fad12d7048c2d1ad83e2d20c157674d970b157.zip
cmd_move: Fix crash when moving to scratchpad hidden split containers
-rw-r--r--sway/commands/move.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/sway/commands/move.c b/sway/commands/move.c
index 6ad1c7ca..09a47652 100644
--- a/sway/commands/move.c
+++ b/sway/commands/move.c
@@ -248,10 +248,11 @@ static void container_move_to_container(struct sway_container *container,
248 ipc_event_window(container, "move"); 248 ipc_event_window(container, "move");
249 } 249 }
250 250
251 workspace_focus_fullscreen(destination->workspace); 251 if (destination->workspace) {
252 workspace_focus_fullscreen(destination->workspace);
253 workspace_detect_urgent(destination->workspace);
254 }
252 255
253 // Update workspace urgent state
254 workspace_detect_urgent(destination->workspace);
255 if (old_workspace && old_workspace != destination->workspace) { 256 if (old_workspace && old_workspace != destination->workspace) {
256 workspace_detect_urgent(old_workspace); 257 workspace_detect_urgent(old_workspace);
257 } 258 }
@@ -519,8 +520,10 @@ static struct cmd_results *cmd_move_container(bool no_auto_back_and_forth,
519 } 520 }
520 521
521 struct sway_output *new_output = node_get_output(destination); 522 struct sway_output *new_output = node_get_output(destination);
522 struct sway_workspace *new_output_last_ws = old_output == new_output ? 523 struct sway_workspace *new_output_last_ws = NULL;
523 NULL : output_get_active_workspace(new_output); 524 if (new_output && old_output != new_output) {
525 new_output_last_ws = output_get_active_workspace(new_output);
526 }
524 527
525 // save focus, in case it needs to be restored 528 // save focus, in case it needs to be restored
526 struct sway_node *focus = seat_get_focus(seat); 529 struct sway_node *focus = seat_get_focus(seat);
@@ -551,12 +554,14 @@ static struct cmd_results *cmd_move_container(bool no_auto_back_and_forth,
551 } 554 }
552 555
553 // restore focus on destination output back to its last active workspace 556 // restore focus on destination output back to its last active workspace
554 struct sway_workspace *new_workspace = 557 struct sway_workspace *new_workspace = new_output ?
555 output_get_active_workspace(new_output); 558 output_get_active_workspace(new_output) : NULL;
556 if (!sway_assert(new_workspace, "Expected output to have a workspace")) { 559 if (new_output &&
560 !sway_assert(new_workspace, "Expected output to have a workspace")) {
557 return cmd_results_new(CMD_FAILURE, 561 return cmd_results_new(CMD_FAILURE,
558 "Expected output to have a workspace"); 562 "Expected output to have a workspace");
559 } 563 }
564
560 if (new_output_last_ws && new_output_last_ws != new_workspace) { 565 if (new_output_last_ws && new_output_last_ws != new_workspace) {
561 struct sway_node *new_output_last_focus = 566 struct sway_node *new_output_last_focus =
562 seat_get_focus_inactive(seat, &new_output_last_ws->node); 567 seat_get_focus_inactive(seat, &new_output_last_ws->node);