efl_ui_win/ecore_evas_wayland: handle win's visibility change event
authorJuyeon Lee <juyeonne.lee@samsung.com>
Mon, 13 Nov 2017 02:12:41 +0000 (11:12 +0900)
committerJiyoun Park <jy0703.park@samsung.com>
Tue, 19 Dec 2017 07:30:03 +0000 (16:30 +0900)
efl_ui_win, emit SIG_VISIBILITY_CHANGED by state of ee->prop.obsecured
ecore_evas, ee->prop.obscured is updated by the
 ECORE_WL2_EVENT_WINDOW_VISIBILITY_CHANGE event handler

Change-Id: Id62b2c5f6382e854f8addbc220c30f582eea9f2b

src/lib/ecore_evas/Ecore_Evas.h
src/lib/ecore_evas/ecore_evas.c
src/lib/ecore_evas/ecore_evas_private.h
src/lib/elementary/efl_ui_win.c
src/lib/elementary/elm_win.h
src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c

index 4096d7d..a4eb648 100644 (file)
@@ -3583,6 +3583,19 @@ EAPI Evas_Object *ecore_evas_extn_plug_new(Ecore_Evas *ee_target);
  */
 EAPI Eina_Bool ecore_evas_extn_plug_connect(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys);
 
+// TIZEN_ONLY(20160120): support visibility_change event
+/**
+ * @brief Query if the ecore evas is obscured or unobscured.
+ *
+ * @param ee The Ecore_Evas
+ * @return EINA_TRUE if the ecore evas is obscured, EINA_FALSE unobscured.
+ * @warning Support for this depends on the underlying windowing system.
+ *
+ * @since 1.16
+ */
+EAPI Eina_Bool ecore_evas_obscured_get(const Ecore_Evas *ee);
+//
+
 /**
  * @brief Retrieves the coordinates of the default mouse pointer.
  *
index 89a8409..d850a49 100644 (file)
@@ -5273,3 +5273,17 @@ ecore_evas_callback_device_mouse_in_set(Ecore_Evas *ee,
    IFE;
    ee->func.fn_device_mouse_in = func;
 }
+
+// TIZEN_ONLY(20160120): support visibility_change event
+EAPI Eina_Bool
+ecore_evas_obscured_get(const Ecore_Evas *ee)
+{
+   if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
+     {
+        ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
+                         "ecore_evas_obscured_get");
+        return -1;
+     }
+   return ee->prop.obscured ? EINA_TRUE : EINA_FALSE;
+}
+//
index efcc662..28a506c 100644 (file)
@@ -296,6 +296,7 @@ struct _Ecore_Evas
       Eina_Bool       demand_attention : 1;
       Eina_Bool       focus_skip       : 1;
       Eina_Bool       focused       : 1;
+      Eina_Bool       obscured         : 1; // TIZEN_ONLY(20160120): support visibility_change event
   } prop;
 
    struct {
index 8b85ac6..e6a7bdf 100644 (file)
@@ -299,6 +299,10 @@ struct _Efl_Ui_Win_Data
    Eina_Bool    shown : 1;
    Eina_Bool    stack_base : 1;
    Eina_Bool    paused : 1;
+
+   // TIZEN_ONLY(20160120): support visibility_change event
+   Eina_Bool    obscured : 1;
+   //
 };
 
 struct _Input_Pointer_Iterator
@@ -331,6 +335,9 @@ static const char SIG_WM_ROTATION_CHANGED[] = "wm,rotation,changed";
 static const char SIG_EFFECT_STARTED[] = "effect,started";
 static const char SIG_EFFECT_DONE[] = "effect,done";
 //
+// TIZEN_ONLY(20160120): support visibility_change event
+static const char SIG_VISIBILITY_CHANGED[] = "visibility,changed";
+//
 
 static const Evas_Smart_Cb_Description _smart_callbacks[] = {
    {SIG_DELETE_REQUEST, ""},
@@ -355,6 +362,7 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = {
    {SIG_WIDGET_UNFOCUSED, ""}, /**< handled by elm_widget */
    {SIG_EFFECT_STARTED, ""},
    {SIG_EFFECT_DONE, ""},
+   {SIG_VISIBILITY_CHANGED, ""},
    {NULL, NULL}
 };
 
