devilhorns pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=9ca13ef5c10904b620407ce8981fadf2a903b180

commit 9ca13ef5c10904b620407ce8981fadf2a903b180
Author: Woochanlee <wc0917....@samsung.com>
Date:   Tue May 26 11:49:16 2020 -0400

    ecore_wl2 : Organize window creation/deletion events.
    
    Summary:
    Add create / destroy events.
    Call hide event when the window terminated if the window was visible.
    
    Reviewers: devilhorns, Hermet, raster
    
    Reviewed By: devilhorns
    
    Subscribers: cedric, #reviewers, #committers
    
    Tags: #efl
    
    Differential Revision: https://phab.enlightenment.org/D11878
---
 src/lib/ecore_wl2/Ecore_Wl2.h         |  9 +++++++++
 src/lib/ecore_wl2/ecore_wl2.c         |  8 +++++++-
 src/lib/ecore_wl2/ecore_wl2_private.h |  2 ++
 src/lib/ecore_wl2/ecore_wl2_window.c  | 25 +++++++++++++++++++++++++
 4 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h
index 4bee824e66..6a7d2507ec 100644
--- a/src/lib/ecore_wl2/Ecore_Wl2.h
+++ b/src/lib/ecore_wl2/Ecore_Wl2.h
@@ -320,6 +320,13 @@ typedef struct _Ecore_Wl2_Event_Window_Deactivate
    Ecore_Wl2_Window *event_win;
 } Ecore_Wl2_Event_Window_Deactivate;
 
+typedef struct _Ecore_Wl2_Event_Window_Common
+{
+   Ecore_Wl2_Window *win;
+   Ecore_Wl2_Window *parent_win;
+   Ecore_Wl2_Window *event_win;
+} Ecore_Wl2_Event_Window_Common;
+
 typedef struct _Ecore_Wl2_Event_Window_Iconify_State_Change
 {
    Ecore_Wl2_Window *win;
@@ -422,6 +429,8 @@ EAPI extern int ECORE_WL2_EVENT_WINDOW_ACTIVATE; /** @since 
1.20 */
 EAPI extern int ECORE_WL2_EVENT_WINDOW_DEACTIVATE; /** @since 1.20 */
 EAPI extern int ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE; /** @since 1.21 */
 EAPI extern int ECORE_WL2_EVENT_WINDOW_OFFSCREEN; /** @since 1.21 */
+EAPI extern int ECORE_WL2_EVENT_WINDOW_CREATE; /** @since 1.25 */
+EAPI extern int ECORE_WL2_EVENT_WINDOW_DESTROY; /** @since 1.25 */
 
 typedef struct _Ecore_Wl2_Surface_Interface
 {
diff --git a/src/lib/ecore_wl2/ecore_wl2.c b/src/lib/ecore_wl2/ecore_wl2.c
index 33e06873cd..a07d3ce27c 100644
--- a/src/lib/ecore_wl2/ecore_wl2.c
+++ b/src/lib/ecore_wl2/ecore_wl2.c
@@ -58,6 +58,8 @@ EAPI int ECORE_WL2_EVENT_WINDOW_ACTIVATE = 0;
 EAPI int ECORE_WL2_EVENT_WINDOW_DEACTIVATE = 0;
 EAPI int ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE = 0;
 EAPI int ECORE_WL2_EVENT_WINDOW_OFFSCREEN = 0;
+EAPI int ECORE_WL2_EVENT_WINDOW_CREATE = 0;
+EAPI int ECORE_WL2_EVENT_WINDOW_DESTROY = 0;
 
 EAPI int _ecore_wl2_event_window_www = -1;
 EAPI int _ecore_wl2_event_window_www_drag = -1;
@@ -203,6 +205,8 @@ ecore_wl2_init(void)
    ECORE_WL2_EVENT_WINDOW_DEACTIVATE = ecore_event_type_new();
    ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE = ecore_event_type_new();
    ECORE_WL2_EVENT_WINDOW_OFFSCREEN = ecore_event_type_new();
+   ECORE_WL2_EVENT_WINDOW_CREATE = ecore_event_type_new();
+   ECORE_WL2_EVENT_WINDOW_DESTROY = ecore_event_type_new();
 
    if (!no_session_recovery)
      no_session_recovery = !!getenv("EFL_NO_WAYLAND_SESSION_RECOVERY");
@@ -277,7 +281,9 @@ ecore_wl2_shutdown(void)
                           ECORE_WL2_EVENT_WINDOW_ACTIVATE,
                           ECORE_WL2_EVENT_WINDOW_DEACTIVATE,
                           ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE,
-                          ECORE_WL2_EVENT_WINDOW_OFFSCREEN);
+                          ECORE_WL2_EVENT_WINDOW_OFFSCREEN
+                          ECORE_WL2_EVENT_WINDOW_CREATE,
+                          ECORE_WL2_EVENT_WINDOW_DESTROY);
 
    /* shutdown Ecore_Event */
    ecore_event_shutdown();
