ecore_wl2: Call check function through a pointer

We'll need this in the function array when we make surface managers
modular.
This commit is contained in:
Derek Foreman 2018-01-25 14:37:16 -06:00
parent bf4b828cb6
commit 84f703cf67
2 changed files with 8 additions and 5 deletions

View File

@ -564,6 +564,7 @@ typedef struct _Ecore_Wl2_Surface
Eina_Bool alpha : 1;
struct
{
Eina_Bool (*check)(Ecore_Wl2_Window *win);
void (*destroy)(Ecore_Wl2_Surface *surface);
void (*reconfigure)(Ecore_Wl2_Surface *surface, int w, int h, uint32_t flags, Eina_Bool force);
void *(*data_get)(Ecore_Wl2_Surface *surface, int *w, int *h);

View File

@ -245,18 +245,20 @@ ecore_wl2_surface_create(Ecore_Wl2_Window *win, Eina_Bool alpha)
out->w = 0;
out->h = 0;
if (!_evas_dmabuf_surface_check(win)) goto err;
out->funcs.check = _evas_dmabuf_surface_check;
out->funcs.destroy = _evas_dmabuf_surface_destroy;
out->funcs.reconfigure = _evas_dmabuf_surface_reconfigure;
out->funcs.data_get = _evas_dmabuf_surface_data_get;
out->funcs.assign = _evas_dmabuf_surface_assign;
out->funcs.post = _evas_dmabuf_surface_post;
out->funcs.flush = _surface_flush;
win->wl2_surface = out;
return out;
err:
if (out->funcs.check(win))
{
win->wl2_surface = out;
return out;
}
free(out);
return NULL;
}