summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2016-11-04 15:18:24 -0500
committerMike Blumenkrantz <zmike@osg.samsung.com>2016-11-18 11:43:29 -0500
commitd95e3a77e8c1967b22ca8924093e5d7636cf0377 (patch)
treef95a9f94f349d994b81ea974c914500b864d49df
parent805eb5562832dbddfa69b5e5b07cfdb2a2a1ac49 (diff)
Fix massive wayland input region brokenness
It was impossible to set an empty input region. Input regions were being clipped to the size of whatever buffer was previously attached when they should really be clipped at commit time to whatever buffer was attached in the commit. The intersection operation created round off errors and e_comp_object_input_area_set is clipping anyway, so we can simplify this and retain precision.
-rw-r--r--src/bin/e_comp_wl.c42
1 files changed, 17 insertions, 25 deletions
diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c
index 2f030c023..4a26ac9df 100644
--- a/src/bin/e_comp_wl.c
+++ b/src/bin/e_comp_wl.c
@@ -1242,8 +1242,7 @@ _e_comp_wl_surface_state_init(E_Comp_Wl_Surface_State *state, int w, int h)
1242 _e_comp_wl_surface_state_cb_buffer_destroy; 1242 _e_comp_wl_surface_state_cb_buffer_destroy;
1243 state->sx = state->sy = 0; 1243 state->sx = state->sy = 0;
1244 1244
1245 state->input = eina_tiler_new(w, h); 1245 state->input = NULL;
1246 eina_tiler_tile_size_set(state->input, 1, 1);
1247 1246
1248 state->opaque = eina_tiler_new(w, h); 1247 state->opaque = eina_tiler_new(w, h);
1249 eina_tiler_tile_size_set(state->opaque, 1, 1); 1248 eina_tiler_tile_size_set(state->opaque, 1, 1);
@@ -1512,35 +1511,29 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state)
1512 } 1511 }
1513 1512
1514 /* put state input into surface */ 1513 /* put state input into surface */
1515 if ((state->input) && 1514 if (state->input)
1516 (!eina_tiler_empty(state->input)))
1517 { 1515 {
1518 Eina_Tiler *src, *tmp; 1516 if (!eina_tiler_empty(state->input))
1519
1520 tmp = eina_tiler_new(state->bw, state->bh);
1521 eina_tiler_tile_size_set(tmp, 1, 1);
1522 eina_tiler_rect_add(tmp,
1523 &(Eina_Rectangle){0, 0, state->bw, state->bh});
1524 if ((src = eina_tiler_intersection(state->input, tmp)))
1525 { 1517 {
1526 Eina_Rectangle *rect; 1518 Eina_Rectangle *rect;
1527 Eina_Iterator *itr; 1519 Eina_Iterator *itr;
1528 1520
1529 itr = eina_tiler_iterator_new(src); 1521 /* This is seriously wrong and results in only the last
1522 * rectangle in the region being set, but in the usual
1523 * case there's only one rectangle.
1524 */
1525 itr = eina_tiler_iterator_new(state->input);
1530 EINA_ITERATOR_FOREACH(itr, rect) 1526 EINA_ITERATOR_FOREACH(itr, rect)
1531 e_comp_object_input_area_set(ec->frame, rect->x, rect->y, 1527 e_comp_object_input_area_set(ec->frame, rect->x, rect->y,
1532 rect->w, rect->h); 1528 rect->w, rect->h);
1533 1529
1534 eina_iterator_free(itr); 1530 eina_iterator_free(itr);
1535 eina_tiler_free(src);
1536 } 1531 }
1537 else 1532 else
1538 e_comp_object_input_area_set(ec->frame, 0, 0, ec->w, ec->h); 1533 e_comp_object_input_area_set(ec->frame, 1, 1, 0, 0);
1539 1534
1540 eina_tiler_free(tmp); 1535 eina_tiler_free(state->input);
1541 1536 state->input = NULL;
1542 /* clear input tiler */
1543 eina_tiler_clear(state->input);
1544 } 1537 }
1545 ec->comp_data->in_commit = 0; 1538 ec->comp_data->in_commit = 0;
1546 1539
@@ -1679,7 +1672,9 @@ _e_comp_wl_surface_cb_input_region_set(struct wl_client *client EINA_UNUSED, str
1679 if (e_object_is_del(E_OBJECT(ec))) return; 1672 if (e_object_is_del(E_OBJECT(ec))) return;
1680 1673
1681 if (ec->comp_data->pending.input) 1674 if (ec->comp_data->pending.input)
1682 eina_tiler_clear(ec->comp_data->pending.input); 1675 eina_tiler_free(ec->comp_data->pending.input);
1676 ec->comp_data->pending.input = eina_tiler_new(65535, 65535);
1677 eina_tiler_tile_size_set(ec->comp_data->pending.input, 1, 1);
1683 if (region_resource) 1678 if (region_resource)
1684 { 1679 {
1685 Eina_Tiler *tmp; 1680 Eina_Tiler *tmp;
@@ -1692,7 +1687,7 @@ _e_comp_wl_surface_cb_input_region_set(struct wl_client *client EINA_UNUSED, str
1692 else 1687 else
1693 { 1688 {
1694 eina_tiler_rect_add(ec->comp_data->pending.input, 1689 eina_tiler_rect_add(ec->comp_data->pending.input,
1695 &(Eina_Rectangle){0, 0, ec->client.w, ec->client.h}); 1690 &(Eina_Rectangle){0, 0, 65535, 65535});
1696 } 1691 }
1697} 1692}
1698 1693
@@ -2055,11 +2050,8 @@ _e_comp_wl_subsurface_commit_to_cache(E_Client *ec)
2055 eina_tiler_rect_add(sdata->cached.opaque, rect); 2050 eina_tiler_rect_add(sdata->cached.opaque, rect);
2056 eina_iterator_free(itr); 2051 eina_iterator_free(itr);
2057 2052
2058 /* repeat for input */ 2053 sdata->cached.input = cdata->pending.input;
2059 itr = eina_tiler_iterator_new(cdata->pending.input); 2054 cdata->pending.input = NULL;
2060 EINA_ITERATOR_FOREACH(itr, rect)
2061 eina_tiler_rect_add(sdata->cached.input, rect);
2062 eina_iterator_free(itr);
2063 2055
2064 sdata->cached.frames = eina_list_merge(sdata->cached.frames, 2056 sdata->cached.frames = eina_list_merge(sdata->cached.frames,
2065 cdata->pending.frames); 2057 cdata->pending.frames);