diff --git a/src/lib/ecore_wayland/Ecore_Wayland.h b/src/lib/ecore_wayland/Ecore_Wayland.h index e33c0b7167..703c2a6d73 100644 --- a/src/lib/ecore_wayland/Ecore_Wayland.h +++ b/src/lib/ecore_wayland/Ecore_Wayland.h @@ -567,6 +567,7 @@ EAPI void ecore_wl_window_move(Ecore_Wl_Window *win, int x, int y); EAPI void ecore_wl_window_resize(Ecore_Wl_Window *win, int w, int h, int location); EAPI void ecore_wl_window_damage(Ecore_Wl_Window *win, int x, int y, int w, int h); EAPI void ecore_wl_window_buffer_attach(Ecore_Wl_Window *win, struct wl_buffer *buffer, int x, int y); +EAPI struct wl_compositor *ecore_wl_compositor_get(void); /* @since 1.8 */ EAPI void ecore_wl_window_commit(Ecore_Wl_Window *win); diff --git a/src/lib/ecore_wayland/ecore_wl.c b/src/lib/ecore_wayland/ecore_wl.c index a19b45a7ff..e4f69dc96c 100644 --- a/src/lib/ecore_wayland/ecore_wl.c +++ b/src/lib/ecore_wayland/ecore_wl.c @@ -301,6 +301,12 @@ ecore_wl_registry_get(void) return _ecore_wl_disp->wl.registry; } +EAPI struct wl_compositor * +ecore_wl_compositor_get(void) +{ + return _ecore_wl_compositor_get(); +} + struct wl_compositor * _ecore_wl_compositor_get(void) { diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c index a850c81c49..f87a6bbca2 100644 --- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c +++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c @@ -211,7 +211,9 @@ ecore_evas_wayland_egl_new_internal(const char *disp_name, unsigned int parent, if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas))) { + struct wl_compositor *temp_comp = NULL; einfo->info.display = ecore_wl_display_get(); + einfo->info.compositor = ecore_wl_compositor_get(); einfo->info.destination_alpha = EINA_TRUE; einfo->info.rotation = ee->rotation; einfo->info.depth = 32; diff --git a/src/modules/evas/engines/wayland_egl/Evas_Engine_Wayland_Egl.h b/src/modules/evas/engines/wayland_egl/Evas_Engine_Wayland_Egl.h index e06f82cf37..532b5e46d0 100644 --- a/src/modules/evas/engines/wayland_egl/Evas_Engine_Wayland_Egl.h +++ b/src/modules/evas/engines/wayland_egl/Evas_Engine_Wayland_Egl.h @@ -27,6 +27,7 @@ struct _Evas_Engine_Info_Wayland_Egl struct wl_display *display; struct wl_surface *surface; struct wl_egl_window *win; + struct wl_compositor *compositor; int depth, screen, rotation, edges; unsigned int destination_alpha : 1; } info; diff --git a/src/modules/evas/engines/wayland_egl/evas_engine.c b/src/modules/evas/engines/wayland_egl/evas_engine.c index ab8a9c2524..b701c96f4b 100644 --- a/src/modules/evas/engines/wayland_egl/evas_engine.c +++ b/src/modules/evas/engines/wayland_egl/evas_engine.c @@ -36,6 +36,14 @@ struct _Native void *egl_surface; }; +/* Evas GL wl_surface & wl_egl_window */ +typedef struct _Evgl_wl_Surface Evgl_wl_Surface; +struct _Evgl_wl_Surface +{ + struct wl_surface *wl_surf; + struct wl_egl_window *egl_win; +}; + /* local function prototypes */ typedef void (*_eng_fn) (void); typedef _eng_fn (*glsym_func_eng_fn) (); @@ -257,33 +265,43 @@ evgl_eng_evas_surface_get(void *data) static void * evgl_eng_native_window_create(void *data) { + Evgl_wl_Surface* surface = NULL; Render_Engine *re; Outbuf *ob; - struct wl_egl_window *win; if (!(re = (Render_Engine *)data)) return NULL; if (!(ob = eng_get_ob(re))) return NULL; - if (!(win = wl_egl_window_create(ob->info->info.surface, 1, 1))) + if (!(surface = calloc(1, sizeof(Evgl_wl_Surface)))) + return NULL; + surface->wl_surf = wl_compositor_create_surface(ob->compositor); + if (!surface->wl_surf) + { + ERR("Could not create wl_surface: %m"); + return NULL; + } + surface->egl_win = wl_egl_window_create(surface->wl_surf, 1, 1); + if (!surface->egl_win) { ERR("Could not create wl_egl window: %m"); return NULL; } - - return (void *)win; + return (void *)surface; } static int evgl_eng_native_window_destroy(void *data, void *win) { - Render_Engine *re; + Evgl_wl_Surface* surface = NULL; - if (!(re = (Render_Engine *)data)) return 0; if (!win) return 0; + surface = (Evgl_wl_Surface*)win; + if (surface->egl_win) + wl_egl_window_destroy((struct wl_egl_window *)surface->egl_win); + if (surface->wl_surf) + wl_surface_destroy(surface->wl_surf); - wl_egl_window_destroy((struct wl_egl_window *)win); - win = NULL; - + free(surface); return 1; } diff --git a/src/modules/evas/engines/wayland_egl/evas_engine.h b/src/modules/evas/engines/wayland_egl/evas_engine.h index 0d22968e17..8595e4724e 100644 --- a/src/modules/evas/engines/wayland_egl/evas_engine.h +++ b/src/modules/evas/engines/wayland_egl/evas_engine.h @@ -54,6 +54,7 @@ struct _Outbuf struct wl_display *disp; struct wl_egl_window *win; struct wl_surface *surface; + struct wl_compositor *compositor; int w, h; int depth, screen, rot, alpha; diff --git a/src/modules/evas/engines/wayland_egl/evas_wl_main.c b/src/modules/evas/engines/wayland_egl/evas_wl_main.c index 6d1339098b..39c3247331 100644 --- a/src/modules/evas/engines/wayland_egl/evas_wl_main.c +++ b/src/modules/evas/engines/wayland_egl/evas_wl_main.c @@ -31,6 +31,7 @@ eng_window_new(Evas *evas, Evas_Engine_Info_Wayland_Egl *einfo, int w, int h, Re gw->disp = einfo->info.display; gw->surface = einfo->info.surface; gw->screen = einfo->info.screen; + gw->compositor = einfo->info.compositor; gw->depth = einfo->info.depth; gw->alpha = einfo->info.destination_alpha; gw->rot = einfo->info.rotation;