summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2018-01-30 15:19:43 -0600
committerDerek Foreman <derekf@osg.samsung.com>2018-01-30 17:09:51 -0600
commit1bd41aa3b6d36744c3cd3dd41ed46f5b801a5888 (patch)
tree68003c7246e83fd6d4b0233364e4477f718c0839
parent8abac6da65a1bfd5883383bb72de1215ff555b8f (diff)
ecore_wl2: Add new event for windows not displayed on any output
When a window leaves all outputs we can free its render buffers to save memory. This new event is generated when a window leaves all outputs.
-rw-r--r--src/lib/ecore_wl2/Ecore_Wl2.h6
-rw-r--r--src/lib/ecore_wl2/ecore_wl2.c5
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_window.c10
3 files changed, 20 insertions, 1 deletions
diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h
index 4207bf40cf..238aaef63b 100644
--- a/src/lib/ecore_wl2/Ecore_Wl2.h
+++ b/src/lib/ecore_wl2/Ecore_Wl2.h
@@ -362,6 +362,11 @@ typedef struct Ecore_Wl2_Event_Aux_Message
362 Ecore_Wl2_Display *display; 362 Ecore_Wl2_Display *display;
363} Ecore_Wl2_Event_Aux_Message; 363} Ecore_Wl2_Event_Aux_Message;
364 364
365typedef struct Ecore_Wl2_Event_Window_Offscreen
366{
367 unsigned int win;
368} Ecore_Wl2_Event_Window_Offscreen;
369
365typedef struct _Ecore_Wl2_Buffer Ecore_Wl2_Buffer; 370typedef struct _Ecore_Wl2_Buffer Ecore_Wl2_Buffer;
366 371
367typedef enum _Ecore_Wl2_Buffer_Type Ecore_Wl2_Buffer_Type; 372typedef enum _Ecore_Wl2_Buffer_Type Ecore_Wl2_Buffer_Type;
@@ -418,6 +423,7 @@ EAPI extern int ECORE_WL2_EVENT_WINDOW_HIDE; /** @since 1.20 */
418EAPI extern int ECORE_WL2_EVENT_WINDOW_ACTIVATE; /** @since 1.20 */ 423EAPI extern int ECORE_WL2_EVENT_WINDOW_ACTIVATE; /** @since 1.20 */
419EAPI extern int ECORE_WL2_EVENT_WINDOW_DEACTIVATE; /** @since 1.20 */ 424EAPI extern int ECORE_WL2_EVENT_WINDOW_DEACTIVATE; /** @since 1.20 */
420EAPI extern int ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE; /** @since 1.21 */ 425EAPI extern int ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE; /** @since 1.21 */
426EAPI extern int ECORE_WL2_EVENT_WINDOW_OFFSCREEN; /** @since 1.21 */
421 427
422typedef struct _Ecore_Wl2_Surface_Interface 428typedef struct _Ecore_Wl2_Surface_Interface
423{ 429{
diff --git a/src/lib/ecore_wl2/ecore_wl2.c b/src/lib/ecore_wl2/ecore_wl2.c
index 479ee93ef0..78ac85b6ac 100644
--- a/src/lib/ecore_wl2/ecore_wl2.c
+++ b/src/lib/ecore_wl2/ecore_wl2.c
@@ -53,6 +53,7 @@ EAPI int ECORE_WL2_EVENT_WINDOW_HIDE = 0;
53EAPI int ECORE_WL2_EVENT_WINDOW_ACTIVATE = 0; 53EAPI int ECORE_WL2_EVENT_WINDOW_ACTIVATE = 0;
54EAPI int ECORE_WL2_EVENT_WINDOW_DEACTIVATE = 0; 54EAPI int ECORE_WL2_EVENT_WINDOW_DEACTIVATE = 0;
55EAPI int ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE = 0; 55EAPI int ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE = 0;
56EAPI int ECORE_WL2_EVENT_WINDOW_OFFSCREEN = 0;
56 57
57EAPI int _ecore_wl2_event_window_www = -1; 58EAPI int _ecore_wl2_event_window_www = -1;
58EAPI int _ecore_wl2_event_window_www_drag = -1; 59EAPI int _ecore_wl2_event_window_www_drag = -1;
@@ -173,6 +174,7 @@ ecore_wl2_init(void)
173 ECORE_WL2_EVENT_WINDOW_ACTIVATE = ecore_event_type_new(); 174 ECORE_WL2_EVENT_WINDOW_ACTIVATE = ecore_event_type_new();
174 ECORE_WL2_EVENT_WINDOW_DEACTIVATE = ecore_event_type_new(); 175 ECORE_WL2_EVENT_WINDOW_DEACTIVATE = ecore_event_type_new();
175 ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE = ecore_event_type_new(); 176 ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE = ecore_event_type_new();
177 ECORE_WL2_EVENT_WINDOW_OFFSCREEN = ecore_event_type_new();
176 178
177 if (!no_session_recovery) 179 if (!no_session_recovery)
178 no_session_recovery = !!getenv("EFL_NO_WAYLAND_SESSION_RECOVERY"); 180 no_session_recovery = !!getenv("EFL_NO_WAYLAND_SESSION_RECOVERY");
@@ -246,7 +248,8 @@ ecore_wl2_shutdown(void)
246 ECORE_WL2_EVENT_WINDOW_HIDE, 248 ECORE_WL2_EVENT_WINDOW_HIDE,
247 ECORE_WL2_EVENT_WINDOW_ACTIVATE, 249 ECORE_WL2_EVENT_WINDOW_ACTIVATE,
248 ECORE_WL2_EVENT_WINDOW_DEACTIVATE, 250 ECORE_WL2_EVENT_WINDOW_DEACTIVATE,
249 ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE); 251 ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE,
252 ECORE_WL2_EVENT_WINDOW_OFFSCREEN);
250 253
251 /* shutdown Ecore_Event */ 254 /* shutdown Ecore_Event */
252 ecore_event_shutdown(); 255 ecore_event_shutdown();
diff --git a/src/lib/ecore_wl2/ecore_wl2_window.c b/src/lib/ecore_wl2/ecore_wl2_window.c
index 0e93170876..6d39250015 100644
--- a/src/lib/ecore_wl2/ecore_wl2_window.c
+++ b/src/lib/ecore_wl2/ecore_wl2_window.c
@@ -447,6 +447,16 @@ _surface_leave(void *data, struct wl_surface *surf EINA_UNUSED, struct wl_output
447 EINA_SAFETY_ON_NULL_RETURN(output); 447 EINA_SAFETY_ON_NULL_RETURN(output);
448 448
449 win->outputs = eina_list_remove(win->outputs, output); 449 win->outputs = eina_list_remove(win->outputs, output);
450 if (!win->outputs)
451 {
452 Ecore_Wl2_Event_Window_Offscreen *ev;
453 ev = calloc(1, sizeof(Ecore_Wl2_Event_Window_Offscreen));
454 if (ev)
455 {
456 ev->win = win->id;
457 ecore_event_add(ECORE_WL2_EVENT_WINDOW_OFFSCREEN, ev, NULL, NULL);
458 }
459 }
450} 460}
451 461
452static const struct wl_surface_listener _surface_listener = 462static const struct wl_surface_listener _surface_listener =