diff --git a/src/lib/ecore_wl2/ecore_wl2_private.h 
b/src/lib/ecore_wl2/ecore_wl2_private.h
index 0f8b7ffc09..e4d19bd1e0 100644
--- a/src/lib/ecore_wl2/ecore_wl2_private.h
+++ b/src/lib/ecore_wl2/ecore_wl2_private.h
@@ -266,6 +266,8 @@ struct _Ecore_Wl2_Window
    Eina_Bool has_buffer : 1;
    Eina_Bool updating : 1;
    Eina_Bool deferred_minimize : 1;
+
+   Eina_Bool visible : 1;
 };
 
 struct _Ecore_Wl2_Output
diff --git a/src/lib/ecore_wl2/ecore_wl2_window.c 
b/src/lib/ecore_wl2/ecore_wl2_window.c
index 3ca227abbc..86ea5d3f90 100644
--- a/src/lib/ecore_wl2/ecore_wl2_window.c
+++ b/src/lib/ecore_wl2/ecore_wl2_window.c
@@ -519,6 +519,7 @@ _ecore_wl2_window_show_send(Ecore_Wl2_Window *window)
    if (window->parent)
      ev->parent_win = window->parent;
    ev->event_win = window;
+   window->visible = EINA_TRUE;
    ecore_event_add(ECORE_WL2_EVENT_WINDOW_SHOW, ev, NULL, NULL);
 }
 
@@ -534,9 +535,27 @@ _ecore_wl2_window_hide_send(Ecore_Wl2_Window *window)
    if (window->parent)
      ev->parent_win = window->parent;
    ev->event_win = window;
+   window->visible = EINA_FALSE;
    ecore_event_add(ECORE_WL2_EVENT_WINDOW_HIDE, ev, NULL, NULL);
 }
 
+static void
+_ecore_wl2_window_create_destroy_send(Ecore_Wl2_Window *window, Eina_Bool 
create)
+{
+   Ecore_Wl2_Event_Window_Hide *ev;
+
+   ev = calloc(1, sizeof(Ecore_Wl2_Event_Window_Common));
+   if (!ev) return;
+
+   ev->win = window;
+   if (window->parent)
+     ev->parent_win = window->parent;
+   ev->event_win = window;
+
+   if (create) ecore_event_add(ECORE_WL2_EVENT_WINDOW_CREATE, ev, NULL, NULL);
+   else ecore_event_add(ECORE_WL2_EVENT_WINDOW_DESTROY, ev, NULL, NULL);
+}
+
 EAPI Ecore_Wl2_Window *
 ecore_wl2_window_new(Ecore_Wl2_Display *display, Ecore_Wl2_Window *parent, int 
x, int y, int w, int h)
 {
@@ -569,6 +588,8 @@ ecore_wl2_window_new(Ecore_Wl2_Display *display, 
Ecore_Wl2_Window *parent, int x
 
    _ecore_wl2_window_surface_create(win);
 
+   _ecore_wl2_window_create_destroy_send(win, EINA_TRUE);
+
    return win;
 }
 
@@ -692,6 +713,10 @@ ecore_wl2_window_free(Ecore_Wl2_Window *window)
 
    EINA_SAFETY_ON_NULL_RETURN(window);
 
+   if (window->visible) _ecore_wl2_window_hide_send(window);
+
+   _ecore_wl2_window_create_destroy_send(window, EINA_FALSE);
+
    display = window->display;
 
    EINA_INLIST_FOREACH(display->inputs, input)

-- 


Reply via email to