raster pushed a commit to branch efl-1.9. http://git.enlightenment.org/core/efl.git/commit/?id=fef45870b0a65a838cc0248c3a4ea1baeda25c94
commit fef45870b0a65a838cc0248c3a4ea1baeda25c94 Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com> Date: Wed Apr 2 20:29:03 2014 +0900 ecore-evas - fix object cursor to not delete the same cursor when set this fixes a misbehavior with ecore evas object cursors when you set one, the old one is deleted, but if the old is the same, the new one you set gets deleted, rather than just updated. @fix Conflicts: src/modules/ecore_evas/engines/drm/ecore_evas_drm.c --- .../ecore_evas/engines/cocoa/ecore_evas_cocoa.c | 61 +++++++++++++--------- src/modules/ecore_evas/engines/fb/ecore_evas_fb.c | 37 ++++++++----- .../engines/psl1ght/ecore_evas_psl1ght.c | 37 ++++++++----- .../ecore_evas/engines/sdl/ecore_evas_sdl.c | 37 ++++++++----- .../engines/wayland/ecore_evas_wayland_common.c | 42 +++++++++------ .../ecore_evas/engines/win32/ecore_evas_win32.c | 47 +++++++++++------ src/modules/ecore_evas/engines/x/ecore_evas_x.c | 29 ++++++---- 7 files changed, 182 insertions(+), 108 deletions(-) diff --git a/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c b/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c index d54737e..8f81a23 100644 --- a/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c +++ b/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c @@ -338,36 +338,45 @@ _ecore_evas_object_cursor_del(void *data, Evas *e, Evas_Object *obj, void *event static void _ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) { - int x, y; - DBG("Cursor Set"); - if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); + int x, y; + Evas_Object *old; + DBG("Cursor Set"); - if (obj == NULL) - { - ee->prop.cursor.object = NULL; - ee->prop.cursor.layer = 0; - ee->prop.cursor.hot.x = 0; - ee->prop.cursor.hot.y = 0; - return; - } - - ee->prop.cursor.object = obj; - ee->prop.cursor.layer = layer; - ee->prop.cursor.hot.x = hot_x; - ee->prop.cursor.hot.y = hot_y; - - evas_pointer_output_xy_get(ee->evas, &x, &y); - evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); + old = ee->prop.cursor.object; + if (obj == NULL) + { + ee->prop.cursor.object = NULL; + ee->prop.cursor.layer = 0; + ee->prop.cursor.hot.x = 0; + ee->prop.cursor.hot.y = 0; + goto end; + } + + ee->prop.cursor.object = obj; + ee->prop.cursor.layer = layer; + ee->prop.cursor.hot.x = hot_x; + ee->prop.cursor.hot.y = hot_y; + + if (obj != old) + { + evas_pointer_output_xy_get(ee->evas, &x, &y); + evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); + evas_object_pass_events_set(ee->prop.cursor.object, 1); + if (evas_pointer_inside_get(ee->evas)) + evas_object_show(ee->prop.cursor.object); + evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, + _ecore_evas_object_cursor_del, ee); + } evas_object_move(ee->prop.cursor.object, x - ee->prop.cursor.hot.x, y - ee->prop.cursor.hot.y); - - evas_object_pass_events_set(ee->prop.cursor.object, 1); - - if (evas_pointer_inside_get(ee->evas)) - evas_object_show(ee->prop.cursor.object); - - evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); +end: + if ((old) && (obj != old)) + { + evas_object_event_callback_del_full + (old, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); + evas_object_del(old); + } } static int diff --git a/src/modules/ecore_evas/engines/fb/ecore_evas_fb.c b/src/modules/ecore_evas/engines/fb/ecore_evas_fb.c index aba3127..0521c34 100644 --- a/src/modules/ecore_evas/engines/fb/ecore_evas_fb.c +++ b/src/modules/ecore_evas/engines/fb/ecore_evas_fb.c @@ -425,32 +425,43 @@ static void _ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) { int x, y; - - if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); - - if (!obj) + Evas_Object *old; + + old = ee->prop.cursor.object; + if (obj == NULL) { ee->prop.cursor.object = NULL; ee->prop.cursor.layer = 0; ee->prop.cursor.hot.x = 0; ee->prop.cursor.hot.y = 0; - return; + goto end; } - + ee->prop.cursor.object = obj; ee->prop.cursor.layer = layer; ee->prop.cursor.hot.x = hot_x; ee->prop.cursor.hot.y = hot_y; - evas_pointer_output_xy_get(ee->evas, &x, &y); - evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); + + if (obj != old) + { + evas_pointer_output_xy_get(ee->evas, &x, &y); + evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); + evas_object_pass_events_set(ee->prop.cursor.object, 1); + if (evas_pointer_inside_get(ee->evas)) + evas_object_show(ee->prop.cursor.object); + evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, + _ecore_evas_object_cursor_del, ee); + } evas_object_move(ee->prop.cursor.object, x - ee->prop.cursor.hot.x, y - ee->prop.cursor.hot.y); - evas_object_pass_events_set(ee->prop.cursor.object, 1); - if (evas_pointer_inside_get(ee->evas)) - evas_object_show(ee->prop.cursor.object); - - evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); +end: + if ((old) && (obj != old)) + { + evas_object_event_callback_del_full + (old, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); + evas_object_del(old); + } } static void diff --git a/src/modules/ecore_evas/engines/psl1ght/ecore_evas_psl1ght.c b/src/modules/ecore_evas/engines/psl1ght/ecore_evas_psl1ght.c index bd09d14..74b7213 100644 --- a/src/modules/ecore_evas/engines/psl1ght/ecore_evas_psl1ght.c +++ b/src/modules/ecore_evas/engines/psl1ght/ecore_evas_psl1ght.c @@ -317,32 +317,43 @@ static void _ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) { int x, y; - - if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); - - if (!obj) + Evas_Object *old; + + old = ee->prop.cursor.object; + if (obj == NULL) { ee->prop.cursor.object = NULL; ee->prop.cursor.layer = 0; ee->prop.cursor.hot.x = 0; ee->prop.cursor.hot.y = 0; - return; + goto end; } - + ee->prop.cursor.object = obj; ee->prop.cursor.layer = layer; ee->prop.cursor.hot.x = hot_x; ee->prop.cursor.hot.y = hot_y; - evas_pointer_output_xy_get(ee->evas, &x, &y); - evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); + + if (obj != old) + { + evas_pointer_output_xy_get(ee->evas, &x, &y); + evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); + evas_object_pass_events_set(ee->prop.cursor.object, 1); + if (evas_pointer_inside_get(ee->evas)) + evas_object_show(ee->prop.cursor.object); + evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, + _ecore_evas_object_cursor_del, ee); + } evas_object_move(ee->prop.cursor.object, x - ee->prop.cursor.hot.x, y - ee->prop.cursor.hot.y); - evas_object_pass_events_set(ee->prop.cursor.object, 1); - if (evas_pointer_inside_get(ee->evas)) - evas_object_show(ee->prop.cursor.object); - - evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); +end: + if ((old) && (obj != old)) + { + evas_object_event_callback_del_full + (old, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); + evas_object_del(old); + } } static Ecore_Evas_Engine_Func _ecore_psl1ght_engine_func = diff --git a/src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c b/src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c index 33da518..94f6f69 100644 --- a/src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c +++ b/src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c @@ -357,32 +357,43 @@ static void _ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) { int x, y; - - if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); - - if (!obj) + Evas_Object *old; + + old = ee->prop.cursor.object; + if (obj == NULL) { ee->prop.cursor.object = NULL; ee->prop.cursor.layer = 0; ee->prop.cursor.hot.x = 0; ee->prop.cursor.hot.y = 0; - return; + goto end; } - + ee->prop.cursor.object = obj; ee->prop.cursor.layer = layer; ee->prop.cursor.hot.x = hot_x; ee->prop.cursor.hot.y = hot_y; - evas_pointer_output_xy_get(ee->evas, &x, &y); - evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); + + if (obj != old) + { + evas_pointer_output_xy_get(ee->evas, &x, &y); + evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); + evas_object_pass_events_set(ee->prop.cursor.object, 1); + if (evas_pointer_inside_get(ee->evas)) + evas_object_show(ee->prop.cursor.object); + evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, + _ecore_evas_object_cursor_del, ee); + } evas_object_move(ee->prop.cursor.object, x - ee->prop.cursor.hot.x, y - ee->prop.cursor.hot.y); - evas_object_pass_events_set(ee->prop.cursor.object, 1); - if (evas_pointer_inside_get(ee->evas)) - evas_object_show(ee->prop.cursor.object); - - evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); +end: + if ((old) && (obj != old)) + { + evas_object_event_callback_del_full + (old, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); + evas_object_del(old); + } } static Ecore_Evas_Engine_Func _ecore_sdl_engine_func = diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c index 90223f8..9936d14 100644 --- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c +++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c @@ -1182,37 +1182,45 @@ _ecore_evas_wl_common_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int la { int x, y, fx, fy; Ecore_Evas_Engine_Wl_Data *wdata = ee->engine.data; - - if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); - - if (!obj) + Evas_Object *old; + + old = ee->prop.cursor.object; + if (obj == NULL) { ee->prop.cursor.object = NULL; ee->prop.cursor.layer = 0; ee->prop.cursor.hot.x = 0; ee->prop.cursor.hot.y = 0; - ecore_wl_window_cursor_default_restore(wdata->win); - return; + goto end; } - + ee->prop.cursor.object = obj; ee->prop.cursor.layer = layer; ee->prop.cursor.hot.x = hot_x; ee->prop.cursor.hot.y = hot_y; - - ecore_wl_window_pointer_set(wdata->win, NULL, 0, 0); - - evas_pointer_output_xy_get(ee->evas, &x, &y); + + if (obj != old) + { + ecore_wl_window_pointer_set(wdata->win, NULL, 0, 0); + evas_pointer_output_xy_get(ee->evas, &x, &y); + evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); + evas_object_pass_events_set(ee->prop.cursor.object, 1); + if (evas_pointer_inside_get(ee->evas)) + evas_object_show(ee->prop.cursor.object); + evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, + _ecore_evas_object_cursor_del, ee); + } evas_output_framespace_get(ee->evas, &fx, &fy, NULL, NULL); - evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); evas_object_move(ee->prop.cursor.object, x - fx - ee->prop.cursor.hot.x, y - fy - ee->prop.cursor.hot.y); - evas_object_pass_events_set(ee->prop.cursor.object, 1); - if (evas_pointer_inside_get(ee->evas)) - evas_object_show(ee->prop.cursor.object); - - evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); +end: + if ((old) && (obj != old)) + { + evas_object_event_callback_del_full + (old, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); + evas_object_del(old); + } } void diff --git a/src/modules/ecore_evas/engines/win32/ecore_evas_win32.c b/src/modules/ecore_evas/engines/win32/ecore_evas_win32.c index bbcfae2..e9809fd 100644 --- a/src/modules/ecore_evas/engines/win32/ecore_evas_win32.c +++ b/src/modules/ecore_evas/engines/win32/ecore_evas_win32.c @@ -809,39 +809,56 @@ _ecore_evas_win32_size_step_set(Ecore_Evas *ee, int width, int height) } static void +_ecore_evas_object_cursor_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Ecore_Evas *ee; + + ee = data; + if (ee) ee->prop.cursor.object = NULL; +} + +static void _ecore_evas_win32_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) { -#if 0 int x, y; - - if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); - + Evas_Object *old; + + old = ee->prop.cursor.object; if (obj == NULL) { ee->prop.cursor.object = NULL; ee->prop.cursor.layer = 0; ee->prop.cursor.hot.x = 0; ee->prop.cursor.hot.y = 0; - ecore_win32_window_cursor_show(ee->prop.window, 1); - return; + goto end; } - + ee->prop.cursor.object = obj; ee->prop.cursor.layer = layer; ee->prop.cursor.hot.x = hot_x; ee->prop.cursor.hot.y = hot_y; - ecore_win32_window_cursor_show(ee->prop.window, 0); - - evas_pointer_output_xy_get(ee->evas, &x, &y); - evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); + if (obj != old) + { + ecore_win32_window_cursor_show(ee->prop.window, 0); + evas_pointer_output_xy_get(ee->evas, &x, &y); + evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); + evas_object_pass_events_set(ee->prop.cursor.object, 1); + if (evas_pointer_inside_get(ee->evas)) + evas_object_show(ee->prop.cursor.object); + evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, + _ecore_evas_object_cursor_del, ee); + } evas_object_move(ee->prop.cursor.object, x - ee->prop.cursor.hot.x, y - ee->prop.cursor.hot.y); - evas_object_pass_events_set(ee->prop.cursor.object, 1); - if (evas_pointer_inside_get(ee->evas)) - evas_object_show(ee->prop.cursor.object); -#endif +end: + if ((old) && (obj != old)) + { + evas_object_event_callback_del_full + (old, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); + evas_object_del(old); + } } static void diff --git a/src/modules/ecore_evas/engines/x/ecore_evas_x.c b/src/modules/ecore_evas/engines/x/ecore_evas_x.c index 2a33fc8..f96db90 100644 --- a/src/modules/ecore_evas/engines/x/ecore_evas_x.c +++ b/src/modules/ecore_evas/engines/x/ecore_evas_x.c @@ -2894,7 +2894,7 @@ static void _ecore_evas_x_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) { int x, y; - Evas_Object* old; + Evas_Object *old; old = ee->prop.cursor.object; if (!obj) @@ -2912,21 +2912,28 @@ _ecore_evas_x_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int ee->prop.cursor.hot.x = hot_x; ee->prop.cursor.hot.y = hot_y; - ecore_x_window_cursor_show(ee->prop.window, 0); - - evas_pointer_output_xy_get(ee->evas, &x, &y); - evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); + if (obj != old) + { + ecore_x_window_cursor_show(ee->prop.window, 0); + evas_pointer_output_xy_get(ee->evas, &x, &y); + evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); + evas_object_pass_events_set(ee->prop.cursor.object, 1); + if (evas_pointer_inside_get(ee->evas)) + evas_object_show(ee->prop.cursor.object); + evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, + _ecore_evas_object_cursor_del, ee); + } evas_object_move(ee->prop.cursor.object, x - ee->prop.cursor.hot.x, y - ee->prop.cursor.hot.y); - evas_object_pass_events_set(ee->prop.cursor.object, 1); - if (evas_pointer_inside_get(ee->evas)) - evas_object_show(ee->prop.cursor.object); - - evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); end: - if (old) evas_object_del(old); + if ((old) && (obj != old)) + { + evas_object_event_callback_del_full + (old, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); + evas_object_del(old); + } } /* --