diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-05-01 19:59:36 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-05-01 19:59:36 +1000 |
commit | 6ef14e99eec0d741104be3a1483b7e92de870c96 (patch) | |
tree | c4f26a5c400faaa30006d1b226d534486828442c | |
parent | Allow clicking view decorations to focus view (diff) | |
download | sway-6ef14e99eec0d741104be3a1483b7e92de870c96.tar.gz sway-6ef14e99eec0d741104be3a1483b7e92de870c96.tar.zst sway-6ef14e99eec0d741104be3a1483b7e92de870c96.zip |
Restore view_update_position()
-rw-r--r-- | include/sway/tree/view.h | 2 | ||||
-rw-r--r-- | sway/tree/view.c | 13 |
2 files changed, 15 insertions, 0 deletions
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); | |||
197 | 197 | ||
198 | void view_unmap(struct sway_view *view); | 198 | void view_unmap(struct sway_view *view); |
199 | 199 | ||
200 | void view_update_position(struct sway_view *view, double ox, double oy); | ||
201 | |||
200 | void view_update_size(struct sway_view *view, int width, int height); | 202 | void view_update_size(struct sway_view *view, int width, int height); |
201 | 203 | ||
202 | void view_child_init(struct sway_view_child *child, | 204 | void view_child_init(struct sway_view_child *child, |
diff --git a/sway/tree/view.c b/sway/tree/view.c index 7d493af9..80949c89 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -349,6 +349,19 @@ void view_unmap(struct sway_view *view) { | |||
349 | arrange_children_of(parent); | 349 | arrange_children_of(parent); |
350 | } | 350 | } |
351 | 351 | ||
352 | void view_update_position(struct sway_view *view, double ox, double oy) { | ||
353 | if (view->swayc->x == ox && view->swayc->y == oy) { | ||
354 | return; | ||
355 | } | ||
356 | |||
357 | // TODO: Only allow this if the view is floating (this function will only be | ||
358 | // called in response to wayland clients wanting to reposition themselves). | ||
359 | view_damage(view, true); | ||
360 | view->swayc->x = ox; | ||
361 | view->swayc->y = oy; | ||
362 | view_damage(view, true); | ||
363 | } | ||
364 | |||
352 | void view_update_size(struct sway_view *view, int width, int height) { | 365 | void view_update_size(struct sway_view *view, int width, int height) { |
353 | if (view->width == width && view->height == height) { | 366 | if (view->width == width && view->height == height) { |
354 | return; | 367 | return; |