Merge branch 'framespace'

This commit is contained in:
Chris Michael 2013-09-04 14:36:29 +01:00
commit 03604a15b6
8 changed files with 147 additions and 96 deletions

View File

@ -206,11 +206,6 @@ struct _Ecore_Wl_Window
struct wl_surface *surface;
struct wl_shell_surface *shell_surface;
struct
{
struct wl_region *input, *opaque;
} region;
struct
{
struct wl_surface *surface;
@ -219,11 +214,14 @@ struct _Ecore_Wl_Window
} pointer;
int id, surface_id;
int x, y;
int edges;
Eina_Rectangle allocation, pending_allocation;
Eina_Rectangle saved_allocation, server_allocation;
Eina_Rectangle allocation;
struct
{
int w, h;
} saved, server;
/* Eina_Bool redraw_scheduled : 1; */
/* Eina_Bool resize_scheduled : 1; */
@ -708,6 +706,40 @@ EAPI Eina_Bool ecore_wl_window_alpha_get(Ecore_Wl_Window *win);
*/
EAPI Ecore_Wl_Window *ecore_wl_window_surface_find(struct wl_surface *surface);
/**
* Set the input region of the Ecore_Wl_Window.
*
* To set an empty region, pass width and height as 0.
*
* An empty input region means the entire window surface will accept input.
*
* @param win The window
* @param x The left point of the region.
* @param y The top point of the region.
* @param w The width of the region.
* @param h The height of the region.
*
* @ingroup Ecore_Wl_Window_Group
* @since 1.8
*/
EAPI void ecore_wl_window_input_region_set(Ecore_Wl_Window *win, int x, int y, int w, int h);
/**
* Set the opaque region of the Ecore_Wl_Window
*
* To set an empty region, pass width and height as 0.
*
* @param win The window
* @param x The left point of the region.
* @param y The top point of the region.
* @param w The width of the region.
* @param h The height of the region.
*
* @ingroup Ecore_Wl_Window_Group
* @since 1.8
*/
EAPI void ecore_wl_window_opaque_region_set(Ecore_Wl_Window *win, int x, int y, int w, int h);
/**
* @defgroup Ecore_Wl_Dnd_Group Functions dealing with Wayland Drag-n-Drop
* @ingroup Ecore_Wl_Group

View File

@ -73,7 +73,8 @@ ecore_wl_window_new(Ecore_Wl_Window *parent, int x, int y, int w, int h, int buf
win->allocation.y = y;
win->allocation.w = w;
win->allocation.h = h;
win->saved_allocation = win->allocation;
win->saved.w = w;
win->saved.h = h;
win->transparent = EINA_FALSE;
win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
win->buffer_type = buffer_type;
@ -107,11 +108,6 @@ ecore_wl_window_free(Ecore_Wl_Window *win)
if (win->anim_callback) wl_callback_destroy(win->anim_callback);
win->anim_callback = NULL;
if (win->region.input) wl_region_destroy(win->region.input);
win->region.input = NULL;
if (win->region.opaque) wl_region_destroy(win->region.opaque);
win->region.opaque = NULL;
if (win->shell_surface) wl_shell_surface_destroy(win->shell_surface);
win->shell_surface = NULL;
if (win->surface) wl_surface_destroy(win->surface);
@ -128,8 +124,7 @@ ecore_wl_window_move(Ecore_Wl_Window *win, int x, int y)
if (!win) return;
win->allocation.x = x;
win->allocation.y = y;
ecore_wl_window_update_location(win, x, y);
if (win->shell_surface)
{
@ -208,19 +203,20 @@ ecore_wl_window_buffer_attach(Ecore_Wl_Window *win, struct wl_buffer *buffer, in
switch (win->buffer_type)
{
case ECORE_WL_WINDOW_BUFFER_TYPE_EGL_WINDOW:
win->server_allocation = win->allocation;
win->server.w = win->allocation.w;
win->server.h = win->allocation.h;
break;
case ECORE_WL_WINDOW_BUFFER_TYPE_EGL_IMAGE:
case ECORE_WL_WINDOW_BUFFER_TYPE_SHM:
if (win->surface)
{
if (win->edges & 4) // resizing from the left
x = win->server_allocation.w - win->allocation.w;
x = win->server.w - win->allocation.w;
else
x = 0;
if (win->edges & 1) // resizing from the top
y = win->server_allocation.h - win->allocation.h;
y = win->server.h - win->allocation.h;
else
y = 0;
@ -232,7 +228,8 @@ ecore_wl_window_buffer_attach(Ecore_Wl_Window *win, struct wl_buffer *buffer, in
win->allocation.w, win->allocation.h);
wl_surface_commit(win->surface);
win->server_allocation = win->allocation;
win->server.w = win->allocation.w;
win->server.h = win->allocation.h;
}
break;
default:
@ -339,7 +336,8 @@ ecore_wl_window_maximized_set(Ecore_Wl_Window *win, Eina_Bool maximized)
if ((win->type == ECORE_WL_WINDOW_TYPE_MAXIMIZED) == maximized) return;
if (win->type == ECORE_WL_WINDOW_TYPE_TOPLEVEL)
{
win->saved_allocation = win->allocation;
win->saved.w = win->allocation.w;
win->saved.h = win->allocation.h;
if (win->shell_surface)
wl_shell_surface_set_maximized(win->shell_surface, NULL);
win->type = ECORE_WL_WINDOW_TYPE_MAXIMIZED;
@ -349,8 +347,7 @@ ecore_wl_window_maximized_set(Ecore_Wl_Window *win, Eina_Bool maximized)
if (win->shell_surface)
wl_shell_surface_set_toplevel(win->shell_surface);
win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
_ecore_wl_window_configure_send(win, win->saved_allocation.w,
win->saved_allocation.h);
_ecore_wl_window_configure_send(win, win->saved.w, win->saved.h);
}
win->edges = 0;
}
@ -378,7 +375,8 @@ ecore_wl_window_fullscreen_set(Ecore_Wl_Window *win, Eina_Bool fullscreen)
if (fullscreen)
{
win->type = ECORE_WL_WINDOW_TYPE_FULLSCREEN;
win->saved_allocation = win->allocation;
win->saved.w = win->allocation.w;
win->saved.h = win->allocation.h;
if (win->shell_surface)
wl_shell_surface_set_fullscreen(win->shell_surface,
WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
@ -389,8 +387,7 @@ ecore_wl_window_fullscreen_set(Ecore_Wl_Window *win, Eina_Bool fullscreen)
if (win->shell_surface)
wl_shell_surface_set_toplevel(win->shell_surface);
win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
_ecore_wl_window_configure_send(win, win->saved_allocation.w,
win->saved_allocation.h);
_ecore_wl_window_configure_send(win, win->saved.w, win->saved.h);
}
win->edges = 0;
}
@ -451,39 +448,11 @@ ecore_wl_window_transparent_get(Ecore_Wl_Window *win)
EAPI void
ecore_wl_window_update_size(Ecore_Wl_Window *win, int w, int h)
{
struct wl_region *region = NULL;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!win) return;
if ((win->allocation.w == w) && (win->allocation.h == h))
return;
win->allocation.w = w;
win->allocation.h = h;
if (!win->surface) return;
if ((!win->transparent) && (!win->alpha))
{
region = wl_compositor_create_region(_ecore_wl_disp->wl.compositor);
wl_region_add(region, win->allocation.x, win->allocation.y,
win->allocation.w, win->allocation.h);
wl_surface_set_opaque_region(win->surface, region);
wl_region_destroy(region);
}
if ((win->type != ECORE_WL_WINDOW_TYPE_FULLSCREEN) ||
(win->type != ECORE_WL_WINDOW_TYPE_DND))
{
region =
wl_compositor_create_region(_ecore_wl_disp->wl.compositor);
wl_region_add(region, win->allocation.x, win->allocation.y,
win->allocation.w, win->allocation.h);
wl_surface_set_input_region(win->surface, region);
wl_region_destroy(region);
}
}
EAPI void
@ -613,6 +582,59 @@ ecore_wl_window_surface_find(struct wl_surface *surface)
return win;
}
/* @since 1.8 */
EAPI void
ecore_wl_window_input_region_set(Ecore_Wl_Window *win, int x, int y, int w, int h)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!win) return;
if ((win->type != ECORE_WL_WINDOW_TYPE_FULLSCREEN) ||
(win->type != ECORE_WL_WINDOW_TYPE_DND))
{
if ((w > 0) && (h > 0))
{
struct wl_region *region = NULL;
region =
wl_compositor_create_region(_ecore_wl_disp->wl.compositor);
wl_region_add(region, x, y, w, h);
wl_surface_set_input_region(win->surface, region);
wl_region_destroy(region);
}
else
wl_surface_set_input_region(win->surface, NULL);
}
}
/* @since 1.8 */
EAPI void
ecore_wl_window_opaque_region_set(Ecore_Wl_Window *win, int x, int y, int w, int h)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!win) return;
if ((!win->transparent) && (!win->alpha))
{
if ((w > 0) && (h > 0))
{
struct wl_region *region = NULL;
region =
wl_compositor_create_region(_ecore_wl_disp->wl.compositor);
wl_region_add(region, x, y, w, h);
wl_surface_set_opaque_region(win->surface, region);
wl_region_destroy(region);
}
else
wl_surface_set_opaque_region(win->surface, NULL);
}
else
wl_surface_set_opaque_region(win->surface, NULL);
}
/* local functions */
static void
_ecore_wl_window_cb_ping(void *data EINA_UNUSED, struct wl_shell_surface *shell_surface, unsigned int serial)
@ -636,10 +658,6 @@ _ecore_wl_window_cb_configure(void *data, struct wl_shell_surface *shell_surface
{
if (win->type == ECORE_WL_WINDOW_TYPE_TOPLEVEL)
win->edges = edges;
if (win->region.input) wl_region_destroy(win->region.input);
win->region.input = NULL;
if (win->region.opaque) wl_region_destroy(win->region.opaque);
win->region.opaque = NULL;
_ecore_wl_window_configure_send(win, w, h);
}

View File

@ -276,7 +276,8 @@ _ecore_evas_wl_common_cb_window_configure(void *data EINA_UNUSED, int type EINA_
_ecore_evas_wayland_resize_edge_set(ee, win->edges);
win->server_allocation = win->allocation;
win->server.w = win->allocation.w;
win->server.h = win->allocation.h;
ecore_wl_window_update_size(wdata->win, ev->w, ev->h);
}
}

