discomfitor pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=142829e819e82be0ab13c35423d0381409922d98

commit 142829e819e82be0ab13c35423d0381409922d98
Author: Wonguk Jeong <[email protected]>
Date:   Sun May 11 12:30:00 2014 -0400

    pager/pager16: fix wrong min values.
    
    Summary:
    currently, if we shrink pager gadget horizontally, the resize guide (blue 
rectangle) became smaller (16x16, pager16: 4x4) than real pager size.
    There was hard-coded min value.
    
    calculate min value base on aspect ratio for real.
    
    @fix
    
    Test Plan: pager -> begin move/resize -> make it small horizontally as much 
as possible -> check whether the guide is fit on real size.
    
    Reviewers: raster, zmike
    
    CC: seoz, cedric
    
    Differential Revision: https://phab.enlightenment.org/D793
---
 src/modules/pager/e_mod_main.c   | 25 ++++++++++++++++++-------
 src/modules/pager16/e_mod_main.c | 25 ++++++++++++++++++-------
 2 files changed, 36 insertions(+), 14 deletions(-)

diff --git a/src/modules/pager/e_mod_main.c b/src/modules/pager/e_mod_main.c
index 4bfe5a7..881ae11 100644
--- a/src/modules/pager/e_mod_main.c
+++ b/src/modules/pager/e_mod_main.c
@@ -246,17 +246,28 @@ static void
 _gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient __UNUSED__)
 {
    Instance *inst;
+   int aspect_w, aspect_h;
+   double aspect_ratio;
 
    inst = gcc->data;
    if (inst->pager->invert)
-     e_gadcon_client_aspect_set(gcc,
-                                inst->pager->ynum * inst->pager->zone->w,
-                                inst->pager->xnum * inst->pager->zone->h);
+     {
+        aspect_w = inst->pager->ynum * inst->pager->zone->w;
+        aspect_h = inst->pager->xnum * inst->pager->zone->h;
+     }
+   else
+     {
+        aspect_w = inst->pager->xnum * inst->pager->zone->w;
+        aspect_h = inst->pager->ynum * inst->pager->zone->h;
+     }
+
+   e_gadcon_client_aspect_set(gcc, aspect_w, aspect_h);
+   aspect_ratio = (double)aspect_w / (double)aspect_h;
+
+   if (aspect_ratio > 1.0)
+     e_gadcon_client_min_size_set(gcc, 16 * aspect_ratio, 16);
    else
-     e_gadcon_client_aspect_set(gcc,
-                                inst->pager->xnum * inst->pager->zone->w,
-                                inst->pager->ynum * inst->pager->zone->h);
-   e_gadcon_client_min_size_set(gcc, 16, 16);
+     e_gadcon_client_min_size_set(gcc, 16, 16 * aspect_ratio);
 }
 
 static const char *
diff --git a/src/modules/pager16/e_mod_main.c b/src/modules/pager16/e_mod_main.c
index 87b2770..32425ef 100644
--- a/src/modules/pager16/e_mod_main.c
+++ b/src/modules/pager16/e_mod_main.c
@@ -255,17 +255,28 @@ static void
 _gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient __UNUSED__)
 {
    Instance *inst;
+   int aspect_w, aspect_h;
+   double aspect_ratio;
 
    inst = gcc->data;
    if (inst->pager->invert)
-     e_gadcon_client_aspect_set(gcc,
-                                inst->pager->ynum * inst->pager->zone->w,
-                                inst->pager->xnum * inst->pager->zone->h);
+     {
+        aspect_w = inst->pager->ynum * inst->pager->zone->w;
+        aspect_h = inst->pager->xnum * inst->pager->zone->h;
+     }
+   else
+     {
+        aspect_w = inst->pager->xnum * inst->pager->zone->w;
+        aspect_h = inst->pager->ynum * inst->pager->zone->h;
+     }
+
+   e_gadcon_client_aspect_set(gcc, aspect_w, aspect_h);
+   aspect_ratio = (double)aspect_w / (double)aspect_h;
+
+   if (aspect_ratio > 1.0)
+     e_gadcon_client_min_size_set(gcc, 4 * aspect_ratio, 4);
    else
-     e_gadcon_client_aspect_set(gcc,
-                                inst->pager->xnum * inst->pager->zone->w,
-                                inst->pager->ynum * inst->pager->zone->h);
-   e_gadcon_client_min_size_set(gcc, 4, 4);
+     e_gadcon_client_min_size_set(gcc, 4, 4 * aspect_ratio);
 }
 
 static const char *

-- 


Reply via email to