elm_win: handle changes of visibility state 37/57437/2 accepted/tizen/mobile/20160122.034118 accepted/tizen/tv/20160122.034135 accepted/tizen/wearable/20160122.034155 submit/tizen/20160121.075859
authorMinJeong Kim <minjjj.kim@samsung.com>
Wed, 20 Jan 2016 06:52:52 +0000 (15:52 +0900)
committerMinJeong Kim <minjjj.kim@samsung.com>
Thu, 21 Jan 2016 06:55:37 +0000 (15:55 +0900)
Change-Id: I65f91da1abc6c0de1fea74925389cc3c625f6563

src/bin/test_win_state.c
src/lib/elm_win.c
src/lib/elm_win.h

index c4b07f42c7a03fd088dfdd7125e05029a0dd19b5..562ae93629d5d788a5ae9b602b06000682ccf90b 100644 (file)
@@ -229,6 +229,17 @@ _win_state_focus_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info E
    printf("WIN FOCUS: %s\n", (char *)data);
 }
 
+static void
+_win_state_visibility_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
+{
+   /* event_info for "visibility,changed" callback
+    * 0: the window is fully obscured
+    * 1: the window is unobscured
+    */
+   int visibility = (int)(void *)event_info;
+   printf("WIN: %s %d\n", (char *)data, visibility);
+}
+
 static void
 _win_show(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
 {
@@ -273,6 +284,7 @@ test_win_state(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event
    evas_object_smart_callback_add(win, "focus,in", _win_state_focus_cb, "focus,in");
    evas_object_smart_callback_add(win, "delete,request", _win_state_print_cb, "delete,request");
    evas_object_smart_callback_add(win, "wm,rotation,changed", _win_state_print_cb, "wm,rotation,changed");
+   evas_object_smart_callback_add(win, "visibility,changed", _win_state_visibility_cb, "visibility,changed");
    elm_win_autodel_set(win, EINA_TRUE);
 
    bg = elm_bg_add(win);
index ca55ce161897331a65cf21e79efe55c5b326e3c8..d07b363f85b8062d96d20a45680b19cab80eb160 100644 (file)
@@ -228,6 +228,7 @@ struct _Elm_Win_Data
    Eina_Bool    noblank : 1;
    Eina_Bool    theme_alpha : 1; /**< alpha value fetched by a theme. this has higher priority than application_alpha */
    Eina_Bool    application_alpha : 1; /**< alpha value set by an elm_win_alpha_set() api. this has lower priority than theme_alpha */
+   Eina_Bool    obscured :1;
 };
 
 static const char SIG_DELETE_REQUEST[] = "delete,request";
@@ -250,6 +251,7 @@ static const char SIG_PROFILE_CHANGED[] = "profile,changed";
 static const char SIG_WM_ROTATION_CHANGED[] = "wm,rotation,changed";
 static const char SIG_CONFORMANT_CHANGED[] = "conformant,changed";
 static const char SIG_AUX_HINT_ALLOWED[] = "aux,hint,allowed";
+static const char SIG_VISIBILITY_CHANGED[] = "visibility,changed";
 
 static const Evas_Smart_Cb_Description _smart_callbacks[] = {
    {SIG_DELETE_REQUEST, ""},
@@ -274,6 +276,7 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = {
    {SIG_WIDGET_UNFOCUSED, ""}, /**< handled by elm_widget */
    {SIG_CONFORMANT_CHANGED, ""},
    {SIG_AUX_HINT_ALLOWED, ""},
+   {SIG_VISIBILITY_CHANGED, ""},
    {NULL, NULL}
 };
 
@@ -1314,6 +1317,7 @@ _elm_win_state_change(Ecore_Evas *ee)
    Eina_Bool ch_profile = EINA_FALSE;
    Eina_Bool ch_wm_rotation = EINA_FALSE;
    Eina_Bool ch_conformant  = EINA_FALSE;
+   Eina_Bool ch_visibility = EINA_FALSE;
    Eina_Bool ch_aux_hint = EINA_FALSE;
    Eina_List *aux_hints = NULL;
    const char *profile;
@@ -1362,6 +1366,13 @@ _elm_win_state_change(Ecore_Evas *ee)
              ch_wm_rotation = EINA_TRUE;
           }
      }
+
+   if (sd->obscured != ecore_evas_obscured_get(sd->ee))
+     {
+        sd->obscured = ecore_evas_obscured_get(sd->ee);
+        ch_visibility = EINA_TRUE;
+     }
+
    aux_hints = ecore_evas_aux_hints_allowed_get(sd->ee);
    if (aux_hints)
      {
@@ -1498,6 +1509,10 @@ _elm_win_state_change(Ecore_Evas *ee)
           }
         eina_list_free(aux_hints);
      }
+   if (ch_visibility)
+     {
+        evas_object_smart_callback_call(obj, SIG_VISIBILITY_CHANGED, (void*)!sd->obscured);
+     }
 }
 
 EOLIAN static Eina_Bool
@@ -3856,6 +3871,7 @@ _elm_win_finalize_internal(Eo *obj, Elm_Win_Data *sd, const char *name, Elm_Win_
    sd->parent = parent;
    sd->modal_count = 0;
    sd->withdrawn = ecore_evas_withdrawn_get(sd->ee);
+   sd->obscured = ecore_evas_obscured_get(sd->ee);
 
    if (sd->parent)
      evas_object_event_callback_add
index 7312f05010545c1b0f129e3dd09739a809e59350..d29f2a5c6766b8da7da89d84f24f5fc589b70667 100644 (file)
@@ -91,6 +91,7 @@
  * @li "focused" : When the win has received focus. (since 1.8)
  * @li "unfocused" : When the win has lost focus. (since 1.8)
  * @li "theme,changed" - The theme was changed. (since 1.13)
+ * @li "visibility,changed" - visibility of the window has been changed.
  *
  * Note that calling evas_object_show() after window contents creation is
  * recommended. It will trigger evas_smart_objects_calculate() and some backend