summaryrefslogtreecommitdiff
path: root/src/lib/ecore_wl2/ecore_wl2_surface.c
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2018-01-30 16:32:45 -0600
committerDerek Foreman <derekf@osg.samsung.com>2018-01-30 17:09:52 -0600
commit879f248f0845be0163dbee0807a4eb859cf12786 (patch)
tree671af085304548ac4060c52238ffb652f7d444e5 /src/lib/ecore_wl2/ecore_wl2_surface.c
parent9632c7b56cc41cef3c1811b745e207599d427607 (diff)
ecore_wl2_surface: Flush surfaces for offscreen windows
When a surface leaves all outputs we can discard its buffers to save memory. Currently most compositors don't send leave events for iconify, so this pretty much just saves us a cursor buffer under weston for now, but in the future it could be used for freeing resources of offscreen (fully occluded or iconified) windows.
Diffstat (limited to 'src/lib/ecore_wl2/ecore_wl2_surface.c')
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_surface.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/lib/ecore_wl2/ecore_wl2_surface.c b/src/lib/ecore_wl2/ecore_wl2_surface.c
index c3a791f7c8..1e101e8405 100644
--- a/src/lib/ecore_wl2/ecore_wl2_surface.c
+++ b/src/lib/ecore_wl2/ecore_wl2_surface.c
@@ -63,6 +63,18 @@ ecore_wl2_surface_flush(Ecore_Wl2_Surface *surface)
63 surface->funcs->flush(surface, surface->private_data); 63 surface->funcs->flush(surface, surface->private_data);
64} 64}
65 65
66static Eina_Bool
67_ecore_wl2_surface_cb_offscreen(void *data, int type EINA_UNUSED, void *event)
68{
69 Ecore_Wl2_Event_Window_Offscreen *ev = event;
70 Ecore_Wl2_Surface *surf = data;
71
72 if (surf->wl2_win->id == (int)ev->win)
73 ecore_wl2_surface_flush(surf);
74
75 return ECORE_CALLBACK_RENEW;
76}
77
66EAPI Ecore_Wl2_Surface * 78EAPI Ecore_Wl2_Surface *
67ecore_wl2_surface_create(Ecore_Wl2_Window *win, Eina_Bool alpha) 79ecore_wl2_surface_create(Ecore_Wl2_Window *win, Eina_Bool alpha)
68{ 80{
@@ -90,6 +102,10 @@ ecore_wl2_surface_create(Ecore_Wl2_Window *win, Eina_Bool alpha)
90 { 102 {
91 out->funcs = intf; 103 out->funcs = intf;
92 win->wl2_surface = out; 104 win->wl2_surface = out;
105 out->offscreen_handler =
106 ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_OFFSCREEN,
107 _ecore_wl2_surface_cb_offscreen,
108 out);
93 return out; 109 return out;
94 } 110 }
95 } 111 }