els_cursor: Fix mouse_out changing cursor to wrong image

Summary:
Fixes a bug when having a mouse_out event from elm objects that had a cursor set to them.
For example, Entry has a specific cursor set to it.
The bug is observable in Entry Test, and in any other test that has anchors (markup) in the entry widget.
Just take your mouse in an anchor, and out of it, to see that the entry now has the wrong cursor.

The old way of handling this asssumed that the triggering object had an elm-parent.
However, this is not the case for anchors.
Instead, it was agreed that the simplest way was to determine if there is any elm object,
with a cursor set to it, under the current mouse position.
If one is found, then use the cursor assigned to it.
Fixes T878.

Reviewers: tasn, raster

CC: raster, JackDanielZ

Maniphest Tasks: T878

Differential Revision: https://phab.enlightenment.org/D551
This commit is contained in:
Daniel Hirt 2014-02-17 21:34:59 +09:00 committed by Carsten Haitzler (Rasterman)
parent 7c4288548b
commit 6248f9c0fa
1 changed files with 8 additions and 2 deletions

View File

@ -209,10 +209,13 @@ _elm_cursor_set_hot_spots(Elm_Cursor *cur)
}
static void
_elm_cursor_mouse_in(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
_elm_cursor_mouse_in(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{
Elm_Cursor *cur = data;
Evas_Event_Mouse_In *ev = event_info;
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
if (cur->visible) return;
evas_event_freeze(cur->evas);
cur->visible = EINA_TRUE;
@ -239,12 +242,15 @@ _elm_cursor_mouse_in(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_U
}
static void
_elm_cursor_mouse_out(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
_elm_cursor_mouse_out(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{
Evas_Object *sobj_parent;
Elm_Cursor *pcur = NULL;
Elm_Cursor *cur = data;
Evas_Event_Mouse_Out *ev = event_info;
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
if (!cur->visible) return;
evas_event_freeze(cur->evas);
cur->visible = EINA_FALSE;