diff options
-rw-r--r-- | sway/tree/view.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c index 50d25c4f..ae73a687 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -630,6 +630,25 @@ void view_update_size(struct sway_view *view, int width, int height) { | |||
630 | container_set_geometry_from_floating_view(view->container); | 630 | container_set_geometry_from_floating_view(view->container); |
631 | } | 631 | } |
632 | 632 | ||
633 | static void subsurface_get_root_coords(struct sway_view_child *child, | ||
634 | int *root_sx, int *root_sy) { | ||
635 | struct wlr_surface *surface = child->surface; | ||
636 | *root_sx = -child->view->geometry.x; | ||
637 | *root_sy = -child->view->geometry.y; | ||
638 | |||
639 | while (surface && wlr_surface_is_subsurface(surface)) { | ||
640 | struct wlr_subsurface *subsurface = | ||
641 | wlr_subsurface_from_wlr_surface(surface); | ||
642 | *root_sx += subsurface->current.x; | ||
643 | *root_sy += subsurface->current.y; | ||
644 | surface = subsurface->parent; | ||
645 | } | ||
646 | } | ||
647 | |||
648 | static const struct sway_view_child_impl subsurface_impl = { | ||
649 | .get_root_coords = subsurface_get_root_coords, | ||
650 | }; | ||
651 | |||
633 | static void view_subsurface_create(struct sway_view *view, | 652 | static void view_subsurface_create(struct sway_view *view, |
634 | struct wlr_subsurface *subsurface) { | 653 | struct wlr_subsurface *subsurface) { |
635 | struct sway_view_child *child = calloc(1, sizeof(struct sway_view_child)); | 654 | struct sway_view_child *child = calloc(1, sizeof(struct sway_view_child)); |
@@ -637,7 +656,7 @@ static void view_subsurface_create(struct sway_view *view, | |||
637 | wlr_log(WLR_ERROR, "Allocation failed"); | 656 | wlr_log(WLR_ERROR, "Allocation failed"); |
638 | return; | 657 | return; |
639 | } | 658 | } |
640 | view_child_init(child, NULL, view, subsurface->surface); | 659 | view_child_init(child, &subsurface_impl, view, subsurface->surface); |
641 | } | 660 | } |
642 | 661 | ||
643 | static void view_child_damage(struct sway_view_child *child, bool whole) { | 662 | static void view_child_damage(struct sway_view_child *child, bool whole) { |