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.
This commit is contained in:
parent
8abac6da65
commit
1bd41aa3b6
|
@ -362,6 +362,11 @@ typedef struct Ecore_Wl2_Event_Aux_Message
|
|||
Ecore_Wl2_Display *display;
|
||||
} Ecore_Wl2_Event_Aux_Message;
|
||||
|
||||
typedef struct Ecore_Wl2_Event_Window_Offscreen
|
||||
{
|
||||
unsigned int win;
|
||||
} Ecore_Wl2_Event_Window_Offscreen;
|
||||
|
||||
typedef struct _Ecore_Wl2_Buffer Ecore_Wl2_Buffer;
|
||||
|
||||
typedef enum _Ecore_Wl2_Buffer_Type Ecore_Wl2_Buffer_Type;
|
||||
|
@ -418,6 +423,7 @@ EAPI extern int ECORE_WL2_EVENT_WINDOW_HIDE; /** @since 1.20 */
|
|||
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 */
|
||||
|
||||
typedef struct _Ecore_Wl2_Surface_Interface
|
||||
{
|
||||
|
|
|
@ -53,6 +53,7 @@ EAPI int ECORE_WL2_EVENT_WINDOW_HIDE = 0;
|
|||
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_www = -1;
|
||||
EAPI int _ecore_wl2_event_window_www_drag = -1;
|
||||
|
@ -173,6 +174,7 @@ ecore_wl2_init(void)
|
|||
ECORE_WL2_EVENT_WINDOW_ACTIVATE = ecore_event_type_new();
|
||||
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();
|
||||
|
||||
if (!no_session_recovery)
|
||||
no_session_recovery = !!getenv("EFL_NO_WAYLAND_SESSION_RECOVERY");
|
||||
|
@ -246,7 +248,8 @@ ecore_wl2_shutdown(void)
|
|||
ECORE_WL2_EVENT_WINDOW_HIDE,
|
||||
ECORE_WL2_EVENT_WINDOW_ACTIVATE,
|
||||
ECORE_WL2_EVENT_WINDOW_DEACTIVATE,
|
||||
ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE);
|
||||
ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE,
|
||||
ECORE_WL2_EVENT_WINDOW_OFFSCREEN);
|
||||
|
||||
/* shutdown Ecore_Event */
|
||||
ecore_event_shutdown();
|
||||
|
|
|
@ -447,6 +447,16 @@ _surface_leave(void *data, struct wl_surface *surf EINA_UNUSED, struct wl_output
|
|||
EINA_SAFETY_ON_NULL_RETURN(output);
|
||||
|
||||
win->outputs = eina_list_remove(win->outputs, output);
|
||||
if (!win->outputs)
|
||||
{
|
||||
Ecore_Wl2_Event_Window_Offscreen *ev;
|
||||
ev = calloc(1, sizeof(Ecore_Wl2_Event_Window_Offscreen));
|
||||
if (ev)
|
||||
{
|
||||
ev->win = win->id;
|
||||
ecore_event_add(ECORE_WL2_EVENT_WINDOW_OFFSCREEN, ev, NULL, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static const struct wl_surface_listener _surface_listener =
|
||||
|
|
Loading…
Reference in New Issue