aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Iezzi <aiezzi@alessandroiezzi.it>2023-05-30 00:49:01 +0200
committerAlessandro Iezzi <aiezzi@alessandroiezzi.it>2023-05-30 00:49:01 +0200
commit80f959733fb7cc7e2e86a3e462496cc17e482bcf (patch)
treec96fec4ffaa3096998ffdeb3bda715928e4bc185
parente699edc5c53cf77dec04ceecc1ceb03cb1eb3920 (diff)
downloadcherry-80f959733fb7cc7e2e86a3e462496cc17e482bcf.tar.gz
cherry-80f959733fb7cc7e2e86a3e462496cc17e482bcf.zip
Update position and dimension only if the window
is drawn
-rw-r--r--src/window.c13
1 files changed, 12 insertions, 1 deletions
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