From 1e2d589b145fe63761c62a1f8c6830a839b60075 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Fri, 17 Jan 2020 22:06:14 +0000 Subject: [PATCH] csd - fix size hint handling and sizing to not be broken gtk and efl can use csd. we kind of were copying gtk's but we got it wrong... in efl. and in etoo as a result. this fixes it to use min/bas/max size as covering the whole window including the insets. @fix --- src/bin/e_client.c | 26 ++++++++++++++++++++------ src/bin/e_moveresize.c | 23 +++++++++++++---------- 2 files changed, 33 insertions(+), 16 deletions(-) diff --git a/src/bin/e_client.c b/src/bin/e_client.c index 2b2bcf696..cb21b9782 100644 --- a/src/bin/e_client.c +++ b/src/bin/e_client.c @@ -5381,17 +5381,24 @@ e_client_signal_resize_end(E_Client *ec, const char *dir EINA_UNUSED, const char E_API void e_client_resize_limit(const E_Client *ec, int *w, int *h) { - int dw, dh; + int l = 0, r = 0, t = 0, b = 0; + int dw = 0, dh = 0; E_OBJECT_CHECK(ec); E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE); - if (ec->frame) + e_comp_object_frame_geometry_get(ec->frame, &l, &r, &t, &b); + if ((ec->frame) && e_comp_object_frame_allowed(ec->frame)) { e_comp_object_frame_wh_unadjust(ec->frame, ec->w, ec->h, &dw, &dh); e_comp_object_frame_wh_unadjust(ec->frame, *w, *h, w, h); } else - dw = ec->w, dh = ec->h; + { + *w -= l + r; + *h -= t + b; + dw = ec->w; + dh = ec->h; + } dw = abs(*w - dw); dh = abs(*h - dh); if (*h < 1) *h = 1; @@ -5504,9 +5511,16 @@ e_client_resize_limit(const E_Client *ec, int *w, int *h) if (*h < 1) *h = 1; if (*w < 1) *w = 1; - - if (ec->frame) - e_comp_object_frame_wh_adjust(ec->frame, *w, *h, w, h); + if ((ec->frame) && e_comp_object_frame_allowed(ec->frame)) + { + if (ec->frame) + e_comp_object_frame_wh_adjust(ec->frame, *w, *h, w, h); + } + else + { + *w += l + r; + *h += t + b; + } } //////////////////////////////////////////// diff --git a/src/bin/e_moveresize.c b/src/bin/e_moveresize.c index 9b9ce8e4c..06d7e6216 100644 --- a/src/bin/e_moveresize.c +++ b/src/bin/e_moveresize.c @@ -56,24 +56,27 @@ e_moveresize_replace(Eina_Bool enable) E_API void e_moveresize_client_extents(const E_Client *ec, int *w, int *h) { + int l, r, t, b, bw, bh; + + e_comp_object_frame_geometry_get(ec->frame, &l, &r, &t, &b); + bw = ec->icccm.base_w; + bh = ec->icccm.base_h; if (e_comp_object_frame_allowed(ec->frame)) *w = ec->client.w, *h = ec->client.h; else - *w = ec->w, *h = ec->h; - if ((ec->icccm.base_w >= 0) && - (ec->icccm.base_h >= 0)) { - if (ec->icccm.step_w > 0) - *w = (*w - ec->icccm.base_w) / ec->icccm.step_w; - if (ec->icccm.step_h > 0) - *h = (*h - ec->icccm.base_h) / ec->icccm.step_h; + *w = ec->w; + *h = ec->h; + bw -= -l + -r; + bh -= -t + -b; } - else + if ((bw >= 0) && + (bh >= 0)) { if (ec->icccm.step_w > 0) - *w = (*w - ec->icccm.min_w) / ec->icccm.step_w; + *w = (*w - bw) / ec->icccm.step_w; if (ec->icccm.step_h > 0) - *h = (*h - ec->icccm.min_h) / ec->icccm.step_h; + *h = (*h - bh) / ec->icccm.step_h; } }