ecore wayland: modified code to handle iconic state 00/56000/1 accepted/tizen/mobile/20160104.224429 accepted/tizen/tv/20160104.224444 accepted/tizen/wearable/20160104.224510 submit/tizen/20160104.063048
authorDoyoun Kang <doyoun.kang@samsung.com>
Thu, 31 Dec 2015 01:59:37 +0000 (10:59 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Thu, 31 Dec 2015 01:59:37 +0000 (10:59 +0900)
Change-Id: I867299796d4a650d3dae301b634046ef1fd0555e

src/lib/ecore_wayland/Ecore_Wayland.h
src/lib/ecore_wayland/ecore_wl_window.c
src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c

index 8132b2c..c011b40 100644 (file)
@@ -759,6 +759,7 @@ EAPI void ecore_wl_window_role_set(Ecore_Wl_Window *win, const char *role);
 EAPI void ecore_wl_window_iconified_set(Ecore_Wl_Window *win, Eina_Bool iconified);
 EAPI Eina_Bool ecore_wl_window_iconified_get(Ecore_Wl_Window *win);
 
+EAPI void ecore_wl_window_iconify_state_update(Ecore_Wl_Window *win, Eina_Bool iconified, Eina_Bool send_event);
 
 EAPI int ecore_wl_window_id_get(Ecore_Wl_Window *win);
 EAPI void ecore_wl_window_title_set(Ecore_Wl_Window *win, const char *title);
index f85f2d0..c6768a8 100644 (file)
@@ -26,6 +26,8 @@ static void _ecore_wl_window_cb_available_angles_done(void *data, struct tizen_r
 static void _ecore_wl_window_cb_preferred_angle_done(void *data, struct tizen_rotation *tizen_rotation, uint32_t angle);
 static void _ecore_wl_window_cb_angle_change(void *data, struct tizen_rotation *tizen_rotation, uint32_t angle, uint32_t serial);
 static void _ecore_wl_window_cb_resource_id(void *data, struct tizen_resource *tizen_resource, uint32_t id);
+static void _ecore_wl_window_iconified_set(Ecore_Wl_Window *win, Eina_Bool iconified, Eina_Bool send_event);
+
 
 /* local variables */
 static Eina_Hash *_windows = NULL;
@@ -637,6 +639,11 @@ ecore_wl_window_activate(Ecore_Wl_Window *win)
 
    if (!win) return;
 
+   Eina_Bool iconic = EINA_FALSE;
+   iconic = ecore_wl_window_iconified_get(win);
+   if (iconic)
+     ecore_wl_window_iconified_set(win, EINA_FALSE);
+
    if (_ecore_wl_disp->wl.tz_policy)
      tizen_policy_activate(_ecore_wl_disp->wl.tz_policy, win->surface);
 }
@@ -1000,54 +1007,7 @@ ecore_wl_window_role_set(Ecore_Wl_Window *win, const char *role)
 EAPI void
 ecore_wl_window_iconified_set(Ecore_Wl_Window *win, Eina_Bool iconified)
 {
-   struct wl_array states;
-   uint32_t *s;
-
-   LOGFN(__FILE__, __LINE__, __FUNCTION__);
-
-   if (!win) return;
-
-   if (iconified)
-     {
-        if ((win->surface) && (_ecore_wl_disp->wl.tz_policy))
-          {
-             tizen_policy_iconify(_ecore_wl_disp->wl.tz_policy, win->surface);
-             win->iconified = EINA_TRUE;
-          }
-        else if (win->xdg_surface)
-          {
-             xdg_surface_set_minimized(win->xdg_surface);
-             win->minimized = iconified;
-          }
-        else if (win->shell_surface)
-          {
-             /* TODO: handle case of iconifying a wl_shell surface */
-          }
-     }
-   else
-     {
-        if ((win->surface) && (_ecore_wl_disp->wl.tz_policy))
-          {
-             tizen_policy_uniconify(_ecore_wl_disp->wl.tz_policy, win->surface);
-             win->iconified = EINA_FALSE;
-          }
-        else if (win->xdg_surface)
-          {
-             win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
-             wl_array_init(&states);
-             s = wl_array_add(&states, sizeof(*s));
-             *s = XDG_SURFACE_STATE_ACTIVATED;
-             _ecore_xdg_handle_surface_configure(win, win->xdg_surface, win->saved.w, win->saved.h, &states, 0);
-             wl_array_release(&states);
-          }
-        else if (win->shell_surface)
-          {
-             wl_shell_surface_set_toplevel(win->shell_surface);
-             win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
-             _ecore_wl_window_configure_send(win,
-                                             win->saved.w, win->saved.h, 0);
-          }
-     }
+   _ecore_wl_window_iconified_set(win, iconified, EINA_TRUE);
 }
 
 EAPI Eina_Bool
@@ -1063,6 +1023,12 @@ ecore_wl_window_iconified_get(Ecore_Wl_Window *win)
      return win->minimized;
 }
 
