From: Junseok Kim Date: Fri, 29 Apr 2022 07:39:02 +0000 (+0900) Subject: e_client: added resize aspect ratio X-Git-Tag: accepted/tizen/unified/20220525.210651~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F09%2F275209%2F1;p=platform%2Fupstream%2Fenlightenment.git e_client: added resize aspect ratio added values for resize aspect ratio and adjust to resize handle Change-Id: I88f218cb4ebb01c7b5c1d5f785560abcccea92cb Signed-off-by: Junseok Kim --- diff --git a/src/bin/e_client.c b/src/bin/e_client.c index 96716b4..e8f4768 100644 --- a/src/bin/e_client.c +++ b/src/bin/e_client.c @@ -1798,15 +1798,16 @@ _e_client_resize_handle(E_Client *ec) else h = ec->moveinfo.down.h + (ec->mouse.current.my - ec->moveinfo.down.my); } - tw = ec->w; th = ec->h; - if ((ec->resize_mode == E_POINTER_RESIZE_TL) || + if ((ec->resize_mode == E_POINTER_RESIZE_T) || + (ec->resize_mode == E_POINTER_RESIZE_TL) || (ec->resize_mode == E_POINTER_RESIZE_L) || (ec->resize_mode == E_POINTER_RESIZE_BL)) x += (tw - w); - if ((ec->resize_mode == E_POINTER_RESIZE_TL) || + if ((ec->resize_mode == E_POINTER_RESIZE_L) || + (ec->resize_mode == E_POINTER_RESIZE_TL) || (ec->resize_mode == E_POINTER_RESIZE_T) || (ec->resize_mode == E_POINTER_RESIZE_TR)) y += (th - h); @@ -1829,11 +1830,32 @@ _e_client_resize_handle(E_Client *ec) } } e_client_resize_limit(ec, &new_w, &new_h); - if ((ec->resize_mode == E_POINTER_RESIZE_TL) || + + if (ec->manage_resize.enable_aspect_ratio) + { + if ((ec->resize_mode == E_POINTER_RESIZE_TL) || + (ec->resize_mode == E_POINTER_RESIZE_L) || + (ec->resize_mode == E_POINTER_RESIZE_BL) || + (ec->resize_mode == E_POINTER_RESIZE_TR) || + (ec->resize_mode == E_POINTER_RESIZE_R) || + (ec->resize_mode == E_POINTER_RESIZE_BR)) + { + new_h = (int) ec->manage_resize.ah / ec->manage_resize.aw * new_w; + } + else if ((ec->resize_mode == E_POINTER_RESIZE_T) || + (ec->resize_mode == E_POINTER_RESIZE_B)) + { + new_w = (int) ec->manage_resize.aw / ec->manage_resize.ah * new_h; + } + } + + if ((ec->resize_mode == E_POINTER_RESIZE_T) || + (ec->resize_mode == E_POINTER_RESIZE_TL) || (ec->resize_mode == E_POINTER_RESIZE_L) || (ec->resize_mode == E_POINTER_RESIZE_BL)) new_x += (w - new_w); - if ((ec->resize_mode == E_POINTER_RESIZE_TL) || + if ((ec->resize_mode == E_POINTER_RESIZE_L) || + (ec->resize_mode == E_POINTER_RESIZE_TL) || (ec->resize_mode == E_POINTER_RESIZE_T) || (ec->resize_mode == E_POINTER_RESIZE_TR)) new_y += (h - new_h); @@ -4581,6 +4603,8 @@ e_client_new(E_Pixmap *cp, int first_map, int internal) ec->manage_resize.resize_obj = NULL; ec->manage_resize.x = ec->manage_resize.y = ec->manage_resize.w = ec->manage_resize.h = 0; + ec->manage_resize.enable_aspect_ratio = EINA_FALSE; + ec->manage_resize.aw = ec->manage_resize.ah = 0; return ec; } diff --git a/src/bin/e_client.h b/src/bin/e_client.h index ddf8a86..d576a7c 100644 --- a/src/bin/e_client.h +++ b/src/bin/e_client.h @@ -1029,7 +1029,9 @@ struct E_Client struct { int x, y, w, h; + Eina_Bool enable_aspect_ratio; Evas_Object *resize_obj; + float aw, ah; } manage_resize; };