aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/seat.c
diff options
context:
space:
mode:
authorLibravatar Kenny Levinsen <kl@kl.wtf>2021-02-12 23:22:51 +0100
committerLibravatar Tudor Brindus <me@tbrindus.ca>2021-02-16 22:05:00 -0500
commita047b5ee4a2a67d30d93641ff86531d54b8e0879 (patch)
tree271666c6254e4fabf943c1153224059411a5ce56 /sway/input/seat.c
parentAdd missing transaction commits to seatop_default (diff)
downloadsway-a047b5ee4a2a67d30d93641ff86531d54b8e0879.tar.gz
sway-a047b5ee4a2a67d30d93641ff86531d54b8e0879.tar.zst
sway-a047b5ee4a2a67d30d93641ff86531d54b8e0879.zip
container: Move pending state to state struct
Pending state is currently inlined directly in the container struct, while the current state is in a state struct. A side-effect of this is that it is not immediately obvious that pending double-buffered state is accessed, nor is it obvious what state is double-buffered. Instead, use the state struct for both current and pending.
Diffstat (limited to 'sway/input/seat.c')
-rw-r--r--sway/input/seat.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c
index 3c0d9a29..e6e1d4fb 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -309,8 +309,8 @@ static void handle_seat_node_destroy(struct wl_listener *listener, void *data) {
309 // Setting focus_inactive 309 // Setting focus_inactive
310 focus = seat_get_focus_inactive(seat, &root->node); 310 focus = seat_get_focus_inactive(seat, &root->node);
311 seat_set_raw_focus(seat, next_focus); 311 seat_set_raw_focus(seat, next_focus);
312 if (focus->type == N_CONTAINER && focus->sway_container->workspace) { 312 if (focus->type == N_CONTAINER && focus->sway_container->pending.workspace) {
313 seat_set_raw_focus(seat, &focus->sway_container->workspace->node); 313 seat_set_raw_focus(seat, &focus->sway_container->pending.workspace->node);
314 } 314 }
315 seat_set_raw_focus(seat, focus); 315 seat_set_raw_focus(seat, focus);
316 } 316 }
@@ -1086,7 +1086,7 @@ void seat_set_focus(struct sway_seat *seat, struct sway_node *node) {
1086 } 1086 }
1087 1087
1088 struct sway_workspace *new_workspace = node->type == N_WORKSPACE ? 1088 struct sway_workspace *new_workspace = node->type == N_WORKSPACE ?
1089 node->sway_workspace : node->sway_container->workspace; 1089 node->sway_workspace : node->sway_container->pending.workspace;
1090 struct sway_container *container = node->type == N_CONTAINER ? 1090 struct sway_container *container = node->type == N_CONTAINER ?
1091 node->sway_container : NULL; 1091 node->sway_container : NULL;
1092 1092
@@ -1135,10 +1135,10 @@ void seat_set_focus(struct sway_seat *seat, struct sway_node *node) {
1135 // Put the container parents on the focus stack, then the workspace, then 1135 // Put the container parents on the focus stack, then the workspace, then
1136 // the focused container. 1136 // the focused container.
1137 if (container) { 1137 if (container) {
1138 struct sway_container *parent = container->parent; 1138 struct sway_container *parent = container->pending.parent;
1139 while (parent) { 1139 while (parent) {
1140 seat_set_raw_focus(seat, &parent->node); 1140 seat_set_raw_focus(seat, &parent->node);
1141 parent = parent->parent; 1141 parent = parent->pending.parent;
1142 } 1142 }
1143 } 1143 }
1144 if (new_workspace) { 1144 if (new_workspace) {
@@ -1327,7 +1327,7 @@ struct sway_container *seat_get_focus_inactive_tiling(struct sway_seat *seat,
1327 struct sway_node *node = current->node; 1327 struct sway_node *node = current->node;
1328 if (node->type == N_CONTAINER && 1328 if (node->type == N_CONTAINER &&
1329 !container_is_floating_or_child(node->sway_container) && 1329 !container_is_floating_or_child(node->sway_container) &&
1330 node->sway_container->workspace == workspace) { 1330 node->sway_container->pending.workspace == workspace) {
1331 return node->sway_container; 1331 return node->sway_container;
1332 } 1332 }
1333 } 1333 }
@@ -1344,7 +1344,7 @@ struct sway_container *seat_get_focus_inactive_floating(struct sway_seat *seat,
1344 struct sway_node *node = current->node; 1344 struct sway_node *node = current->node;
1345 if (node->type == N_CONTAINER && 1345 if (node->type == N_CONTAINER &&
1346 container_is_floating_or_child(node->sway_container) && 1346 container_is_floating_or_child(node->sway_container) &&
1347 node->sway_container->workspace == workspace) { 1347 node->sway_container->pending.workspace == workspace) {
1348 return node->sway_container; 1348 return node->sway_container;
1349 } 1349 }
1350 } 1350 }
@@ -1392,7 +1392,7 @@ struct sway_workspace *seat_get_focused_workspace(struct sway_seat *seat) {
1392 return NULL; 1392 return NULL;
1393 } 1393 }
1394 if (focus->type == N_CONTAINER) { 1394 if (focus->type == N_CONTAINER) {
1395 return focus->sway_container->workspace; 1395 return focus->sway_container->pending.workspace;
1396 } 1396 }
1397 if (focus->type == N_WORKSPACE) { 1397 if (focus->type == N_WORKSPACE) {
1398 return focus->sway_workspace; 1398 return focus->sway_workspace;
@@ -1405,8 +1405,8 @@ struct sway_workspace *seat_get_last_known_workspace(struct sway_seat *seat) {
1405 wl_list_for_each(current, &seat->focus_stack, link) { 1405 wl_list_for_each(current, &seat->focus_stack, link) {
1406 struct sway_node *node = current->node; 1406 struct sway_node *node = current->node;
1407 if (node->type == N_CONTAINER && 1407 if (node->type == N_CONTAINER &&
1408 node->sway_container->workspace) { 1408 node->sway_container->pending.workspace) {
1409 return node->sway_container->workspace; 1409 return node->sway_container->pending.workspace;
1410 } else if (node->type == N_WORKSPACE) { 1410 } else if (node->type == N_WORKSPACE) {
1411 return node->sway_workspace; 1411 return node->sway_workspace;
1412 } 1412 }