diff options
author | Chris Michael <cp.michael@samsung.com> | 2015-10-06 10:31:25 -0400 |
---|---|---|
committer | Chris Michael <cp.michael@samsung.com> | 2015-12-03 12:02:40 -0500 |
commit | 475ade8bf8832dafac3b8fa0e63e6c197fe4d08d (patch) | |
tree | ed9e3c2d424019419fab8281d02d4039e9c20d46 | |
parent | d50af2db70e37878a505374de86a245e28c351e1 (diff) |
ecore-wl2: Add API function to set sync/desync on a subsurface
Signed-off-by: Chris Michael <cp.michael@samsung.com>
-rw-r--r-- | src/lib/ecore_wl2/Ecore_Wl2.h | 27 | ||||
-rw-r--r-- | src/lib/ecore_wl2/ecore_wl2_subsurf.c | 17 |
2 files changed, 44 insertions, 0 deletions
diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h index 2d78a8140e..86cf12389a 100644 --- a/src/lib/ecore_wl2/Ecore_Wl2.h +++ b/src/lib/ecore_wl2/Ecore_Wl2.h | |||
@@ -662,6 +662,33 @@ EAPI void ecore_wl2_subsurface_place_above(Ecore_Wl2_Subsurface *subsurface, str | |||
662 | */ | 662 | */ |
663 | EAPI void ecore_wl2_subsurface_place_below(Ecore_Wl2_Subsurface *subsurface, struct wl_surface *surface); | 663 | EAPI void ecore_wl2_subsurface_place_below(Ecore_Wl2_Subsurface *subsurface, struct wl_surface *surface); |
664 | 664 | ||
665 | /** | ||
666 | * Enables or disables sub-surface synchronization | ||
667 | * | ||
668 | * When synchronization is enabled, surface commits on the subsurface | ||
669 | * will be cached and only applied when the parent surface's state is | ||
670 | * applied. This ensures atomic updates of the parent and all of its | ||
671 | * synchronized sub-surfaces. | ||
672 | * | ||
673 | * When synchronization is disabled, commits will apply to the pending | ||
674 | * state directly without caching, just like a normal wl_surface. If | ||
675 | * there are already cached events when this is set, those events are | ||
676 | * applied simultaneously with the desync event. | ||
677 | * | ||
678 | * Attempting to enable synchronization when the subsurface already | ||
679 | * thinks it's sync'd, or desync when it believes its desync'd, will | ||
680 | * be trivially ignored and will not generate a Wayland event. | ||
681 | * | ||
682 | * See Wayland's set_desync documentation for further details and | ||
683 | * exceptional cases. | ||
684 | * | ||
685 | * @param subsurface the subsurface | ||
686 | * @param sync true to enable synchronization, false to desynchronize | ||
687 | * | ||
688 | * @ingroup Ecore_Wl2_Subsurface_Group | ||
689 | */ | ||
690 | EAPI void ecore_wl2_subsurface_sync_set(Ecore_Wl2_Subsurface *subsurface, Eina_Bool sync); | ||
691 | |||
665 | /* # ifdef __cplusplus */ | 692 | /* # ifdef __cplusplus */ |
666 | /* } */ | 693 | /* } */ |
667 | /* # endif */ | 694 | /* # endif */ |
diff --git a/src/lib/ecore_wl2/ecore_wl2_subsurf.c b/src/lib/ecore_wl2/ecore_wl2_subsurf.c index 0a4a49be52..2456fd2aaa 100644 --- a/src/lib/ecore_wl2/ecore_wl2_subsurf.c +++ b/src/lib/ecore_wl2/ecore_wl2_subsurf.c | |||
@@ -126,3 +126,20 @@ ecore_wl2_subsurface_place_below(Ecore_Wl2_Subsurface *subsurface, struct wl_sur | |||
126 | 126 | ||
127 | wl_subsurface_place_below(subsurface->wl.subsurface, surface); | 127 | wl_subsurface_place_below(subsurface->wl.subsurface, surface); |
128 | } | 128 | } |
129 | |||
130 | EAPI void | ||
131 | ecore_wl2_subsurface_sync_set(Ecore_Wl2_Subsurface *subsurface, Eina_Bool sync) | ||
132 | { | ||
133 | EINA_SAFETY_ON_NULL_RETURN(subsurface); | ||
134 | EINA_SAFETY_ON_NULL_RETURN(subsurface->wl.subsurface); | ||
135 | |||
136 | sync = !!sync; | ||
137 | if (subsurface->sync == sync) return; | ||
138 | |||
139 | subsurface->sync = sync; | ||
140 | |||
141 | if (subsurface->sync) | ||
142 | wl_subsurface_set_sync(subsurface->wl.subsurface); | ||
143 | else | ||
144 | wl_subsurface_set_desync(subsurface->wl.subsurface); | ||
145 | } | ||