use persistent clipping for comp object input rects

it's technically legal to set an input region larger than a surface,
then later expand the surface and expect that the input region will
also expand
This commit is contained in:
Mike Blumenkrantz 2017-01-13 11:35:26 -05:00
parent df414cef65
commit 0fbef3b74e
1 changed files with 18 additions and 12 deletions

View File

@ -2456,6 +2456,21 @@ _e_comp_smart_del(Evas_Object *obj)
free(cw);
}
static void
_e_comp_object_input_rect_update(E_Comp_Object *cw)
{
int x, y, w, h;
if (!cw->input_obj) return;
x = cw->input_rect.x, y = cw->input_rect.y, w = cw->input_rect.w, h = cw->input_rect.h;
E_RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, cw->ec->client.w, cw->ec->client.h);
evas_object_geometry_set(cw->input_obj,
cw->x + x + (!!cw->frame_object * cw->client_inset.l),
cw->y + y + (!!cw->frame_object * cw->client_inset.t),
w, h);
}
static void
_e_comp_smart_move(Evas_Object *obj, int x, int y)
{
@ -2472,10 +2487,7 @@ _e_comp_smart_move(Evas_Object *obj, int x, int y)
evas_object_move(cw->clip, 0, 0);
evas_object_move(cw->effect_obj, x, y);
if (cw->input_obj)
evas_object_geometry_set(cw->input_obj,
cw->x + cw->input_rect.x + (!!cw->frame_object * cw->client_inset.l),
cw->y + cw->input_rect.y + (!!cw->frame_object * cw->client_inset.t),
cw->input_rect.w, cw->input_rect.h);
_e_comp_object_input_rect_update(cw);
/* this gets called once during setup to init coords offscreen and guarantee first move */
if (e_comp && cw->visible)
e_comp_shape_queue();
@ -2520,10 +2532,7 @@ _e_comp_smart_resize(Evas_Object *obj, int w, int h)
evas_object_resize(cw->effect_obj, w, h);
if (cw->zoomobj) e_zoomap_child_resize(cw->zoomobj, pw, ph);
if (cw->input_obj)
evas_object_geometry_set(cw->input_obj,
cw->x + cw->input_rect.x + (!!cw->frame_object * cw->client_inset.l),
cw->y + cw->input_rect.y + (!!cw->frame_object * cw->client_inset.t),
cw->input_rect.w, cw->input_rect.h);
_e_comp_object_input_rect_update(cw);
/* resize render update tiler */
if (!first)
{
@ -3150,7 +3159,6 @@ e_comp_object_input_area_set(Evas_Object *obj, int x, int y, int w, int h)
API_ENTRY;
//INF("%d,%d %dx%d", x, y, w, h);
E_RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, cw->ec->client.w, cw->ec->client.h);
if ((cw->input_rect.x == x) && (cw->input_rect.y == y) &&
(cw->input_rect.w == w) && (cw->input_rect.h == h)) return;
EINA_RECTANGLE_SET(&cw->input_rect, x, y, w, h);
@ -3165,9 +3173,7 @@ e_comp_object_input_area_set(Evas_Object *obj, int x, int y, int w, int h)
evas_object_clip_set(cw->input_obj, cw->clip);
evas_object_smart_member_add(cw->input_obj, obj);
}
evas_object_geometry_set(cw->input_obj,
cw->ec->client.x + (!!cw->frame_object * cw->client_inset.l) + x,
cw->ec->client.y + (!!cw->frame_object * cw->client_inset.t) + y, w, h);
_e_comp_object_input_rect_update(cw);
evas_object_pass_events_set(cw->obj, 1);
if (cw->visible) evas_object_show(cw->input_obj);
}