diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2019-01-25 08:29:21 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2019-01-25 08:29:21 +1000 |
commit | 20aa8ee67dc528299dbc8735220a1c081c7ff9f6 (patch) | |
tree | 685de48be3db51fc01510ccf051e2b63a4655fba /sway/commands/move.c | |
parent | Update for swaywm/wlroots#1402 (diff) | |
download | sway-20aa8ee67dc528299dbc8735220a1c081c7ff9f6.tar.gz sway-20aa8ee67dc528299dbc8735220a1c081c7ff9f6.tar.zst sway-20aa8ee67dc528299dbc8735220a1c081c7ff9f6.zip |
Implement fullscreen global
Diffstat (limited to 'sway/commands/move.c')
-rw-r--r-- | sway/commands/move.c | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/sway/commands/move.c b/sway/commands/move.c index acb5f44f..aa06b168 100644 --- a/sway/commands/move.c +++ b/sway/commands/move.c | |||
@@ -191,7 +191,7 @@ static void container_move_to_workspace(struct sway_container *container, | |||
191 | workspace_add_floating(workspace, container); | 191 | workspace_add_floating(workspace, container); |
192 | container_handle_fullscreen_reparent(container); | 192 | container_handle_fullscreen_reparent(container); |
193 | // If changing output, center it within the workspace | 193 | // If changing output, center it within the workspace |
194 | if (old_output != workspace->output && !container->is_fullscreen) { | 194 | if (old_output != workspace->output && !container->fullscreen_mode) { |
195 | container_floating_move_to_center(container); | 195 | container_floating_move_to_center(container); |
196 | } | 196 | } |
197 | } else { | 197 | } else { |
@@ -276,7 +276,7 @@ static void workspace_rejigger(struct sway_workspace *ws, | |||
276 | static bool container_move_in_direction(struct sway_container *container, | 276 | static bool container_move_in_direction(struct sway_container *container, |
277 | enum wlr_direction move_dir) { | 277 | enum wlr_direction move_dir) { |
278 | // If moving a fullscreen view, only consider outputs | 278 | // If moving a fullscreen view, only consider outputs |
279 | if (container->is_fullscreen) { | 279 | if (container->fullscreen_mode == FULLSCREEN_WORKSPACE) { |
280 | struct sway_output *new_output = | 280 | struct sway_output *new_output = |
281 | output_get_in_direction(container->workspace->output, move_dir); | 281 | output_get_in_direction(container->workspace->output, move_dir); |
282 | if (!new_output) { | 282 | if (!new_output) { |
@@ -286,6 +286,9 @@ static bool container_move_in_direction(struct sway_container *container, | |||
286 | container_move_to_workspace(container, ws); | 286 | container_move_to_workspace(container, ws); |
287 | return true; | 287 | return true; |
288 | } | 288 | } |
289 | if (container->fullscreen_mode == FULLSCREEN_GLOBAL) { | ||
290 | return false; | ||
291 | } | ||
289 | 292 | ||
290 | // If container is in a split container by itself, move out of the split | 293 | // If container is in a split container by itself, move out of the split |
291 | if (container->parent) { | 294 | if (container->parent) { |
@@ -309,13 +312,19 @@ static bool container_move_in_direction(struct sway_container *container, | |||
309 | int index = list_find(siblings, current); | 312 | int index = list_find(siblings, current); |
310 | int desired = index + offs; | 313 | int desired = index + offs; |
311 | 314 | ||
315 | // Don't allow containers to move out of their | ||
316 | // fullscreen or floating parent | ||
317 | if (current->fullscreen_mode || container_is_floating(current)) { | ||
318 | return false; | ||
319 | } | ||
320 | |||
312 | if (is_parallel(layout, move_dir)) { | 321 | if (is_parallel(layout, move_dir)) { |
313 | if (desired == -1 || desired == siblings->length) { | 322 | if (desired == -1 || desired == siblings->length) { |
314 | if (current->parent == container->parent) { | 323 | if (current->parent == container->parent) { |
315 | current = current->parent; | 324 | current = current->parent; |
316 | continue; | 325 | continue; |
317 | } else { | 326 | } else { |
318 | // Special case | 327 | // Reparenting |
319 | if (current->parent) { | 328 | if (current->parent) { |
320 | container_insert_child(current->parent, container, | 329 | container_insert_child(current->parent, container, |
321 | index + (offs < 0 ? 0 : 1)); | 330 | index + (offs < 0 ? 0 : 1)); |
@@ -334,13 +343,6 @@ static bool container_move_in_direction(struct sway_container *container, | |||
334 | } | 343 | } |
335 | 344 | ||
336 | current = current->parent; | 345 | current = current->parent; |
337 | |||
338 | // Don't allow containers to move out of their | ||
339 | // fullscreen or floating parent | ||
340 | if (current && | ||
341 | (current->is_fullscreen || container_is_floating(current))) { | ||
342 | return false; | ||
343 | } | ||
344 | } | 346 | } |
345 | 347 | ||
346 | // Maybe rejigger the workspace | 348 | // Maybe rejigger the workspace |
@@ -563,10 +565,14 @@ static struct cmd_results *cmd_move_container(int argc, char **argv) { | |||
563 | } | 565 | } |
564 | 566 | ||
565 | // arrange windows | 567 | // arrange windows |
566 | if (old_ws && !old_ws->node.destroying) { | 568 | if (root->fullscreen_global) { |
567 | arrange_workspace(old_ws); | 569 | arrange_root(); |
570 | } else { | ||
571 | if (old_ws && !old_ws->node.destroying) { | ||
572 | arrange_workspace(old_ws); | ||
573 | } | ||
574 | arrange_node(node_get_parent(destination)); | ||
568 | } | 575 | } |
569 | arrange_node(node_get_parent(destination)); | ||
570 | 576 | ||
571 | return cmd_results_new(CMD_SUCCESS, NULL); | 577 | return cmd_results_new(CMD_SUCCESS, NULL); |
572 | } | 578 | } |
@@ -658,7 +664,7 @@ static struct cmd_results *cmd_move_in_direction( | |||
658 | "Cannot move a hidden scratchpad container"); | 664 | "Cannot move a hidden scratchpad container"); |
659 | } | 665 | } |
660 | if (container_is_floating(container)) { | 666 | if (container_is_floating(container)) { |
661 | if (container->is_fullscreen) { | 667 | if (container->fullscreen_mode) { |
662 | return cmd_results_new(CMD_FAILURE, | 668 | return cmd_results_new(CMD_FAILURE, |
663 | "Cannot move fullscreen floating container"); | 669 | "Cannot move fullscreen floating container"); |
664 | } | 670 | } |
@@ -690,9 +696,13 @@ static struct cmd_results *cmd_move_in_direction( | |||
690 | 696 | ||
691 | struct sway_workspace *new_ws = container->workspace; | 697 | struct sway_workspace *new_ws = container->workspace; |
692 | 698 | ||
693 | arrange_workspace(old_ws); | 699 | if (root->fullscreen_global) { |
694 | if (new_ws != old_ws) { | 700 | arrange_root(); |
695 | arrange_workspace(new_ws); | 701 | } else { |
702 | arrange_workspace(old_ws); | ||
703 | if (new_ws != old_ws) { | ||
704 | arrange_workspace(new_ws); | ||
705 | } | ||
696 | } | 706 | } |
697 | 707 | ||
698 | if (container->view) { | 708 | if (container->view) { |