aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/xdg_shell.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-07-14 23:14:55 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-07-14 23:14:55 +1000
commit2032f85d94f2f222282b242116b3e827dd458f6c (patch)
treed6ad82f79521cdd948985be22630b803af58afea /sway/desktop/xdg_shell.c
parentMerge pull request #2244 from RyanDwyer/floating-resize (diff)
downloadsway-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/xdg_shell.c')
-rw-r--r--sway/desktop/xdg_shell.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c
index fbeeb2e3..98c16faf 100644
--- a/sway/desktop/xdg_shell.c
+++ b/sway/desktop/xdg_shell.c
@@ -244,7 +244,8 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data)
244 view_set_fullscreen(view, e->fullscreen); 244 view_set_fullscreen(view, e->fullscreen);
245 245
246 struct sway_container *output = container_parent(view->swayc, C_OUTPUT); 246 struct sway_container *output = container_parent(view->swayc, C_OUTPUT);
247 arrange_and_commit(output); 247 arrange_windows(output);
248 transaction_commit_dirty();
248} 249}
249 250
250static void handle_unmap(struct wl_listener *listener, void *data) { 251static void handle_unmap(struct wl_listener *listener, void *data) {
@@ -281,10 +282,11 @@ static void handle_map(struct wl_listener *listener, void *data) {
281 if (xdg_surface->toplevel->client_pending.fullscreen) { 282 if (xdg_surface->toplevel->client_pending.fullscreen) {
282 view_set_fullscreen(view, true); 283 view_set_fullscreen(view, true);
283 struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE); 284 struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE);
284 arrange_and_commit(ws); 285 arrange_windows(ws);
285 } else { 286 } else {
286 arrange_and_commit(view->swayc->parent); 287 arrange_windows(view->swayc->parent);
287 } 288 }
289 transaction_commit_dirty();
288 290
289 xdg_shell_view->commit.notify = handle_commit; 291 xdg_shell_view->commit.notify = handle_commit;
290 wl_signal_add(&xdg_surface->surface->events.commit, 292 wl_signal_add(&xdg_surface->surface->events.commit,