From: Derek Foreman Date: Thu, 30 Nov 2017 21:10:22 +0000 (-0600) Subject: ecore_wl2: add Ecore_Wl2_Surface to Ecore_Wl2_Window X-Git-Tag: submit/sandbox/upgrade/efl120/20180319.053334~1416 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fdd05f8028c658534c6444f02fbfc40d92614903;p=platform%2Fupstream%2Fefl.git ecore_wl2: add Ecore_Wl2_Surface to Ecore_Wl2_Window Track the surface of a window and only allow one. Eventually this might be worthwhile to apply to subsurfaces, but for today lazy is the way. --- diff --git a/src/lib/ecore_wl2/ecore_wl2_private.h b/src/lib/ecore_wl2/ecore_wl2_private.h index 8e1c2fb..c8865bc 100644 --- a/src/lib/ecore_wl2/ecore_wl2_private.h +++ b/src/lib/ecore_wl2/ecore_wl2_private.h @@ -170,6 +170,8 @@ struct _Ecore_Wl2_Window Ecore_Wl2_Window *parent; Ecore_Wl2_Input *grab; + Ecore_Wl2_Surface *wl2_surface; + int id, rotation, surface_id; const char *title; const char *class; diff --git a/src/lib/ecore_wl2/ecore_wl2_surface.c b/src/lib/ecore_wl2/ecore_wl2_surface.c index 9a1c8ea..8fcf9c1 100644 --- a/src/lib/ecore_wl2/ecore_wl2_surface.c +++ b/src/lib/ecore_wl2/ecore_wl2_surface.c @@ -146,8 +146,6 @@ _evas_dmabuf_surface_destroy(Ecore_Wl2_Surface *s) EINA_LIST_FREE(s->buffers, b) ecore_wl2_buffer_destroy(b); - - free(s); } EAPI void @@ -156,6 +154,9 @@ ecore_wl2_surface_destroy(Ecore_Wl2_Surface *surface) EINA_SAFETY_ON_NULL_RETURN(surface); surface->funcs.destroy(surface); + surface->wl2_win = NULL; + + free(surface); } EAPI void @@ -197,6 +198,10 @@ ecore_wl2_surface_create(Ecore_Wl2_Window *win, Eina_Bool alpha) Ecore_Wl2_Display *ewd; Ecore_Wl2_Buffer_Type types = 0; + EINA_SAFETY_ON_NULL_RETURN_VAL(win, NULL); + + if (win->wl2_surface) return win->wl2_surface; + out = calloc(1, sizeof(*out)); if (!out) return NULL; out->wl2_win = win; @@ -219,7 +224,7 @@ ecore_wl2_surface_create(Ecore_Wl2_Window *win, Eina_Bool alpha) out->funcs.data_get = _evas_dmabuf_surface_data_get; out->funcs.assign = _evas_dmabuf_surface_assign; out->funcs.post = _evas_dmabuf_surface_post; - + win->wl2_surface = out; return out; err: