forked from enlightenment/efl
This series of patches merges in better support for hiding of surfaces
Essentially, this series modifies ecore_evas and evas engine code in order that we do not need to destroy surfaces when hiding a canvas. Previous code would destroy the wl_surface on ecore_evas_hide and have to recreate it on ecore_evas_show. These patches eliminate the need to do that by setting an engine field ('hidden'). When the evas engines go to post a surface update, if it is 'hidden' then the code will just attach a NULL buffer to the surface. Merge branch 'devs/devilhorns/surface_hide'
This commit is contained in:
commit
515d894fe9
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include <unistd.h>
|
||||
# include <sys/types.h>
|
||||
# include <sys/mman.h>
|
||||
|
||||
#ifdef EAPI
|
||||
# undef EAPI
|
||||
|
|
|
@ -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 <stdio.h>
|
||||
# define LOGFN(fl, ln, fn) \
|
||||
# ifdef LOGFNS
|
||||
# include <stdio.h>
|
||||
# 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 <Eina.h>
|
||||
#include <Ecore.h>
|
||||
#include <Ecore_Input.h>
|
||||
#include <Ecore_Input_Evas.h>
|
||||
#include <Ecore_Wl2.h>
|
||||
# include <Eina.h>
|
||||
# include <Ecore.h>
|
||||
# include <Ecore_Input.h>
|
||||
# include <Ecore_Input_Evas.h>
|
||||
# include <Ecore_Wl2.h>
|
||||
|
||||
#include <Ecore_Evas.h>
|
||||
#endif
|
||||
#include "ecore_wl2_private.h"
|
||||
#include "ecore_private.h"
|
||||
#include "ecore_evas_private.h"
|
||||
#include "ecore_evas_wayland.h"
|
||||
# include <Ecore_Evas.h>
|
||||
# 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;
|
||||
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include <unistd.h>
|
||||
# include <sys/types.h>
|
||||
# include <sys/mman.h>
|
||||
|
||||
#ifdef EAPI
|
||||
# undef EAPI
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue