comp: fix self feeding event loop with shape input events on override wins

so comp would call ecore_x_composite_window_events_enable in
_e_comp_x_client_shape_input_rectangle_set()
_e_comp_x_hook_client_post_new_client() all the time.. because
ec->need_shape_merge was always set.. why was it always set.. because
ecore_x_composite_window_events_enable woudl set shape rectangles to
make the window visible to input events... so e would feed itsefl with
events all day long via x. this shortcuts that to check if event rects
are the SAME then don't set them as the ones that are stored.
This commit is contained in:
Carsten Haitzler 2014-01-23 19:58:59 +09:00
parent 0f3e3ae5da
commit 05a7087c84
1 changed files with 39 additions and 2 deletions

View File

@ -2399,6 +2399,40 @@ _e_comp_x_focus_in(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_W
return ECORE_CALLBACK_PASS_ON;
}
static Eina_Bool
_shapes_differ(E_Client *ec)
{
Eina_Bool differ = EINA_FALSE;
if (ec->shape_input_rects)
{
Ecore_X_Rectangle *rects;
int num = 0, i;
rects = ecore_x_window_shape_input_rectangles_get
(e_client_util_win_get(ec), &num);
if (rects)
{
if (num == (int)ec->shape_input_rects_num)
{
for (i = 0; i < num; i++)
{
if ((rects[i].x != ec->shape_input_rects[i].x) ||
(rects[i].y != ec->shape_input_rects[i].y) ||
(rects[i].width != (unsigned int)ec->shape_input_rects[i].w) ||
(rects[i].height != (unsigned int)ec->shape_input_rects[i].h))
{
differ = EINA_TRUE;
break;
}
}
}
else differ = EINA_TRUE;
free(rects);
}
}
return differ;
}
static Eina_Bool
_e_comp_x_shape(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_Window_Shape *ev)
{
@ -2417,8 +2451,11 @@ _e_comp_x_shape(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_Wind
{
if (ev->type == ECORE_X_SHAPE_INPUT)
{
ec->changes.shape_input = 1;
ec->need_shape_merge = 1;
if (_shapes_differ(ec))
{
ec->changes.shape_input = 1;
ec->need_shape_merge = 1;
}
}
else
{