pager/pager16: fix wrong min values.
authorWonguk Jeong <wonguk.jeong@samsung.com>
Sun, 11 May 2014 16:30:00 +0000 (12:30 -0400)
committerMike Blumenkrantz <zmike@samsung.com>
Sun, 11 May 2014 16:30:00 +0000 (12:30 -0400)
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
src/modules/pager16/e_mod_main.c

index 4bfe5a7..881ae11 100644 (file)
@@ -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 *
index 87b2770..32425ef 100644 (file)
@@ -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 *