From e5acc5604a5bb728f1affc0a839878de55f5dafc Mon Sep 17 00:00:00 2001 From: Guilherme Iscaro Date: Tue, 22 Nov 2016 16:14:03 -0200 Subject: [PATCH] Ecore Evas: Add support to set cursor icon per mouse device. Since Ecore Evas now supports multiple mouses new APIs were added in order to be able to set the cursor image to any device. --- src/lib/ecore_evas/Ecore_Evas.h | 50 +- src/lib/ecore_evas/ecore_evas.c | 530 ++++++++++++++++++--- src/lib/ecore_evas/ecore_evas_buffer.c | 5 + src/lib/ecore_evas/ecore_evas_ews.c | 56 +-- src/lib/ecore_evas/ecore_evas_private.h | 27 +- .../ecore_evas/engines/cocoa/ecore_evas_cocoa.c | 69 +-- .../ecore_evas/engines/drm/ecore_evas_drm.c | 66 +-- src/modules/ecore_evas/engines/fb/ecore_evas_fb.c | 100 +--- .../engines/psl1ght/ecore_evas_psl1ght.c | 64 +-- .../ecore_evas/engines/sdl/ecore_evas_sdl.c | 64 +-- .../engines/wayland/ecore_evas_wayland_common.c | 74 +-- .../ecore_evas/engines/win32/ecore_evas_win32.c | 67 +-- src/modules/ecore_evas/engines/x/ecore_evas_x.c | 67 +-- 13 files changed, 607 insertions(+), 632 deletions(-) diff --git a/src/lib/ecore_evas/Ecore_Evas.h b/src/lib/ecore_evas/Ecore_Evas.h index 19493f8..0af4bcc 100644 --- a/src/lib/ecore_evas/Ecore_Evas.h +++ b/src/lib/ecore_evas/Ecore_Evas.h @@ -2143,7 +2143,7 @@ EAPI void ecore_evas_size_step_set(Ecore_Evas *ee, int w, int h); EAPI void ecore_evas_size_step_get(const Ecore_Evas *ee, int *w, int *h); /** - * @brief Set the cursor of an Ecore_Evas. + * @brief Set the cursor for the default pointer device. * * @param ee The Ecore_Evas * @param file The path to an image file for the cursor. @@ -2166,9 +2166,9 @@ EAPI void ecore_evas_size_step_get(const Ecore_Evas *ee, int *w, int *h); */ EAPI void ecore_evas_cursor_set(Ecore_Evas *ee, const char *file, int layer, int hot_x, int hot_y); /** - * @brief Get information about an Ecore_Evas' cursor + * @brief Get information about an Ecore_Evas' default pointer device. * - * @param ee The Ecore_Evas to set + * @param ee The Ecore_Evas to get * @param obj A pointer to an Evas_Object to place the cursor Evas_Object. * @param layer A pointer to an int to place the cursor's layer in. * @param hot_x A pointer to an int to place the cursor's hot_x coordinate in. @@ -2183,10 +2183,9 @@ EAPI void ecore_evas_cursor_set(Ecore_Evas *ee, const char *file, int lay 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 + * @brief Set the cursor for the default pointer device. * * @param ee The Ecore_Evas - * * @param obj The Evas_Object which will be the cursor. * @param layer The layer in which the cursor will appear. * @param hot_x The x coordinate of the cursor's hot spot. @@ -2202,7 +2201,7 @@ 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 + * @brief Unset the cursor of the default pointer device. * * @param ee The Ecore_Evas to unset the cursor. * @@ -2218,6 +2217,45 @@ EAPI void ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, EAPI Evas_Object* ecore_evas_cursor_unset(Ecore_Evas *ee); /** + * @brief Set the cursor of an Ecore_Evas specified pointer device. + * + * @param ee The Ecore_Evas + * @param pointer A pointer device to set the cursor. Use @c NULL for the default. + * @param obj The Evas_Object which will be the cursor. + * @param layer The layer in which the cursor will appear. + * @param hot_x The x coordinate of the cursor's hot spot. + * @param hot_y The y coordinate of the cursor's hot spot. + * + * This function makes the mouse cursor over @p ee be the object specified by + * @p obj. The actual point within the object that the mouse is at is specified + * by @p hot_x and @p hot_y, which are coordinates with respect to the top left + * corner of the cursor object. Cursor object will be delete with the Ecore_Evas. + * + * @since 1.19 + */ +EAPI void ecore_evas_object_cursor_device_set(Ecore_Evas *ee, Efl_Input_Device *pointer, + Evas_Object *obj, int layer, + int hot_x, int hot_y); +/** + * @brief Get information about an Ecore_Evas' specified pointer device. + * + * @param ee The Ecore_Evas + * @param pointer A pointer device to set the cursor. Use @c NULL for the default. + * @param obj A pointer to an Evas_Object to place the cursor Evas_Object. + * @param layer A pointer to an int to place the cursor's layer in. + * @param hot_x A pointer to an int to place the cursor's hot_x coordinate in. + * @param hot_y A pointer to an int to place the cursor's hot_y coordinate in. + * + * This function queries information about an Ecore_Evas' cursor. + * + * @see ecore_evas_cursor_device_set() + * @since 1.19 + */ +EAPI Eina_Bool ecore_evas_cursor_device_get(const Ecore_Evas *ee, Efl_Input_Device *pointer, + Evas_Object **obj, int *layer, + int *hot_x, int *hot_y); + +/** * @brief 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 b493383..da485a8 100644 --- a/src/lib/ecore_evas/ecore_evas.c +++ b/src/lib/ecore_evas/ecore_evas.c @@ -51,6 +51,13 @@ return __VA_ARGS__; \ } +#define ECORE_EVAS_CHECK_GOTO(_ee, _label) \ + if (!ECORE_MAGIC_CHECK(_ee, ECORE_MAGIC_EVAS)) \ + { \ + ECORE_MAGIC_FAIL(_ee, ECORE_MAGIC_EVAS, __FUNCTION__); \ + goto _label; \ + } + EAPI Eina_Bool _ecore_evas_app_comp_sync = EINA_FALSE; EAPI int _ecore_evas_log_dom = -1; static int _ecore_evas_init_count = 0; @@ -62,6 +69,8 @@ static Ecore_Idle_Enterer *ecore_evas_idle_enterer = NULL; static Ecore_Evas *ecore_evases = NULL; static int _ecore_evas_fps_debug = 0; +static const Efl_Event_Description *_event_description_get(Efl_Pointer_Action action); + //RENDER_SYNC static int _ecore_evas_render_sync = 1; @@ -246,6 +255,87 @@ _ecore_evas_idle_enter(void *data EINA_UNUSED) return ECORE_CALLBACK_RENEW; } +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_Cursor *cursor = data; + cursor->object = NULL; +} + +static void +_ecore_evas_cursor_element_del(Ecore_Evas_Cursor *cursor) +{ + if (cursor->object) + { + evas_object_event_callback_del_full(cursor->object, EVAS_CALLBACK_DEL, + _ecore_evas_object_cursor_del, + cursor); + evas_object_del(cursor->object); + } + free(cursor); +} + +static void +_ecore_evas_cursor_add(Ecore_Evas *ee, Efl_Input_Device *dev) +{ + Ecore_Evas_Cursor *cursor = calloc(1, sizeof(Ecore_Evas_Cursor)); + EINA_SAFETY_ON_NULL_RETURN(cursor); + eina_hash_add(ee->prop.cursors, &dev, cursor); + if (ee->prop.cursor_cache.object) + { + ecore_evas_object_cursor_device_set(ee, dev, + ee->prop.cursor_cache.object, + ee->prop.cursor_cache.layer, + ee->prop.cursor_cache.hot.x, + ee->prop.cursor_cache.hot.y); + memset(&ee->prop.cursor_cache, 0, sizeof(Ecore_Evas_Cursor)); + } +} + +static void +_ecore_evas_dev_added_or_removed(void *data, const Efl_Event *event) +{ + Ecore_Evas *ee = data; + + if (efl_input_device_type_get(event->info) != EFL_INPUT_DEVICE_CLASS_MOUSE) + return; + + if (event->desc == EFL_CANVAS_EVENT_DEVICE_ADDED) + _ecore_evas_cursor_add(ee, event->info); + else + eina_hash_del_by_key(ee->prop.cursors, &event->info); +} + +EFL_CALLBACKS_ARRAY_DEFINE(_ecore_evas_device_cbs, + { EFL_CANVAS_EVENT_DEVICE_ADDED, _ecore_evas_dev_added_or_removed }, + { EFL_CANVAS_EVENT_DEVICE_REMOVED, _ecore_evas_dev_added_or_removed }); +Eina_Bool +_ecore_evas_cursors_init(Ecore_Evas *ee) +{ + const Eina_List *devs, *l; + Efl_Input_Device *dev; + + EINA_SAFETY_ON_NULL_RETURN_VAL(ee, EINA_FALSE); + ee->prop.cursors = eina_hash_pointer_new(EINA_FREE_CB(_ecore_evas_cursor_element_del)); + EINA_SAFETY_ON_NULL_RETURN_VAL(ee->prop.cursors, EINA_FALSE); + + devs = evas_device_list(ee->evas, NULL); + + EINA_LIST_FOREACH(devs, l, dev) + { + if (efl_input_device_type_get(dev) != EFL_INPUT_DEVICE_CLASS_MOUSE) + continue; + _ecore_evas_cursor_add(ee, dev); + } + + efl_event_callback_array_priority_add(ee->evas, _ecore_evas_device_cbs(), + EFL_CALLBACK_PRIORITY_BEFORE, ee); + + return EINA_TRUE; +} + EAPI Ecore_Evas_Interface * _ecore_evas_interface_get(const Ecore_Evas *ee, const char *iname) { @@ -1534,13 +1624,106 @@ ecore_evas_size_step_get(const Ecore_Evas *ee, int *w, int *h) } } +EAPI Evas_Object * +_ecore_evas_default_cursor_image_get(Ecore_Evas *ee) +{ + Efl_Input_Device *pointer; + Ecore_Evas_Cursor *cursor; + + pointer = evas_default_device_get(ee->evas, EFL_INPUT_DEVICE_CLASS_MOUSE); + cursor = eina_hash_find(ee->prop.cursors, &pointer); + EINA_SAFETY_ON_NULL_RETURN_VAL(cursor, NULL); + return cursor->object; +} + EAPI void -ecore_evas_cursor_set(Ecore_Evas *ee, const char *file, int layer, int hot_x, int hot_y) +_ecore_evas_default_cursor_hide(Ecore_Evas *ee) +{ + Efl_Input_Device *pointer; + Ecore_Evas_Cursor *cursor; + + pointer = evas_default_device_get(ee->evas, EFL_INPUT_DEVICE_CLASS_MOUSE); + cursor = eina_hash_find(ee->prop.cursors, &pointer); + EINA_SAFETY_ON_NULL_RETURN(cursor); + if (cursor->object) + evas_object_hide(cursor->object); +} + +static void +_ecore_evas_object_cursor_device_set(Ecore_Evas *ee, Efl_Input_Device *pointer, + Evas_Object *obj, int layer, + int hot_x, int hot_y) { - Evas_Object *obj = NULL; + Ecore_Evas_Cursor *cursor; + int x, y; + Evas_Object *old; ECORE_EVAS_CHECK(ee); + if (!pointer) + { + pointer = evas_default_device_get(ee->evas, EFL_INPUT_DEVICE_CLASS_MOUSE); + if (!pointer) + { + ee->prop.cursor_cache.object = obj; + ee->prop.cursor_cache.layer = layer; + ee->prop.cursor_cache.hot.x = hot_x; + ee->prop.cursor_cache.hot.y = hot_y; + return; + } + } + + if (obj && ee->engine.func->fn_object_cursor_set) + ee->engine.func->fn_object_cursor_set(ee, obj, layer, hot_x, hot_y); + else if (!obj && ee->engine.func->fn_object_cursor_unset) + ee->engine.func->fn_object_cursor_unset(ee); + + cursor = eina_hash_find(ee->prop.cursors, &pointer); + EINA_SAFETY_ON_NULL_RETURN(cursor); + old = cursor->object; + if (!obj) + { + cursor->object = NULL; + cursor->layer = 0; + cursor->hot.x = 0; + cursor->hot.y = 0; + goto end; + } + + cursor->object = obj; + cursor->layer = layer; + cursor->hot.x = hot_x; + cursor->hot.y = hot_y; + + evas_pointer_output_xy_get(ee->evas, &x, &y); + + if (obj != old) + { + evas_object_layer_set(cursor->object, cursor->layer); + evas_object_pass_events_set(cursor->object, 1); + if (evas_pointer_inside_get(ee->evas)) + evas_object_show(cursor->object); + evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, + _ecore_evas_object_cursor_del, cursor); + } + + evas_object_move(cursor->object, x - cursor->hot.x, + y - cursor->hot.y); + +end: + if ((old) && (obj != old)) + { + evas_object_event_callback_del_full + (old, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, cursor); + evas_object_del(old); + } +} + +EAPI void +ecore_evas_cursor_set(Ecore_Evas *ee, const char *file, + int layer, int hot_x, int hot_y) +{ + Evas_Object *obj = NULL; if (file) { int x, y; @@ -1552,41 +1735,82 @@ ecore_evas_cursor_set(Ecore_Evas *ee, const char *file, int layer, int hot_x, in evas_object_image_fill_set(obj, 0, 0, x, y); } - IFC(ee, fn_object_cursor_set) (ee, obj, layer, hot_x, hot_y); - IFE; + _ecore_evas_object_cursor_device_set(ee, NULL, obj, layer, hot_x, hot_y); } EAPI void -ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) +ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, + int layer, int hot_x, int hot_y) { - ECORE_EVAS_CHECK(ee); - IFC(ee, fn_object_cursor_set) (ee, obj, layer, hot_x, hot_y); - IFE; + _ecore_evas_object_cursor_device_set(ee, NULL, obj, layer, hot_x, hot_y); +} + +EAPI void +ecore_evas_object_cursor_device_set(Ecore_Evas *ee, Efl_Input_Device *pointer, + Evas_Object *obj, int layer, + int hot_x, int hot_y) +{ + _ecore_evas_object_cursor_device_set(ee, pointer, obj, layer, hot_x, hot_y); +} + +EAPI Eina_Bool +ecore_evas_cursor_device_get(const Ecore_Evas *ee, Efl_Input_Device *pointer, + Evas_Object **obj, int *layer, + int *hot_x, int *hot_y) +{ + Ecore_Evas_Cursor *cursor; + + ECORE_EVAS_CHECK_GOTO(ee, err); + + if (!pointer) + pointer = evas_default_device_get(ee->evas, EFL_INPUT_DEVICE_CLASS_MOUSE); + if (pointer) + { + cursor = eina_hash_find(ee->prop.cursors, &pointer); + if (cursor) + { + if (obj) *obj = cursor->object; + if (layer) *layer = cursor->layer; + if (hot_x) *hot_x = cursor->hot.x; + if (hot_y) *hot_y = cursor->hot.y; + return EINA_TRUE; + } + } + + err: + if (obj) *obj = NULL; + if (layer) *layer = 0; + if (hot_x) *hot_x = 0; + if (hot_y) *hot_y = 0; + return EINA_FALSE; } EAPI void ecore_evas_cursor_get(const Ecore_Evas *ee, Evas_Object **obj, int *layer, int *hot_x, int *hot_y) { - ECORE_EVAS_CHECK(ee); - if (obj) *obj = ee->prop.cursor.object; - if (layer) *layer = ee->prop.cursor.layer; - if (hot_x) *hot_x = ee->prop.cursor.hot.x; - if (hot_y) *hot_y = ee->prop.cursor.hot.y; + ecore_evas_cursor_device_get(ee, NULL, obj, layer, hot_x, hot_y); } EAPI Evas_Object * ecore_evas_cursor_unset(Ecore_Evas *ee) { + Ecore_Evas_Cursor *cursor; + Efl_Input_Device *pointer; Evas_Object *obj; ECORE_EVAS_CHECK(ee, NULL); - obj = ee->prop.cursor.object; - IFC(ee, fn_object_cursor_unset) (ee); + pointer = evas_default_device_get(ee->evas, EFL_INPUT_DEVICE_CLASS_MOUSE); + cursor = eina_hash_find(ee->prop.cursors, &pointer); + EINA_SAFETY_ON_NULL_RETURN_VAL(cursor, NULL); + obj = cursor->object; + if (ee->engine.func->fn_object_cursor_unset) + ee->engine.func->fn_object_cursor_unset(ee); evas_object_hide(obj); - ee->prop.cursor.object = NULL; - } - + cursor->object = NULL; + evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL, + _ecore_evas_object_cursor_del, + cursor); return obj; } @@ -2386,7 +2610,8 @@ ecore_evas_pointer_device_xy_get(const Ecore_Evas *ee, const Efl_Input_Device *pointer, Evas_Coord *x, Evas_Coord *y) { - if (!pointer || pointer == evas_default_device_get(ee->evas, EFL_INPUT_DEVICE_CLASS_MOUSE)) + if ((!pointer) || + (pointer == evas_default_device_get(ee->evas, EFL_INPUT_DEVICE_CLASS_MOUSE))) ecore_evas_pointer_xy_get(ee, x, y); else { @@ -2853,8 +3078,9 @@ _ecore_evas_free(Ecore_Evas *ee) ecore_timer_del(ee->prop.wm_rot.manual_mode.timer); _ecore_evas_aux_hint_free(ee); ee->prop.wm_rot.manual_mode.timer = NULL; - if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); - ee->prop.cursor.object = NULL; + efl_event_callback_array_del(ee->evas, _ecore_evas_device_cbs(), ee); + eina_hash_free(ee->prop.cursors); + ee->prop.cursors = NULL; if (ee->evas) evas_free(ee->evas); ee->evas = NULL; ECORE_MAGIC_SET(ee, ECORE_MAGIC_NONE); @@ -2904,49 +3130,98 @@ _ecore_evas_idle_timeout_update(Ecore_Evas *ee) } static void -_ecore_evas_mouse_move_process_internal(Ecore_Evas *ee, int x, int y, unsigned int timestamp, Eina_Bool feed) +_ecore_evas_mouse_move_process_internal(Ecore_Evas *ee, + Efl_Input_Device *pointer, + int x, int y, unsigned int timestamp, + Eina_Bool feed) { - int fx, fy, fw, fh; + Efl_Input_Pointer_Data *ev; + Efl_Input_Pointer *evt; + Eina_Bool send_event = EINA_TRUE; + Ecore_Evas_Cursor *cursor; + int fx, fy, fw, fh, evt_x, evt_y; ee->mouse.x = x; ee->mouse.y = y; evas_output_framespace_get(ee->evas, &fx, &fy, &fw, &fh); - if (ee->prop.cursor.object) + if (!pointer) + pointer = evas_default_device_get(ee->evas, EFL_INPUT_DEVICE_CLASS_MOUSE); + cursor = eina_hash_find(ee->prop.cursors, &pointer); + EINA_SAFETY_ON_NULL_RETURN(cursor); + if (cursor->object) { - evas_object_show(ee->prop.cursor.object); + evas_object_show(cursor->object); if (ee->rotation == 0) - evas_object_move(ee->prop.cursor.object, - x - fx - ee->prop.cursor.hot.x, - y - fy - ee->prop.cursor.hot.y); + evas_object_move(cursor->object, + x - fx - cursor->hot.x, + y - fy - cursor->hot.y); else if (ee->rotation == 90) - evas_object_move(ee->prop.cursor.object, - ee->h + fw - y - fx - 1 - ee->prop.cursor.hot.x, - x - fy - ee->prop.cursor.hot.y); + evas_object_move(cursor->object, + ee->h + fw - y - fx - 1 - cursor->hot.x, + x - fy - cursor->hot.y); else if (ee->rotation == 180) - evas_object_move(ee->prop.cursor.object, - ee->w + fw - x - fx - 1 - ee->prop.cursor.hot.x, - ee->h + fh - y - fy - 1 - ee->prop.cursor.hot.y); + evas_object_move(cursor->object, + ee->w + fw - x - fx - 1 - cursor->hot.x, + ee->h + fh - y - fy - 1 - cursor->hot.y); else if (ee->rotation == 270) - evas_object_move(ee->prop.cursor.object, - y - fx - ee->prop.cursor.hot.x, - ee->w + fh - x - fy - 1 - ee->prop.cursor.hot.y); + evas_object_move(cursor->object, + y - fx - cursor->hot.x, + ee->w + fh - x - fy - 1 - cursor->hot.y); } + if (!feed) return; if (ee->rotation == 0) - evas_event_input_mouse_move(ee->evas, x, y, timestamp, NULL); + { + evt_x = x; + evt_y = y; + } else if (ee->rotation == 90) - evas_event_input_mouse_move(ee->evas, ee->h + fw - y - 1, x, timestamp, NULL); + { + evt_x = ee->h + fw - y - 1; + evt_y = x; + } else if (ee->rotation == 180) - evas_event_input_mouse_move(ee->evas, ee->w + fw - x - 1, ee->h + fh - y - 1, timestamp, NULL); + { + evt_x = ee->w + fw - x - 1; + evt_y = ee->h + fh - y - 1; + } else if (ee->rotation == 270) - evas_event_input_mouse_move(ee->evas, y, ee->w + fh - x - 1, timestamp, NULL); + { + evt_x = y; + evt_y = ee->w + fh - x - 1; + } + else + send_event = EINA_FALSE; + + if (!send_event) return; + + evt = efl_input_instance_get(EFL_INPUT_POINTER_CLASS, ee->evas, (void **) &ev); + if (!evt) return; + + ev->action = EFL_POINTER_ACTION_MOVE; + ev->device = efl_ref(pointer); + ev->timestamp = timestamp; + ev->cur.x = evt_x; + ev->cur.y = evt_y; + efl_event_callback_legacy_call(ee->evas, + _event_description_get(ev->action), evt); + efl_del(evt); } EAPI void _ecore_evas_mouse_move_process(Ecore_Evas *ee, int x, int y, unsigned int timestamp) { - _ecore_evas_mouse_move_process_internal(ee, x, y, timestamp, EINA_TRUE); + _ecore_evas_mouse_move_process_internal(ee, NULL, x, y, timestamp, + EINA_TRUE); +} + +EAPI void +_ecore_evas_mouse_device_move_process(Ecore_Evas *ee, Efl_Input_Device *pointer, + int x, int y, unsigned int timestamp) +{ + _ecore_evas_mouse_move_process_internal(ee, pointer, x, y, timestamp, + EINA_TRUE); } EAPI void @@ -3203,6 +3478,7 @@ _ecore_evas_aux_hint_free(Ecore_Evas *ee) EAPI Ecore_Evas * ecore_evas_fb_new(const char *disp_name, int rotation, int w, int h) { + Ecore_Evas *ee; Ecore_Evas *(*new)(const char *, int, int, int); Eina_Module *m = _ecore_evas_engine_load("fb"); EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL); @@ -3210,12 +3486,19 @@ ecore_evas_fb_new(const char *disp_name, int rotation, int w, int h) new = eina_module_symbol_get(m, "ecore_evas_fb_new_internal"); EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL); - return new(disp_name, rotation, w, h); + ee = new(disp_name, rotation, w, h); + if (!_ecore_evas_cursors_init(ee)) + { + ecore_evas_free(ee); + return NULL; + } + return ee; } EAPI Ecore_Evas * ecore_evas_software_x11_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h) { + Ecore_Evas *ee; Ecore_Evas *(*new)(const char *, Ecore_X_Window, int, int, int, int); Eina_Module *m = _ecore_evas_engine_load("x"); EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL); @@ -3223,7 +3506,13 @@ ecore_evas_software_x11_new(const char *disp_name, Ecore_X_Window parent, int x, new = eina_module_symbol_get(m, "ecore_evas_software_x11_new_internal"); EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL); - return new(disp_name, parent, x, y, w, h); + ee = new(disp_name, parent, x, y, w, h); + if (!_ecore_evas_cursors_init(ee)) + { + ecore_evas_free(ee); + return NULL; + } + return ee; } EAPI Ecore_X_Window @@ -3269,6 +3558,7 @@ ecore_evas_software_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window wi EAPI Ecore_Evas * ecore_evas_software_x11_pixmap_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h) { + Ecore_Evas *ee; Ecore_Evas *(*new)(const char *, Ecore_X_Window, int, int, int, int); Eina_Module *m = _ecore_evas_engine_load("x"); EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL); @@ -3276,7 +3566,14 @@ ecore_evas_software_x11_pixmap_new(const char *disp_name, Ecore_X_Window parent, new = eina_module_symbol_get(m, "ecore_evas_software_x11_pixmap_new_internal"); EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL); - return new(disp_name, parent, x, y, w, h); + ee = new(disp_name, parent, x, y, w, h); + if (!_ecore_evas_cursors_init(ee)) + { + ecore_evas_free(ee); + return NULL; + } + return ee; + } EAPI Ecore_X_Pixmap @@ -3295,6 +3592,7 @@ ecore_evas_software_x11_pixmap_get(const Ecore_Evas *ee) EAPI Ecore_Evas * ecore_evas_gl_x11_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h) { + Ecore_Evas *ee; Ecore_Evas *(*new)(const char *, Ecore_X_Window, int, int, int, int); Eina_Module *m = _ecore_evas_engine_load("x"); EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL); @@ -3302,12 +3600,20 @@ ecore_evas_gl_x11_new(const char *disp_name, Ecore_X_Window parent, int x, int y new = eina_module_symbol_get(m, "ecore_evas_gl_x11_new_internal"); EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL); - return new(disp_name, parent, x, y, w, h); + ee = new(disp_name, parent, x, y, w, h); + if (!_ecore_evas_cursors_init(ee)) + { + ecore_evas_free(ee); + return NULL; + } + return ee; + } EAPI Ecore_Evas * ecore_evas_gl_x11_options_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h, const int *opt) { + Ecore_Evas *ee; Ecore_Evas *(*new)(const char *, Ecore_X_Window, int, int, int, int, const int*); Eina_Module *m = _ecore_evas_engine_load("x"); EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL); @@ -3315,12 +3621,19 @@ ecore_evas_gl_x11_options_new(const char *disp_name, Ecore_X_Window parent, int new = eina_module_symbol_get(m, "ecore_evas_gl_x11_options_new_internal"); EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL); - return new(disp_name, parent, x, y, w, h, opt); + ee = new(disp_name, parent, x, y, w, h, opt); + if (!_ecore_evas_cursors_init(ee)) + { + ecore_evas_free(ee); + return NULL; + } + return ee; } EAPI Ecore_Evas * ecore_evas_gl_x11_pixmap_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h) { + Ecore_Evas *ee; Ecore_Evas *(*new)(const char *, Ecore_X_Window, int, int, int, int); Eina_Module *m = _ecore_evas_engine_load("x"); EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL); @@ -3328,7 +3641,14 @@ ecore_evas_gl_x11_pixmap_new(const char *disp_name, Ecore_X_Window parent, int x new = eina_module_symbol_get(m, "ecore_evas_gl_x11_pixmap_new_internal"); EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL); - return new(disp_name, parent, x, y, w, h); + ee = new(disp_name, parent, x, y, w, h); + if (!_ecore_evas_cursors_init(ee)) + { + ecore_evas_free(ee); + return NULL; + } + return ee; + } EAPI Ecore_X_Pixmap @@ -3524,6 +3844,7 @@ ecore_evas_vnc_stop(Ecore_Evas *ee) EAPI Ecore_Evas * ecore_evas_extn_socket_new(int w, int h) { + Ecore_Evas *ee; Ecore_Evas *(*new)(int, int); Eina_Module *m = _ecore_evas_engine_load("extn"); EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL); @@ -3531,7 +3852,14 @@ ecore_evas_extn_socket_new(int w, int h) new = eina_module_symbol_get(m, "ecore_evas_extn_socket_new_internal"); EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL); - return new(w, h); + ee = new(w, h); + if (!_ecore_evas_cursors_init(ee)) + { + ecore_evas_free(ee); + return NULL; + } + return ee; + } EAPI Eina_Bool @@ -3634,6 +3962,7 @@ EAPI Ecore_Evas * ecore_evas_sdl_new(const char* name, int w, int h, int fullscreen, int hwsurface, int noframe, int alpha) { + Ecore_Evas *ee; Ecore_Evas *(*new)(const char *, int, int, int, int, int, int); Eina_Module *m = _ecore_evas_engine_load("sdl"); EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL); @@ -3641,13 +3970,20 @@ ecore_evas_sdl_new(const char* name, int w, int h, int fullscreen, new = eina_module_symbol_get(m, "ecore_evas_sdl_new_internal"); EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL); - return new(name, w, h, fullscreen, hwsurface, noframe, alpha); + ee = new(name, w, h, fullscreen, hwsurface, noframe, alpha); + if (!_ecore_evas_cursors_init(ee)) + { + ecore_evas_free(ee); + return NULL; + } + return ee; } EAPI Ecore_Evas * ecore_evas_sdl16_new(const char* name, int w, int h, int fullscreen, int hwsurface, int noframe, int alpha) { + Ecore_Evas *ee; Ecore_Evas *(*new)(const char *, int, int, int, int, int, int); Eina_Module *m = _ecore_evas_engine_load("sdl"); EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL); @@ -3655,12 +3991,19 @@ ecore_evas_sdl16_new(const char* name, int w, int h, int fullscreen, new = eina_module_symbol_get(m, "ecore_evas_sdl16_new_internal"); EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL); - return new(name, w, h, fullscreen, hwsurface, noframe, alpha); + ee = new(name, w, h, fullscreen, hwsurface, noframe, alpha); + if (!_ecore_evas_cursors_init(ee)) + { + ecore_evas_free(ee); + return NULL; + } + return ee; } EAPI Ecore_Evas * ecore_evas_gl_sdl_new(const char* name, int w, int h, int fullscreen, int noframe) { + Ecore_Evas *ee; Ecore_Evas *(*new)(const char *, int, int, int, int); Eina_Module *m = _ecore_evas_engine_load("sdl"); EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL); @@ -3668,13 +4011,20 @@ ecore_evas_gl_sdl_new(const char* name, int w, int h, int fullscreen, int nofram new = eina_module_symbol_get(m, "ecore_evas_gl_sdl_new_internal"); EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL); - return new(name, w, h, fullscreen, noframe); + ee = new(name, w, h, fullscreen, noframe); + if (!_ecore_evas_cursors_init(ee)) + { + ecore_evas_free(ee); + return NULL; + } + return ee; } EAPI Ecore_Evas * ecore_evas_wayland_shm_new(const char *disp_name, unsigned int parent, int x, int y, int w, int h, Eina_Bool frame) { + Ecore_Evas *ee; Ecore_Evas *(*new)(const char *, unsigned int, int, int, int, int, Eina_Bool); Eina_Module *m = _ecore_evas_engine_load("wayland"); EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL); @@ -3682,13 +4032,20 @@ ecore_evas_wayland_shm_new(const char *disp_name, unsigned int parent, new = eina_module_symbol_get(m, "ecore_evas_wayland_shm_new_internal"); EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL); - return new(disp_name, parent, x, y, w, h, frame); + ee = new(disp_name, parent, x, y, w, h, frame); + if (!_ecore_evas_cursors_init(ee)) + { + ecore_evas_free(ee); + return NULL; + } + return ee; } EAPI Ecore_Evas * ecore_evas_wayland_egl_new(const char *disp_name, unsigned int parent, int x, int y, int w, int h, Eina_Bool frame) { + Ecore_Evas *ee; Ecore_Evas *(*new)(const char *, unsigned int, int, int, int, int, Eina_Bool); Eina_Module *m = _ecore_evas_engine_load("wayland"); EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL); @@ -3696,7 +4053,13 @@ ecore_evas_wayland_egl_new(const char *disp_name, unsigned int parent, new = eina_module_symbol_get(m, "ecore_evas_wayland_egl_new_internal"); EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL); - return new(disp_name, parent, x, y, w, h, frame); + ee = new(disp_name, parent, x, y, w, h, frame); + if (!_ecore_evas_cursors_init(ee)) + { + ecore_evas_free(ee); + return NULL; + } + return ee; } EAPI void @@ -3772,6 +4135,7 @@ EAPI Ecore_Evas * ecore_evas_drm_new(const char *disp_name, unsigned int parent, int x, int y, int w, int h) { + Ecore_Evas *ee; Ecore_Evas *(*new)(const char *, unsigned int, int, int, int, int); Eina_Module *m = _ecore_evas_engine_load("drm"); EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL); @@ -3779,13 +4143,20 @@ ecore_evas_drm_new(const char *disp_name, unsigned int parent, new = eina_module_symbol_get(m, "ecore_evas_drm_new_internal"); EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL); - return new(disp_name, parent, x, y, w, h); + ee = new(disp_name, parent, x, y, w, h); + if (!_ecore_evas_cursors_init(ee)) + { + ecore_evas_free(ee); + return NULL; + } + return ee; } EAPI Ecore_Evas * ecore_evas_gl_drm_new(const char *disp_name, unsigned int parent, int x, int y, int w, int h) { + Ecore_Evas *ee; Ecore_Evas *(*new)(const char *, unsigned int, int, int, int, int); Eina_Module *m = _ecore_evas_engine_load("drm"); EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL); @@ -3793,7 +4164,14 @@ ecore_evas_gl_drm_new(const char *disp_name, unsigned int parent, new = eina_module_symbol_get(m, "ecore_evas_gl_drm_new_internal"); EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL); - return new(disp_name, parent, x, y, w, h); + ee = new(disp_name, parent, x, y, w, h); + if (!_ecore_evas_cursors_init(ee)) + { + ecore_evas_free(ee); + return NULL; + } + return ee; + } EAPI Ecore_Evas * @@ -3803,6 +4181,7 @@ ecore_evas_software_gdi_new(Ecore_Win32_Window *parent, int width, int height) { + Ecore_Evas *ee; Ecore_Evas *(*new)(Ecore_Win32_Window *, int, int, int, int); Eina_Module *m = _ecore_evas_engine_load("win32"); EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL); @@ -3810,7 +4189,14 @@ ecore_evas_software_gdi_new(Ecore_Win32_Window *parent, new = eina_module_symbol_get(m, "ecore_evas_software_gdi_new_internal"); EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL); - return new(parent, x, y, width, height); + ee = new(parent, x, y, width, height); + if (!_ecore_evas_cursors_init(ee)) + { + ecore_evas_free(ee); + return NULL; + } + return ee; + } EAPI Ecore_Evas * @@ -3820,6 +4206,7 @@ ecore_evas_software_ddraw_new(Ecore_Win32_Window *parent, int width, int height) { + Ecore_Evas *ee; Ecore_Evas *(*new)(Ecore_Win32_Window *, int, int, int, int); Eina_Module *m = _ecore_evas_engine_load("win32"); EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL); @@ -3827,7 +4214,13 @@ ecore_evas_software_ddraw_new(Ecore_Win32_Window *parent, new = eina_module_symbol_get(m, "ecore_evas_software_ddraw_new_internal"); EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL); - return new(parent, x, y, width, height); + ee = new(parent, x, y, width, height); + if (!_ecore_evas_cursors_init(ee)) + { + ecore_evas_free(ee); + return NULL; + } + return ee; } EAPI Ecore_Win32_Window * @@ -3843,6 +4236,7 @@ ecore_evas_win32_window_get(const Ecore_Evas *ee) EAPI Ecore_Evas * ecore_evas_cocoa_new(Ecore_Cocoa_Window *parent, int x, int y, int w, int h) { + Ecore_Evas *ee; Ecore_Evas *(*new)(Ecore_Cocoa_Window *, int, int, int, int); Eina_Module *m = _ecore_evas_engine_load("cocoa"); EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL); @@ -3850,12 +4244,19 @@ ecore_evas_cocoa_new(Ecore_Cocoa_Window *parent, int x, int y, int w, int h) new = eina_module_symbol_get(m, "ecore_evas_cocoa_new_internal"); EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL); - return new(parent, x, y, w, h); + ee = new(parent, x, y, w, h); + if (!_ecore_evas_cursors_init(ee)) + { + ecore_evas_free(ee); + return NULL; + } + return ee; } EAPI Ecore_Evas * ecore_evas_psl1ght_new(const char* name, int w, int h) { + Ecore_Evas *ee; Ecore_Evas *(*new)(const char*, int, int); Eina_Module *m = _ecore_evas_engine_load("psl1ght"); EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL); @@ -3863,7 +4264,13 @@ ecore_evas_psl1ght_new(const char* name, int w, int h) new = eina_module_symbol_get(m, "ecore_evas_psl1ght_new_internal"); EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL); - return new(name, w, h); + ee = new(name, w, h); + if (!_ecore_evas_cursors_init(ee)) + { + ecore_evas_free(ee); + return NULL; + } + return ee; } @@ -3995,7 +4402,8 @@ _direct_mouse_move_cb(Ecore_Evas *ee, const Ecore_Event_Mouse_Move *info) Evas *e = ee->evas; Eina_Bool processed; - _ecore_evas_mouse_move_process_internal(ee, info->x, info->y, info->timestamp, EINA_FALSE); + _ecore_evas_mouse_move_process_internal(ee, info->dev, info->x, info->y, + info->timestamp, EINA_FALSE); /* Unused information: * same_screen diff --git a/src/lib/ecore_evas/ecore_evas_buffer.c b/src/lib/ecore_evas/ecore_evas_buffer.c index 979f925..74bcdd7 100644 --- a/src/lib/ecore_evas/ecore_evas_buffer.c +++ b/src/lib/ecore_evas/ecore_evas_buffer.c @@ -721,6 +721,11 @@ ecore_evas_buffer_allocfunc_new(int w, int h, evas_key_lock_add(ee->evas, "Num_Lock"); evas_key_lock_add(ee->evas, "Scroll_Lock"); + if (!_ecore_evas_cursors_init(ee)) + { + ERR("Could not init the Ecore Evas cursors"); + ecore_evas_free(ee); + } evas_event_feed_mouse_in(ee->evas, 0, NULL); _ecore_evas_register(ee); diff --git a/src/lib/ecore_evas/ecore_evas_ews.c b/src/lib/ecore_evas/ecore_evas_ews.c index 719d5ea..199c1d8 100644 --- a/src/lib/ecore_evas/ecore_evas_ews.c +++ b/src/lib/ecore_evas/ecore_evas_ews.c @@ -400,50 +400,10 @@ _ecore_evas_ews_size_step_set(Ecore_Evas *ee, int w, int h) } static void -_ecore_evas_ews_object_cursor_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +_ecore_evas_ews_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj EINA_UNUSED, + int layer EINA_UNUSED, int hot_x EINA_UNUSED, + int hot_y EINA_UNUSED) { - Ecore_Evas *ee = data; - ee->prop.cursor.object = NULL; -} - -static void -_ecore_evas_ews_object_cursor_unset(Ecore_Evas *ee) -{ - evas_object_event_callback_del_full(ee->prop.cursor.object, EVAS_CALLBACK_DEL, _ecore_evas_ews_object_cursor_del, ee); -} - -static void -_ecore_evas_ews_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) - { - 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); - 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_ews_object_cursor_del, ee); - _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); } @@ -670,7 +630,7 @@ static const Ecore_Evas_Engine_Func _ecore_ews_engine_func = _ecore_evas_ews_size_base_set, _ecore_evas_ews_size_step_set, _ecore_evas_ews_object_cursor_set, - _ecore_evas_ews_object_cursor_unset, + NULL, _ecore_evas_ews_layer_set, _ecore_evas_ews_focus_set, _ecore_evas_ews_iconified_set, @@ -883,7 +843,7 @@ _ecore_evas_ews_cb_mouse_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj E if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee); _ecore_evas_ews_modifiers_apply(ee, ev->modifiers); evas_event_feed_mouse_out(ee->evas, ev->timestamp, NULL); - if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); + _ecore_evas_default_cursor_hide(ee); _ecore_evas_mouse_move_process(ee, x, y, ev->timestamp); } @@ -1261,6 +1221,12 @@ ecore_evas_ews_new(int x, int y, int w, int h) evas_key_lock_add(ee->evas, "Num_Lock"); evas_key_lock_add(ee->evas, "Scroll_Lock"); + if (!_ecore_evas_cursors_init(ee)) + { + ERR("Could not init the Ecore Evas cursors"); + ecore_evas_free(ee); + } + _ews_ee->sub_ecore_evas = eina_list_append(_ews_ee->sub_ecore_evas, ee); _ews_children = eina_list_append(_ews_children, ee); diff --git a/src/lib/ecore_evas/ecore_evas_private.h b/src/lib/ecore_evas/ecore_evas_private.h index 919d2da..74af4dc 100644 --- a/src/lib/ecore_evas/ecore_evas_private.h +++ b/src/lib/ecore_evas/ecore_evas_private.h @@ -76,6 +76,7 @@ typedef struct _Ecore_Evas_Engine Ecore_Evas_Engine; typedef struct _Ecore_Evas_Engine_Func Ecore_Evas_Engine_Func; typedef struct _Ecore_Evas_Interface Ecore_Evas_Interface; typedef struct _Ecore_Evas_Aux_Hint Ecore_Evas_Aux_Hint; +typedef struct _Ecore_Evas_Cursor Ecore_Evas_Cursor; /* Engines interfaces */ struct _Ecore_Evas_Engine_Func @@ -187,6 +188,14 @@ struct _Ecore_Evas_Engine #endif }; +struct _Ecore_Evas_Cursor { + Evas_Object *object; + int layer; + struct { + int x, y; + } hot; +}; + struct _Ecore_Evas { EINA_INLIST; @@ -227,6 +236,7 @@ struct _Ecore_Evas } expecting_resize; struct { + Eina_Hash *cursors; char *title; char *name; char *clas; @@ -238,13 +248,7 @@ struct _Ecore_Evas struct { int w, h; } min, max, base, step; - struct { - Evas_Object *object; - int layer; - struct { - int x, y; - } hot; - } cursor; + Ecore_Evas_Cursor cursor_cache; struct { Eina_Bool supported; // indicate that the underlying window system supports window manager rotation protocol Eina_Bool app_set; // indicate that the ee supports window manager rotation protocol @@ -390,6 +394,8 @@ EAPI void _ecore_evas_register_animators(Ecore_Evas *ee); EAPI void _ecore_evas_free(Ecore_Evas *ee); EAPI void _ecore_evas_idle_timeout_update(Ecore_Evas *ee); EAPI void _ecore_evas_mouse_move_process(Ecore_Evas *ee, int x, int y, unsigned int timestamp); +EAPI void _ecore_evas_mouse_device_move_process(Ecore_Evas *ee, Efl_Input_Device *pointer, + int x, int y, unsigned int timestamp); EAPI void _ecore_evas_mouse_multi_move_process(Ecore_Evas *ee, int device, int x, int y, double radius, @@ -457,13 +463,18 @@ EAPI void ecore_evas_animator_tick(Ecore_Evas *ee, Eina_Rectangle *viewport, dou Eina_Module *_ecore_evas_vnc_server_module_load(void); - EAPI void _ecore_evas_focus_device_set(Ecore_Evas *ee, Efl_Input_Device *seat, Eina_Bool on); EAPI Eina_Bool _ecore_evas_mouse_in_check(Ecore_Evas *ee, Efl_Input_Device *mouse); EAPI void _ecore_evas_mouse_inout_set(Ecore_Evas *ee, Efl_Input_Device *mouse, Eina_Bool in, Eina_Bool force_out); + +EAPI Evas_Object *_ecore_evas_default_cursor_image_get(Ecore_Evas *ee); +EAPI void _ecore_evas_default_cursor_hide(Ecore_Evas *ee); + +Eina_Bool _ecore_evas_cursors_init(Ecore_Evas *ee); + #undef EAPI #define EAPI 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 488ed67..6dabee4 100644 --- a/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c +++ b/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c @@ -464,69 +464,16 @@ _ecore_evas_title_set(Ecore_Evas *ee, const char *title) } 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_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, + int layer EINA_UNUSED, int hot_x EINA_UNUSED, + int hot_y EINA_UNUSED) { - Ecore_Evas *ee; - - DBG(""); - - ee = data; - if (ee) - ee->prop.cursor.object = NULL; -} - -static void -_ecore_evas_object_cursor_unset(Ecore_Evas *ee) -{ - evas_object_event_callback_del_full(ee->prop.cursor.object, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); -} - -static void -_ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) -{ - int x, y; - Evas_Object *old; Ecore_Cocoa_Window *win = (Ecore_Cocoa_Window *)(ee->prop.window); - DBG(""); - - 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_cocoa_window_cursor_show(win, EINA_TRUE); - 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); - if (obj != old) - { - ecore_cocoa_window_cursor_show(win, EINA_FALSE); - 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); - -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); - } + if (!obj) + ecore_cocoa_window_cursor_show(win, EINA_TRUE); + else if (obj != _ecore_evas_default_cursor_image_get(ee)) + ecore_cocoa_window_cursor_show(win, EINA_FALSE); } static void @@ -627,7 +574,7 @@ static Ecore_Evas_Engine_Func _ecore_cocoa_engine_func = NULL, _ecore_evas_size_step_set, _ecore_evas_object_cursor_set, - _ecore_evas_object_cursor_unset, + NULL, NULL, NULL, _ecore_evas_iconified_set, diff --git a/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c b/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c index b1ab702..d69c430 100644 --- a/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c +++ b/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c @@ -434,68 +434,6 @@ _drm_size_step_set(Ecore_Evas *ee, int w, int h) } static void -_drm_object_cursor_del(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) -{ - Ecore_Evas *ee; - - ee = data; - if (ee) ee->prop.cursor.object = NULL; -} - -static void -_drm_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) -{ - Evas_Object *old; - int x, y; - - old = ee->prop.cursor.object; - if (!obj) - { - 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; - - ecore_evas_pointer_xy_get(ee, &x, &y); - - if (obj != old) - { - 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, - _drm_object_cursor_del, ee); - } - - evas_object_move(ee->prop.cursor.object, x - ee->prop.cursor.hot.x, - y - ee->prop.cursor.hot.y); - -end: - if ((old) && (obj != old)) - { - evas_object_event_callback_del_full - (old, EVAS_CALLBACK_DEL, _drm_object_cursor_del, ee); - evas_object_del(old); - } -} - -static void -_drm_object_cursor_unset(Ecore_Evas *ee) -{ - evas_object_event_callback_del_full(ee->prop.cursor.object, - EVAS_CALLBACK_DEL, - _drm_object_cursor_del, ee); -} - -static void _drm_layer_set(Ecore_Evas *ee, int layer) { if (layer < 1) layer = 1; @@ -747,8 +685,8 @@ static Ecore_Evas_Engine_Func _ecore_evas_drm_engine_func = _drm_size_max_set, _drm_size_base_set, _drm_size_step_set, - _drm_object_cursor_set, - _drm_object_cursor_unset, + NULL, + NULL, _drm_layer_set, NULL, //void (*fn_focus_set) (Ecore_Evas *ee, Eina_Bool on); _drm_iconified_set, 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 2e82862..d1ab63a 100644 --- a/src/modules/ecore_evas/engines/fb/ecore_evas_fb.c +++ b/src/modules/ecore_evas/engines/fb/ecore_evas_fb.c @@ -56,30 +56,37 @@ struct _Ecore_Evas_Engine_FB_Data { static void _ecore_evas_mouse_move_process_fb(Ecore_Evas *ee, int x, int y) { + Efl_Input_Device *pointer; + Ecore_Evas_Cursor *cursor; int fbw, fbh; ee->mouse.x = x; ee->mouse.y = y; ecore_fb_size_get(&fbw, &fbh); - if (ee->prop.cursor.object) + + pointer = evas_default_device_get(ee->evas, EFL_INPUT_DEVICE_CLASS_MOUSE); + cursor = eina_hash_find(ee->prop.cursors, &pointer); + EINA_SAFETY_ON_NULL_RETURN(cursor); + + if (cursor->object) { - evas_object_show(ee->prop.cursor.object); + evas_object_show(cursor->object); if (ee->rotation == 0) - evas_object_move(ee->prop.cursor.object, - x - ee->prop.cursor.hot.x, - y - ee->prop.cursor.hot.y); + evas_object_move(cursor->object, + x - cursor->hot.x, + y - cursor->hot.y); else if (ee->rotation == 90) - evas_object_move(ee->prop.cursor.object, - (fbh - ee->h) + ee->h - y - 1 - ee->prop.cursor.hot.x, - x - ee->prop.cursor.hot.y); + evas_object_move(cursor->object, + (fbh - ee->h) + ee->h - y - 1 - cursor->hot.x, + x - cursor->hot.y); else if (ee->rotation == 180) - evas_object_move(ee->prop.cursor.object, - (fbw - ee->w) + ee->w - x - 1 - ee->prop.cursor.hot.x, - (fbh - ee->h) + ee->h - y - 1 - ee->prop.cursor.hot.y); + evas_object_move(cursor->object, + (fbw - ee->w) + ee->w - x - 1 - cursor->hot.x, + (fbh - ee->h) + ee->h - y - 1 - cursor->hot.y); else if (ee->rotation == 270) - evas_object_move(ee->prop.cursor.object, - y - ee->prop.cursor.hot.x, - (fbw - ee->w) + ee->w - x - 1 - ee->prop.cursor.hot.y); + evas_object_move(cursor->object, + y - cursor->hot.x, + (fbw - ee->w) + ee->w - x - 1 - cursor->hot.y); } } @@ -431,67 +438,6 @@ _ecore_evas_hide(Ecore_Evas *ee) } 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_object_cursor_unset(Ecore_Evas *ee) -{ - evas_object_event_callback_del_full(ee->prop.cursor.object, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); -} - -static void -_ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) -{ - int x, y; - 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; - 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); - - if (obj != old) - { - 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); - -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 _ecore_evas_fullscreen_set(Ecore_Evas *ee, Eina_Bool on) { Eina_List *l; @@ -592,8 +538,8 @@ static Ecore_Evas_Engine_Func _ecore_fb_engine_func = NULL, NULL, NULL, - _ecore_evas_object_cursor_set, - _ecore_evas_object_cursor_unset, + NULL, + NULL, NULL, NULL, NULL, 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 a65a61a..935a757 100644 --- a/src/modules/ecore_evas/engines/psl1ght/ecore_evas_psl1ght.c +++ b/src/modules/ecore_evas/engines/psl1ght/ecore_evas_psl1ght.c @@ -319,66 +319,6 @@ _ecore_evas_screen_geometry_get(const Ecore_Evas *ee EINA_UNUSED, int *x, int *y ecore_psl1ght_screen_resolution_get (w, h); } -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_object_cursor_unset(Ecore_Evas *ee) -{ - evas_object_event_callback_del_full(ee->prop.cursor.object, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); -} - -static void -_ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) -{ - int x, y; - 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; - 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); - -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 = { _ecore_evas_psl1ght_free, @@ -413,8 +353,8 @@ static Ecore_Evas_Engine_Func _ecore_psl1ght_engine_func = NULL, NULL, NULL, - _ecore_evas_object_cursor_set, - _ecore_evas_object_cursor_unset, + NULL, + NULL, NULL, NULL, NULL, 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 782d065..e12307a 100644 --- a/src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c +++ b/src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c @@ -411,66 +411,6 @@ _ecore_evas_show(Ecore_Evas *ee) evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); } -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_object_cursor_unset(Ecore_Evas *ee) -{ - evas_object_event_callback_del_full(ee->prop.cursor.object, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); -} - -static void -_ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) -{ - int x, y; - 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; - 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); - - if (obj != old) - { - 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); - -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 = { _ecore_evas_sdl_free, @@ -505,8 +445,8 @@ static Ecore_Evas_Engine_Func _ecore_sdl_engine_func = NULL, NULL, NULL, - _ecore_evas_object_cursor_set, - _ecore_evas_object_cursor_unset, + NULL, + NULL, NULL, NULL, NULL, 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 6bd4528..5eeae7c 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 @@ -43,7 +43,7 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func = _ecore_evas_wl_common_size_base_set, _ecore_evas_wl_common_size_step_set, _ecore_evas_wl_common_object_cursor_set, - _ecore_evas_wl_common_object_cursor_unset, + NULL, _ecore_evas_wl_common_layer_set, NULL, // focus set _ecore_evas_wl_common_iconified_set, @@ -171,7 +171,7 @@ _ecore_evas_wl_common_cb_mouse_in(void *data EINA_UNUSED, int type EINA_UNUSED, _ecore_evas_mouse_inout_set(ee, ev->dev, EINA_TRUE, EINA_FALSE); ecore_event_evas_seat_modifier_lock_update(ee->evas, ev->modifiers, ev->dev); evas_event_feed_mouse_in(ee->evas, ev->timestamp, NULL); - _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp); + _ecore_evas_mouse_device_move_process(ee, ev->dev, ev->x, ev->y, ev->timestamp); return ECORE_CALLBACK_PASS_ON; } @@ -191,10 +191,9 @@ _ecore_evas_wl_common_cb_mouse_out(void *data EINA_UNUSED, int type EINA_UNUSED, ecore_event_evas_seat_modifier_lock_update(ee->evas, ev->modifiers, ev->dev); - _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp); + _ecore_evas_mouse_device_move_process(ee, ev->dev, ev->x, ev->y, ev->timestamp); evas_event_feed_mouse_out(ee->evas, ev->timestamp, NULL); _ecore_evas_mouse_inout_set(ee, ev->dev, EINA_FALSE, EINA_FALSE); - if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); return ECORE_CALLBACK_PASS_ON; } @@ -1265,72 +1264,17 @@ _ecore_evas_wl_common_aspect_set(Ecore_Evas *ee, double aspect) ee->prop.aspect = aspect; } -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; -} - -void -_ecore_evas_wl_common_object_cursor_unset(Ecore_Evas *ee) -{ - evas_object_event_callback_del_full(ee->prop.cursor.object, - EVAS_CALLBACK_DEL, - _ecore_evas_object_cursor_del, ee); -} - void -_ecore_evas_wl_common_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) +_ecore_evas_wl_common_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, + int layer EINA_UNUSED, + int hot_x EINA_UNUSED, + int hot_y EINA_UNUSED) { - int x, y, fx, fy; Ecore_Evas_Engine_Wl_Data *wdata; - Evas_Object *old; - if (!ee) return; wdata = ee->engine.data; - old = ee->prop.cursor.object; - if (obj == NULL) - { - ecore_wl2_window_pointer_set(wdata->win, NULL, 0, 0); - 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; - - evas_pointer_output_xy_get(ee->evas, &x, &y); - - if (obj != old) - { - ecore_wl2_window_pointer_set(wdata->win, NULL, 0, 0); - 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_move(ee->prop.cursor.object, x - fx - ee->prop.cursor.hot.x, - y - fy - ee->prop.cursor.hot.y); - -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); - } + if (obj != _ecore_evas_default_cursor_image_get(ee)) + ecore_wl2_window_pointer_set(wdata->win, NULL, 0, 0); } 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 4469c66..e9dbd37 100644 --- a/src/modules/ecore_evas/engines/win32/ecore_evas_win32.c +++ b/src/modules/ecore_evas/engines/win32/ecore_evas_win32.c @@ -220,7 +220,7 @@ _ecore_evas_win32_event_mouse_out(void *data EINA_UNUSED, int type EINA_UNUSED, if (evas_event_down_count_get(ee->evas) > 0) return ECORE_CALLBACK_PASS_ON; evas_event_feed_mouse_out(ee->evas, e->timestamp, NULL); _ecore_evas_mouse_inout_set(ee, NULL, EINA_FALSE, EINA_FALSE); - if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); + _ecore_evas_default_cursor_hide(ee); } return ECORE_CALLBACK_PASS_ON; @@ -835,67 +835,6 @@ _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_unset(Ecore_Evas *ee) -{ - evas_object_event_callback_del_full(ee->prop.cursor.object, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); -} - -static void -_ecore_evas_win32_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) -{ - int x, y; - 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; - 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); - - if (obj != old) - { -// ecore_win32_window_cursor_show(ee->prop.window, 0); - 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); - -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 _ecore_evas_win32_focus_set(Ecore_Evas *ee, Eina_Bool on EINA_UNUSED) { ecore_win32_window_focus((struct _Ecore_Win32_Window *)ee->prop.window); @@ -1157,8 +1096,8 @@ static Ecore_Evas_Engine_Func _ecore_win32_engine_func = _ecore_evas_win32_size_max_set, _ecore_evas_win32_size_base_set, _ecore_evas_win32_size_step_set, - _ecore_evas_win32_cursor_set, - _ecore_evas_win32_cursor_unset, + NULL, + NULL, NULL, /* _ecore_evas_x_layer_set */ _ecore_evas_win32_focus_set, _ecore_evas_win32_iconified_set, 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 3c52034..2b4e00b 100644 --- a/src/modules/ecore_evas/engines/x/ecore_evas_x.c +++ b/src/modules/ecore_evas/engines/x/ecore_evas_x.c @@ -1315,7 +1315,7 @@ _fake_out(void *data) _feed_cancel_out(e, (e->mode == ECORE_X_EVENT_MODE_GRAB)); _ecore_evas_mouse_inout_set(ee, NULL, EINA_FALSE, EINA_TRUE); - if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); + _ecore_evas_default_cursor_hide(ee); return EINA_FALSE; } @@ -1480,7 +1480,7 @@ _ecore_evas_x_event_mouse_out(void *data EINA_UNUSED, int type EINA_UNUSED, void _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); _ecore_evas_mouse_inout_set(ee, NULL, EINA_FALSE, EINA_FALSE); _feed_cancel_out(e, (e->mode == ECORE_X_EVENT_MODE_GRAB)); - if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); + _ecore_evas_default_cursor_hide(ee); } return ECORE_CALLBACK_PASS_ON; } @@ -1800,7 +1800,7 @@ _ecore_evas_x_event_window_hide(void *data EINA_UNUSED, int type EINA_UNUSED, vo }; _feed_cancel_out(&out, EINA_TRUE); _ecore_evas_mouse_inout_set(ee, NULL, EINA_FALSE, EINA_FALSE); - if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); + _ecore_evas_default_cursor_hide(ee); } if (ee->prop.override) { @@ -3153,65 +3153,18 @@ _ecore_evas_x_size_step_set(Ecore_Evas *ee, int w, int h) } 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_x_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, + int layer EINA_UNUSED, int hot_x EINA_UNUSED, + int hot_y EINA_UNUSED) { - Ecore_Evas *ee; - - ee = data; - if (ee) ee->prop.cursor.object = NULL; + if (obj != _ecore_evas_default_cursor_image_get(ee)) + ecore_x_window_cursor_show(ee->prop.window, 0); } static void -_ecore_evas_x_object_cursor_unset(Ecore_Evas *ee) +_ecore_evas_x_object_cursor_unset(Ecore_Evas *ee EINA_UNUSED) { - evas_object_event_callback_del_full(ee->prop.cursor.object, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); -} - -static void -_ecore_evas_x_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) -{ - int x = 0, y = 0; - Evas_Object *old; - - old = ee->prop.cursor.object; - if (!obj) - { - ee->prop.cursor.object = NULL; - ee->prop.cursor.layer = 0; - ee->prop.cursor.hot.x = 0; - ee->prop.cursor.hot.y = 0; - ecore_x_window_cursor_show(ee->prop.window, 1); - 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); - - if (obj != old) - { - ecore_x_window_cursor_show(ee->prop.window, 0); - 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); - -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); - } + ecore_x_window_cursor_show(ee->prop.window, 1); } /* -- 2.7.4