From 83952c52019ceee95e9293398bdc5f723db773eb Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Tue, 1 May 2018 19:59:36 +1000 Subject: [PATCH] Restore view_update_position() --- include/sway/tree/view.h | 2 ++ sway/tree/view.c | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index 4395e94a..21127ab1 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h @@ -197,6 +197,8 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface); void view_unmap(struct sway_view *view); +void view_update_position(struct sway_view *view, double ox, double oy); + void view_update_size(struct sway_view *view, int width, int height); void view_child_init(struct sway_view_child *child, diff --git a/sway/tree/view.c b/sway/tree/view.c index 4903b3a4..05a9b277 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -353,6 +353,19 @@ void view_unmap(struct sway_view *view) { } } +void view_update_position(struct sway_view *view, double ox, double oy) { + if (view->swayc->x == ox && view->swayc->y == oy) { + return; + } + + // TODO: Only allow this if the view is floating (this function will only be + // called in response to wayland clients wanting to reposition themselves). + view_damage(view, true); + view->swayc->x = ox; + view->swayc->y = oy; + view_damage(view, true); +} + void view_update_size(struct sway_view *view, int width, int height) { if (view->width == width && view->height == height) { return;