In tests we need to know about the decoration size. Moreover
it's a small clean-up.

Signed-off-by: Marek Chalupa <mchqwe...@gmail.com>
---
 clients/window.c | 37 ++++++++++++++++++++++---------------
 clients/window.h |  2 ++
 2 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/clients/window.c b/clients/window.c
index 8dbf878..7ac2b8f 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -2524,26 +2524,33 @@ window_frame_create(struct window *window, void *data)
 }
 
 void
-window_frame_set_child_size(struct widget *widget, int child_width,
-                           int child_height)
+window_get_decoration_size(struct window *window, int *width, int *height)
 {
-       struct display *display = widget->window->display;
+       struct display *display = window->display;
        struct theme *t = display->theme;
+       int margin;
+
+       if (window->maximized || window->fullscreen)
+               margin = 0;
+       else
+               margin = t->margin;
+
+       if (width)
+               *width = (t->width + margin) * 2;
+       if (height)
+               *height = t->width + t->titlebar_height + margin * 2;
+}
+
+void
+window_frame_set_child_size(struct widget *widget, int width, int height)
+{
        int decoration_width, decoration_height;
-       int width, height;
-       int margin = widget->window->maximized ? 0 : t->margin;
 
-       if (!widget->window->fullscreen) {
-               decoration_width = (t->width + margin) * 2;
-               decoration_height = t->width +
-                       t->titlebar_height + margin * 2;
+       window_get_decoration_size(widget->window, &decoration_width,
+                                  &decoration_height);
 
-               width = child_width + decoration_width;
-               height = child_height + decoration_height;
-       } else {
-               width = child_width;
-               height = child_height;
-       }
+       width += decoration_width;
+       height += decoration_height;
 
        window_schedule_resize(widget->window, width, height);
 }
diff --git a/clients/window.h b/clients/window.h
index 20d3fa0..a6675d0 100644
--- a/clients/window.h
+++ b/clients/window.h
@@ -349,6 +349,8 @@ void
 window_schedule_redraw(struct window *window);
 void
 window_schedule_resize(struct window *window, int width, int height);
+void
+window_get_decoration_size(struct window *window, int *height, int *width);
 
 void
 window_damage(struct window *window, int32_t x, int32_t y,
-- 
2.1.0

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to