mirror of
https://github.com/swaywm/sway.git
synced 2025-11-08 13:29:50 -05:00
Merge pull request #2272 from RyanDwyer/simplify-transactions
Simplify transactions by using a dirty flag on containers
This commit is contained in:
commit
53e3f35ba3
29 changed files with 139 additions and 190 deletions
|
|
@ -42,7 +42,7 @@ struct cmd_results *cmd_border(int argc, char **argv) {
|
|||
container_set_geometry_from_floating_view(view->swayc);
|
||||
}
|
||||
|
||||
arrange_and_commit(view->swayc);
|
||||
arrange_windows(view->swayc);
|
||||
|
||||
struct sway_seat *seat = input_manager_current_seat(input_manager);
|
||||
if (seat->cursor) {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ struct cmd_results *cmd_floating(int argc, char **argv) {
|
|||
container_set_floating(container, wants_floating);
|
||||
|
||||
struct sway_container *workspace = container_parent(container, C_WORKSPACE);
|
||||
arrange_and_commit(workspace);
|
||||
arrange_windows(workspace);
|
||||
|
||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ struct cmd_results *cmd_fullscreen(int argc, char **argv) {
|
|||
view_set_fullscreen(view, wants_fullscreen);
|
||||
|
||||
struct sway_container *workspace = container_parent(container, C_WORKSPACE);
|
||||
arrange_and_commit(workspace->parent);
|
||||
arrange_windows(workspace->parent);
|
||||
|
||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ struct cmd_results *cmd_gaps(int argc, char **argv) {
|
|||
return cmd_results_new(CMD_INVALID, "gaps",
|
||||
"gaps edge_gaps on|off|toggle");
|
||||
}
|
||||
arrange_and_commit(&root_container);
|
||||
arrange_windows(&root_container);
|
||||
} else {
|
||||
int amount_idx = 0; // the current index in argv
|
||||
enum gaps_op op = GAPS_OP_SET;
|
||||
|
|
@ -124,7 +124,7 @@ struct cmd_results *cmd_gaps(int argc, char **argv) {
|
|||
if (amount_idx == 0) { // gaps <amount>
|
||||
config->gaps_inner = val;
|
||||
config->gaps_outer = val;
|
||||
arrange_and_commit(&root_container);
|
||||
arrange_windows(&root_container);
|
||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||
}
|
||||
// Other variants. The middle-length variant (gaps inner|outer <amount>)
|
||||
|
|
@ -155,7 +155,7 @@ struct cmd_results *cmd_gaps(int argc, char **argv) {
|
|||
} else {
|
||||
config->gaps_outer = total;
|
||||
}
|
||||
arrange_and_commit(&root_container);
|
||||
arrange_windows(&root_container);
|
||||
} else {
|
||||
struct sway_container *c =
|
||||
config->handler_context.current_container;
|
||||
|
|
@ -169,7 +169,7 @@ struct cmd_results *cmd_gaps(int argc, char **argv) {
|
|||
c->gaps_outer = total;
|
||||
}
|
||||
|
||||
arrange_and_commit(c->parent ? c->parent : &root_container);
|
||||
arrange_windows(c->parent ? c->parent : &root_container);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ struct cmd_results *cmd_layout(int argc, char **argv) {
|
|||
}
|
||||
|
||||
container_notify_subtree_changed(parent);
|
||||
arrange_and_commit(parent);
|
||||
arrange_windows(parent);
|
||||
|
||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
#include <wlr/types/wlr_output_layout.h>
|
||||
#include <wlr/util/log.h>
|
||||
#include "sway/commands.h"
|
||||
#include "sway/desktop/transaction.h"
|
||||
#include "sway/input/cursor.h"
|
||||
#include "sway/input/seat.h"
|
||||
#include "sway/output.h"
|
||||
|
|
@ -105,10 +104,8 @@ static struct cmd_results *cmd_move_container(struct sway_container *current,
|
|||
// TODO: Ideally we would arrange the surviving parent after reaping,
|
||||
// but container_reap_empty does not return it, so we arrange the
|
||||
// workspace instead.
|
||||
struct sway_transaction *txn = transaction_create();
|
||||
arrange_windows(old_ws, txn);
|
||||
arrange_windows(destination->parent, txn);
|
||||
transaction_commit(txn);
|
||||
arrange_windows(old_ws);
|
||||
arrange_windows(destination->parent);
|
||||
|
||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||
} else if (strcasecmp(argv[1], "to") == 0
|
||||
|
|
@ -144,10 +141,8 @@ static struct cmd_results *cmd_move_container(struct sway_container *current,
|
|||
// TODO: Ideally we would arrange the surviving parent after reaping,
|
||||
// but container_reap_empty does not return it, so we arrange the
|
||||
// workspace instead.
|
||||
struct sway_transaction *txn = transaction_create();
|
||||
arrange_windows(old_ws, txn);
|
||||
arrange_windows(focus->parent, txn);
|
||||
transaction_commit(txn);
|
||||
arrange_windows(old_ws);
|
||||
arrange_windows(focus->parent);
|
||||
|
||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||
}
|
||||
|
|
@ -177,10 +172,8 @@ static struct cmd_results *cmd_move_workspace(struct sway_container *current,
|
|||
}
|
||||
container_move_to(current, destination);
|
||||
|
||||
struct sway_transaction *txn = transaction_create();
|
||||
arrange_windows(source, txn);
|
||||
arrange_windows(destination, txn);
|
||||
transaction_commit(txn);
|
||||
arrange_windows(source);
|
||||
arrange_windows(destination);
|
||||
|
||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||
}
|
||||
|
|
@ -238,12 +231,10 @@ static struct cmd_results *move_in_direction(struct sway_container *container,
|
|||
container_move(container, direction, move_amt);
|
||||
struct sway_container *new_ws = container_parent(container, C_WORKSPACE);
|
||||
|
||||
struct sway_transaction *txn = transaction_create();
|
||||
arrange_windows(old_ws, txn);
|
||||
arrange_windows(old_ws);
|
||||
if (new_ws != old_ws) {
|
||||
arrange_windows(new_ws, txn);
|
||||
arrange_windows(new_ws);
|
||||
}
|
||||
transaction_commit(txn);
|
||||
|
||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,6 @@ struct cmd_results *cmd_reload(int argc, char **argv) {
|
|||
}
|
||||
|
||||
load_swaybars();
|
||||
arrange_and_commit(&root_container);
|
||||
arrange_windows(&root_container);
|
||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@ static void resize_tiled(int amount, enum resize_axis axis) {
|
|||
}
|
||||
}
|
||||
|
||||
arrange_and_commit(parent->parent);
|
||||
arrange_windows(parent->parent);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -338,7 +338,7 @@ static struct cmd_results *resize_adjust_floating(enum resize_axis axis,
|
|||
view->height += grow_height;
|
||||
}
|
||||
|
||||
arrange_and_commit(con);
|
||||
arrange_windows(con);
|
||||
|
||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||
}
|
||||
|
|
@ -410,7 +410,7 @@ static struct cmd_results *resize_set_floating(struct sway_container *con,
|
|||
view->height += grow_height;
|
||||
}
|
||||
|
||||
arrange_and_commit(con);
|
||||
arrange_windows(con);
|
||||
|
||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ struct cmd_results *cmd_smart_gaps(int argc, char **argv) {
|
|||
"Expected 'smart_gaps <on|off>' ");
|
||||
}
|
||||
|
||||
arrange_and_commit(&root_container);
|
||||
arrange_windows(&root_container);
|
||||
|
||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ static struct cmd_results *do_split(int layout) {
|
|||
}
|
||||
struct sway_container *parent = container_split(con, layout);
|
||||
container_create_notify(parent);
|
||||
arrange_and_commit(parent->parent);
|
||||
arrange_windows(parent->parent);
|
||||
|
||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
#include <strings.h>
|
||||
#include <wlr/util/log.h>
|
||||
#include "sway/commands.h"
|
||||
#include "sway/desktop/transaction.h"
|
||||
#include "sway/tree/arrange.h"
|
||||
#include "sway/tree/layout.h"
|
||||
#include "sway/tree/view.h"
|
||||
|
|
@ -79,14 +78,10 @@ struct cmd_results *cmd_swap(int argc, char **argv) {
|
|||
|
||||
container_swap(current, other);
|
||||
|
||||
struct sway_transaction *txn = transaction_create();
|
||||
arrange_windows(current->parent, txn);
|
||||
|
||||
arrange_windows(current->parent);
|
||||
if (other->parent != current->parent) {
|
||||
arrange_windows(other->parent, txn);
|
||||
arrange_windows(other->parent);
|
||||
}
|
||||
|
||||
transaction_commit(txn);
|
||||
|
||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue