elm_conform: implemented elm_win_conformant_set/get for wayland 67/42867/1
authorDuna Oh <duna.oh@samsung.com>
Fri, 3 Jul 2015 08:10:35 +0000 (17:10 +0900)
committerDuna Oh <duna.oh@samsung.com>
Fri, 3 Jul 2015 08:41:55 +0000 (17:41 +0900)
if conformant_parts are changed, re-evaluates the size of each parts

Signed-off-by: Duna Oh <duna.oh@samsung.com>
Change-Id: I746b643d9c0b738a4670761f3b6ebb78e34241ff

src/lib/elm_conform.c
src/lib/elm_win.c

index 13e95af09204a244e168d49b1264dc8f3b2db567..2d6246af09f3169620f86cc0ade4f7135e764b3a 100644 (file)
@@ -125,15 +125,18 @@ _conformant_part_sizing_eval(Evas_Object *obj,
 {
 #ifdef HAVE_ELEMENTARY_X
    Ecore_X_Window zone = 0;
-   Evas_Object *top;
    Ecore_X_Window xwin;
 #endif
+#ifdef HAVE_ELEMENTARY_WAYLAND
+   Ecore_Wl_Window *wlwin;
+#endif
+   Evas_Object *top;
    int sx = -1, sy = -1, sw = -1, sh = -1;
 
    ELM_CONFORMANT_DATA_GET(obj, sd);
+   top = elm_widget_top_get(obj);
 
 #ifdef HAVE_ELEMENTARY_X
-   top = elm_widget_top_get(obj);
    xwin = elm_win_xwindow_get(top);
 
    if (xwin)
@@ -152,6 +155,11 @@ _conformant_part_sizing_eval(Evas_Object *obj,
                    (zone, &sx, &sy, &sw, &sh)))
                sx = sy = sw = sh = 0;
           }
+#endif
+#ifdef HAVE_ELEMENTARY_WAYLAND
+        wlwin = elm_win_wl_window_get(top);
+        if (wlwin)
+          ecore_wl_window_indicator_geometry_get(wlwin, &sx, &sy, &sw, &sh);
 #endif
         if (((sd->rot == 90) || (sd->rot == 270)) && sd->landscape_indicator)
           _conformant_part_size_hints_set(obj, sd->landscape_indicator, sx, sy, sw, sh);
@@ -180,6 +188,11 @@ _conformant_part_sizing_eval(Evas_Object *obj,
                     }
                }
           }
+#endif
+#ifdef HAVE_ELEMENTARY_WAYLAND
+        wlwin = elm_win_wl_window_get(top);
+        if (wlwin)
+          ecore_wl_window_keyboard_geometry_get(wlwin, &sx, &sy, &sw, &sh);
 #endif
         DBG("[KEYPAD]: size(%d,%d, %dx%d).", sx, sy, sw, sh);
         _conformant_part_size_hints_set