@@ -1538,6 +1546,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_visibility = EINA_FALSE;
    const char *profile;
 
    if (!sd) return;
@@ -1586,6 +1595,14 @@ _elm_win_state_change(Ecore_Evas *ee)
           }
      }
 
+   // TIZEN_ONLY(20160120): support visibility_change event
+   if (sd->obscured != ecore_evas_obscured_get(sd->ee))
+     {
+        sd->obscured = ecore_evas_obscured_get(sd->ee);
+        ch_visibility = EINA_TRUE;
+     }
+   //
+
    _elm_win_state_eval_queue();
 
    if ((ch_withdrawn) || (ch_iconified))
@@ -1672,20 +1689,12 @@ _elm_win_state_change(Ecore_Evas *ee)
           (obj, EFL_UI_WIN_EVENT_ROTATION_CHANGED, NULL);
         efl_event_callback_legacy_call
           (obj, EFL_UI_WIN_EVENT_WM_ROTATION_CHANGED, NULL);
-        if (_elm_config->atspi_mode)
-          {
-             Evas_Coord x = 0, y = 0, width = 0, height = 0;
-             elm_win_screen_size_get(obj, &x, &y, &width, &height);
-             if ((sd->rot == 0) || (sd->rot == 180))
-               {
-                  efl_access_bounds_changed_signal_emit(obj, x, y, width, height);
-               }
-             else
-               {
-                  efl_access_bounds_changed_signal_emit(obj, x, y, height, width);
-               }
-          }
      }
+
+   // TIZEN_ONLY(20160120): support visibility_change event
+   if (ch_visibility)
+     evas_object_smart_callback_call(obj, SIG_VISIBILITY_CHANGED, (void*)!sd->obscured);
+   //
 }
 
 EOLIAN static Eina_Bool
index d8abdbe..8c92a4b 100644 (file)
@@ -93,6 +93,7 @@
  * @li "theme,changed" - The theme was changed. (since 1.13)
  * @li "effect,started" - window effect has been started.
  * @li "effect,done" - window effect has been done.
+ * @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
index 59389a6..516eadb 100644 (file)
@@ -1325,6 +1325,29 @@ _ecore_evas_wl_common_cb_tizen_device_del(void *data EINA_UNUSED, int type EINA_
 
 //
 
+// TIZEN_ONLY(20160120): support visibility_change event
+static Eina_Bool
+_ecore_evas_wl_common_cb_window_visibility_change(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
+{
+   Ecore_Evas *ee;
+   Ecore_Wl2_Event_Window_Visibility_Change *ev;
+
+   ev = event;
+   ee = ecore_event_window_match(ev->win);
+
+   if (!ee) return ECORE_CALLBACK_PASS_ON;
+   if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
+
+   if (ee->prop.obscured == ev->fully_obscured)
+     return ECORE_CALLBACK_PASS_ON;
+
+   ee->prop.obscured = ev->fully_obscured;
+   _ecore_evas_wl_common_state_update(ee);
+   return ECORE_CALLBACK_PASS_ON;
+
+}
+//
+
 static int
 _ecore_evas_wl_common_init(void)
 {
@@ -1421,6 +1444,11 @@ _ecore_evas_wl_common_init(void)
      ecore_event_handler_add(ECORE_WL2_EVENT_TIZEN_DEVICE_DEL,
                              _ecore_evas_wl_common_cb_tizen_device_del, NULL);
    //
+   // TIZEN_ONLY(20160120): support visibility_change event
+   _ecore_evas_wl_event_hdls[20] =
+     ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_VISIBILITY_CHANGE,
+                             _ecore_evas_wl_common_cb_window_visibility_change, NULL);
+   //
 
    ecore_event_evas_init();
 
@@ -2713,6 +2741,7 @@ _ecore_evas_wl_common_new_internal(const char *disp_name, unsigned int parent, i
    ee->prop.request_pos = EINA_FALSE;
    ee->prop.sticky = EINA_FALSE;
    ee->prop.withdrawn = EINA_TRUE;
+   ee->prop.obscured = EINA_TRUE; // TIZEN_ONLY(20160120): support visibility_change event
    ee->alpha = EINA_FALSE;
 
    /* Wayland egl engine can't async render */