derekf pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=82277ae6b39401a41b6c5148b880fa9fd60aed91

commit 82277ae6b39401a41b6c5148b880fa9fd60aed91
Author: Derek Foreman <[email protected]>
Date:   Tue Nov 1 16:20:49 2016 -0500

    ecore_evas_wayland: Move more functions into the common implementation
    
    Show and hide can be made common with almost no functional changes.
---
 .../engines/wayland/ecore_evas_wayland_common.c    | 100 ++++++++++++++++++++
 .../engines/wayland/ecore_evas_wayland_egl.c       | 101 +-------------------
 .../engines/wayland/ecore_evas_wayland_private.h   |   2 +
 .../engines/wayland/ecore_evas_wayland_shm.c       | 103 +--------------------
 4 files changed, 106 insertions(+), 200 deletions(-)

diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c 
b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
index 55f865d..a7927cf 100644
--- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
+++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
@@ -3,6 +3,7 @@
 #endif
 
 #include "ecore_evas_wayland_private.h"
+#include <Evas_Engine_Wayland.h>
 
 #define _smart_frame_type "ecore_evas_wl_frame"
 
@@ -1906,3 +1907,102 @@ _ecore_evas_wl_interface_new(void)
 
    return iface;
 }
+
+void
+_ecore_evas_wl_common_show(Ecore_Evas *ee)
+{
+   Evas_Engine_Info_Wayland *einfo;
+   Ecore_Evas_Engine_Wl_Data *wdata;
+   int fw, fh;
+
+   LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+   if ((!ee) || (ee->visible)) return;
+
+   wdata = ee->engine.data;
+   if (!wdata->sync_done)
+     {
+        wdata->defer_show = EINA_TRUE;
+        return;
+     }
+
+   evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
+
+   if (wdata->win)
+     {
+        ecore_wl2_window_show(wdata->win);
+        ecore_wl2_window_alpha_set(wdata->win, ee->alpha);
+
+        einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas);
+        if (einfo)
+          {
+             struct wl_surface *surf;
+
+             surf = ecore_wl2_window_surface_get(wdata->win);
+             if ((!einfo->info.wl_surface) || (einfo->info.wl_surface != surf))
+               {
+                  einfo->info.wl_surface = surf;
+                  if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info 
*)einfo))
+                    ERR("Failed to set Evas Engine Info for '%s'", ee->driver);
+                  evas_damage_rectangle_add(ee->evas, 0, 0, ee->w + fw, ee->h 
+ fh);
+               }
+             einfo->www_avail = !!wdata->win->www_surface;
+             einfo->just_mapped = EINA_TRUE;
+          }
+     }
+
+   if (wdata->frame)
+     {
+        evas_object_show(wdata->frame);
+        evas_object_resize(wdata->frame, ee->w + fw, ee->h + fh);
+     }
+
+   ee->prop.withdrawn = EINA_FALSE;
+   if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
+
+   if (ee->visible) return;
+   ee->visible = 1;
+   ee->should_be_visible = 1;
+   ee->draw_ok = EINA_TRUE;
+   if (ee->func.fn_show) ee->func.fn_show(ee);
+}
+
+void
+_ecore_evas_wl_common_hide(Ecore_Evas *ee)
+{
+   Evas_Engine_Info_Wayland *einfo;
+   Ecore_Evas_Engine_Wl_Data *wdata;
+
+   LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+   if ((!ee) || (!ee->visible)) return;
+   wdata = ee->engine.data;
+
+   evas_sync(ee->evas);
+
+   einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas);
+   if (einfo)
+     {
+        einfo->info.wl_surface = NULL;
+        if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
+          {
+             ERR("Failed to set Evas Engine Info for '%s'", ee->driver);
+          }
+     }
+
+   if (wdata->win)
+     ecore_wl2_window_hide(wdata->win);
+
+   if (ee->prop.override)
+     {
+        ee->prop.withdrawn = EINA_TRUE;
+        if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
+     }
+
+   if (!ee->visible) return;
+   ee->visible = 0;
+   ee->should_be_visible = 0;
+   ee->draw_ok = EINA_FALSE;
+
+   if (ee->func.fn_hide) ee->func.fn_hide(ee);
+}
diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c 
b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c
index 620ea66..f412871 100644
--- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c
+++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c
@@ -34,8 +34,6 @@ extern EAPI Eina_List *_evas_canvas_image_data_unset(Evas 
*eo_e);
 extern EAPI void _evas_canvas_image_data_regenerate(Eina_List *list);
 
 /* local function prototypes */
