summaryrefslogtreecommitdiffstats
path: root/sway/tree
diff options
context:
space:
mode:
Diffstat (limited to 'sway/tree')
-rw-r--r--sway/tree/container.c4
-rw-r--r--sway/tree/view.c23
2 files changed, 17 insertions, 10 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c
index d8ad3bc0..1cf5c8e7 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -169,8 +169,8 @@ static struct sway_container *surface_at_view(struct sway_container *con, double
169 return NULL; 169 return NULL;
170 } 170 }
171 struct sway_view *view = con->view; 171 struct sway_view *view = con->view;
172 double view_sx = lx - con->content_x + view->geometry.x; 172 double view_sx = lx - con->surface_x + view->geometry.x;
173 double view_sy = ly - con->content_y + view->geometry.y; 173 double view_sy = ly - con->surface_y + view->geometry.y;
174 174
175 double _sx, _sy; 175 double _sx, _sy;
176 struct wlr_surface *_surface = NULL; 176 struct wlr_surface *_surface = NULL;
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;