devilhorns pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=4c140180d19f314cc3c6c610f9c7a0cd01e0e0a0
commit 4c140180d19f314cc3c6c610f9c7a0cd01e0e0a0 Author: Chris Michael <[email protected]> Date: Fri Dec 2 13:02:00 2016 -0500 ecore-wl2: Don't destroy surfaces on window hide In order to hide a window (via wayland) we can actually assign a NULL buffer to the surface, so there is no need to destroy the window's wl_surface during a hide request. Signed-off-by: Chris Michael <[email protected]> --- src/lib/ecore_wl2/ecore_wl2_window.c | 72 ++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 35 deletions(-) diff --git a/src/lib/ecore_wl2/ecore_wl2_window.c b/src/lib/ecore_wl2/ecore_wl2_window.c index 2c19f05..47f3fc8 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); + 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); + 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_SAFETY_ON_NULL_RETURN(window); 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); --
