aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/swap.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2019-01-25 08:29:21 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2019-01-25 08:29:21 +1000
commit20aa8ee67dc528299dbc8735220a1c081c7ff9f6 (patch)
tree685de48be3db51fc01510ccf051e2b63a4655fba /sway/commands/swap.c
parentUpdate for swaywm/wlroots#1402 (diff)
downloadsway-20aa8ee67dc528299dbc8735220a1c081c7ff9f6.tar.gz
sway-20aa8ee67dc528299dbc8735220a1c081c7ff9f6.tar.zst
sway-20aa8ee67dc528299dbc8735220a1c081c7ff9f6.zip
Implement fullscreen global
Diffstat (limited to 'sway/commands/swap.c')
-rw-r--r--sway/commands/swap.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/sway/commands/swap.c b/sway/commands/swap.c
index 0d8d1116..0e2c2d10 100644
--- a/sway/commands/swap.c
+++ b/sway/commands/swap.c
@@ -77,6 +77,11 @@ static void swap_focus(struct sway_container *con1,
77 } else { 77 } else {
78 seat_set_focus_container(seat, focus); 78 seat_set_focus_container(seat, focus);
79 } 79 }
80
81 if (root->fullscreen_global) {
82 seat_set_focus(seat,
83 seat_get_focus_inactive(seat, &root->fullscreen_global->node));
84 }
80} 85}
81 86
82static void container_swap(struct sway_container *con1, 87static void container_swap(struct sway_container *con1,
@@ -98,13 +103,13 @@ static void container_swap(struct sway_container *con1,
98 sway_log(SWAY_DEBUG, "Swapping containers %zu and %zu", 103 sway_log(SWAY_DEBUG, "Swapping containers %zu and %zu",
99 con1->node.id, con2->node.id); 104 con1->node.id, con2->node.id);
100 105
101 bool fs1 = con1->is_fullscreen; 106 enum sway_fullscreen_mode fs1 = con1->fullscreen_mode;
102 bool fs2 = con2->is_fullscreen; 107 enum sway_fullscreen_mode fs2 = con2->fullscreen_mode;
103 if (fs1) { 108 if (fs1) {
104 container_set_fullscreen(con1, false); 109 container_fullscreen_disable(con1);
105 } 110 }
106 if (fs2) { 111 if (fs2) {
107 container_set_fullscreen(con2, false); 112 container_fullscreen_disable(con2);
108 } 113 }
109 114
110 struct sway_seat *seat = config->handler_context.seat; 115 struct sway_seat *seat = config->handler_context.seat;
@@ -136,10 +141,10 @@ static void container_swap(struct sway_container *con1,
136 } 141 }
137 142
138 if (fs1) { 143 if (fs1) {
139 container_set_fullscreen(con2, true); 144 container_set_fullscreen(con2, fs1);
140 } 145 }
141 if (fs2) { 146 if (fs2) {
142 container_set_fullscreen(con1, true); 147 container_set_fullscreen(con1, fs2);
143 } 148 }
144} 149}
145 150
@@ -220,9 +225,13 @@ struct cmd_results *cmd_swap(int argc, char **argv) {
220 225
221 container_swap(current, other); 226 container_swap(current, other);
222 227
223 arrange_node(node_get_parent(&current->node)); 228 if (root->fullscreen_global) {
224 if (node_get_parent(&other->node) != node_get_parent(&current->node)) { 229 arrange_root();
225 arrange_node(node_get_parent(&other->node)); 230 } else {
231 arrange_node(node_get_parent(&current->node));
232 if (node_get_parent(&other->node) != node_get_parent(&current->node)) {
233 arrange_node(node_get_parent(&other->node));
234 }
226 } 235 }
227 236
228 return cmd_results_new(CMD_SUCCESS, NULL); 237 return cmd_results_new(CMD_SUCCESS, NULL);