diff options
author | Derek Foreman <derekf@osg.samsung.com> | 2018-04-05 14:59:26 -0500 |
---|---|---|
committer | Derek Foreman <derekf@osg.samsung.com> | 2018-04-20 13:00:28 -0500 |
commit | 4837f3244307f45a812342e114e2a98bc5436743 (patch) | |
tree | cf0476e9f178c54bafeb82974c95a578bcd70288 /src/lib/ecore_wl2/ecore_wl2_window.c | |
parent | 0ca813dbd07e549f0c20f75e930d741c7a259e31 (diff) |
ecore_wl2: Share same region between input and opaque when possible
If input and opaque region are the same (they usually are) we can use
the same region for both.
Diffstat (limited to '')
-rw-r--r-- | src/lib/ecore_wl2/ecore_wl2_window.c | 59 |
1 files changed, 31 insertions, 28 deletions
diff --git a/src/lib/ecore_wl2/ecore_wl2_window.c b/src/lib/ecore_wl2/ecore_wl2_window.c index c86ea27f03..dee8b0a972 100644 --- a/src/lib/ecore_wl2/ecore_wl2_window.c +++ b/src/lib/ecore_wl2/ecore_wl2_window.c | |||
@@ -1545,43 +1545,49 @@ _region_create(struct wl_compositor *comp, int x, int y, int w, int h) | |||
1545 | } | 1545 | } |
1546 | 1546 | ||
1547 | static void | 1547 | static void |
1548 | _input_set(Ecore_Wl2_Window *window) | 1548 | _regions_set(Ecore_Wl2_Window *window) |
1549 | { | 1549 | { |
1550 | struct wl_region *region; | 1550 | struct wl_region *region = NULL; |
1551 | 1551 | ||
1552 | if (window->type == ECORE_WL2_WINDOW_TYPE_DND) return; | 1552 | if (window->pending.opaque) |
1553 | { | ||
1554 | if (window->opaque_set) | ||
1555 | { | ||
1556 | region = _region_create(window->display->wl.compositor, | ||
1557 | window->opaque.x, window->opaque.y, | ||
1558 | window->opaque.w, window->opaque.h); | ||
1559 | if (!region) return; | ||
1560 | } | ||
1561 | wl_surface_set_opaque_region(window->surface, region); | ||
1562 | } | ||
1563 | |||
1564 | if (!window->pending.input) goto out; | ||
1565 | if (window->type == ECORE_WL2_WINDOW_TYPE_DND) goto out; | ||
1553 | 1566 | ||
1554 | if (!window->input_set) | 1567 | if (!window->input_set) |
1555 | { | 1568 | { |
1556 | wl_surface_set_input_region(window->surface, NULL); | 1569 | wl_surface_set_input_region(window->surface, NULL); |
1557 | return; | 1570 | goto out; |
1558 | } | 1571 | } |
1559 | 1572 | ||
1573 | if (region && (window->opaque.x == window->input_rect.x) && | ||
1574 | (window->opaque.y == window->input_rect.y) && | ||
1575 | (window->opaque.w == window->input_rect.w) && | ||
1576 | (window->opaque.h == window->input_rect.h)) | ||
1577 | { | ||
1578 | wl_surface_set_input_region(window->surface, region); | ||
1579 | goto out; | ||
1580 | } | ||
1581 | if (region) wl_region_destroy(region); | ||
1582 | |||
1560 | region = _region_create(window->display->wl.compositor, | 1583 | region = _region_create(window->display->wl.compositor, |
1561 | window->input_rect.x, window->input_rect.y, | 1584 | window->input_rect.x, window->input_rect.y, |
1562 | window->input_rect.w, window->input_rect.h); | 1585 | window->input_rect.w, window->input_rect.h); |
1563 | if (!region) return; | 1586 | if (!region) return; |
1564 | wl_surface_set_input_region(window->surface, region); | 1587 | wl_surface_set_input_region(window->surface, region); |
1565 | wl_region_destroy(region); | ||
1566 | } | ||
1567 | 1588 | ||
1568 | static void | 1589 | out: |
1569 | _opaque_set(Ecore_Wl2_Window *window) | 1590 | if (region) wl_region_destroy(region); |
1570 | { | ||
1571 | struct wl_region *region; | ||
1572 | |||
1573 | if (!window->opaque_set) | ||
1574 | { | ||
1575 | wl_surface_set_opaque_region(window->surface, NULL); | ||
1576 | return; | ||
1577 | } | ||
1578 | |||
1579 | region = _region_create(window->display->wl.compositor, | ||
1580 | window->opaque.x, window->opaque.y, | ||
1581 | window->opaque.w, window->opaque.h); | ||
1582 | if (!region) return; | ||
1583 | wl_surface_set_opaque_region(window->surface, region); | ||
1584 | wl_region_destroy(region); | ||
1585 | } | 1591 | } |
1586 | 1592 | ||
1587 | EAPI void | 1593 | EAPI void |
@@ -1619,11 +1625,8 @@ ecore_wl2_window_commit(Ecore_Wl2_Window *window, Eina_Bool flush) | |||
1619 | window->set_config.geometry.w, | 1625 | window->set_config.geometry.w, |
1620 | window->set_config.geometry.h); | 1626 | window->set_config.geometry.h); |
1621 | } | 1627 | } |
1622 | if (window->pending.opaque) | 1628 | if (window->pending.opaque || window->pending.input) |
1623 | _opaque_set(window); | 1629 | _regions_set(window); |
1624 | |||
1625 | if (window->pending.input) | ||
1626 | _input_set(window); | ||
1627 | 1630 | ||
1628 | if (window->pending.maximized) | 1631 | if (window->pending.maximized) |
1629 | _maximized_set(window); | 1632 | _maximized_set(window); |