View File

@ -159,7 +159,7 @@ ecore_evas_wayland_egl_new_internal(const char *disp_name, unsigned int parent,
ee->prop.request_pos = 0;
ee->prop.sticky = 0;
ee->prop.draw_frame = frame;
ee->alpha = EINA_FALSE;
ee->alpha = EINA_TRUE;
/* NB: Disabled for right now as it causes textgrid (terminology)
* to not draw text anymore */
@ -184,6 +184,7 @@ ecore_evas_wayland_egl_new_internal(const char *disp_name, unsigned int parent,
wdata->win =
ecore_wl_window_new(p, x, y, w + fw, h + fh,
ECORE_WL_WINDOW_BUFFER_TYPE_EGL_WINDOW);
ecore_wl_window_alpha_set(wdata->win, ee->alpha);
ee->prop.window = wdata->win->id;
ee->evas = evas_new();
@ -335,7 +336,8 @@ _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h)
_ecore_evas_wayland_egl_resize_edge_set(ee, win->edges);
win->edges = 0;
win->server_allocation = win->allocation;
win->server.w = win->allocation.w;
win->server.h = win->allocation.h;
ecore_wl_window_update_size(wdata->win, w, h);
}
@ -460,23 +462,20 @@ _ecore_evas_wayland_egl_alpha_do(Ecore_Evas *ee, int alpha)
if (!ee) return;
if ((ee->alpha == alpha)) return;
ee->alpha = alpha;
ee->alpha = EINA_TRUE;
wdata = ee->engine.data;
if (wdata->win) ecore_wl_window_alpha_set(wdata->win, alpha);
if (wdata->win) ecore_wl_window_alpha_set(wdata->win, ee->alpha);
evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas)))
{
einfo->info.destination_alpha = alpha;
einfo->info.destination_alpha = ee->alpha;
if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
evas_damage_rectangle_add(ee->evas, 0, 0, ee->w + fw, ee->h + fh);
}
if (wdata->win)
ecore_wl_window_update_size(wdata->win, ee->w + fw, ee->h + fh);
}
static void
@ -484,7 +483,7 @@ _ecore_evas_wl_alpha_set(Ecore_Evas *ee, int alpha)
{
if (ee->in_async_render)
{
ee->delayed.alpha = alpha;
ee->delayed.alpha = EINA_TRUE;
ee->delayed.alpha_changed = EINA_TRUE;
return;
}
@ -503,24 +502,21 @@ _ecore_evas_wayland_egl_transparent_do(Ecore_Evas *ee, int transparent)
if (!ee) return;
if ((ee->transparent == transparent)) return;
ee->transparent = transparent;
ee->transparent = EINA_TRUE;
wdata = ee->engine.data;
if (wdata->win)
ecore_wl_window_transparent_set(wdata->win, transparent);
ecore_wl_window_transparent_set(wdata->win, ee->transparent);
evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas)))
{
einfo->info.destination_alpha = transparent;
einfo->info.destination_alpha = ee->transparent;
if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
evas_damage_rectangle_add(ee->evas, 0, 0, ee->w + fw, ee->h + fh);
}
if (wdata->win)
ecore_wl_window_update_size(wdata->win, ee->w + fw, ee->h + fh);
}
static void
@ -528,7 +524,7 @@ _ecore_evas_wl_transparent_set(Ecore_Evas *ee, int transparent)
{
if (ee->in_async_render)
{
ee->delayed.transparent = transparent;
ee->delayed.transparent = EINA_TRUE;
ee->delayed.transparent_changed = EINA_TRUE;
return;
}

View File

@ -157,7 +157,7 @@ ecore_evas_wayland_shm_new_internal(const char *disp_name, unsigned int parent,
ee->prop.request_pos = 0;
ee->prop.sticky = 0;
ee->prop.draw_frame = frame;
ee->alpha = EINA_FALSE;
ee->alpha = EINA_TRUE;
if (getenv("ECORE_EVAS_FORCE_SYNC_RENDER"))
ee->can_async_render = 0;
@ -181,6 +181,7 @@ ecore_evas_wayland_shm_new_internal(const char *disp_name, unsigned int parent,
wdata->win =
ecore_wl_window_new(p, x, y, w + fw, h + fh,
ECORE_WL_WINDOW_BUFFER_TYPE_SHM);
ecore_wl_window_alpha_set(wdata->win, ee->alpha);
ee->prop.window = wdata->win->id;
ee->evas = evas_new();
@ -329,7 +330,8 @@ _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h)
_ecore_evas_wayland_shm_resize_edge_set(ee, win->edges);
win->edges = 0;
win->server_allocation = win->allocation;
win->server.w = win->allocation.w;
win->server.h = win->allocation.h;
ecore_wl_window_update_size(wdata->win, w, h);
}
@ -459,23 +461,20 @@ _ecore_evas_wayland_shm_alpha_do(Ecore_Evas *ee, int alpha)
if (!ee) return;
if ((ee->alpha == alpha)) return;
ee->alpha = alpha;
ee->alpha = EINA_TRUE;
wdata = ee->engine.data;
if (wdata->win) ecore_wl_window_alpha_set(wdata->win, alpha);
if (wdata->win) ecore_wl_window_alpha_set(wdata->win, ee->alpha);
evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
if ((einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas)))
{
einfo->info.destination_alpha = alpha;
einfo->info.destination_alpha = ee->alpha;
if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
evas_damage_rectangle_add(ee->evas, 0, 0, ee->w + fw, ee->h + fh);
}
if (wdata->win)
ecore_wl_window_update_size(wdata->win, ee->w + fw, ee->h + fh);
}
static void
@ -483,7 +482,7 @@ _ecore_evas_wl_alpha_set(Ecore_Evas *ee, int alpha)
{
if (ee->in_async_render)
{
ee->delayed.alpha = alpha;
ee->delayed.alpha = EINA_TRUE;
ee->delayed.alpha_changed = EINA_TRUE;
return;
}
@ -501,24 +500,21 @@ _ecore_evas_wayland_shm_transparent_do(Ecore_Evas *ee, int transparent)
if (!ee) return;
if ((ee->transparent == transparent)) return;
ee->transparent = transparent;
ee->transparent = EINA_TRUE;
wdata = ee->engine.data;
if (wdata->win)
ecore_wl_window_transparent_set(wdata->win, transparent);
ecore_wl_window_transparent_set(wdata->win, ee->transparent);
evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
if ((einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas)))
{
einfo->info.destination_alpha = transparent;
einfo->info.destination_alpha = ee->transparent;
if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
evas_damage_rectangle_add(ee->evas, 0, 0, ee->w + fw, ee->h + fh);
}
if (wdata->win)
ecore_wl_window_update_size(wdata->win, ee->w + fw, ee->h + fh);
}
static void
@ -526,7 +522,7 @@ _ecore_evas_wl_transparent_set(Ecore_Evas *ee, int transparent)
{
if (ee->in_async_render)
{
ee->delayed.transparent = transparent;
ee->delayed.transparent = EINA_TRUE;
ee->delayed.transparent_changed = EINA_TRUE;
return;
}

View File

@ -823,6 +823,7 @@ eng_setup(Evas *evas, void *info)
return 0;
}
if (re->tb) evas_common_tilebuf_free(re->tb);
re->tb = evas_common_tilebuf_new(re->win->w, re->win->h);
if (!re->tb)
{

View File

@ -249,9 +249,16 @@ eng_setup(Evas *eo_evas, void *einfo)
if ((re) && (re->ob)) ponebuf = re->ob->onebuf;
/* we have an existing render engine */
/* free any existing tile buffer */
if (re->tb) evas_common_tilebuf_free(re->tb);
/* we have an existing output buffer, free it */
if (re->ob) re->outbuf_free(re->ob);
/* create new tile buffer */
if ((re->tb = evas_common_tilebuf_new(epd->output.w, epd->output.h)))
evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
if ((re->ob = evas_swapbuf_setup(epd->output.w, epd->output.h,
info->info.rotation,
info->info.depth,
@ -416,7 +423,7 @@ eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, i
re->rects = evas_common_tilebuf_get_render_rects(re->tb);
if (re->rects)
{
if (re->lost_back)
if ((re->lost_back) || (re->mode == MODE_FULL))
{
/* if we lost our backbuffer since the last frame redraw all */
re->lost_back = 0;

View File

@ -45,9 +45,9 @@ typedef struct _Outbuf Outbuf;
enum _Outbuf_Depth
{
OUTBUF_DEPTH_NONE,
OUTBUF_DEPTH_ARGB_32BPP_8888_8888,
OUTBUF_DEPTH_RGB_32BPP_8888_8888,
OUTBUF_DEPTH_LAST
OUTBUF_DEPTH_ARGB_32BPP_8888_8888,
OUTBUF_DEPTH_RGB_32BPP_8888_8888,
OUTBUF_DEPTH_LAST
};
enum