raster pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=69552fc39205afaf9d2b3bca0759089ef3db94e9
commit 69552fc39205afaf9d2b3bca0759089ef3db94e9 Author: Vyacheslav Reutskiy <[email protected]> Date: Tue Jun 10 17:32:10 2014 +0900 Ecore_Evas: add new API for unset the cursor from Ecore_Evas. Summary: Add ecore_evas_cursor_unset function. Use the new function in the ecore_evas_object_example. @feature Test Plan: ecore_evas_object_example Reviewers: raster, cedric, seoz, Hermet CC: cedric Differential Revision: https://phab.enlightenment.org/D812 --- src/examples/ecore/ecore_evas_object_example.c | 14 +++++++------- src/lib/ecore_evas/Ecore_Evas.h | 16 ++++++++++++++++ src/lib/ecore_evas/ecore_evas.c | 18 ++++++++++++++++++ 3 files changed, 41 insertions(+), 7 deletions(-) diff --git a/src/examples/ecore/ecore_evas_object_example.c b/src/examples/ecore/ecore_evas_object_example.c index 95731d0..f634b42 100644 --- a/src/examples/ecore/ecore_evas_object_example.c +++ b/src/examples/ecore/ecore_evas_object_example.c @@ -12,20 +12,20 @@ #include <Ecore.h> #include <Ecore_Evas.h> +Evas_Object *cursor; + static void _mouse_down_cb(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { static Eina_Bool flag = EINA_FALSE; if (!flag) - ecore_evas_object_cursor_set(data, NULL, 0, 1, 1); - else { - Evas_Object *cursor = evas_object_rectangle_add(ecore_evas_get(data)); - evas_object_color_set(cursor, 0, 255, 0, 255); - evas_object_resize(cursor, 5, 10); - ecore_evas_object_cursor_set(data, cursor, 0, 1, 1); + ecore_evas_cursor_unset(data); + ecore_evas_object_cursor_set(data, NULL, 0, 1, 1); } + else + ecore_evas_object_cursor_set(data, cursor, 0, 1, 1); flag = !flag; } @@ -34,7 +34,7 @@ int main(void) { Ecore_Evas *ee; - Evas_Object *bg, *cursor, *obj; + Evas_Object *bg, *obj; int layer, x, y; ecore_evas_init(); diff --git a/src/lib/ecore_evas/Ecore_Evas.h b/src/lib/ecore_evas/Ecore_Evas.h index 81a6c3a..e59fca6 100644 --- a/src/lib/ecore_evas/Ecore_Evas.h +++ b/src/lib/ecore_evas/Ecore_Evas.h @@ -1939,6 +1939,7 @@ EAPI void ecore_evas_cursor_set(Ecore_Evas *ee, const char *file, int lay * @see ecore_evas_object_cursor_set() */ EAPI void ecore_evas_cursor_get(const Ecore_Evas *ee, Evas_Object **obj, int *layer, int *hot_x, int *hot_y); + /** * @brief Set the cursor of an Ecore_Evas * @@ -1959,6 +1960,21 @@ EAPI void ecore_evas_cursor_get(const Ecore_Evas *ee, Evas_Object **obj, EAPI void ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y); /** + * @brief Unset the Ecore_Evas cursor + * + * @param ee The Ecore_Evas to uset the cursor. + * + * This function unset the cursor from the Ecore_Evas and return the cursor + * object. If the cursor was setted from ecore_evas_cursor_set() fuction + * returned the image. In this case this image need to delete when it not be + * needed. + * + * @see ecore_evas_cursor_set() + * @see ecore_evas_object_cursor_set() + */ +EAPI Evas_Object* ecore_evas_cursor_unset(Ecore_Evas *ee); + +/** * Tell the WM whether or not to ignore an Ecore_Evas' window * * @param ee The Ecore_Evas. diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c index 618a2e6..224220a 100644 --- a/src/lib/ecore_evas/ecore_evas.c +++ b/src/lib/ecore_evas/ecore_evas.c @@ -1725,6 +1725,24 @@ ecore_evas_cursor_get(const Ecore_Evas *ee, Evas_Object **obj, int *layer, int * if (hot_y) *hot_y = ee->prop.cursor.hot.y; } +EAPI Evas_Object * +ecore_evas_cursor_unset(Ecore_Evas *ee) +{ + Evas_Object *obj; + + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_cursor_unset"); + return NULL; + } + obj = ee->prop.cursor.object; + evas_object_hide(obj); + ee->prop.cursor.object = NULL; + + return obj; +} + EAPI void ecore_evas_layer_set(Ecore_Evas *ee, int layer) { --
