diff --git a/src/lib/ecore_wl2/ecore_wl2_window.c b/src/lib/ecore_wl2/ecore_wl2_window.c index 2c19f05ec1..47f3fc85f8 100644 --- a/src/lib/ecore_wl2/ecore_wl2_window.c +++ b/src/lib/ecore_wl2/ecore_wl2_window.c @@ -338,24 +338,25 @@ surf_err: static void _ecore_wl2_window_surface_create(Ecore_Wl2_Window *window) { - if (window->surface) return; - EINA_SAFETY_ON_NULL_RETURN(window->display->wl.compositor); - window->surface = - wl_compositor_create_surface(window->display->wl.compositor); if (!window->surface) { - ERR("Failed to create surface for window"); - return; + window->surface = + wl_compositor_create_surface(window->display->wl.compositor); + if (!window->surface) + { + ERR("Failed to create surface for window"); + return; + } + + window->surface_id = + wl_proxy_get_id((struct wl_proxy *)window->surface); + + if (window->display->wl.session_recovery) + zwp_e_session_recovery_add_listener(window->display->wl.session_recovery, + &_session_listener, window); } - - window->surface_id = - wl_proxy_get_id((struct wl_proxy *)window->surface); - - if (window->display->wl.session_recovery) - zwp_e_session_recovery_add_listener(window->display->wl.session_recovery, - &_session_listener, window); } EAPI Ecore_Wl2_Window * @@ -443,36 +444,14 @@ ecore_wl2_window_hide(Ecore_Wl2_Window *window) { Ecore_Wl2_Subsurface *subsurf; Eina_Inlist *tmp; + EINA_SAFETY_ON_NULL_RETURN(window); - if (window->xdg_surface) xdg_surface_destroy(window->xdg_surface); - window->xdg_surface = NULL; - - if (window->xdg_popup) xdg_popup_destroy(window->xdg_popup); - window->xdg_popup = NULL; - - if (window->wl_shell_surface) - wl_shell_surface_destroy(window->wl_shell_surface); - window->wl_shell_surface = NULL; - - if (window->www_surface) - www_surface_destroy(window->www_surface); - window->www_surface = NULL; - EINA_INLIST_FOREACH_SAFE(window->subsurfs, tmp, subsurf) _ecore_wl2_subsurf_unmap(subsurf); - if (window->uuid && window->surface && window->display->wl.session_recovery) - zwp_e_session_recovery_destroy_uuid(window->display->wl.session_recovery, - window->surface, window->uuid); - - if (window->surface) wl_surface_destroy(window->surface); - window->surface = NULL; - window->configure_serial = 0; window->configure_ack = NULL; - - window->surface_id = -1; } EAPI void @@ -493,7 +472,30 @@ ecore_wl2_window_free(Ecore_Wl2_Window *window) EINA_INLIST_FOREACH_SAFE(window->subsurfs, tmp, subsurf) _ecore_wl2_subsurf_free(subsurf); + if (window->xdg_surface) xdg_surface_destroy(window->xdg_surface); + window->xdg_surface = NULL; + + if (window->xdg_popup) xdg_popup_destroy(window->xdg_popup); + window->xdg_popup = NULL; + + if (window->wl_shell_surface) + wl_shell_surface_destroy(window->wl_shell_surface); + window->wl_shell_surface = NULL; + + if (window->www_surface) + www_surface_destroy(window->www_surface); + window->www_surface = NULL; + ecore_wl2_window_hide(window); + + if (window->uuid && window->surface && window->display->wl.session_recovery) + zwp_e_session_recovery_destroy_uuid(window->display->wl.session_recovery, + window->surface, window->uuid); + + if (window->surface) wl_surface_destroy(window->surface); + window->surface = NULL; + window->surface_id = -1; + eina_stringshare_replace(&window->uuid, NULL); if (window->title) eina_stringshare_del(window->title); diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index da07122f1a..7bbf379931 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -956,7 +956,6 @@ _elm_win_mouse_out(Ecore_Evas *ee) if ((sd->wl.win) && (sd->pointer.ee)) { ecore_evas_hide(sd->pointer.ee); - sd->pointer.surf = NULL; ecore_wl2_window_pointer_set(sd->wl.win, NULL, sd->pointer.hot_x, sd->pointer.hot_y); } @@ -2272,7 +2271,6 @@ _efl_ui_win_hide(Eo *obj, Efl_Ui_Win_Data *sd) if (sd->pointer.ee) { ecore_evas_hide(sd->pointer.ee); - sd->pointer.surf = NULL; ecore_wl2_window_pointer_set(sd->wl.win, NULL, sd->pointer.hot_x, sd->pointer.hot_y); } diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c index a4c2f36ba9..81d16a44ad 100644 --- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c +++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c @@ -1752,18 +1752,13 @@ _ecore_evas_wl_common_show(Ecore_Evas *ee) einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas); if (einfo) { - struct wl_surface *surf; - - surf = ecore_wl2_window_surface_get(wdata->win); - if ((!einfo->info.wl_surface) || (einfo->info.wl_surface != surf)) - { - einfo->info.wl_surface = surf; - if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) - ERR("Failed to set Evas Engine Info for '%s'", ee->driver); - evas_damage_rectangle_add(ee->evas, 0, 0, ee->w + fw, ee->h + fh); - } + einfo->info.wl_surface = ecore_wl2_window_surface_get(wdata->win); + einfo->info.hidden = EINA_FALSE; einfo->www_avail = !!wdata->win->www_surface; einfo->just_mapped = EINA_TRUE; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + ERR("Failed to set Evas Engine Info for '%s'", ee->driver); + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w + fw, ee->h + fh); } } @@ -1793,7 +1788,7 @@ _ecore_evas_wl_common_hide(Ecore_Evas *ee) einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas); if (einfo) { - einfo->info.wl_surface = NULL; + einfo->info.hidden = EINA_TRUE; if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) { ERR("Failed to set Evas Engine Info for '%s'", ee->driver); 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 f342252a83..0ecd868975 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 @@ -4,8 +4,6 @@ # include # include # include -# include -# include #ifdef EAPI # undef EAPI diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h index 77b2778c31..cb02409437 100644 --- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h +++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h @@ -1,34 +1,35 @@ #ifndef _ECORE_EVAS_WAYLAND_PRIVATE_H_ -#define _ECORE_EVAS_WAYLAND_PRIVATE_H_ +# define _ECORE_EVAS_WAYLAND_PRIVATE_H_ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif +# ifdef HAVE_CONFIG_H +# include "config.h" +# endif -#define ECORE_EVAS_INTERNAL +# define ECORE_EVAS_INTERNAL -#ifndef ELEMENTARY_H +# ifndef ELEMENTARY_H //#define LOGFNS 1 -#ifdef LOGFNS -# include -# define LOGFN(fl, ln, fn) \ +# ifdef LOGFNS +# include +# define LOGFN(fl, ln, fn) \ printf("-ECORE_EVAS-WL: %25s: %5i - %s\n", fl, ln, fn); -#else -# define LOGFN(fl, ln, fn) -#endif +# else +# define LOGFN(fl, ln, fn) +# endif -#include -#include -#include -#include -#include +# include +# include +# include +# include +# include -#include -#endif -#include "ecore_wl2_private.h" -#include "ecore_private.h" -#include "ecore_evas_private.h" -#include "ecore_evas_wayland.h" +# include +# endif + +# include "ecore_wl2_private.h" +# include "ecore_private.h" +# include "ecore_evas_private.h" +# include "ecore_evas_wayland.h" typedef struct _Ecore_Evas_Engine_Wl_Data Ecore_Evas_Engine_Wl_Data; diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c index e538f99b99..b01d02bf18 100644 --- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c +++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c @@ -4,8 +4,6 @@ # include # include # include -# include -# include #ifdef EAPI # undef EAPI diff --git a/src/modules/evas/engines/wayland_common/Evas_Engine_Wayland.h b/src/modules/evas/engines/wayland_common/Evas_Engine_Wayland.h index 4307ebf1f7..f2b4e51417 100644 --- a/src/modules/evas/engines/wayland_common/Evas_Engine_Wayland.h +++ b/src/modules/evas/engines/wayland_common/Evas_Engine_Wayland.h @@ -20,6 +20,7 @@ struct _Evas_Engine_Info_Wayland int depth, rotation, edges; int compositor_version; Eina_Bool destination_alpha : 1; + Eina_Bool hidden : 1; } info; /* non-blocking or blocking mode */ diff --git a/src/modules/evas/engines/wayland_shm/evas_dmabuf.c b/src/modules/evas/engines/wayland_shm/evas_dmabuf.c index 63d6e30ddd..df04b5e57b 100644 --- a/src/modules/evas/engines/wayland_shm/evas_dmabuf.c +++ b/src/modules/evas/engines/wayland_shm/evas_dmabuf.c @@ -390,7 +390,7 @@ _fallback(Dmabuf_Surface *s, int w, int h) new_data = surf->funcs.data_get(surf, NULL, NULL); for (y = 0; y < h; y++) memcpy(new_data + y * w * 4, old_data + y * b->stride, w * 4); - surf->funcs.post(surf, NULL, 0); + surf->funcs.post(surf, NULL, 0, EINA_FALSE); buffer_manager->unmap(b); out: @@ -600,7 +600,7 @@ _evas_dmabuf_surface_assign(Surface *s) } static void -_evas_dmabuf_surface_post(Surface *s, Eina_Rectangle *rects, unsigned int count) +_evas_dmabuf_surface_post(Surface *s, Eina_Rectangle *rects, unsigned int count, Eina_Bool hidden) { Dmabuf_Surface *surface; Dmabuf_Buffer *b; @@ -626,9 +626,16 @@ _evas_dmabuf_surface_post(Surface *s, Eina_Rectangle *rects, unsigned int count) return; } surface->pre = NULL; - wl_surface_attach(surface->wl_surface, b->wl_buffer, 0, 0); - _evas_surface_damage(surface->wl_surface, surface->compositor_version, - b->w, b->h, rects, count); + + if (!hidden) + { + wl_surface_attach(surface->wl_surface, b->wl_buffer, 0, 0); + _evas_surface_damage(surface->wl_surface, surface->compositor_version, + b->w, b->h, rects, count); + } + else + wl_surface_attach(surface->wl_surface, NULL, 0, 0); + wl_surface_commit(surface->wl_surface); } diff --git a/src/modules/evas/engines/wayland_shm/evas_engine.h b/src/modules/evas/engines/wayland_shm/evas_engine.h index e3a05530b4..5bfb6c1c53 100644 --- a/src/modules/evas/engines/wayland_shm/evas_engine.h +++ b/src/modules/evas/engines/wayland_shm/evas_engine.h @@ -99,7 +99,7 @@ struct _Surface void (*reconfigure)(Surface *surface, int w, int h, uint32_t flags); void *(*data_get)(Surface *surface, int *w, int *h); int (*assign)(Surface *surface); - void (*post)(Surface *surface, Eina_Rectangle *rects, unsigned int count); + void (*post)(Surface *surface, Eina_Rectangle *rects, unsigned int count, Eina_Bool hidden); } funcs; }; @@ -133,6 +133,8 @@ struct _Outbuf /* Eina_Bool redraw : 1; */ Eina_Bool destination_alpha : 1; } priv; + + Eina_Bool hidden : 1; }; Eina_Bool _evas_dmabuf_surface_create(Surface *s, int w, int h, int num_buff); diff --git a/src/modules/evas/engines/wayland_shm/evas_outbuf.c b/src/modules/evas/engines/wayland_shm/evas_outbuf.c index b25242fe99..fcfb8b95a5 100644 --- a/src/modules/evas/engines/wayland_shm/evas_outbuf.c +++ b/src/modules/evas/engines/wayland_shm/evas_outbuf.c @@ -55,6 +55,7 @@ _evas_outbuf_setup(int w, int h, Evas_Engine_Info_Wayland *info) ob->rotation = info->info.rotation; ob->depth = info->info.depth; ob->priv.destination_alpha = info->info.destination_alpha; + ob->hidden = info->info.hidden; /* default to triple buffer */ ob->num_buff = 3; @@ -82,7 +83,8 @@ _evas_outbuf_setup(int w, int h, Evas_Engine_Info_Wayland *info) sw = h; sh = w; } - else goto unhandled_rotation; + else + goto unhandled_rotation; ob->surface = _evas_surface_create(info, sw, sh, ob->num_buff); if (!ob->surface) goto surf_err; @@ -203,6 +205,8 @@ _evas_outbuf_flush(Outbuf *ob, Tilebuf_Rect *surface_damage EINA_UNUSED, Tilebuf LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (ob->hidden) return; + if (render_mode == EVAS_RENDER_MODE_ASYNC_INIT) return; if (ob->priv.rect_count) free(ob->priv.rects); @@ -359,6 +363,8 @@ _evas_outbuf_reconfigure(Outbuf *ob, int w, int h, int rot, Outbuf_Depth depth, ob->depth = depth; ob->priv.destination_alpha = alpha; + if (ob->hidden) return; + if ((ob->rotation == 0) || (ob->rotation == 180)) { ob->surface->funcs.reconfigure(ob->surface, w, h, resize); @@ -626,7 +632,7 @@ _evas_outbuf_redraws_clear(Outbuf *ob) { if (!ob->priv.rect_count) return; if (ob->info->info.wl_surface) - ob->surface->funcs.post(ob->surface, ob->priv.rects, ob->priv.rect_count); + ob->surface->funcs.post(ob->surface, ob->priv.rects, ob->priv.rect_count, ob->hidden); free(ob->priv.rects); ob->priv.rect_count = 0; } diff --git a/src/modules/evas/engines/wayland_shm/evas_shm.c b/src/modules/evas/engines/wayland_shm/evas_shm.c index b6667c7f71..d38a19fd49 100644 --- a/src/modules/evas/engines/wayland_shm/evas_shm.c +++ b/src/modules/evas/engines/wayland_shm/evas_shm.c @@ -543,9 +543,8 @@ _evas_shm_surface_data_get(Surface *s, int *w, int *h) } void -_evas_shm_surface_post(Surface *s, Eina_Rectangle *rects, unsigned int count) +_evas_shm_surface_post(Surface *s, Eina_Rectangle *rects, unsigned int count, Eina_Bool hidden) { - /* struct wl_callback *frame_cb; */ Shm_Surface *surf; Shm_Leaf *leaf; @@ -557,12 +556,15 @@ _evas_shm_surface_post(Surface *s, Eina_Rectangle *rects, unsigned int count) if (!surf->surface) return; - wl_surface_attach(surf->surface, leaf->data->buffer, 0, 0); + if (!hidden) + { + wl_surface_attach(surf->surface, leaf->data->buffer, 0, 0); - _evas_surface_damage(surf->surface, surf->compositor_version, - leaf->w, leaf->h, rects, count); - /* frame_cb = wl_surface_frame(surface->surface); */ - /* wl_callback_add_listener(frame_cb, &_shm_frame_listener, surface); */ + _evas_surface_damage(surf->surface, surf->compositor_version, + leaf->w, leaf->h, rects, count); + } + else + wl_surface_attach(surf->surface, NULL, 0, 0); wl_surface_commit(surf->surface);