elm_conform: consider window's geometry while reflecting keyboard conformant geometry 35/150235/1 accepted/tizen/unified/20170921.072252 submit/tizen/20170920.082902
authorDoyoun Kang <doyoun.kang@samsung.com>
Fri, 15 Sep 2017 00:30:21 +0000 (09:30 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Fri, 15 Sep 2017 01:54:59 +0000 (10:54 +0900)
There was a bug that the partial window was resized when the keyboard was shown on landscape mode.
So, we add code to consider window's geometry while calculating conformant's geometry.

Change-Id: Iaa895335ddbc78697044f6712e7477317f4d3758

src/lib/elm_conform.c

index 42753b9..c02adf4 100644 (file)
@@ -204,17 +204,46 @@ _conformant_part_size_hints_set(Evas_Object *obj,
    Evas_Coord cx, cy, cw, ch;
    Evas_Coord part_height = 0, part_width = 0;
    //TIZEN_ONLY(20170405): add window's x,y postion when calculating overlapping size.
-   Evas_Coord tx, ty;
+   Evas_Coord tx, ty, tw, th;
+   Evas_Coord nx, ny;
    Evas_Object *top;
    //
 
    evas_object_geometry_get(obj, &cx, &cy, &cw, &ch);
 
    //TIZEN_ONLY(20170405): add window's x,y postion when calculating overlapping size.
+   ELM_CONFORMANT_DATA_GET(obj, sd);
    top = elm_widget_top_get(obj);
-   evas_object_geometry_get(top, &tx, &ty, NULL, NULL);
-   cx += tx;
-   cy += ty;
+   evas_object_geometry_get(top, &tx, &ty, &tw, &th);
+   // position (tx, ty) is based on screen(absolute) coordinates,
+   // but size (tw, th) is based on view port :(
+
+   Evas_Coord ww = 0, wh = 0;
+   elm_win_screen_size_get(top, NULL, NULL, &ww, &wh);
+
+   if (sd->rot == 90)
+     {
+        nx = wh - ty - tw;
+        ny = tx;
+     }
+   else if (sd->rot == 180)
+     {
+        nx = ww - tx - tw;
+        ny = wh - ty - th;
+     }
+   else if (sd->rot == 270)
+     {
+        nx = ty;
+        ny = ww - tx - th;
+     }
+   else
+     {
+        nx = tx;
+        ny = ty;
+     }
+
+   cx += nx;
+   cy += ny;
    //
 
    /* Part overlapping with conformant */
@@ -309,25 +338,41 @@ _conformant_part_sizing_eval(Evas_Object *obj,
 #endif
 // TIZEN_ONLY(20150707): implemented elm_win_conformant_set/get for wayland
 #ifdef HAVE_ELEMENTARY_WAYLAND
+        int tx = -1, ty = -1, tw = -1, th = -1;
+
         wlwin = elm_win_wl_window_get(top);
         if (wlwin)
-          ecore_wl_window_keyboard_geometry_get(wlwin, &sx, &sy, &sw, &sh);
-        Evas_Coord tmp = 0;
+          ecore_wl_window_keyboard_geometry_get(wlwin, &tx, &ty, &tw, &th);
         Evas_Coord ww = 0, wh = 0;
         elm_win_screen_size_get(top, NULL, NULL, &ww, &wh);
+
         if (sd->rot == 90)
           {
-             SWAP(sx, sy, tmp);
-             SWAP(sw, sh, tmp);
+             sx = wh - ty - th;
+             sy = tx;
+             sw = th;
+             sh = tw;
+          }
+        else if (sd->rot == 180)
+          {
+             sx = ww - tx - tw;
+             sy = wh - ty - th;
+             sw = tw;
+             sh = th;
           }
-        if (sd->rot == 180)
+        else if (sd->rot == 270)
           {
-             sy = wh - sh;
+             sx = ty;
+             sy = ww - tx - tw;
+             sw = th;
+             sh = tw;
           }
-        if (sd->rot == 270)
+        else
           {
-             sy = ww - sw;
-             SWAP(sw, sh, tmp);
+             sx = tx;
+             sy = ty;
+             sw = tw;
+             sh = th;
           }
 #endif
 //