@@ -891,6 +904,19 @@ _on_prop_change(void *data,
 
 #endif
 
+static void
+_on_conformant_changed(void *data,
+                     Evas_Object *obj,
+                     void *event_info EINA_UNUSED)
+{
+   Conformant_Part_Type part_type;
+
+   part_type = (ELM_CONFORMANT_INDICATOR_PART |
+                ELM_CONFORMANT_VIRTUAL_KEYPAD_PART);
+
+   _conformant_part_sizing_eval(data, part_type);
+}
+
 EOLIAN static void
 _elm_conformant_evas_object_smart_add(Eo *obj, Elm_Conformant_Data *_pd EINA_UNUSED)
 {
@@ -990,6 +1016,8 @@ _elm_conformant_eo_base_constructor(Eo *obj, Elm_Conformant_Data *sd)
      (top, "indicator,prop,changed", _on_indicator_mode_changed, obj);
    evas_object_smart_callback_add
      (top, "rotation,changed", _on_rotation_changed, obj);
+   evas_object_smart_callback_add
+     (top, "conformant,changed", _on_conformant_changed, obj);
 }
 
 static void
index 69ed3992d0ebcb7da81ee728e150085e1fe2d8fc..1678ac64b34d516969bcafccce7ddfa397420968 100644 (file)
@@ -126,6 +126,8 @@ struct _Elm_Win_Data
    Elm_Win_Keyboard_Mode          kbdmode;
    Elm_Win_Indicator_Mode         indmode;
    Elm_Win_Indicator_Opacity_Mode ind_o_mode;
+   Eina_Rectangle kbd;
+   Eina_Rectangle ind;
    struct
    {
       const char  *info;
@@ -234,6 +236,7 @@ static const char SIG_ROTATION_CHANGED[] = "rotation,changed";
 static const char SIG_PROFILE_CHANGED[] = "profile,changed";
 static const char SIG_WM_ROTATION_CHANGED[] = "wm,rotation,changed";
 static const char SIG_THEME_CHANGED[] = "theme,changed";
+static const char SIG_CONFORMANT_CHANGED[] = "conformant,changed";
 
 static const Evas_Smart_Cb_Description _smart_callbacks[] = {
    {SIG_DELETE_REQUEST, ""},
@@ -256,6 +259,7 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = {
    {SIG_WM_ROTATION_CHANGED, ""},
    {SIG_WIDGET_FOCUSED, ""}, /**< handled by elm_widget */
    {SIG_WIDGET_UNFOCUSED, ""}, /**< handled by elm_widget */
+   {SIG_CONFORMANT_CHANGED, ""},
    {NULL, NULL}
 };
 
@@ -1168,6 +1172,7 @@ _elm_win_state_change(Ecore_Evas *ee)
    Eina_Bool ch_maximized = EINA_FALSE;
    Eina_Bool ch_profile = EINA_FALSE;
    Eina_Bool ch_wm_rotation = EINA_FALSE;
+   Eina_Bool ch_conformant  = EINA_FALSE;
    const char *profile;
 
    if (!sd) return;
@@ -1214,6 +1219,41 @@ _elm_win_state_change(Ecore_Evas *ee)
              ch_wm_rotation = EINA_TRUE;
           }
      }
+#ifdef HAVE_ELEMENTARY_WAYLAND
+   int x = 0, y = 0, w = 0, h = 0;
+   if (sd->indmode != (Elm_Win_Indicator_Mode)ecore_wl_window_indicator_state_get(sd->wl.win))
+     {
+        sd->indmode = ecore_wl_window_indicator_state_get(sd->wl.win);
+        ch_conformant = EINA_TRUE;
+     }
+   if (sd->kbdmode != (Elm_Win_Keyboard_Mode)ecore_wl_window_keyboard_state_get(sd->wl.win))
+     {
+        sd->kbdmode = ecore_wl_window_keyboard_state_get(sd->wl.win);
+        ch_conformant = EINA_TRUE;
+     }
+   if (ecore_wl_window_indicator_geometry_get(sd->wl.win, &x, &y, &w, &h))
+     {
+        if ((sd->ind.x != x) || (sd->ind.y != y) || (sd->ind.w != w) || (sd->ind.h != h))
+          {
+             sd->ind.x = x;
+             sd->ind.y = y;
+             sd->ind.w = w;
+             sd->ind.h = h;
+             ch_conformant  = EINA_TRUE;
+          }
+     }
+   if (ecore_wl_window_keyboard_geometry_get(sd->wl.win, &x, &y, &w, &h))
+     {
+        if ((sd->ind.x != x) || (sd->ind.y != y) || (sd->ind.w != w) || (sd->ind.h != h))
+          {
+             sd->kbd.x = x;
+             sd->kbd.y = y;
+             sd->kbd.w = w;
+             sd->kbd.h = h;
+             ch_conformant  = EINA_TRUE;
+          }
+     }
+#endif
 
    _elm_win_state_eval_queue();
 
@@ -1262,6 +1302,10 @@ _elm_win_state_change(Ecore_Evas *ee)
         evas_object_smart_callback_call(obj, SIG_ROTATION_CHANGED, NULL);
         evas_object_smart_callback_call(obj, SIG_WM_ROTATION_CHANGED, NULL);
      }
+   if (ch_conformant)
+     {
+        evas_object_smart_callback_call(obj, SIG_CONFORMANT_CHANGED, NULL);
+     }
 }
 
 EOLIAN static Eina_Bool
@@ -4685,8 +4729,13 @@ _elm_win_conformant_set(Eo *obj EINA_UNUSED, Elm_Win_Data *sd, Eina_Bool conform
    _internal_elm_win_xwindow_get(sd);
    if (sd->x.xwin)
      ecore_x_e_illume_conformant_set(sd->x.xwin, conformant);
+#elif HAVE_ELEMENTARY_WAYLAND
+   _elm_win_wlwindow_get(sd);
+   if (sd->wl.win)
+     ecore_wl_window_conformant_set(sd->wl.win, conformant);
 #else
    (void)conformant;
+
 #endif
 }
 
@@ -4698,6 +4747,11 @@ _elm_win_conformant_get(Eo *obj EINA_UNUSED, Elm_Win_Data *sd)
    if (sd->x.xwin)
      return ecore_x_e_illume_conformant_get(sd->x.xwin);
 #endif
+#if HAVE_ELEMENTARY_WAYLAND
+   _elm_win_wlwindow_get(sd);
+   if (sd->wl.win)
+     return ecore_wl_window_conformant_get(sd->wl.win);
+#endif
 
    return EINA_FALSE;
 }