diff options
author | Kenny Levinsen <kl@kl.wtf> | 2021-02-08 02:03:01 +0100 |
---|---|---|
committer | Tudor Brindus <me@tbrindus.ca> | 2021-02-14 13:19:08 -0500 |
commit | b5b628cb41a4a316456d5ef3014f1a2cbdc5cfc2 (patch) | |
tree | f2dca5621c62d4fea0546c8b9eee99a3cc6dfd6c /sway/input/seatop_resize_floating.c | |
parent | readme: update French translation (diff) | |
download | sway-b5b628cb41a4a316456d5ef3014f1a2cbdc5cfc2.tar.gz sway-b5b628cb41a4a316456d5ef3014f1a2cbdc5cfc2.tar.zst sway-b5b628cb41a4a316456d5ef3014f1a2cbdc5cfc2.zip |
input: Only commit transactions when necessary
There is no need to check for transactions at the end of every user
input, as the vast majority of input will not issue transactions. This
implementation can also hide where changes are made without an
appropriate transaction commit, as a future unrelated input would issue
the commit instead.
Instead, commit transactions in places where changes are made or are
likely to be made.
Diffstat (limited to 'sway/input/seatop_resize_floating.c')
-rw-r--r-- | sway/input/seatop_resize_floating.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sway/input/seatop_resize_floating.c b/sway/input/seatop_resize_floating.c index 5da22e47..78dfe29f 100644 --- a/sway/input/seatop_resize_floating.c +++ b/sway/input/seatop_resize_floating.c | |||
@@ -2,6 +2,7 @@ | |||
2 | #include <limits.h> | 2 | #include <limits.h> |
3 | #include <wlr/types/wlr_cursor.h> | 3 | #include <wlr/types/wlr_cursor.h> |
4 | #include <wlr/types/wlr_xcursor_manager.h> | 4 | #include <wlr/types/wlr_xcursor_manager.h> |
5 | #include "sway/desktop/transaction.h" | ||
5 | #include "sway/input/cursor.h" | 6 | #include "sway/input/cursor.h" |
6 | #include "sway/input/seat.h" | 7 | #include "sway/input/seat.h" |
7 | #include "sway/tree/arrange.h" | 8 | #include "sway/tree/arrange.h" |
@@ -27,6 +28,7 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec, | |||
27 | if (seat->cursor->pressed_button_count == 0) { | 28 | if (seat->cursor->pressed_button_count == 0) { |
28 | container_set_resizing(con, false); | 29 | container_set_resizing(con, false); |
29 | arrange_container(con); // Send configure w/o resizing hint | 30 | arrange_container(con); // Send configure w/o resizing hint |
31 | transaction_commit_dirty(); | ||
30 | seatop_begin_default(seat); | 32 | seatop_begin_default(seat); |
31 | } | 33 | } |
32 | } | 34 | } |
@@ -133,6 +135,7 @@ static void handle_pointer_motion(struct sway_seat *seat, uint32_t time_msec) { | |||
133 | con->content_height += relative_grow_height; | 135 | con->content_height += relative_grow_height; |
134 | 136 | ||
135 | arrange_container(con); | 137 | arrange_container(con); |
138 | transaction_commit_dirty(); | ||
136 | } | 139 | } |
137 | 140 | ||
138 | static void handle_unref(struct sway_seat *seat, struct sway_container *con) { | 141 | static void handle_unref(struct sway_seat *seat, struct sway_container *con) { |
@@ -176,6 +179,7 @@ void seatop_begin_resize_floating(struct sway_seat *seat, | |||
176 | 179 | ||
177 | container_set_resizing(con, true); | 180 | container_set_resizing(con, true); |
178 | container_raise_floating(con); | 181 | container_raise_floating(con); |
182 | transaction_commit_dirty(); | ||
179 | 183 | ||
180 | const char *image = edge == WLR_EDGE_NONE ? | 184 | const char *image = edge == WLR_EDGE_NONE ? |
181 | "se-resize" : wlr_xcursor_get_resize_name(edge); | 185 | "se-resize" : wlr_xcursor_get_resize_name(edge); |