From 5448f0a1ac0c6786c277119e24002b61f35dbcb2 Mon Sep 17 00:00:00 2001 From: Chris Michael Date: Fri, 18 Jul 2014 02:46:42 -0400 Subject: [PATCH] handle setting any pending opaque regions during surface commit and cleanup the input region code also Signed-off-by: Chris Michael --- src/bin/e_comp_wl.c | 76 +++++++++++++++++++++++++++++++++------------ 1 file changed, 57 insertions(+), 19 deletions(-) diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c index ada808ce9..76493cc41 100644 --- a/src/bin/e_comp_wl.c +++ b/src/bin/e_comp_wl.c @@ -642,6 +642,51 @@ _e_comp_wl_surface_commit(E_Client *ec) ec->wl_comp_data->pending.buffer = NULL; ec->wl_comp_data->pending.new_attach = EINA_FALSE; + /* handle surface opaque region */ + tmp = eina_tiler_new(ec->w, ec->h); + eina_tiler_tile_size_set(tmp, 1, 1); + eina_tiler_rect_add(tmp, &(Eina_Rectangle){0, 0, ec->client.w, ec->client.h}); + + src = eina_tiler_intersection(ec->wl_comp_data->pending.opaque, tmp); + if (src) + { + Eina_Rectangle *rect; + Eina_Iterator *itr; + int i = 0; + + ec->shape_rects_num = 0; + + itr = eina_tiler_iterator_new(src); + EINA_ITERATOR_FOREACH(itr, rect) + { + ec->shape_rects_num += 1; + } + + ec->shape_rects = + malloc(sizeof(Eina_Rectangle) * ec->shape_rects_num); + + if (ec->shape_rects) + { + EINA_ITERATOR_FOREACH(itr, rect) + { + ec->shape_rects[i] = *(Eina_Rectangle *)((char *)rect); + + ec->shape_rects[i].x = rect->x; + ec->shape_rects[i].y = rect->y; + ec->shape_rects[i].w = rect->w; + ec->shape_rects[i].h = rect->h; + + i++; + } + } + + eina_iterator_free(itr); + eina_tiler_free(src); + } + + eina_tiler_free(tmp); + eina_tiler_clear(ec->wl_comp_data->pending.opaque); + /* handle surface damages */ if ((!ec->comp->nocomp) && (ec->frame)) { @@ -671,9 +716,7 @@ _e_comp_wl_surface_commit(E_Client *ec) eina_tiler_clear(ec->wl_comp_data->pending.damage); } - /* TODO !!! FIXME !!! */ - /* handle surface opaque region */ - + /* handle input regions */ tmp = eina_tiler_new(ec->w, ec->h); eina_tiler_tile_size_set(tmp, 1, 1); eina_tiler_rect_add(tmp, &(Eina_Rectangle){0, 0, ec->client.w, ec->client.h}); @@ -696,25 +739,20 @@ _e_comp_wl_surface_commit(E_Client *ec) ec->shape_input_rects = malloc(sizeof(Eina_Rectangle) * ec->shape_input_rects_num); - if (!ec->shape_input_rects) + if (ec->shape_input_rects) { - eina_iterator_free(itr); - eina_tiler_free(src); - eina_tiler_free(tmp); - return; - } + EINA_ITERATOR_FOREACH(itr, rect) + { + ec->shape_input_rects[i] = + *(Eina_Rectangle *)((char *)rect); - EINA_ITERATOR_FOREACH(itr, rect) - { - ec->shape_input_rects[i] = - *(Eina_Rectangle *)((char *)rect); + ec->shape_input_rects[i].x = rect->x; + ec->shape_input_rects[i].y = rect->y; + ec->shape_input_rects[i].w = rect->w; + ec->shape_input_rects[i].h = rect->h; - ec->shape_input_rects[i].x = rect->x; - ec->shape_input_rects[i].y = rect->y; - ec->shape_input_rects[i].w = rect->w; - ec->shape_input_rects[i].h = rect->h; - - i++; + i++; + } } eina_iterator_free(itr);