From 0b8d2f1f240e87e09cbc962884f5486b9af59f04 Mon Sep 17 00:00:00 2001 From: Chris Michael Date: Tue, 6 Oct 2015 10:17:25 -0400 Subject: [PATCH] ecore-wl2: Add API function to set the position of a subsurface Signed-off-by: Chris Michael --- src/lib/ecore_wl2/Ecore_Wl2.h | 13 +++++++++++++ src/lib/ecore_wl2/ecore_wl2_subsurf.c | 14 ++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h index fe49269131..ac4f8b6113 100644 --- a/src/lib/ecore_wl2/Ecore_Wl2.h +++ b/src/lib/ecore_wl2/Ecore_Wl2.h @@ -610,6 +610,19 @@ EAPI void ecore_wl2_subsurface_del(Ecore_Wl2_Subsurface *subsurface); */ EAPI struct wl_surface *ecore_wl2_subsurface_surface_get(Ecore_Wl2_Subsurface *subsurface); +/** + * Set the position of this subsurface, relative to its parent surface. + * If subsurface is defined and the x, y coordinates differ from the currently + * tracked position, this also schedules a sub-surface position change. + * + * @param subsurface the subsurface + * @param x coordinate in the parent surface + * @param y coordinate in the parent surface + * + * @ingroup Ecore_Wl2_Subsurface_Group + */ +EAPI void ecore_wl2_subsurface_position_set(Ecore_Wl2_Subsurface *subsurface, int x, int y); + /* # ifdef __cplusplus */ /* } */ /* # endif */ diff --git a/src/lib/ecore_wl2/ecore_wl2_subsurf.c b/src/lib/ecore_wl2/ecore_wl2_subsurf.c index eab1ec630c..c17566bfda 100644 --- a/src/lib/ecore_wl2/ecore_wl2_subsurf.c +++ b/src/lib/ecore_wl2/ecore_wl2_subsurf.c @@ -85,3 +85,17 @@ ecore_wl2_subsurface_surface_get(Ecore_Wl2_Subsurface *subsurface) return subsurface->wl.surface; } + +EAPI void +ecore_wl2_subsurface_position_set(Ecore_Wl2_Subsurface *subsurface, int x, int y) +{ + EINA_SAFETY_ON_NULL_RETURN(subsurface); + EINA_SAFETY_ON_NULL_RETURN(subsurface->wl.subsurface); + + if ((subsurface->x == x) && (subsurface->y == y)) return; + + subsurface->x = x; + subsurface->y = y; + + wl_subsurface_set_position(subsurface->wl.subsurface, x, y); +}