From 64aad5b332882286730ae354e4492b4579227092 Mon Sep 17 00:00:00 2001 From: Charlotte Meyer Date: Sat, 14 Aug 2021 20:06:00 +0000 Subject: [PATCH] Damage on move and resize --- include/desktop/view.h | 1 + kiwmi/desktop/view.c | 17 +++++++++++++++++ kiwmi/luak/kiwmi_view.c | 6 ++++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/include/desktop/view.h b/include/desktop/view.h index 832c146..1ba8510 100644 --- a/include/desktop/view.h +++ b/include/desktop/view.h @@ -104,6 +104,7 @@ const char *view_get_app_id(struct kiwmi_view *view); const char *view_get_title(struct kiwmi_view *view); void view_set_activated(struct kiwmi_view *view, bool activated); void view_set_size(struct kiwmi_view *view, uint32_t width, uint32_t height); +void view_set_pos(struct kiwmi_view *view, uint32_t x, uint32_t y); void view_set_tiled(struct kiwmi_view *view, enum wlr_edges edges); struct wlr_surface *view_surface_at( struct kiwmi_view *view, diff --git a/kiwmi/desktop/view.c b/kiwmi/desktop/view.c index c7bd019..3d5d7f3 100644 --- a/kiwmi/desktop/view.c +++ b/kiwmi/desktop/view.c @@ -85,6 +85,23 @@ view_set_size(struct kiwmi_view *view, uint32_t width, uint32_t height) { if (view->impl->set_size) { view->impl->set_size(view, width, height); + + struct kiwmi_output *output; + wl_list_for_each (output, &view->desktop->outputs, link) { + output->damaged = true; + } + } +} + +void +view_set_pos(struct kiwmi_view *view, uint32_t x, uint32_t y) +{ + view->x = x; + view->y = y; + + struct kiwmi_output *output; + wl_list_for_each (output, &view->desktop->outputs, link) { + output->damaged = true; } } diff --git a/kiwmi/luak/kiwmi_view.c b/kiwmi/luak/kiwmi_view.c index 9a2fe0f..931f755 100644 --- a/kiwmi/luak/kiwmi_view.c +++ b/kiwmi/luak/kiwmi_view.c @@ -239,8 +239,10 @@ l_kiwmi_view_move(lua_State *L) luaL_checktype(L, 2, LUA_TNUMBER); luaL_checktype(L, 3, LUA_TNUMBER); - view->x = lua_tonumber(L, 2); - view->y = lua_tonumber(L, 3); + uint32_t x = lua_tonumber(L, 2); + uint32_t y = lua_tonumber(L, 3); + + view_set_pos(view, x, y); return 0; }