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.
This commit is contained in:
Derek Foreman 2017-11-30 15:10:22 -06:00
parent 4f63f327b0
commit fdd05f8028
2 changed files with 10 additions and 3 deletions

View File

@ -170,6 +170,8 @@ struct _Ecore_Wl2_Window
Ecore_Wl2_Window *parent; Ecore_Wl2_Window *parent;
Ecore_Wl2_Input *grab; Ecore_Wl2_Input *grab;
Ecore_Wl2_Surface *wl2_surface;
int id, rotation, surface_id; int id, rotation, surface_id;
const char *title; const char *title;
const char *class; const char *class;

View File

@ -146,8 +146,6 @@ _evas_dmabuf_surface_destroy(Ecore_Wl2_Surface *s)
EINA_LIST_FREE(s->buffers, b) EINA_LIST_FREE(s->buffers, b)
ecore_wl2_buffer_destroy(b); ecore_wl2_buffer_destroy(b);
free(s);
} }
EAPI void EAPI void
@ -156,6 +154,9 @@ ecore_wl2_surface_destroy(Ecore_Wl2_Surface *surface)
EINA_SAFETY_ON_NULL_RETURN(surface); EINA_SAFETY_ON_NULL_RETURN(surface);
surface->funcs.destroy(surface); surface->funcs.destroy(surface);
surface->wl2_win = NULL;
free(surface);
} }
EAPI void EAPI void
@ -197,6 +198,10 @@ ecore_wl2_surface_create(Ecore_Wl2_Window *win, Eina_Bool alpha)
Ecore_Wl2_Display *ewd; Ecore_Wl2_Display *ewd;
Ecore_Wl2_Buffer_Type types = 0; 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)); out = calloc(1, sizeof(*out));
if (!out) return NULL; if (!out) return NULL;
out->wl2_win = win; 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.data_get = _evas_dmabuf_surface_data_get;
out->funcs.assign = _evas_dmabuf_surface_assign; out->funcs.assign = _evas_dmabuf_surface_assign;
out->funcs.post = _evas_dmabuf_surface_post; out->funcs.post = _evas_dmabuf_surface_post;
win->wl2_surface = out;
return out; return out;
err: err: