From 80f959733fb7cc7e2e86a3e462496cc17e482bcf Mon Sep 17 00:00:00 2001 From: Alessandro Iezzi Date: Tue, 30 May 2023 00:49:01 +0200 Subject: Update position and dimension only if the window is drawn --- src/window.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/window.c b/src/window.c index 10f4766..c69b265 100644 --- a/src/window.c +++ b/src/window.c @@ -142,8 +142,10 @@ cherry_window_set_dimension(CherryWindow *window, int width, int height) CherryWidget *widget = (CherryWidget *) window; cherry_widget_set_dimension(widget, width, height); - if (cherry_widget_is_visible(widget)) { + if (widget->drawn) { int x, y; + cherry_widget_get_position(widget, &x, &y); + CherryApplication *app = cherry_application_get_running_app(); XMoveResizeWindow(app->display, window->window_handler, x, y, @@ -164,6 +166,15 @@ cherry_window_set_position(CherryWindow *window, int x, int y) CherryWidget *widget = (CherryWidget *) window; cherry_widget_set_position(widget, x, y); + if (widget->drawn) { + int width, height; + cherry_widget_get_dimension(widget, &width, &height); + + CherryApplication *app = cherry_application_get_running_app(); + XMoveResizeWindow(app->display, window->window_handler, + x, y, + width, height); + } } void -- cgit v1.2.3