aboutsummaryrefslogtreecommitdiff
path: root/sway/commands/move.c
diff options
context:
space:
mode:
authorRyan Dwyer <ryandwyer1@gmail.com>2019-01-25 08:29:21 +1000
committerRyan Dwyer <ryandwyer1@gmail.com>2019-01-25 08:29:21 +1000
commit20aa8ee67dc528299dbc8735220a1c081c7ff9f6 (patch)
tree685de48be3db51fc01510ccf051e2b63a4655fba /sway/commands/move.c
parent75406bb93b96091d30e52922d0f319530fe65471 (diff)
Implement fullscreen global
Diffstat (limited to 'sway/commands/move.c')
-rw-r--r--sway/commands/move.c44
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,
workspace_add_floating(workspace, container);
container_handle_fullscreen_reparent(container);
// If changing output, center it within the workspace
- if (old_output != workspace->output && !container->is_fullscreen) {
+ if (old_output != workspace->output && !container->fullscreen_mode) {
container_floating_move_to_center(container);
}
} else {
@@ -276,7 +276,7 @@ static void workspace_rejigger(struct sway_workspace *ws,
static bool container_move_in_direction(struct sway_container *container,
enum wlr_direction move_dir) {
// If moving a fullscreen view, only consider outputs
- if (container->is_fullscreen) {
+ if (container->fullscreen_mode == FULLSCREEN_WORKSPACE) {
struct sway_output *new_output =
output_get_in_direction(container->workspace->output, move_dir);
if (!new_output) {
@@ -286,6 +286,9 @@ static bool container_move_in_direction(struct sway_container *container,
container_move_to_workspace(container, ws);
return true;
}
+ if (container->fullscreen_mode == FULLSCREEN_GLOBAL) {
+ return false;
+ }
// If container is in a split container by itself, move out of the split
if (container->parent) {
@@ -309,13 +312,19 @@ static bool container_move_in_direction(struct sway_container *container,
int index = list_find(siblings, current);
int desired = index + offs;
+ // Don't allow containers to move out of their
+ // fullscreen or floating parent
+ if (current->fullscreen_mode || container_is_floating(current)) {
+ return false;
+ }
+
if (is_parallel(layout, move_dir)) {
if (desired == -1 || desired == siblings->length) {
if (current->parent == container->parent) {
current = current->parent;
continue;
} else {
- // Special case
+ // Reparenting
if (current->parent) {
container_insert_child(current->parent, container,
index + (offs < 0 ? 0 : 1));
@@ -334,13 +343,6 @@ static bool container_move_in_direction(struct sway_container *container,
}
current = current->parent;
-
- // Don't allow containers to move out of their
- // fullscreen or floating parent
- if (current &&
- (current->is_fullscreen || container_is_floating(current))) {
- return false;
- }
}
// Maybe rejigger the workspace
@@ -563,10 +565,14 @@ static struct cmd_results *cmd_move_container(int argc, char **argv) {
}
// arrange windows
- if (old_ws && !old_ws->node.destroying) {
- arrange_workspace(old_ws);
+ if (root->fullscreen_global) {
+ arrange_root();
+ } else {
+ if (old_ws && !old_ws->node.destroying) {
+ arrange_workspace(old_ws);
+ }
+ arrange_node(node_get_parent(destination));
}
- arrange_node(node_get_parent(destination));
return cmd_results_new(CMD_SUCCESS, NULL);
}
@@ -658,7 +664,7 @@ static struct cmd_results *cmd_move_in_direction(
"Cannot move a hidden scratchpad container");
}
if (container_is_floating(container)) {
- if (container->is_fullscreen) {
+ if (container->fullscreen_mode) {
return cmd_results_new(CMD_FAILURE,
"Cannot move fullscreen floating container");
}
@@ -690,9 +696,13 @@ static struct cmd_results *cmd_move_in_direction(
struct sway_workspace *new_ws = container->workspace;
- arrange_workspace(old_ws);
- if (new_ws != old_ws) {
- arrange_workspace(new_ws);
+ if (root->fullscreen_global) {
+ arrange_root();
+ } else {
+ arrange_workspace(old_ws);
+ if (new_ws != old_ws) {
+ arrange_workspace(new_ws);
+ }
}
if (container->view) {