summaryrefslogtreecommitdiffstats
path: root/sway/tree/view.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r--sway/tree/view.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 561c6ef1..9ccb2a31 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -673,15 +673,22 @@ void view_unmap(struct sway_view *view) {
673} 673}
674 674
675void view_update_size(struct sway_view *view, int width, int height) { 675void view_update_size(struct sway_view *view, int width, int height) {
676 if (!sway_assert(container_is_floating(view->container), 676 struct sway_container *con = view->container;
677 "Expected a floating container")) { 677
678 return; 678 if (container_is_floating(con)) {
679 con->content_width = width;
680 con->content_height = height;
681 con->current.content_width = width;
682 con->current.content_height = height;
683 container_set_geometry_from_content(con);
684 } else {
685 con->surface_x = con->content_x + (con->content_width - width) / 2;
686 con->surface_y = con->content_y + (con->content_height - height) / 2;
687 con->surface_x = fmax(con->surface_x, con->content_x);
688 con->surface_y = fmax(con->surface_y, con->content_y);
679 } 689 }
680 view->container->content_width = width; 690 con->surface_width = width;
681 view->container->content_height = height; 691 con->surface_width = height;
682 view->container->current.content_width = width;
683 view->container->current.content_height = height;
684 container_set_geometry_from_content(view->container);
685} 692}
686 693
687static const struct sway_view_child_impl subsurface_impl; 694static const struct sway_view_child_impl subsurface_impl;