diff options
Diffstat (limited to 'sway/tree')
-rw-r--r-- | sway/tree/view.c | 39 |
1 files changed, 15 insertions, 24 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c index 1ee00f8d..ccb03088 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -901,30 +901,19 @@ void view_center_surface(struct sway_view *view) { | |||
901 | 901 | ||
902 | static const struct sway_view_child_impl subsurface_impl; | 902 | static const struct sway_view_child_impl subsurface_impl; |
903 | 903 | ||
904 | static void subsurface_get_root_coords(struct sway_view_child *child, | 904 | static void subsurface_get_view_coords(struct sway_view_child *child, |
905 | int *root_sx, int *root_sy) { | 905 | int *sx, int *sy) { |
906 | struct wlr_surface *surface = child->surface; | 906 | struct wlr_surface *surface = child->surface; |
907 | *root_sx = -child->view->geometry.x; | ||
908 | *root_sy = -child->view->geometry.y; | ||
909 | |||
910 | if (child->parent && child->parent->impl && | 907 | if (child->parent && child->parent->impl && |
911 | child->parent->impl->get_root_coords) { | 908 | child->parent->impl->get_view_coords) { |
912 | int sx, sy; | 909 | child->parent->impl->get_view_coords(child->parent, sx, sy); |
913 | child->parent->impl->get_root_coords(child->parent, &sx, &sy); | ||
914 | *root_sx += sx; | ||
915 | *root_sy += sy; | ||
916 | } else { | 910 | } else { |
917 | while (surface && wlr_surface_is_subsurface(surface)) { | 911 | *sx = *sy = 0; |
918 | struct wlr_subsurface *subsurface = | ||
919 | wlr_subsurface_from_wlr_surface(surface); | ||
920 | if (subsurface == NULL) { | ||
921 | break; | ||
922 | } | ||
923 | *root_sx += subsurface->current.x; | ||
924 | *root_sy += subsurface->current.y; | ||
925 | surface = subsurface->parent; | ||
926 | } | ||
927 | } | 912 | } |
913 | struct wlr_subsurface *subsurface = | ||
914 | wlr_subsurface_from_wlr_surface(surface); | ||
915 | *sx += subsurface->current.x; | ||
916 | *sy += subsurface->current.y; | ||
928 | } | 917 | } |
929 | 918 | ||
930 | static void subsurface_destroy(struct sway_view_child *child) { | 919 | static void subsurface_destroy(struct sway_view_child *child) { |
@@ -938,7 +927,7 @@ static void subsurface_destroy(struct sway_view_child *child) { | |||
938 | } | 927 | } |
939 | 928 | ||
940 | static const struct sway_view_child_impl subsurface_impl = { | 929 | static const struct sway_view_child_impl subsurface_impl = { |
941 | .get_root_coords = subsurface_get_root_coords, | 930 | .get_view_coords = subsurface_get_view_coords, |
942 | .destroy = subsurface_destroy, | 931 | .destroy = subsurface_destroy, |
943 | }; | 932 | }; |
944 | 933 | ||
@@ -1007,10 +996,12 @@ static void view_child_damage(struct sway_view_child *child, bool whole) { | |||
1007 | return; | 996 | return; |
1008 | } | 997 | } |
1009 | int sx, sy; | 998 | int sx, sy; |
1010 | child->impl->get_root_coords(child, &sx, &sy); | 999 | child->impl->get_view_coords(child, &sx, &sy); |
1011 | desktop_damage_surface(child->surface, | 1000 | desktop_damage_surface(child->surface, |
1012 | child->view->container->pending.content_x + sx, | 1001 | child->view->container->pending.content_x - |
1013 | child->view->container->pending.content_y + sy, whole); | 1002 | child->view->geometry.x + sx, |
1003 | child->view->container->pending.content_y - | ||
1004 | child->view->geometry.y + sy, whole); | ||
1014 | } | 1005 | } |
1015 | 1006 | ||
1016 | static void view_child_handle_surface_commit(struct wl_listener *listener, | 1007 | static void view_child_handle_surface_commit(struct wl_listener *listener, |