diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-07-14 23:14:55 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-07-14 23:14:55 +1000 |
commit | 2032f85d94f2f222282b242116b3e827dd458f6c (patch) | |
tree | d6ad82f79521cdd948985be22630b803af58afea /sway/desktop/xwayland.c | |
parent | Merge pull request #2244 from RyanDwyer/floating-resize (diff) | |
download | sway-2032f85d94f2f222282b242116b3e827dd458f6c.tar.gz sway-2032f85d94f2f222282b242116b3e827dd458f6c.tar.zst sway-2032f85d94f2f222282b242116b3e827dd458f6c.zip |
Simplify transactions by utilising a dirty flag on containers
This PR changes the way we handle transactions to a more simple method.
The new method is to mark containers as dirty from low level code
(eg. arranging, or container_destroy, and eventually seat_set_focus),
then call transaction_commit_dirty which picks up those containers and
runs them through a transaction. The old methods of using transactions
(arrange_and_commit, or creating one manually) are now no longer
possible.
The highest-level code (execute_command and view implementation
handlers) will call transaction_commit_dirty, so most other code just
needs to set containers as dirty. This is done by arranging, but can
also be done by calling container_set_dirty.
Diffstat (limited to 'sway/desktop/xwayland.c')
-rw-r--r-- | sway/desktop/xwayland.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index 460d1cc8..11516673 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c | |||
@@ -333,10 +333,11 @@ static void handle_map(struct wl_listener *listener, void *data) { | |||
333 | if (xsurface->fullscreen) { | 333 | if (xsurface->fullscreen) { |
334 | view_set_fullscreen(view, true); | 334 | view_set_fullscreen(view, true); |
335 | struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE); | 335 | struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE); |
336 | arrange_and_commit(ws); | 336 | arrange_windows(ws); |
337 | } else { | 337 | } else { |
338 | arrange_and_commit(view->swayc->parent); | 338 | arrange_windows(view->swayc->parent); |
339 | } | 339 | } |
340 | transaction_commit_dirty(); | ||
340 | } | 341 | } |
341 | 342 | ||
342 | static void handle_destroy(struct wl_listener *listener, void *data) { | 343 | static void handle_destroy(struct wl_listener *listener, void *data) { |
@@ -392,7 +393,8 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data) | |||
392 | view_set_fullscreen(view, xsurface->fullscreen); | 393 | view_set_fullscreen(view, xsurface->fullscreen); |
393 | 394 | ||
394 | struct sway_container *output = container_parent(view->swayc, C_OUTPUT); | 395 | struct sway_container *output = container_parent(view->swayc, C_OUTPUT); |
395 | arrange_and_commit(output); | 396 | arrange_windows(output); |
397 | transaction_commit_dirty(); | ||
396 | } | 398 | } |
397 | 399 | ||
398 | static void handle_set_title(struct wl_listener *listener, void *data) { | 400 | static void handle_set_title(struct wl_listener *listener, void *data) { |