diff options
author | Kenny Levinsen <kl@kl.wtf> | 2021-02-08 01:05:51 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-02-09 09:37:10 +0100 |
commit | 90fa6953ea84477c09cb57fd60ded2bb0e33414d (patch) | |
tree | 06be6b3e9f89033bbef9d3ef3092eae739e538ef /sway/tree | |
parent | transaction: Move centering to view_center_surface (diff) | |
download | sway-90fa6953ea84477c09cb57fd60ded2bb0e33414d.tar.gz sway-90fa6953ea84477c09cb57fd60ded2bb0e33414d.tar.zst sway-90fa6953ea84477c09cb57fd60ded2bb0e33414d.zip |
shells: Only center tiled views on size change
The size of a tiled container cannot change in response to new buffer
sizes, so there is no need to commit a new transaction. Instead, simply
recenter the view with the new geometry, leaving the full transaction
flow for floating containers.
Diffstat (limited to 'sway/tree')
-rw-r--r-- | sway/tree/view.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c index f4ae8171..38417874 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -874,17 +874,9 @@ void view_unmap(struct sway_view *view) { | |||
874 | 874 | ||
875 | void view_update_size(struct sway_view *view, int width, int height) { | 875 | void view_update_size(struct sway_view *view, int width, int height) { |
876 | struct sway_container *con = view->container; | 876 | struct sway_container *con = view->container; |
877 | 877 | con->content_width = width; | |
878 | if (container_is_floating(con)) { | 878 | con->content_height = height; |
879 | con->content_width = width; | 879 | container_set_geometry_from_content(con); |
880 | con->content_height = height; | ||
881 | container_set_geometry_from_content(con); | ||
882 | } else { | ||
883 | con->surface_x = con->content_x + (con->content_width - width) / 2; | ||
884 | con->surface_y = con->content_y + (con->content_height - height) / 2; | ||
885 | con->surface_x = fmax(con->surface_x, con->content_x); | ||
886 | con->surface_y = fmax(con->surface_y, con->content_y); | ||
887 | } | ||
888 | } | 880 | } |
889 | 881 | ||
890 | void view_center_surface(struct sway_view *view) { | 882 | void view_center_surface(struct sway_view *view) { |