From b3ea9e9e9de47eb9ee6e9087a6449cbf715df720 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 15 Oct 2013 12:43:51 +0100 Subject: [PATCH] feature: break out e_moveresize_client_extents for calculating client step sizes if using an external moveresize implementation, this function is very handy --- src/bin/e_moveresize.c | 61 +++++++++++++++++++++--------------------- src/bin/e_moveresize.h | 1 + 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/bin/e_moveresize.c b/src/bin/e_moveresize.c index a8dacece2..f7a0cc23e 100644 --- a/src/bin/e_moveresize.c +++ b/src/bin/e_moveresize.c @@ -3,7 +3,6 @@ static void _e_resize_begin(void *data, E_Client *ec); static void _e_resize_update(void *data, E_Client *ec); static void _e_resize_end(void *data, E_Client *ec); -static void _e_resize_client_extents(E_Client *ec, int *w, int *h); static void _e_move_begin(void *data, E_Client *ec); static void _e_move_update(void *data, E_Client *ec); static void _e_move_end(void *data, E_Client *ec); @@ -55,6 +54,34 @@ e_moveresize_replace(Eina_Bool enable) _e_moveresize_enabled = !enable; } +EAPI void +e_moveresize_client_extents(const E_Client *ec, int *w, int *h) +{ + if ((ec->icccm.base_w >= 0) && + (ec->icccm.base_h >= 0)) + { + if (ec->icccm.step_w > 0) + *w = (ec->client.w - ec->icccm.base_w) / ec->icccm.step_w; + else + *w = ec->client.w; + if (ec->icccm.step_h > 0) + *h = (ec->client.h - ec->icccm.base_h) / ec->icccm.step_h; + else + *h = ec->client.h; + } + else + { + if (ec->icccm.step_w > 0) + *w = (ec->client.w - ec->icccm.min_w) / ec->icccm.step_w; + else + *w = ec->client.w; + if (ec->icccm.step_h > 0) + *h = (ec->client.h - ec->icccm.min_h) / ec->icccm.step_h; + else + *h = ec->client.h; + } +} + static void _e_resize_begin(void *data __UNUSED__, E_Client *ec) { @@ -69,7 +96,7 @@ _e_resize_begin(void *data __UNUSED__, E_Client *ec) if ((!e_config->resize_info_visible) || (!_e_moveresize_enabled)) return; - _e_resize_client_extents(ec, &w, &h); + e_moveresize_client_extents(ec, &w, &h); _disp_content = o = edje_object_add(e_comp_get(ec)->evas); evas_object_name_set(o, "resizeinfo->_disp_content"); @@ -122,7 +149,7 @@ _e_resize_update(void *data __UNUSED__, E_Client *ec) if (e_config->resize_info_follows) e_comp_object_util_center_on(_disp_obj, ec->frame); - _e_resize_client_extents(ec, &w, &h); + e_moveresize_client_extents(ec, &w, &h); if (!visible) { @@ -133,34 +160,6 @@ _e_resize_update(void *data __UNUSED__, E_Client *ec) edje_object_part_text_set(_disp_content, "e.text.label", buf); } -static void -_e_resize_client_extents(E_Client *ec, int *w, int *h) -{ - if ((ec->icccm.base_w >= 0) && - (ec->icccm.base_h >= 0)) - { - if (ec->icccm.step_w > 0) - *w = (ec->client.w - ec->icccm.base_w) / ec->icccm.step_w; - else - *w = ec->client.w; - if (ec->icccm.step_h > 0) - *h = (ec->client.h - ec->icccm.base_h) / ec->icccm.step_h; - else - *h = ec->client.h; - } - else - { - if (ec->icccm.step_w > 0) - *w = (ec->client.w - ec->icccm.min_w) / ec->icccm.step_w; - else - *w = ec->client.w; - if (ec->icccm.step_h > 0) - *h = (ec->client.h - ec->icccm.min_h) / ec->icccm.step_h; - else - *h = ec->client.h; - } -} - static void _e_move_begin(void *data __UNUSED__, E_Client *ec) { diff --git a/src/bin/e_moveresize.h b/src/bin/e_moveresize.h index 0d9364943..11b47ae96 100644 --- a/src/bin/e_moveresize.h +++ b/src/bin/e_moveresize.h @@ -7,5 +7,6 @@ EINTERN int e_moveresize_init(void); EINTERN int e_moveresize_shutdown(void); EAPI void e_moveresize_replace(Eina_Bool enable); +EAPI void e_moveresize_client_extents(const E_Client *ec, int *w, int *h); #endif #endif