#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;
}
main(void)
{
Ecore_Evas *ee;
- Evas_Object *bg, *cursor, *obj;
+ Evas_Object *bg, *obj;
int layer, x, y;
ecore_evas_init();
* @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
*
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.
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)
{