-static void _ecore_evas_wl_show(Ecore_Evas *ee);
-static void _ecore_evas_wl_hide(Ecore_Evas *ee);
 static void _ecore_evas_wl_alpha_set(Ecore_Evas *ee, int alpha);
 static void _ecore_evas_wl_transparent_set(Ecore_Evas *ee, int transparent);
 static void _ecore_evas_wl_rotation_set(Ecore_Evas *ee, int rotation, int 
resize);
@@ -63,8 +61,8 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
    _ecore_evas_wl_common_move_resize,
    _ecore_evas_wl_rotation_set,
    NULL, // shaped_set
-   _ecore_evas_wl_show,
-   _ecore_evas_wl_hide,
+   _ecore_evas_wl_common_show,
+   _ecore_evas_wl_common_hide,
    _ecore_evas_wl_common_raise,
    NULL, // lower
    NULL, // activate
@@ -470,101 +468,6 @@ _ecore_evas_wl_rotation_set(Ecore_Evas *ee, int rotation, 
int resize)
 }
 
 static void 
-_ecore_evas_wl_show(Ecore_Evas *ee)
-{
-   Evas_Engine_Info_Wayland *einfo;
-   Ecore_Evas_Engine_Wl_Data *wdata;
-   int fw, fh;
-
-   LOGFN(__FILE__, __LINE__, __FUNCTION__);
-
-   if ((!ee) || (ee->visible)) return;
-
-   wdata = ee->engine.data;
-   if (!wdata->sync_done)
-     {
-        wdata->defer_show = EINA_TRUE;
-        return;
-     }
-
-   evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
-
-   if (wdata->win)
-     {
-        ecore_wl2_window_show(wdata->win);
-        ecore_wl2_window_alpha_set(wdata->win, ee->alpha);
-
-        einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas);
-        if (einfo)
-          {
-             struct wl_surface *surf;
-
-             surf = ecore_wl2_window_surface_get(wdata->win);
-             if ((!einfo->info.wl_surface) || (einfo->info.wl_surface != surf))
-               {
-                  einfo->info.wl_surface = surf;
-                  evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
-                  evas_damage_rectangle_add(ee->evas, 0, 0, ee->w + fw, ee->h 
+ fh);
-               }
-             einfo->www_avail = !!wdata->win->www_surface;
-             einfo->just_mapped = EINA_TRUE;
-          }
-     }
-
-   if (wdata->frame)
-     {
-        evas_object_show(wdata->frame);
-        evas_object_resize(wdata->frame, ee->w + fw, ee->h + fh);
-     }
-
-   ee->prop.withdrawn = EINA_FALSE;
-   if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
-
-   if (ee->visible) return;
-   ee->visible = 1;
-   ee->should_be_visible = 1;
-   ee->draw_ok = EINA_TRUE;
-   if (ee->func.fn_show) ee->func.fn_show(ee);
-}
-
-static void 
-_ecore_evas_wl_hide(Ecore_Evas *ee)
-{
-   Ecore_Evas_Engine_Wl_Data *wdata;
-   Evas_Engine_Info_Wayland *einfo;
-
-   LOGFN(__FILE__, __LINE__, __FUNCTION__);
-
-   if ((!ee) || (!ee->visible)) return;
-   wdata = ee->engine.data;
-
-   evas_sync(ee->evas);
-
-   einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas);
-   if (einfo)
-     {
-        einfo->info.wl_surface = NULL;
-        evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
-     }
-
-   if (wdata->win) 
-     ecore_wl2_window_hide(wdata->win);
-
-   if (ee->prop.override)
-     {
-        ee->prop.withdrawn = EINA_TRUE;
-        if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
-     }
-
-   if (!ee->visible) return;
-   ee->visible = 0;
-   ee->should_be_visible = 0;
-   ee->draw_ok = EINA_FALSE;
-
-   if (ee->func.fn_hide) ee->func.fn_hide(ee);
-}
-
-static void 
 _ecore_evas_wayland_egl_alpha_do(Ecore_Evas *ee, int alpha)
 {
    Evas_Engine_Info_Wayland *einfo;
diff --git 
a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h 
b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h
index 8fe07db..d139a43 100644
--- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h
+++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h
@@ -96,6 +96,8 @@ void _ecore_evas_wl_common_render_updates(void *data, Evas 
*evas, void *event);
 void _ecore_evas_wl_common_rotation_set(Ecore_Evas *ee, int rotation, int 
resize);
 void _ecore_evas_wl_common_borderless_set(Ecore_Evas *ee, Eina_Bool on);
 void _ecore_evas_wl_common_withdrawn_set(Ecore_Evas *ee, Eina_Bool on);
+void _ecore_evas_wl_common_show(Ecore_Evas *ee);
+void _ecore_evas_wl_common_hide(Ecore_Evas *ee);
 
 void _ecore_evas_wl_common_frame_callback_clean(Ecore_Evas *ee);
 
diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c 
b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c
index fbe9dee..166c4a6 100644
--- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c
+++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c
@@ -31,8 +31,6 @@
 #endif /* ! _WIN32 */
 
 /* local function prototypes */
-static void _ecore_evas_wl_show(Ecore_Evas *ee);
-static void _ecore_evas_wl_hide(Ecore_Evas *ee);
 static void _ecore_evas_wl_alpha_set(Ecore_Evas *ee, int alpha);
 static void _ecore_evas_wl_transparent_set(Ecore_Evas *ee, int transparent);
 static void _ecore_evas_wl_rotation_set(Ecore_Evas *ee, int rotation, int 
resize);
@@ -60,8 +58,8 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
    _ecore_evas_wl_common_move_resize,
    _ecore_evas_wl_rotation_set,
    NULL, // shaped_set
-   _ecore_evas_wl_show,
-   _ecore_evas_wl_hide,
+   _ecore_evas_wl_common_show,
+   _ecore_evas_wl_common_hide,
    _ecore_evas_wl_common_raise,
    NULL, // lower
    NULL, // activate
@@ -398,103 +396,6 @@ _ecore_evas_wl_rotation_set(Ecore_Evas *ee, int rotation, 
int resize)
      ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
 }
 
