fix x11 compositor to use damage events

it seems that since the first version of the enlightenment compositor
in e17, damage events in x11 have never been used correctly. using
the event struct members will only give the bounding box/area instead
of the damaged regions; the real regions must be explicitly fetched
from the server

this removes the need for a lot of hacks which were added over the years
to make override windows render correctly, and also probably reduces
rendering overhead slightly
This commit is contained in:
Mike Blumenkrantz 2015-09-07 11:10:54 -04:00
parent 64a62e29ca
commit 92d1c36be7
1 changed files with 11 additions and 10 deletions

View File

@ -1484,11 +1484,6 @@ _e_comp_x_configure(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_
{
e_pixmap_dirty(ec->pixmap);
evas_object_resize(ec->frame, ev->w, ev->h);
if (ec->override && (!ec->input_only))
{
e_comp_object_damage(ec->frame, 0, 0, ev->w, ev->h);
e_comp_object_render_update_del(ec->frame);
}
}
return ECORE_CALLBACK_RENEW;
}
@ -2785,27 +2780,33 @@ static Eina_Bool
_e_comp_x_damage(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_Damage *ev)
{
E_Client *ec;
Ecore_X_Rectangle *rects;
int n = 0;
ec = _e_comp_x_client_find_by_damage(ev->damage);
if ((!ec) || e_object_is_del(E_OBJECT(ec))) return ECORE_CALLBACK_PASS_ON;
if (_e_comp_x_client_data_get(ec)->damage)
{
Ecore_X_Region parts;
Ecore_X_Rectangle bounds;
parts = ecore_x_region_new(NULL, 0);
ecore_x_damage_subtract(_e_comp_x_client_data_get(ec)->damage, 0, parts);
rects = ecore_x_region_fetch(parts, &n, &bounds);
ecore_x_region_free(parts);
}
//WRN("DAMAGE %p: %dx%d", ec, ev->area.width, ev->area.height);
if (!n) return ECORE_CALLBACK_RENEW;
if (e_comp->nocomp)
e_pixmap_dirty(ec->pixmap);
/* discard unwanted xy position of first damage
* to avoid wrong composition for override redirect window */
else if ((ec->override) && (!_e_comp_x_client_data_get(ec)->first_damage))
e_comp_object_damage(ec->frame, 0, 0, ev->area.width, ev->area.height);
else
e_comp_object_damage(ec->frame, ev->area.x, ev->area.y, ev->area.width, ev->area.height);
{
int i;
for (i = 0; i < n; i++)
e_comp_object_damage(ec->frame, rects[i].x, rects[i].y, rects[i].width, rects[i].height);
}
if ((!ec->re_manage) && (!ec->override) && (!_e_comp_x_client_data_get(ec)->first_damage))
e_comp_object_render_update_del(ec->frame);
else