+EAPI void
+ecore_wl_window_iconify_state_update(Ecore_Wl_Window *win, Eina_Bool iconified, Eina_Bool send_event)
+{
+   _ecore_wl_window_iconified_set(win, iconified, send_event);
+}
+
 EAPI Ecore_Wl_Window *
 ecore_wl_window_surface_find(struct wl_surface *surface)
 {
@@ -1537,6 +1503,72 @@ _ecore_wl_window_cb_resource_id(void *data, struct tizen_resource *tizen_resourc
    ecore_event_add(ECORE_WL_EVENT_WINDOW_SHOW, ev, NULL, NULL);
 }
 
+static void
+_ecore_wl_window_iconified_set(Ecore_Wl_Window *win, Eina_Bool iconified, Eina_Bool send_event)
+{
+   struct wl_array states;
+   uint32_t *s;
+
+   LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+   if (!win) return;
+
+   if (iconified)
+     {
+        if ((win->surface) && (_ecore_wl_disp->wl.tz_policy))
+          {
+             if (send_event)
+               tizen_policy_iconify(_ecore_wl_disp->wl.tz_policy, win->surface);
+             win->iconified = EINA_TRUE;
+          }
+        else if (win->xdg_surface)
+          {
+             xdg_surface_set_minimized(win->xdg_surface);
+             win->minimized = iconified;
+          }
+        else if (win->shell_surface)
+          {
+             /* TODO: handle case of iconifying a wl_shell surface */
+          }
+     }
+   else
+     {
+        if ((win->surface) && (_ecore_wl_disp->wl.tz_policy))
+          {
+             if (send_event)
+               tizen_policy_uniconify(_ecore_wl_disp->wl.tz_policy, win->surface);
+             win->iconified = EINA_FALSE;
+          }
+        else if (win->xdg_surface)
+          {
+             win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
+             wl_array_init(&states);
+             s = wl_array_add(&states, sizeof(*s));
+             *s = XDG_SURFACE_STATE_ACTIVATED;
+             _ecore_xdg_handle_surface_configure(win, win->xdg_surface, win->saved.w, win->saved.h, &states, 0);
+             wl_array_release(&states);
+          }
+        else if (win->shell_surface)
+          {
+             wl_shell_surface_set_toplevel(win->shell_surface);
+             win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
+             _ecore_wl_window_configure_send(win,
+                                             win->saved.w, win->saved.h, 0);
+          }
+     }
+
+   if (send_event)
+     {
+        Ecore_Wl_Event_Window_Iconify_State_Change *ev;
+
+        if (!(ev = calloc(1, sizeof(Ecore_Wl_Event_Window_Iconify_State_Change)))) return;
+        ev->win = win->id;
+        ev->iconified = iconified;
+        ev->force = 0;
+        ecore_event_add(ECORE_WL_EVENT_WINDOW_ICONIFY_STATE_CHANGE, ev, NULL, NULL);
+     }
+}
+
 static void 
 _ecore_xdg_handle_surface_delete(void *data, struct xdg_surface *xdg_surface EINA_UNUSED)
 {
index 20cc761..1b57ab7 100644 (file)
@@ -276,20 +276,23 @@ _ecore_evas_wl_common_cb_window_iconify_change(void *data  EINA_UNUSED, int type
 {
    Ecore_Evas *ee;
    Ecore_Wl_Event_Window_Iconify_State_Change *ev;
+   Ecore_Evas_Engine_Wl_Data *wdata;
 
    ev = event;
    ee = ecore_event_window_match(ev->win);
 
    if (!ee) return ECORE_CALLBACK_PASS_ON;
-   if (!ev->force) return ECORE_CALLBACK_PASS_ON;
    if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
 
    if (ee->prop.iconified == ev->iconified)
      return ECORE_CALLBACK_PASS_ON;
 
    ee->prop.iconified = ev->iconified;
-   _ecore_evas_wl_common_state_update(ee);
 
+   wdata = ee->engine.data;
+   if (wdata && ev->force)
+     ecore_wl_window_iconify_state_update(wdata->win, ev->iconified, EINA_FALSE);
+   _ecore_evas_wl_common_state_update(ee);
    return ECORE_CALLBACK_PASS_ON;
 }
 
@@ -1244,6 +1247,10 @@ _ecore_evas_wl_common_activate(Ecore_Evas *ee)
    if (!ee) return;
    wdata = ee->engine.data;
    ecore_evas_show(ee);
+
+   if (ee->prop.iconified)
+     _ecore_evas_wl_common_iconified_set(ee, EINA_FALSE);
+
    ecore_wl_window_activate(wdata->win);
 }