From b5b628cb41a4a316456d5ef3014f1a2cbdc5cfc2 Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Mon, 8 Feb 2021 02:03:01 +0100 Subject: 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. --- sway/input/seatop_resize_tiling.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sway/input/seatop_resize_tiling.c') diff --git a/sway/input/seatop_resize_tiling.c b/sway/input/seatop_resize_tiling.c index 2cca805d..c5fe269e 100644 --- a/sway/input/seatop_resize_tiling.c +++ b/sway/input/seatop_resize_tiling.c @@ -2,6 +2,7 @@ #include #include #include "sway/commands.h" +#include "sway/desktop/transaction.h" #include "sway/input/cursor.h" #include "sway/input/seat.h" #include "sway/tree/arrange.h" @@ -67,6 +68,7 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec, arrange_workspace(e->v_con->workspace); } } + transaction_commit_dirty(); seatop_begin_default(seat); } } @@ -99,6 +101,7 @@ static void handle_pointer_motion(struct sway_seat *seat, uint32_t time_msec) { if (amount_y != 0) { container_resize_tiled(e->v_con, e->edge_y, amount_y); } + transaction_commit_dirty(); } static void handle_unref(struct sway_seat *seat, struct sway_container *con) { @@ -158,5 +161,6 @@ void seatop_begin_resize_tiling(struct sway_seat *seat, seat->seatop_impl = &seatop_impl; seat->seatop_data = e; + transaction_commit_dirty(); wlr_seat_pointer_notify_clear_focus(seat->wlr_seat); } -- cgit v1.2.3