From e8001e6fbe827f6ae6842cf9f221edb322bb570e Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Tue, 26 Jun 2018 14:24:15 +1000 Subject: [PATCH] Damage output when views toggle fullscreen Also add workspace to the transaction when a view maps in fullscreen mode. --- sway/desktop/xdg_shell.c | 10 ++++++++-- sway/desktop/xdg_shell_v6.c | 10 ++++++++-- sway/desktop/xwayland.c | 12 ++++++++++-- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c index 105e77ae..484afd0c 100644 --- a/sway/desktop/xdg_shell.c +++ b/sway/desktop/xdg_shell.c @@ -221,8 +221,11 @@ static void handle_map(struct wl_listener *listener, void *data) { if (xdg_surface->toplevel->client_pending.fullscreen) { view_set_fullscreen(view, true); + struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE); + arrange_and_commit(ws); + } else { + arrange_and_commit(view->swayc->parent); } - arrange_and_commit(view->swayc->parent); xdg_shell_view->commit.notify = handle_commit; wl_signal_add(&xdg_surface->surface->events.commit, @@ -269,7 +272,10 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data) view_set_fullscreen(view, e->fullscreen); struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE); - arrange_and_commit(ws); + struct sway_transaction *transaction = transaction_create(); + arrange_windows(ws, transaction); + transaction_add_damage(transaction, container_get_box(ws->parent)); + transaction_commit(transaction); } void handle_xdg_shell_surface(struct wl_listener *listener, void *data) { diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c index 19b30604..da2eda7a 100644 --- a/sway/desktop/xdg_shell_v6.c +++ b/sway/desktop/xdg_shell_v6.c @@ -220,8 +220,11 @@ static void handle_map(struct wl_listener *listener, void *data) { if (xdg_surface->toplevel->client_pending.fullscreen) { view_set_fullscreen(view, true); + struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE); + arrange_and_commit(ws); + } else { + arrange_and_commit(view->swayc->parent); } - arrange_and_commit(view->swayc->parent); xdg_shell_v6_view->commit.notify = handle_commit; wl_signal_add(&xdg_surface->surface->events.commit, @@ -264,7 +267,10 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data) view_set_fullscreen(view, e->fullscreen); struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE); - arrange_and_commit(ws); + struct sway_transaction *transaction = transaction_create(); + arrange_windows(ws, transaction); + transaction_add_damage(transaction, container_get_box(ws->parent)); + transaction_commit(transaction); } void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index eea8420d..720ea2fd 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c @@ -286,8 +286,11 @@ static void handle_map(struct wl_listener *listener, void *data) { if (xsurface->fullscreen) { view_set_fullscreen(view, true); + struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE); + arrange_and_commit(ws); + } else { + arrange_and_commit(view->swayc->parent); } - arrange_and_commit(view->swayc->parent); } static void handle_destroy(struct wl_listener *listener, void *data) { @@ -337,7 +340,12 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data) return; } view_set_fullscreen(view, xsurface->fullscreen); - arrange_and_commit(view->swayc); + + struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE); + struct sway_transaction *transaction = transaction_create(); + arrange_windows(ws, transaction); + transaction_add_damage(transaction, container_get_box(ws->parent)); + transaction_commit(transaction); } static void handle_set_title(struct wl_listener *listener, void *data) {