-static void
-_ecore_evas_wl_show(Ecore_Evas *ee)
-{
-   Evas_Engine_Info_Wayland *einfo;
-   Ecore_Evas_Engine_Wl_Data *wdata;
-   int fw, fh;
-
-   LOGFN(__FILE__, __LINE__, __FUNCTION__);
-
-   if ((!ee) || (ee->visible)) return;
-
-   wdata = ee->engine.data;
-   if (!wdata->sync_done)
-     {
-        wdata->defer_show = EINA_TRUE;
-        return;
-     }
-
-   evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
-
-   if (wdata->win)
-     {
-        ecore_wl2_window_show(wdata->win);
-        ecore_wl2_window_alpha_set(wdata->win, ee->alpha);
-
-        einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas);
-        if (einfo)
-          {
-             struct wl_surface *surf;
-
-             surf = ecore_wl2_window_surface_get(wdata->win);
-             if ((!einfo->info.wl_surface) || (einfo->info.wl_surface != surf))
-               {
-                  einfo->info.wl_surface = surf;
-                  if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info 
*)einfo))
-                    ERR("Failed to set Evas Engine Info for '%s'", ee->driver);
-                  evas_damage_rectangle_add(ee->evas, 0, 0, ee->w + fw, ee->h 
+ fh);
-               }
-          }
-     }
-
-   if (wdata->frame)
-     {
-        evas_object_show(wdata->frame);
-        evas_object_resize(wdata->frame, ee->w + fw, ee->h + fh);
-     }
-
-   ee->prop.withdrawn = EINA_FALSE;
-   if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
-
-   if (ee->visible) return;
-   ee->visible = 1;
-   ee->should_be_visible = 1;
-   ee->draw_ok = EINA_TRUE;
-   if (ee->func.fn_show) ee->func.fn_show(ee);
-}
-
-static void 
-_ecore_evas_wl_hide(Ecore_Evas *ee)
-{
-   Evas_Engine_Info_Wayland *einfo;
-   Ecore_Evas_Engine_Wl_Data *wdata;
-
-   LOGFN(__FILE__, __LINE__, __FUNCTION__);
-
-   if ((!ee) || (!ee->visible)) return;
-   wdata = ee->engine.data;
-
-   evas_sync(ee->evas);
-
-   einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas);
-   if (einfo)
-     {
-        einfo->info.wl_surface = NULL;
-        if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
-          {
-             ERR("Failed to set Evas Engine Info for '%s'", ee->driver);
-          }
-     }
-
-   if (wdata->win) 
-     ecore_wl2_window_hide(wdata->win);
-
-   if (ee->prop.override)
-     {
-        ee->prop.withdrawn = EINA_TRUE;
-        if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
-     }
-
-   if (!ee->visible) return;
-   ee->visible = 0;
-   ee->should_be_visible = 0;
-   ee->draw_ok = EINA_FALSE;
-
-   if (ee->func.fn_hide) ee->func.fn_hide(ee);
-}
-
 void
 _ecore_evas_wayland_shm_alpha_do(Ecore_Evas *ee, int alpha)
 {

-- 


Reply via email to