forked from enlightenment/efl
Merge branch 'devs/iscaro/ecore_evas_cursor'
This series add new APIs to get the pointer position and set the pointer icon by device Patches by Guilherme Iscaro <iscaro@profusion.mobi> Reviewed By: bdilly, jpeg, zmike Differential Revision: https://phab.enlightenment.org/D4450
This commit is contained in:
commit
e254e50ae5
|
@ -20,6 +20,7 @@
|
|||
/ecore_evas_buffer_example_01
|
||||
/ecore_evas_buffer_example_02
|
||||
/ecore_evas_callbacks
|
||||
/ecore_evas_cursor_example
|
||||
/ecore_evas_ews_example
|
||||
/ecore_evas_extn_plug_example
|
||||
/ecore_evas_extn_socket_example
|
||||
|
|
|
@ -57,9 +57,10 @@ ecore_con_url_ftp_example \
|
|||
ecore_evas_basics_example \
|
||||
ecore_evas_buffer_example_01 \
|
||||
ecore_evas_buffer_example_02 \
|
||||
ecore_evas_callbacks \
|
||||
ecore_evas_cursor_example \
|
||||
ecore_evas_extn_socket_example \
|
||||
ecore_evas_extn_plug_example \
|
||||
ecore_evas_callbacks \
|
||||
ecore_evas_ews_example \
|
||||
ecore_evas_object_example \
|
||||
ecore_evas_wayland_multiseat_example \
|
||||
|
@ -209,15 +210,18 @@ ecore_evas_buffer_example_01_LDADD = $(ECORE_EVAS_COMMON_LDADD)
|
|||
ecore_evas_buffer_example_02_SOURCES = ecore_evas_buffer_example_02.c
|
||||
ecore_evas_buffer_example_02_LDADD = $(ECORE_EVAS_COMMON_LDADD)
|
||||
|
||||
ecore_evas_callbacks_SOURCES = ecore_evas_callbacks.c
|
||||
ecore_evas_callbacks_LDADD = $(ECORE_EVAS_COMMON_LDADD)
|
||||
|
||||
ecore_evas_cursor_example_SOURCES = ecore_evas_cursor_example.c
|
||||
ecore_evas_cursor_example_LDADD = $(ECORE_EVAS_COMMON_LDADD)
|
||||
|
||||
ecore_evas_extn_socket_example_SOURCES = ecore_evas_extn_socket_example.c
|
||||
ecore_evas_extn_socket_example_LDADD = $(ECORE_EVAS_COMMON_LDADD)
|
||||
|
||||
ecore_evas_extn_plug_example_SOURCES = ecore_evas_extn_plug_example.c
|
||||
ecore_evas_extn_plug_example_LDADD = $(ECORE_EVAS_COMMON_LDADD)
|
||||
|
||||
ecore_evas_callbacks_SOURCES = ecore_evas_callbacks.c
|
||||
ecore_evas_callbacks_LDADD = $(ECORE_EVAS_COMMON_LDADD)
|
||||
|
||||
ecore_evas_ews_example_SOURCES = ecore_evas_ews_example.c
|
||||
ecore_evas_ews_example_LDADD = $(ECORE_EVAS_COMMON_LDADD)
|
||||
|
||||
|
|
|
@ -0,0 +1,166 @@
|
|||
/**
|
||||
* Ecore Evas example illustrating how to set a new cursor image for a pointer device.
|
||||
*
|
||||
* @verbatim
|
||||
* gcc -o ecore_evas_cursor_example ecore_evas_cursor_example.c `pkg-config --libs --cflags evas ecore ecore-evas`
|
||||
* @endverbatim
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <Ecore.h>
|
||||
#include <Ecore_Evas.h>
|
||||
#include <Evas.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#define W (200)
|
||||
#define H (200)
|
||||
#define TIMEOUT (1.0)
|
||||
|
||||
static void
|
||||
_delete_request_cb(Ecore_Evas *ee EINA_UNUSED)
|
||||
{
|
||||
ecore_main_loop_quit();
|
||||
}
|
||||
|
||||
static void
|
||||
_resize_cb(Ecore_Evas *ee)
|
||||
{
|
||||
int w, h;
|
||||
|
||||
ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
|
||||
evas_object_resize(ecore_evas_data_get(ee, "bg"), w, h);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_mouse_pos_print(void *data)
|
||||
{
|
||||
Efl_Input_Device *pointer;
|
||||
const Eina_List *devs, *l;
|
||||
|
||||
devs = evas_device_list(ecore_evas_get(data), NULL);
|
||||
|
||||
EINA_LIST_FOREACH(devs, l, pointer)
|
||||
{
|
||||
Evas_Coord x, y;
|
||||
Efl_Input_Device *seat;
|
||||
|
||||
if (efl_input_device_type_get(pointer) != EFL_INPUT_DEVICE_CLASS_MOUSE)
|
||||
continue;
|
||||
ecore_evas_pointer_device_xy_get(data, pointer, &x, &y);
|
||||
seat = efl_input_device_seat_get(pointer);
|
||||
if (!seat)
|
||||
{
|
||||
fprintf(stderr, "Could not fetch the seat from mouse '%s'\n",
|
||||
efl_input_device_name_get(pointer));
|
||||
continue;
|
||||
}
|
||||
printf("Mouse from seat '%s' is at (%d, %d)\n",
|
||||
efl_input_device_name_get(seat), x, y);
|
||||
}
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
_cursor_set(Ecore_Evas *ee, Efl_Input_Device *pointer)
|
||||
{
|
||||
Evas_Object *obj;
|
||||
|
||||
obj = evas_object_rectangle_add(ecore_evas_get(ee));
|
||||
evas_object_color_set(obj, rand() % 256, rand() % 256, rand() % 256, 255);
|
||||
evas_object_resize(obj, 30, 30);
|
||||
evas_object_show(obj);
|
||||
ecore_evas_object_cursor_device_set(ee, pointer, obj, 0, 10, 10);
|
||||
}
|
||||
|
||||
static void
|
||||
_device_added(void *data, const Efl_Event *event)
|
||||
{
|
||||
Efl_Input_Device *pointer = event->info;
|
||||
Efl_Input_Device *seat;
|
||||
|
||||
if (efl_input_device_type_get(pointer) != EFL_INPUT_DEVICE_CLASS_MOUSE)
|
||||
return;
|
||||
seat = efl_input_device_seat_get(pointer);
|
||||
if (!seat)
|
||||
{
|
||||
fprintf(stderr, "Could not fetch the seat from pointer '%s'\n",
|
||||
efl_input_device_name_get(pointer));
|
||||
return;
|
||||
}
|
||||
printf("Setting cursor image at seat '%s'\n", efl_input_device_name_get(seat));
|
||||
_cursor_set(data, pointer);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc EINA_UNUSED, char *argv[] EINA_UNUSED)
|
||||
{
|
||||
const Eina_List *devs, *l;
|
||||
Efl_Input_Device *pointer;
|
||||
Ecore_Evas *ee;
|
||||
Evas_Object *bg;
|
||||
Evas *e;
|
||||
Ecore_Timer *t;
|
||||
const char *driver;
|
||||
|
||||
srand(time(NULL));
|
||||
if (!ecore_evas_init())
|
||||
{
|
||||
fprintf(stderr, "Could not init the Ecore Evas\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
ee = ecore_evas_new(NULL, 0, 0, W, H, NULL);
|
||||
if (!ee)
|
||||
{
|
||||
fprintf(stderr, "Could not create the Ecore Evas\n");
|
||||
goto err_ee;
|
||||
}
|
||||
|
||||
driver = ecore_evas_engine_name_get(ee);
|
||||
printf("Using driver %s\n", driver);
|
||||
if ((!strcmp(driver, "fb") || !strcmp(driver, "software_x11")) &&
|
||||
!ecore_evas_vnc_start(ee, "localhost", -1, NULL, NULL, NULL))
|
||||
{
|
||||
fprintf(stderr, "Could not init the VNC server\n");
|
||||
goto err_ee;
|
||||
}
|
||||
|
||||
e = ecore_evas_get(ee);
|
||||
bg = evas_object_rectangle_add(e);
|
||||
evas_object_resize(bg, W, H);
|
||||
evas_object_move(bg, 0, 0);
|
||||
evas_object_color_set(bg, 255, 255, 255, 255);
|
||||
evas_object_show(bg);
|
||||
ecore_evas_data_set(ee, "bg", bg);
|
||||
|
||||
devs = evas_device_list(e, NULL);
|
||||
|
||||
EINA_LIST_FOREACH(devs, l, pointer)
|
||||
{
|
||||
if (efl_input_device_type_get(pointer) != EFL_INPUT_DEVICE_CLASS_MOUSE)
|
||||
continue;
|
||||
_cursor_set(ee, pointer);
|
||||
}
|
||||
|
||||
t = ecore_timer_add(TIMEOUT, _mouse_pos_print, ee);
|
||||
efl_event_callback_add(e, EFL_CANVAS_EVENT_DEVICE_ADDED,
|
||||
_device_added, ee);
|
||||
ecore_evas_callback_resize_set(ee, _resize_cb);
|
||||
ecore_evas_callback_delete_request_set(ee, _delete_request_cb);
|
||||
|
||||
ecore_evas_show(ee);
|
||||
ecore_main_loop_begin();
|
||||
ecore_evas_free(ee);
|
||||
ecore_timer_del(t);
|
||||
ecore_evas_shutdown();
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
err_ee:
|
||||
ecore_evas_shutdown();
|
||||
return EXIT_FAILURE;
|
||||
}
|
|
@ -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.
|
||||
*
|
||||
|
@ -2217,6 +2216,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
|
||||
*
|
||||
|
@ -2917,12 +2955,13 @@ EAPI Evas_Object *ecore_evas_extn_plug_new(Ecore_Evas *ee_target);
|
|||
EAPI Eina_Bool ecore_evas_extn_plug_connect(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys);
|
||||
|
||||
/**
|
||||
* @brief Retrieve the coordinates of the mouse pointer
|
||||
* @brief Retrieve the coordinates of the default mouse pointer
|
||||
*
|
||||
* @param ee The Ecore_Evas containing the pointer
|
||||
* @param x Pointer to integer to store horizontal coordinate. May be @c NULL.
|
||||
* @param y Pointer to integer to store vertical coordinate. May be @c NULL.
|
||||
*
|
||||
* @see ecore_evas_pointer_device_xy_get
|
||||
* @since 1.8
|
||||
*/
|
||||
EAPI void ecore_evas_pointer_xy_get(const Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y);
|
||||
|
@ -2940,6 +2979,17 @@ EAPI void ecore_evas_pointer_xy_get(const Ecore_Evas *ee, Evas_Coord *x, Evas_Co
|
|||
*/
|
||||
EAPI Eina_Bool ecore_evas_pointer_warp(const Ecore_Evas *ee, Evas_Coord x, Evas_Coord y);
|
||||
|
||||
/**
|
||||
* @brief Retrieve the coordinates of the mouse pointer
|
||||
*
|
||||
* @param ee The Ecore_Evas containing the pointer
|
||||
* @param pointer The pointer device, use @c NULL for the default pointer.
|
||||
* @param x Pointer to integer to store horizontal coordinate. May be @c NULL.
|
||||
* @param y Pointer to integer to store vertical coordinate. May be @c NULL.
|
||||
* @since 1.19
|
||||
*/
|
||||
EAPI void ecore_evas_pointer_device_xy_get(const Ecore_Evas *ee, const Efl_Input_Device *pointer, Evas_Coord *x, Evas_Coord *y);
|
||||
|
||||
/**
|
||||
* @brief Retrieve the Visual used for pixmap creation
|
||||
*
|
||||
|
|
|
@ -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 void
|
||||
ecore_evas_cursor_set(Ecore_Evas *ee, const char *file, int layer, int hot_x, int hot_y)
|
||||
EAPI Evas_Object *
|
||||
_ecore_evas_default_cursor_image_get(Ecore_Evas *ee)
|
||||
{
|
||||
Evas_Object *obj = NULL;
|
||||
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_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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -2381,6 +2605,36 @@ ecore_evas_pointer_warp(const Ecore_Evas *ee, Evas_Coord x, Evas_Coord y)
|
|||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
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)))
|
||||
ecore_evas_pointer_xy_get(ee, x, y);
|
||||
else
|
||||
{
|
||||
if (x) *x = 0;
|
||||
if (y) *y = 0;
|
||||
ECORE_EVAS_CHECK(ee);
|
||||
if (ee->vnc_server)
|
||||
{
|
||||
Eina_Module *mod;
|
||||
void (*pointer_xy_get)(const void *, const Efl_Input_Device *, Evas_Coord *, Evas_Coord *y);
|
||||
|
||||
mod = _ecore_evas_vnc_server_module_load();
|
||||
EINA_SAFETY_ON_NULL_RETURN(mod);
|
||||
|
||||
pointer_xy_get = eina_module_symbol_get(mod, "ecore_evas_vnc_server_pointer_xy_get");
|
||||
EINA_SAFETY_ON_NULL_RETURN(pointer_xy_get);
|
||||
pointer_xy_get(ee->vnc_server, pointer, x, y);
|
||||
}
|
||||
else if (ee->engine.func->fn_pointer_device_xy_get)
|
||||
ee->engine.func->fn_pointer_device_xy_get(ee, pointer, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
EAPI void *
|
||||
ecore_evas_pixmap_visual_get(const Ecore_Evas *ee)
|
||||
{
|
||||
|
@ -2824,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);
|
||||
|
@ -2875,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;
|
||||
ee->mouse.x = x;
|
||||
ee->mouse.y = y;
|
||||
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;
|
||||
|
||||
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);
|
||||
cursor->pos_x = x;
|
||||
cursor->pos_y = y;
|
||||
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
|
||||
|
@ -3174,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);
|
||||
|
@ -3181,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);
|
||||
|
@ -3194,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
|
||||
|
@ -3240,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);
|
||||
|
@ -3247,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
|
||||
|
@ -3266,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);
|
||||
|
@ -3273,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);
|
||||
|
@ -3286,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);
|
||||
|
@ -3299,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
|
||||
|
@ -3495,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);
|
||||
|
@ -3502,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
|
||||
|
@ -3605,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);
|
||||
|
@ -3612,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);
|
||||
|
@ -3626,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);
|
||||
|
@ -3639,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);
|
||||
|
@ -3653,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);
|
||||
|
@ -3667,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
|
||||
|
@ -3743,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);
|
||||
|
@ -3750,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);
|
||||
|
@ -3764,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 *
|
||||
|
@ -3774,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);
|
||||
|
@ -3781,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 *
|
||||
|
@ -3791,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);
|
||||
|
@ -3798,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 *
|
||||
|
@ -3814,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);
|
||||
|
@ -3821,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);
|
||||
|
@ -3834,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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -3966,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
|
||||
|
|
|
@ -607,6 +607,7 @@ static Ecore_Evas_Engine_Func _ecore_buffer_engine_func =
|
|||
NULL, //fn_callback_focus_device_out_set
|
||||
NULL, //fn_callback_device_mouse_in_set
|
||||
NULL, //fn_callback_device_mouse_out_set
|
||||
NULL, //fn_pointer_device_xy_get
|
||||
};
|
||||
|
||||
static void *
|
||||
|
@ -720,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);
|
||||
|
|
|
@ -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,
|
||||
|
@ -719,6 +679,7 @@ static const Ecore_Evas_Engine_Func _ecore_ews_engine_func =
|
|||
NULL, //fn_callback_focus_device_out_set
|
||||
NULL, //fn_callback_device_mouse_in_set
|
||||
NULL, //fn_callback_device_mouse_out_set
|
||||
NULL, //fn_pointer_device_xy_get
|
||||
};
|
||||
|
||||
void
|
||||
|
@ -882,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);
|
||||
}
|
||||
|
||||
|
@ -1260,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);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -165,6 +166,7 @@ struct _Ecore_Evas_Engine_Func
|
|||
|
||||
void (*fn_callback_device_mouse_in_set) (Ecore_Evas *ee, Ecore_Evas_Mouse_IO_Cb func);
|
||||
void (*fn_callback_device_mouse_out_set) (Ecore_Evas *ee, Ecore_Evas_Mouse_IO_Cb func);
|
||||
void (*fn_pointer_device_xy_get)(const Ecore_Evas *ee, const Efl_Input_Device *pointer, Evas_Coord *x, Evas_Coord *y);
|
||||
};
|
||||
|
||||
struct _Ecore_Evas_Interface
|
||||
|
@ -186,6 +188,16 @@ struct _Ecore_Evas_Engine
|
|||
#endif
|
||||
};
|
||||
|
||||
struct _Ecore_Evas_Cursor {
|
||||
Evas_Object *object;
|
||||
int layer;
|
||||
struct {
|
||||
int x, y;
|
||||
} hot;
|
||||
int pos_x;
|
||||
int pos_y;
|
||||
};
|
||||
|
||||
struct _Ecore_Evas
|
||||
{
|
||||
EINA_INLIST;
|
||||
|
@ -217,15 +229,12 @@ struct _Ecore_Evas
|
|||
int changed : 1;
|
||||
} shadow;
|
||||
|
||||
struct {
|
||||
int x, y;
|
||||
} mouse;
|
||||
|
||||
struct {
|
||||
int w, h;
|
||||
} expecting_resize;
|
||||
|
||||
struct {
|
||||
Eina_Hash *cursors;
|
||||
char *title;
|
||||
char *name;
|
||||
char *clas;
|
||||
|
@ -237,13 +246,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
|
||||
|
@ -389,6 +392,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,
|
||||
|
@ -456,13 +461,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
|
||||
|
||||
|
|
|
@ -837,10 +837,23 @@ EAPI void ecore_wl2_window_iconified_set(Ecore_Wl2_Window *window, Eina_Bool ico
|
|||
* @param y where to return the vertical position. May be NULL. Returns 0 on error.
|
||||
*
|
||||
* @ingroup Ecore_Wl2_Window_Group
|
||||
* @see ecore_wl2_window_pointer_device_xy_get
|
||||
* @since 1.17
|
||||
*/
|
||||
EAPI void ecore_wl2_window_pointer_xy_get(Ecore_Wl2_Window *window, int *x, int *y);
|
||||
|
||||
/**
|
||||
* Retrieves the mouse position of the current window.
|
||||
*
|
||||
* @param window The window on which to retrieve the mouse position.
|
||||
* @param pointer The Efl.Input.Pointer device to fetch the position.
|
||||
* @param x where to return the horizontal position. May be NULL. Returns 0 on error.
|
||||
* @param y where to return the vertical position. May be NULL. Returns 0 on error.
|
||||
* @ingroup Ecore_Wl2_Window_Group
|
||||
* @since 1.19
|
||||
*/
|
||||
EAPI void ecore_wl2_window_pointer_device_xy_get(Ecore_Wl2_Window *window, const Eo *pointer, int *x, int *y);
|
||||
|
||||
/**
|
||||
* Set a given wl_surface to use as the pointer on a window
|
||||
*
|
||||
|
|
|
@ -18,15 +18,6 @@
|
|||
#include <sys/mman.h>
|
||||
#include "ecore_wl2_private.h"
|
||||
|
||||
typedef struct _Ecore_Wl2_Input_Devices
|
||||
{
|
||||
Eo *pointer_dev;
|
||||
Eo *keyboard_dev;
|
||||
Eo *touch_dev;
|
||||
Eo *seat_dev;
|
||||
int window_id;
|
||||
} Ecore_Wl2_Input_Devices;
|
||||
|
||||
typedef struct _Ecore_Wl2_Mouse_Down_Info
|
||||
{
|
||||
EINA_INLIST;
|
||||
|
|
|
@ -67,6 +67,15 @@ extern Eina_Bool no_session_recovery;
|
|||
# endif
|
||||
# define CRI(...) EINA_LOG_DOM_CRIT(_ecore_wl2_log_dom, __VA_ARGS__)
|
||||
|
||||
typedef struct _Ecore_Wl2_Input_Devices
|
||||
{
|
||||
Eo *pointer_dev;
|
||||
Eo *keyboard_dev;
|
||||
Eo *touch_dev;
|
||||
Eo *seat_dev;
|
||||
int window_id;
|
||||
} Ecore_Wl2_Input_Devices;
|
||||
|
||||
struct _Ecore_Wl2_Display
|
||||
{
|
||||
int refs;
|
||||
|
|
|
@ -941,6 +941,38 @@ ecore_wl2_window_pointer_xy_get(Ecore_Wl2_Window *window, int *x, int *y)
|
|||
if (y) *y = input->pointer.sy;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_window_pointer_device_xy_get(Ecore_Wl2_Window *window,
|
||||
const Eo *pointer,
|
||||
int *x, int *y)
|
||||
{
|
||||
Ecore_Wl2_Input_Devices *devs;
|
||||
Eina_List *l;
|
||||
Ecore_Wl2_Input *input;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
EINA_SAFETY_ON_NULL_RETURN(pointer);
|
||||
|
||||
if (x) *x = 0;
|
||||
if (y) *y = 0;
|
||||
|
||||
EINA_INLIST_FOREACH(window->display->inputs, input)
|
||||
{
|
||||
if (!input->wl.pointer)
|
||||
continue;
|
||||
|
||||
EINA_LIST_FOREACH(input->devices_list, l, devs)
|
||||
{
|
||||
if ((devs->window_id == window->id) &&
|
||||
(devs->pointer_dev == pointer))
|
||||
{
|
||||
if (x) *x = input->pointer.sx;
|
||||
if (y) *y = input->pointer.sy;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_window_pointer_set(Ecore_Wl2_Window *window, struct wl_surface *surface, int hot_x, int hot_y)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
if (!obj)
|
||||
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)
|
||||
{
|
||||
else if (obj != _ecore_evas_default_cursor_image_get(ee))
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
||||
|
@ -675,6 +622,7 @@ static Ecore_Evas_Engine_Func _ecore_cocoa_engine_func =
|
|||
NULL, //fn_callback_focus_device_out_set
|
||||
NULL, //fn_callback_device_mouse_in_set
|
||||
NULL, //fn_callback_device_mouse_out_set
|
||||
NULL, //fn_pointer_device_xy_get
|
||||
};
|
||||
|
||||
static Ecore_Cocoa_Window *
|
||||
|
|
|
@ -433,68 +433,6 @@ _drm_size_step_set(Ecore_Evas *ee, int w, int h)
|
|||
ee->prop.step.h = 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)
|
||||
{
|
||||
|
@ -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,
|
||||
|
@ -796,6 +734,7 @@ static Ecore_Evas_Engine_Func _ecore_evas_drm_engine_func =
|
|||
NULL, //fn_focus_device_set
|
||||
NULL, //fn_callback_focus_device_in_set
|
||||
NULL, //fn_callback_focus_device_out_set
|
||||
NULL, //fn_pointer_device_xy_get
|
||||
};
|
||||
|
||||
static Ecore_Evas *
|
||||
|
|
|
@ -925,6 +925,7 @@ static const Ecore_Evas_Engine_Func _ecore_extn_plug_engine_func =
|
|||
NULL, //fn_callback_focus_device_out_set
|
||||
NULL, //fn_callback_device_mouse_in_set
|
||||
NULL, //fn_callback_device_mouse_out_set
|
||||
NULL, //fn_pointer_device_xy_get
|
||||
};
|
||||
|
||||
static Eina_Bool
|
||||
|
|
|
@ -56,30 +56,36 @@ 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);
|
||||
cursor->pos_x = x;
|
||||
cursor->pos_y = y;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -354,9 +360,15 @@ _ecore_evas_move_resize(Ecore_Evas *ee, int x EINA_UNUSED, int y EINA_UNUSED, in
|
|||
static void
|
||||
_ecore_evas_rotation_set(Ecore_Evas *ee, int rotation, int resize EINA_UNUSED)
|
||||
{
|
||||
Evas_Device *pointer;
|
||||
Ecore_Evas_Cursor *cursor;
|
||||
Evas_Engine_Info_FB *einfo;
|
||||
int rot_dif;
|
||||
|
||||
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 (ee->rotation == rotation) return;
|
||||
einfo = (Evas_Engine_Info_FB *)evas_engine_info_get(ee->evas);
|
||||
if (!einfo) return;
|
||||
|
@ -409,7 +421,7 @@ _ecore_evas_rotation_set(Ecore_Evas *ee, int rotation, int resize EINA_UNUSED)
|
|||
else
|
||||
evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
|
||||
|
||||
_ecore_evas_mouse_move_process_fb(ee, ee->mouse.x, ee->mouse.y);
|
||||
_ecore_evas_mouse_move_process_fb(ee, cursor->pos_x, cursor->pos_y);
|
||||
if (ee->func.fn_resize) ee->func.fn_resize(ee);
|
||||
}
|
||||
|
||||
|
@ -430,67 +442,6 @@ _ecore_evas_hide(Ecore_Evas *ee)
|
|||
_ecore_evas_focus_device_set(ee, NULL, EINA_FALSE);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -592,8 +543,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,
|
||||
|
@ -642,6 +593,7 @@ static Ecore_Evas_Engine_Func _ecore_fb_engine_func =
|
|||
NULL, //fn_callback_focus_device_out_set
|
||||
NULL, //fn_callback_device_mouse_in_set
|
||||
NULL, //fn_callback_device_mouse_out_set
|
||||
NULL, //fn_pointer_device_xy_get
|
||||
};
|
||||
|
||||
EAPI Ecore_Evas *
|
||||
|
|
|
@ -255,6 +255,8 @@ _ecore_evas_psl1ght_callback_delete_request_set(Ecore_Evas *ee, Ecore_Evas_Event
|
|||
static void
|
||||
_ecore_evas_screen_resized(Ecore_Evas *ee)
|
||||
{
|
||||
Evas_Device *pointer;
|
||||
Ecore_Evas_Cursor *cursor;
|
||||
int w, h;
|
||||
|
||||
/* Do not resize if the window is not fullscreen */
|
||||
|
@ -262,6 +264,10 @@ _ecore_evas_screen_resized(Ecore_Evas *ee)
|
|||
|
||||
ecore_psl1ght_screen_resolution_get (&w, &h);
|
||||
|
||||
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 (w != ee->w || h != ee->h)
|
||||
{
|
||||
ee->req.w = ee->w = w;
|
||||
|
@ -271,7 +277,7 @@ _ecore_evas_screen_resized(Ecore_Evas *ee)
|
|||
ecore_psl1ght_resolution_set (w, h);
|
||||
evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
|
||||
|
||||
_ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
|
||||
_ecore_evas_mouse_move_process(ee, cursor->pos_x, cursor->pos_y,
|
||||
_ecore_evas_time_get());
|
||||
if (ee->func.fn_resize) ee->func.fn_resize(ee);
|
||||
}
|
||||
|
@ -319,66 +325,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 +359,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,
|
||||
|
@ -463,6 +409,7 @@ static Ecore_Evas_Engine_Func _ecore_psl1ght_engine_func =
|
|||
NULL, //fn_callback_focus_device_out_set
|
||||
NULL, //fn_callback_device_mouse_in_set
|
||||
NULL, //fn_callback_device_mouse_out_set
|
||||
NULL, //fn_pointer_device_xy_get
|
||||
};
|
||||
|
||||
EAPI Ecore_Evas *
|
||||
|
|
|
@ -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,
|
||||
|
@ -555,6 +495,7 @@ static Ecore_Evas_Engine_Func _ecore_sdl_engine_func =
|
|||
NULL, //fn_callback_focus_device_out_set
|
||||
NULL, //fn_callback_device_mouse_in_set
|
||||
NULL, //fn_callback_device_mouse_out_set
|
||||
NULL, //fn_pointer_device_xy_get
|
||||
};
|
||||
|
||||
static Ecore_Evas*
|
||||
|
|
|
@ -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,
|
||||
|
@ -90,6 +90,7 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
|
|||
NULL, //fn_callback_focus_device_out_set
|
||||
NULL, //fn_callback_device_mouse_in_set
|
||||
NULL, //fn_callback_device_mouse_out_set
|
||||
_ecore_evas_wl_common_pointer_device_xy_get,
|
||||
};
|
||||
|
||||
#define _smart_frame_type "ecore_evas_wl_frame"
|
||||
|
@ -170,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;
|
||||
}
|
||||
|
||||
|
@ -190,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;
|
||||
}
|
||||
|
||||
|
@ -301,6 +301,20 @@ _ecore_evas_wl_common_cb_window_configure(void *data EINA_UNUSED, int type EINA_
|
|||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
|
||||
static void
|
||||
_mouse_move_dispatch(Ecore_Evas *ee)
|
||||
{
|
||||
Ecore_Evas_Cursor *cursor;
|
||||
Eina_Iterator *itr = eina_hash_iterator_data_new(ee->prop.cursors);
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN(itr);
|
||||
|
||||
EINA_ITERATOR_FOREACH(itr, cursor)
|
||||
_ecore_evas_mouse_move_process(ee, cursor->pos_x, cursor->pos_y,
|
||||
ecore_loop_time_get());
|
||||
eina_iterator_free(itr);
|
||||
}
|
||||
|
||||
static void
|
||||
_rotation_do(Ecore_Evas *ee, int rotation, int resize)
|
||||
{
|
||||
|
@ -422,8 +436,7 @@ _rotation_do(Ecore_Evas *ee, int rotation, int resize)
|
|||
* Yes, it's required to update the mouse position, relatively to
|
||||
* widgets. After a rotation change, e.g., the mouse might not be over
|
||||
* a button anymore. */
|
||||
_ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
|
||||
ecore_loop_time_get());
|
||||
_mouse_move_dispatch(ee);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -437,8 +450,7 @@ _rotation_do(Ecore_Evas *ee, int rotation, int resize)
|
|||
*
|
||||
* NB: Is This Really Needed ? Yes, it's required to update the mouse
|
||||
* position, relatively to widgets. */
|
||||
_ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
|
||||
ecore_loop_time_get());
|
||||
_mouse_move_dispatch(ee);
|
||||
|
||||
/* call the ecore_evas' resize function */
|
||||
if (ee->func.fn_resize) ee->func.fn_resize(ee);
|
||||
|
@ -1132,6 +1144,19 @@ _ecore_evas_wl_common_pointer_xy_get(const Ecore_Evas *ee, Evas_Coord *x, Evas_C
|
|||
ecore_wl2_window_pointer_xy_get(wdata->win, x, y);
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_evas_wl_common_pointer_device_xy_get(const Ecore_Evas *ee,
|
||||
const Efl_Input_Device *pointer,
|
||||
Evas_Coord *x, Evas_Coord *y)
|
||||
{
|
||||
Ecore_Evas_Engine_Wl_Data *wdata;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
wdata = ee->engine.data;
|
||||
ecore_wl2_window_pointer_device_xy_get(wdata->win, pointer, x, y);
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_evas_wl_common_raise(Ecore_Evas *ee)
|
||||
{
|
||||
|
@ -1251,72 +1276,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)
|
||||
_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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (obj != _ecore_evas_default_cursor_image_get(ee))
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -103,6 +103,8 @@ void _ecore_evas_wl_common_transparent_set(Ecore_Evas *ee, int transparent);
|
|||
void _ecore_evas_wl_common_frame_callback_clean(Ecore_Evas *ee);
|
||||
void _ecore_evas_wl_common_pointer_xy_get(const Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y);
|
||||
|
||||
void _ecore_evas_wl_common_pointer_device_xy_get(const Ecore_Evas *ee, const Efl_Input_Device *pointer, Evas_Coord *x, Evas_Coord *y);
|
||||
|
||||
Ecore_Evas *_ecore_evas_wl_common_new_internal(const char *disp_name, unsigned int parent, int x, int y, int w, int h, Eina_Bool frame, const char *engine_name);
|
||||
|
||||
extern Eina_List *ee_list;
|
||||
|
|
|
@ -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;
|
||||
|
@ -371,9 +371,12 @@ _ecore_evas_win32_event_window_hide(void *data EINA_UNUSED, int type EINA_UNUSED
|
|||
static Eina_Bool
|
||||
_ecore_evas_win32_event_window_configure(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
||||
{
|
||||
Evas_Device *pointer;
|
||||
Ecore_Evas_Cursor *cursor;
|
||||
Ecore_Evas *ee;
|
||||
Ecore_Win32_Event_Window_Configure *e;
|
||||
|
||||
|
||||
INF("window configure");
|
||||
|
||||
e = event;
|
||||
|
@ -381,6 +384,10 @@ _ecore_evas_win32_event_window_configure(void *data EINA_UNUSED, int type EINA_U
|
|||
if (!ee) return 1; /* pass on event */
|
||||
if ((Ecore_Window)e->window != ee->prop.window) return 1;
|
||||
|
||||
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, 1);
|
||||
|
||||
if (ee->prop.override)
|
||||
{
|
||||
if ((ee->x != e->x) || (ee->y != e->y))
|
||||
|
@ -426,7 +433,7 @@ _ecore_evas_win32_event_window_configure(void *data EINA_UNUSED, int type EINA_U
|
|||
{
|
||||
if ((ee->expecting_resize.w == ee->w) &&
|
||||
(ee->expecting_resize.h == ee->h))
|
||||
_ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
|
||||
_ecore_evas_mouse_move_process(ee, cursor->pos_x, cursor->pos_y,
|
||||
ecore_win32_current_time_get());
|
||||
ee->expecting_resize.w = 0;
|
||||
ee->expecting_resize.h = 0;
|
||||
|
@ -588,11 +595,17 @@ _ecore_evas_win32_move_resize(Ecore_Evas *ee, int x, int y, int width, int heigh
|
|||
static void
|
||||
_ecore_evas_win32_rotation_set_internal(Ecore_Evas *ee, int rotation)
|
||||
{
|
||||
Evas_Device *pointer;
|
||||
Ecore_Evas_Cursor *cursor;
|
||||
int rot_dif;
|
||||
|
||||
rot_dif = ee->rotation - rotation;
|
||||
if (rot_dif < 0) rot_dif = -rot_dif;
|
||||
|
||||
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 (rot_dif != 180)
|
||||
{
|
||||
int minw, minh, maxw, maxh, basew, baseh, stepw, steph;
|
||||
|
@ -633,13 +646,13 @@ _ecore_evas_win32_rotation_set_internal(Ecore_Evas *ee, int rotation)
|
|||
ecore_evas_size_max_set(ee, maxh, maxw);
|
||||
ecore_evas_size_base_set(ee, baseh, basew);
|
||||
ecore_evas_size_step_set(ee, steph, stepw);
|
||||
_ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
|
||||
_ecore_evas_mouse_move_process(ee, cursor->pos_x, cursor->pos_y,
|
||||
ecore_win32_current_time_get());
|
||||
}
|
||||
else
|
||||
{
|
||||
ee->rotation = rotation;
|
||||
_ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
|
||||
_ecore_evas_mouse_move_process(ee, cursor->pos_x, cursor->pos_y,
|
||||
ecore_win32_current_time_get());
|
||||
if (ee->func.fn_resize) ee->func.fn_resize(ee);
|
||||
}
|
||||
|
@ -834,67 +847,6 @@ _ecore_evas_win32_size_step_set(Ecore_Evas *ee, int width, int height)
|
|||
width, 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)
|
||||
{
|
||||
|
@ -1157,8 +1109,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,
|
||||
|
@ -1207,6 +1159,7 @@ static Ecore_Evas_Engine_Func _ecore_win32_engine_func =
|
|||
NULL, //fn_callback_focus_device_out_set
|
||||
NULL, //fn_callback_device_mouse_in_set
|
||||
NULL, //fn_callback_device_mouse_out_set
|
||||
NULL, //fn_pointer_device_xy_get
|
||||
};
|
||||
|
||||
#endif /* BUILD_ECORE_EVAS_WIN32 */
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
@ -1616,6 +1616,9 @@ _ecore_evas_x_shadow_update(Ecore_Evas *ee)
|
|||
static Eina_Bool
|
||||
_ecore_evas_x_event_window_configure(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
||||
{
|
||||
|
||||
Evas_Device *pointer;
|
||||
Ecore_Evas_Cursor *cursor;
|
||||
Ecore_Evas *ee;
|
||||
Ecore_X_Event_Window_Configure *e;
|
||||
Ecore_Evas_Engine_Data_X11 *edata;
|
||||
|
@ -1628,6 +1631,10 @@ _ecore_evas_x_event_window_configure(void *data EINA_UNUSED, int type EINA_UNUSE
|
|||
if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
|
||||
if (edata->direct_resize) return ECORE_CALLBACK_PASS_ON;
|
||||
|
||||
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, ECORE_CALLBACK_PASS_ON);
|
||||
|
||||
if (edata->configure_reqs > 0) edata->configure_reqs--;
|
||||
|
||||
edata->configure_coming = 0;
|
||||
|
@ -1684,7 +1691,7 @@ _ecore_evas_x_event_window_configure(void *data EINA_UNUSED, int type EINA_UNUSE
|
|||
{
|
||||
if ((ee->expecting_resize.w == ee->w) &&
|
||||
(ee->expecting_resize.h == ee->h))
|
||||
_ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
|
||||
_ecore_evas_mouse_move_process(ee, cursor->pos_x, cursor->pos_y,
|
||||
ecore_x_current_time_get());
|
||||
ee->expecting_resize.w = 0;
|
||||
ee->expecting_resize.h = 0;
|
||||
|
@ -1800,7 +1807,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)
|
||||
{
|
||||
|
@ -2340,10 +2347,16 @@ static void
|
|||
_ecore_evas_x_rotation_set_internal(Ecore_Evas *ee, int rotation, int resize,
|
||||
Evas_Engine_Info *einfo)
|
||||
{
|
||||
Evas_Device *pointer;
|
||||
Ecore_Evas_Cursor *cursor;
|
||||
int rot_dif;
|
||||
Ecore_Evas_Engine_Data_X11 *edata = ee->engine.data;
|
||||
int fw = 0, fh = 0;
|
||||
|
||||
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);
|
||||
|
||||
rot_dif = ee->rotation - rotation;
|
||||
if (rot_dif < 0) rot_dif = -rot_dif;
|
||||
|
||||
|
@ -2422,7 +2435,7 @@ _ecore_evas_x_rotation_set_internal(Ecore_Evas *ee, int rotation, int resize,
|
|||
ecore_evas_size_max_set(ee, maxh, maxw);
|
||||
ecore_evas_size_base_set(ee, baseh, basew);
|
||||
ecore_evas_size_step_set(ee, steph, stepw);
|
||||
_ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
|
||||
_ecore_evas_mouse_move_process(ee, cursor->pos_x, cursor->pos_y,
|
||||
ecore_x_current_time_get());
|
||||
}
|
||||
else
|
||||
|
@ -2432,7 +2445,7 @@ _ecore_evas_x_rotation_set_internal(Ecore_Evas *ee, int rotation, int resize,
|
|||
ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
|
||||
}
|
||||
ee->rotation = rotation;
|
||||
_ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
|
||||
_ecore_evas_mouse_move_process(ee, cursor->pos_x, cursor->pos_y,
|
||||
ecore_x_current_time_get());
|
||||
if (ee->func.fn_resize) ee->func.fn_resize(ee);
|
||||
|
||||
|
@ -3153,65 +3166,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 *ee;
|
||||
|
||||
ee = data;
|
||||
if (ee) ee->prop.cursor.object = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_evas_x_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_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_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)
|
||||
{
|
||||
if (obj != _ecore_evas_default_cursor_image_get(ee))
|
||||
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))
|
||||
static void
|
||||
_ecore_evas_x_object_cursor_unset(Ecore_Evas *ee EINA_UNUSED)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3788,6 +3754,7 @@ static Ecore_Evas_Engine_Func _ecore_x_engine_func =
|
|||
NULL, //fn_callback_focus_device_out_set
|
||||
NULL, //fn_callback_device_mouse_in_set
|
||||
NULL, //fn_callback_device_mouse_out_set
|
||||
NULL, //fn_pointer_device_xy_get
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -893,5 +893,38 @@ ecore_evas_vnc_server_del(Ecore_Evas_Vnc_Server *server)
|
|||
free(server);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_evas_vnc_server_pointer_xy_get(const Ecore_Evas_Vnc_Server *server,
|
||||
const Evas_Device *pointer,
|
||||
Evas_Coord *x, Evas_Coord *y)
|
||||
{
|
||||
Evas_Coord sx, sy;
|
||||
rfbClientIteratorPtr itr;
|
||||
rfbClientRec *client;
|
||||
Ecore_Evas_Vnc_Server_Client_Data *cdata;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN(server);
|
||||
EINA_SAFETY_ON_NULL_RETURN(pointer);
|
||||
|
||||
sx = sy = 0;
|
||||
itr = rfbGetClientIterator(server->vnc_screen);
|
||||
|
||||
while ((client = rfbClientIteratorNext(itr)))
|
||||
{
|
||||
cdata = client->clientData;
|
||||
|
||||
if (cdata->mouse == pointer)
|
||||
{
|
||||
sx = client->lastPtrX;
|
||||
sy = client->lastPtrY;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
rfbReleaseClientIterator(itr);
|
||||
if (x) *x = sx;
|
||||
if (y) *y = sy;
|
||||
}
|
||||
|
||||
EINA_MODULE_INIT(_ecore_evas_vnc_server_init);
|
||||
EINA_MODULE_SHUTDOWN(_ecore_evas_vnc_server_shutdown);
|
||||
|
|
Loading…
Reference in New Issue