summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWoochanlee <wc0917.lee@samsung.com>2020-05-26 11:49:16 -0400
committerChristopher Michael <devilhorns@comcast.net>2020-05-26 11:49:16 -0400
commit9ca13ef5c10904b620407ce8981fadf2a903b180 (patch)
treedda422045e9dc0ec1b1b6cefe915388b4aa66479
parentd584696f12c6d93e26923ad1ce45f3129b6162e6 (diff)
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
-rw-r--r--src/lib/ecore_wl2/Ecore_Wl2.h9
-rw-r--r--src/lib/ecore_wl2/ecore_wl2.c8
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_private.h2
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_window.c25
4 files changed, 43 insertions, 1 deletions
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
320 Ecore_Wl2_Window *event_win; 320 Ecore_Wl2_Window *event_win;
321} Ecore_Wl2_Event_Window_Deactivate; 321} Ecore_Wl2_Event_Window_Deactivate;
322 322
323typedef struct _Ecore_Wl2_Event_Window_Common
324{
325 Ecore_Wl2_Window *win;
326 Ecore_Wl2_Window *parent_win;
327 Ecore_Wl2_Window *event_win;
328} Ecore_Wl2_Event_Window_Common;
329
323typedef struct _Ecore_Wl2_Event_Window_Iconify_State_Change 330typedef struct _Ecore_Wl2_Event_Window_Iconify_State_Change
324{ 331{
325 Ecore_Wl2_Window *win; 332 Ecore_Wl2_Window *win;
@@ -422,6 +429,8 @@ EAPI extern int ECORE_WL2_EVENT_WINDOW_ACTIVATE; /** @since 1.20 */
422EAPI extern int ECORE_WL2_EVENT_WINDOW_DEACTIVATE; /** @since 1.20 */ 429EAPI extern int ECORE_WL2_EVENT_WINDOW_DEACTIVATE; /** @since 1.20 */
423EAPI extern int ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE; /** @since 1.21 */ 430EAPI extern int ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE; /** @since 1.21 */
424EAPI extern int ECORE_WL2_EVENT_WINDOW_OFFSCREEN; /** @since 1.21 */ 431EAPI extern int ECORE_WL2_EVENT_WINDOW_OFFSCREEN; /** @since 1.21 */
432EAPI extern int ECORE_WL2_EVENT_WINDOW_CREATE; /** @since 1.25 */
433EAPI extern int ECORE_WL2_EVENT_WINDOW_DESTROY; /** @since 1.25 */
425 434
426typedef struct _Ecore_Wl2_Surface_Interface 435typedef struct _Ecore_Wl2_Surface_Interface
427{ 436{
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;
58EAPI int ECORE_WL2_EVENT_WINDOW_DEACTIVATE = 0; 58EAPI int ECORE_WL2_EVENT_WINDOW_DEACTIVATE = 0;
59EAPI int ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE = 0; 59EAPI int ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE = 0;
60EAPI int ECORE_WL2_EVENT_WINDOW_OFFSCREEN = 0; 60EAPI int ECORE_WL2_EVENT_WINDOW_OFFSCREEN = 0;
61EAPI int ECORE_WL2_EVENT_WINDOW_CREATE = 0;
62EAPI int ECORE_WL2_EVENT_WINDOW_DESTROY = 0;
61 63
62EAPI int _ecore_wl2_event_window_www = -1; 64EAPI int _ecore_wl2_event_window_www = -1;
63EAPI int _ecore_wl2_event_window_www_drag = -1; 65EAPI int _ecore_wl2_event_window_www_drag = -1;
@@ -203,6 +205,8 @@ ecore_wl2_init(void)
203 ECORE_WL2_EVENT_WINDOW_DEACTIVATE = ecore_event_type_new(); 205 ECORE_WL2_EVENT_WINDOW_DEACTIVATE = ecore_event_type_new();
204 ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE = ecore_event_type_new(); 206 ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE = ecore_event_type_new();
205 ECORE_WL2_EVENT_WINDOW_OFFSCREEN = ecore_event_type_new(); 207 ECORE_WL2_EVENT_WINDOW_OFFSCREEN = ecore_event_type_new();
208 ECORE_WL2_EVENT_WINDOW_CREATE = ecore_event_type_new();
209 ECORE_WL2_EVENT_WINDOW_DESTROY = ecore_event_type_new();
206 210
207 if (!no_session_recovery) 211 if (!no_session_recovery)
208 no_session_recovery = !!getenv("EFL_NO_WAYLAND_SESSION_RECOVERY"); 212 no_session_recovery = !!getenv("EFL_NO_WAYLAND_SESSION_RECOVERY");
@@ -277,7 +281,9 @@ ecore_wl2_shutdown(void)
277 ECORE_WL2_EVENT_WINDOW_ACTIVATE, 281 ECORE_WL2_EVENT_WINDOW_ACTIVATE,
278 ECORE_WL2_EVENT_WINDOW_DEACTIVATE, 282 ECORE_WL2_EVENT_WINDOW_DEACTIVATE,
279 ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE, 283 ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE,
280 ECORE_WL2_EVENT_WINDOW_OFFSCREEN); 284 ECORE_WL2_EVENT_WINDOW_OFFSCREEN
285 ECORE_WL2_EVENT_WINDOW_CREATE,
286 ECORE_WL2_EVENT_WINDOW_DESTROY);
281 287
282 /* shutdown Ecore_Event */ 288 /* shutdown Ecore_Event */
283 ecore_event_shutdown(); 289 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
266 Eina_Bool has_buffer : 1; 266 Eina_Bool has_buffer : 1;
267 Eina_Bool updating : 1; 267 Eina_Bool updating : 1;
268 Eina_Bool deferred_minimize : 1; 268 Eina_Bool deferred_minimize : 1;
269
270 Eina_Bool visible : 1;
269}; 271};
270 272
271struct _Ecore_Wl2_Output 273struct _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)
519 if (window->parent) 519 if (window->parent)
520 ev->parent_win = window->parent; 520 ev->parent_win = window->parent;
521 ev->event_win = window; 521 ev->event_win = window;
522 window->visible = EINA_TRUE;
522 ecore_event_add(ECORE_WL2_EVENT_WINDOW_SHOW, ev, NULL, NULL); 523 ecore_event_add(ECORE_WL2_EVENT_WINDOW_SHOW, ev, NULL, NULL);
523} 524}
524 525
@@ -534,9 +535,27 @@ _ecore_wl2_window_hide_send(Ecore_Wl2_Window *window)
534 if (window->parent) 535 if (window->parent)
535 ev->parent_win = window->parent; 536 ev->parent_win = window->parent;
536 ev->event_win = window; 537 ev->event_win = window;
538 window->visible = EINA_FALSE;
537 ecore_event_add(ECORE_WL2_EVENT_WINDOW_HIDE, ev, NULL, NULL); 539 ecore_event_add(ECORE_WL2_EVENT_WINDOW_HIDE, ev, NULL, NULL);
538} 540}
539 541
542static void
543_ecore_wl2_window_create_destroy_send(Ecore_Wl2_Window *window, Eina_Bool create)
544{
545 Ecore_Wl2_Event_Window_Hide *ev;
546
547 ev = calloc(1, sizeof(Ecore_Wl2_Event_Window_Common));
548 if (!ev) return;
549
550 ev->win = window;
551 if (window->parent)
552 ev->parent_win = window->parent;
553 ev->event_win = window;
554
555 if (create) ecore_event_add(ECORE_WL2_EVENT_WINDOW_CREATE, ev, NULL, NULL);
556 else ecore_event_add(ECORE_WL2_EVENT_WINDOW_DESTROY, ev, NULL, NULL);
557}
558
540EAPI Ecore_Wl2_Window * 559EAPI Ecore_Wl2_Window *
541ecore_wl2_window_new(Ecore_Wl2_Display *display, Ecore_Wl2_Window *parent, int x, int y, int w, int h) 560ecore_wl2_window_new(Ecore_Wl2_Display *display, Ecore_Wl2_Window *parent, int x, int y, int w, int h)
542{ 561{
@@ -569,6 +588,8 @@ ecore_wl2_window_new(Ecore_Wl2_Display *display, Ecore_Wl2_Window *parent, int x
569 588
570 _ecore_wl2_window_surface_create(win); 589 _ecore_wl2_window_surface_create(win);
571 590
591 _ecore_wl2_window_create_destroy_send(win, EINA_TRUE);
592
572 return win; 593 return win;
573} 594}
574 595
@@ -692,6 +713,10 @@ ecore_wl2_window_free(Ecore_Wl2_Window *window)
692 713
693 EINA_SAFETY_ON_NULL_RETURN(window); 714 EINA_SAFETY_ON_NULL_RETURN(window);
694 715
716 if (window->visible) _ecore_wl2_window_hide_send(window);
717
718 _ecore_wl2_window_create_destroy_send(window, EINA_FALSE);
719
695 display = window->display; 720 display = window->display;
696 721
697 EINA_INLIST_FOREACH(display->inputs, input) 722 EINA_INLIST_FOREACH(display->inputs, input)