diff options
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r-- | sway/tree/view.c | 44 |
1 files changed, 14 insertions, 30 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c index 950494d8..fba0b52d 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -162,6 +162,20 @@ void view_get_constraints(struct sway_view *view, double *min_width, | |||
162 | } | 162 | } |
163 | } | 163 | } |
164 | 164 | ||
165 | void view_get_geometry(struct sway_view *view, struct wlr_box *box) { | ||
166 | if (view->surface == NULL) { | ||
167 | box->x = box->y = box->width = box->height = 0; | ||
168 | return; | ||
169 | } | ||
170 | if (view->impl->get_geometry) { | ||
171 | view->impl->get_geometry(view, box); | ||
172 | return; | ||
173 | } | ||
174 | box->x = box->y = 0; | ||
175 | box->width = view->surface->current.width; | ||
176 | box->height = view->surface->current.height; | ||
177 | } | ||
178 | |||
165 | uint32_t view_configure(struct sway_view *view, double lx, double ly, int width, | 179 | uint32_t view_configure(struct sway_view *view, double lx, double ly, int width, |
166 | int height) { | 180 | int height) { |
167 | if (view->impl->configure) { | 181 | if (view->impl->configure) { |
@@ -615,36 +629,6 @@ void view_unmap(struct sway_view *view) { | |||
615 | view->surface = NULL; | 629 | view->surface = NULL; |
616 | } | 630 | } |
617 | 631 | ||
618 | void view_update_position(struct sway_view *view, double lx, double ly) { | ||
619 | if (view->x == lx && view->y == ly) { | ||
620 | return; | ||
621 | } | ||
622 | container_damage_whole(view->swayc); | ||
623 | view->x = lx; | ||
624 | view->y = ly; | ||
625 | view->swayc->current.view_x = lx; | ||
626 | view->swayc->current.view_y = ly; | ||
627 | if (container_is_floating(view->swayc)) { | ||
628 | container_set_geometry_from_floating_view(view->swayc); | ||
629 | } | ||
630 | container_damage_whole(view->swayc); | ||
631 | } | ||
632 | |||
633 | void view_update_size(struct sway_view *view, int width, int height) { | ||
634 | if (view->width == width && view->height == height) { | ||
635 | return; | ||
636 | } | ||
637 | container_damage_whole(view->swayc); | ||
638 | view->width = width; | ||
639 | view->height = height; | ||
640 | view->swayc->current.view_width = width; | ||
641 | view->swayc->current.view_height = height; | ||
642 | if (container_is_floating(view->swayc)) { | ||
643 | container_set_geometry_from_floating_view(view->swayc); | ||
644 | } | ||
645 | container_damage_whole(view->swayc); | ||
646 | } | ||
647 | |||
648 | static void view_subsurface_create(struct sway_view *view, | 632 | static void view_subsurface_create(struct sway_view *view, |
649 | struct wlr_subsurface *subsurface) { | 633 | struct wlr_subsurface *subsurface) { |
650 | struct sway_view_child *child = calloc(1, sizeof(struct sway_view_child)); | 634 | struct sway_view_child *child = calloc(1, sizeof(struct sway_view_child)); |