summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2017-06-23 17:43:58 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2017-06-23 17:43:44 -0400
commitfb5cb4d5c3eb7342f53b569a17404ab84f4721f8 (patch)
tree1b39215951cb63c3eb41f4e515ad1e3e77ad7d92
parent05e74a030b12e935319281ff430a5e663550ca36 (diff)
downloadefl-fb5cb4d5c3eb7342f53b569a17404ab84f4721f8.tar.gz
elm_cursor: store and reapply non-elm cursors when setting an elm cursor
when using elm with non-elm objects, any custom cursors would previously be destroyed by any elm_entry widget upon mouse-in @fix
-rw-r--r--src/lib/elementary/els_cursor.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/src/lib/elementary/els_cursor.c b/src/lib/elementary/els_cursor.c
index b090de0a6a..3d09d9addd 100644
--- a/src/lib/elementary/els_cursor.c
+++ b/src/lib/elementary/els_cursor.c
@@ -176,6 +176,12 @@ struct _Elm_Cursor
Ecore_Cocoa_Window *win;
} cocoa;
#endif
+ struct
+ {
+ Evas_Object *obj;
+ int layer;
+ int x, y;
+ } prev;
Eina_Bool visible:1;
Eina_Bool use_engine:1;
@@ -267,6 +273,7 @@ _elm_cursor_obj_add(Evas_Object *obj, Elm_Cursor *cur)
ELM_SAFE_FREE(cur->obj, evas_object_del);
return EINA_FALSE;
}
+ evas_object_data_set(cur->obj, "elm-cursor", (void*)1);
cur->hotobj = evas_object_rectangle_add(cur->evas);
evas_object_color_set(cur->hotobj, 0, 0, 0, 0);
evas_object_event_callback_add(cur->obj, EVAS_CALLBACK_MOVE,
@@ -312,9 +319,19 @@ _elm_cursor_set(Elm_Cursor *cur)
if (!cur->obj)
_elm_cursor_obj_add(cur->owner, cur);
if (cur->obj)
- ecore_evas_object_cursor_set(cur->ee, cur->obj,
+ {
+ ecore_evas_cursor_get(cur->ee, &cur->prev.obj, &cur->prev.layer, &cur->prev.x, &cur->prev.y);
+ if (cur->prev.obj)
+ {
+ if (evas_object_data_get(cur->prev.obj, "elm-cursor"))
+ memset(&cur->prev, 0, sizeof(cur->prev));
+ else
+ ecore_evas_cursor_unset(cur->ee);
+ }
+ ecore_evas_object_cursor_set(cur->ee, cur->obj,
ELM_OBJECT_LAYER_CURSOR, cur->hot_x,
cur->hot_y);
+ }
cur->visible = !!cur->obj;
}
else
@@ -397,8 +414,15 @@ _elm_cursor_mouse_out(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_
}
if (!cur->use_engine)
- ecore_evas_object_cursor_set(cur->ee, NULL, ELM_OBJECT_LAYER_CURSOR,
- cur->hot_x, cur->hot_y);
+ {
+ if (cur->prev.obj)
+ ecore_evas_object_cursor_set(cur->ee, cur->prev.obj, cur->prev.layer,
+ cur->prev.x, cur->prev.y);
+ else
+ ecore_evas_object_cursor_set(cur->ee, NULL, ELM_OBJECT_LAYER_CURSOR,
+ cur->hot_x, cur->hot_y);
+ memset(&cur->prev, 0, sizeof(cur->prev));
+ }
else
{
#ifdef HAVE_ELEMENTARY_X