forked from enlightenment/efl
ecore_evas/wayland_shm: Fixed window resize.
Using the server_allocation/allocation to determine the resize offset was not completely precise, and causing the window to not always resize correctly. Additionally, calling evas_engine_info_set() on every resize step caused the window content to blink and resize very slow, because the swap buffer, swapper, and everything were being destroyed and recreated. Now only the swapbuf_reconfigure is being called during the resize, which is way faster.
This commit is contained in:
parent
cf67e69b50
commit
dc0d88df9c
|
@ -299,28 +299,14 @@ _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h)
|
|||
if (wdata->win)
|
||||
{
|
||||
Ecore_Wl_Window *win;
|
||||
Evas_Coord x = 0, y = 0;
|
||||
Evas_Engine_Info_Wayland_Shm *einfo;
|
||||
|
||||
win = wdata->win;
|
||||
if (win->surface)
|
||||
{
|
||||
if (win->edges & 4)
|
||||
x = win->server_allocation.w - win->allocation.w;
|
||||
if (win->edges & 1)
|
||||
y = win->server_allocation.h - win->allocation.h;
|
||||
}
|
||||
|
||||
win->edges = 0;
|
||||
|
||||
if ((einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas)))
|
||||
{
|
||||
printf("Setting Resize Edges: %d %d\n", x, y);
|
||||
einfo->info.edges.x = x;
|
||||
einfo->info.edges.y = y;
|
||||
if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
|
||||
ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
|
||||
}
|
||||
einfo->info.edges = win->edges;
|
||||
|
||||
win->edges = 0;
|
||||
|
||||
win->server_allocation = win->allocation;
|
||||
ecore_wl_window_update_size(wdata->win, w, h);
|
||||
|
|
|
@ -18,10 +18,7 @@ struct _Evas_Engine_Info_Wayland_Shm
|
|||
|
||||
unsigned int rotation, depth;
|
||||
Eina_Bool destination_alpha : 1;
|
||||
struct
|
||||
{
|
||||
int x, y;
|
||||
} edges;
|
||||
int edges;
|
||||
} info;
|
||||
|
||||
/* non-blocking or blocking mode */
|
||||
|
|
|
@ -9,6 +9,7 @@ typedef struct _Render_Engine Render_Engine;
|
|||
|
||||
struct _Render_Engine
|
||||
{
|
||||
Evas_Engine_Info_Wayland_Shm *info;
|
||||
Outbuf *ob;
|
||||
Tilebuf *tb;
|
||||
|
||||
|
@ -237,13 +238,14 @@ eng_setup(Evas *eo_evas, void *einfo)
|
|||
}
|
||||
|
||||
if (!(re =
|
||||
_output_engine_setup(info->info.edges.x, info->info.edges.y,
|
||||
_output_engine_setup(0, 0,
|
||||
epd->output.w, epd->output.h,
|
||||
info->info.rotation, info->info.depth,
|
||||
info->info.destination_alpha,
|
||||
info->info.wl_shm, info->info.wl_surface,
|
||||
try_swap)))
|
||||
return 0;
|
||||
re->info = info;
|
||||
}
|
||||
|
||||
else
|
||||
|
@ -255,8 +257,8 @@ eng_setup(Evas *eo_evas, void *einfo)
|
|||
/* we have an existing render engine */
|
||||
if (re->ob) re->outbuf_free(re->ob);
|
||||
|
||||
if ((re->ob = evas_swapbuf_setup(info->info.edges.x,
|
||||
info->info.edges.y,
|
||||
if ((re->ob = evas_swapbuf_setup(0,
|
||||
0,
|
||||
epd->output.w, epd->output.h,
|
||||
info->info.rotation,
|
||||
info->info.depth,
|
||||
|
@ -320,14 +322,23 @@ static void
|
|||
eng_output_resize(void *data, int w, int h)
|
||||
{
|
||||
Render_Engine *re;
|
||||
Evas_Engine_Info_Wayland_Shm *info;
|
||||
int dx = 0, dy = 0;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!(re = (Render_Engine *)data)) return;
|
||||
|
||||
re->outbuf_reconfigure(re->ob, re->ob->x, re->ob->y, w, h,
|
||||
re->ob->rotation, re->ob->depth,
|
||||
re->ob->priv.destination_alpha);
|
||||
if (!(info = re->info)) return;
|
||||
|
||||
if (info->info.edges & 4)
|
||||
dx = re->ob->w - w;
|
||||
if (info->info.edges & 1)
|
||||
dy = re->ob->h - h;
|
||||
|
||||
re->outbuf_reconfigure(re->ob, dx, dy, w, h,
|
||||
info->info.rotation, info->info.depth,
|
||||
info->info.destination_alpha);
|
||||
evas_common_tilebuf_free(re->tb);
|
||||
if ((re->tb = evas_common_tilebuf_new(w, h)))
|
||||
evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
typedef struct _Wl_Buffer Wl_Buffer;
|
||||
struct _Wl_Buffer
|
||||
{
|
||||
int x, y, w, h;
|
||||
int w, h;
|
||||
struct wl_buffer *buffer;
|
||||
void *data;
|
||||
int offset;
|
||||
|
@ -320,8 +320,6 @@ _evas_swapper_buffer_new(Wl_Swapper *ws, Wl_Buffer *wb)
|
|||
/* make sure swapper has a shm */
|
||||
if (!ws->shm) return EINA_FALSE;
|
||||
|
||||
wb->x = ws->x;
|
||||
wb->y = ws->y;
|
||||
wb->w = ws->w;
|
||||
wb->h = ws->h;
|
||||
|
||||
|
@ -421,9 +419,9 @@ _evas_swapper_buffer_put(Wl_Swapper *ws, Wl_Buffer *wb, Eina_Rectangle *rects, u
|
|||
/* surface attach */
|
||||
if (sent != wb->buffer)
|
||||
{
|
||||
wl_surface_attach(ws->surface, wb->buffer, wb->x, wb->y);
|
||||
wb->x = 0;
|
||||
wb->y = 0;
|
||||
wl_surface_attach(ws->surface, wb->buffer, ws->x, ws->y);
|
||||
ws->x = 0;
|
||||
ws->y = 0;
|
||||
sent = wb->buffer;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue