diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-08-18 15:10:06 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-08-18 15:10:06 +1000 |
commit | b0a5f3a25f52bc1d48d771cb02820042006d8d9e (patch) | |
tree | e7a2e4c60e562589e3b9a54c6ce559a41dcf7534 /sway/tree/view.c | |
parent | 4e755c4b123e1dd8478be63ff6b48d2d1ceaa04b (diff) |
Store geometry in the view and handle any floating view resizing
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r-- | sway/tree/view.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c index fba0b52d..fbe4bc58 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -162,20 +162,6 @@ void view_get_constraints(struct sway_view *view, double *min_width, } } -void view_get_geometry(struct sway_view *view, struct wlr_box *box) { - if (view->surface == NULL) { - box->x = box->y = box->width = box->height = 0; - return; - } - if (view->impl->get_geometry) { - view->impl->get_geometry(view, box); - return; - } - box->x = box->y = 0; - box->width = view->surface->current.width; - box->height = view->surface->current.height; -} - uint32_t view_configure(struct sway_view *view, double lx, double ly, int width, int height) { if (view->impl->configure) { @@ -629,6 +615,18 @@ void view_unmap(struct sway_view *view) { view->surface = NULL; } +void view_update_size(struct sway_view *view, int width, int height) { + if (!sway_assert(container_is_floating(view->swayc), + "Expected a floating container")) { + return; + } + view->width = width; + view->height = height; + view->swayc->current.view_width = width; + view->swayc->current.view_height = height; + container_set_geometry_from_floating_view(view->swayc); +} + static void view_subsurface_create(struct sway_view *view, struct wlr_subsurface *subsurface) { struct sway_view_child *child = calloc(1, sizeof(struct sway_view_child)); |