Evas: EO-ify Evas_Device and partly move to Efl

So, this is not a very clean solution, but this mostly
makes Evas_Device an Eo object of class Efl.Input.Device.
Since evas_device relies on some Evas knowledge (evas
callbacks, canvas private data), it can't be fully moved
to lib/efl/.

Making the input device an interface rather than a class
was also not a great solution, as the goal is to share
the data structure around EFL internals (Ecore and Evas).
This commit is contained in:
Jean-Philippe Andre 2016-04-28 17:08:14 +09:00
parent 47e3b171a3
commit ce5688a388
10 changed files with 458 additions and 217 deletions

View File

@ -4,6 +4,7 @@ efl_eolian_legacy_files = \
lib/efl/interfaces/efl_gfx.eo \
lib/efl/interfaces/efl_image.eo \
lib/efl/interfaces/efl_image_animated.eo \
lib/efl/interfaces/efl_input_device.eo \
$(NULL)
efl_eolian_files = \
@ -62,6 +63,7 @@ EXTRA_DIST += \
lib/efl/Efl.h \
lib/efl/Makefile.am \
lib/efl/Makefile.in \
lib/efl/interfaces/efl_common_internal.h \
$(efl_eolian_files) \
$(efl_eolian_type_files)
@ -77,7 +79,9 @@ lib/efl/interfaces/efl_gfx_shape.c \
lib/efl/interfaces/efl_vpath_file.c \
lib/efl/interfaces/efl_vpath_manager.c \
lib/efl/interfaces/efl_vpath_core.c \
lib/efl/interfaces/efl_vpath_file_core.c
lib/efl/interfaces/efl_vpath_file_core.c \
lib/efl/interfaces/efl_input_device.c \
$(NULL)
lib_efl_libefl_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl -I$(top_srcdir)/src/lib/efl @EFL_CFLAGS@ -DEFL_GFX_FILTER_BETA
lib_efl_libefl_la_LIBADD = @EFL_LIBS@

View File

@ -125,6 +125,12 @@ static inline void efl_gfx_color16_type_set(Efl_Gfx_Color *color,
#include "interfaces/efl_pack_linear.eo.h"
#include "interfaces/efl_pack_grid.eo.h"
/* Input events */
#include "interfaces/efl_input_device.eo.h"
//#include "interfaces/efl_input_state.eo.h"
//#include "interfaces/efl_event.eo.h"
//#include "interfaces/efl_pointer_event.eo.h"
#else
#ifndef EFL_NOLEGACY_API_SUPPORT
@ -133,6 +139,7 @@ static inline void efl_gfx_color16_type_set(Efl_Gfx_Color *color,
#include "interfaces/efl_gfx.eo.legacy.h"
#include "interfaces/efl_image.eo.legacy.h"
#include "interfaces/efl_image_animated.eo.legacy.h"
#include "interfaces/efl_input_device.eo.legacy.h"
#endif
typedef Efl_Gfx_Path_Command_Type Efl_Gfx_Path_Command;

View File

@ -0,0 +1,68 @@
/* This header file is intended for EFL internal use, and is not part of
* EFL stable API.
* Place here structs and enums that need to be shared between core EFL
* components, such as Ecore, Evas, etc...
*/
#ifndef EFL_COMMON_INTERNAL_H
#define EFL_COMMON_INTERNAL_H
#ifndef EFL_INTERNAL_UNSTABLE
# error This file can not be included outside EFL
#endif
#include <Efl.h>
typedef struct _Efl_Pointer_Event_Data Efl_Pointer_Event_Data;
typedef struct _Efl_Input_Device_Data Efl_Input_Device_Data;
typedef struct _Efl_Input_State_Data Efl_Input_State_Data;
#ifndef _EVAS_TYPES_EOT_H_
/* FIXME */
typedef struct _Evas_Modifier Evas_Modifier;
typedef struct _Evas_Lock Evas_Lock;
#endif
#if 0
struct _Efl_Pointer_Event_Data
{
Eo *eo;
const Eo_Event_Description *event;
unsigned int timestamp;
int button;
unsigned int pressed_buttons;
struct {
int x, y;
} output;
struct {
int x, y;
} canvas;
Eo *source; /* may be ecore or evas or evas object (?) */
Efl_Pointer_Action action;
Efl_Pointer_Button_Flags button_flags;
Efl_Pointer_Event_Flags event_flags;
void *data; /* evas data - whatever that is */
};
struct _Efl_Input_State_Data
{
Eo *eo;
Evas_Modifier *modifiers;
Evas_Lock *locks;
};
#endif
struct _Efl_Input_Device_Data
{
Eo *eo;
Eo *evas; /* Evas */
Efl_Input_Device *parent; /* no ref */
Efl_Input_Device *source; /* ref */
Eina_List *children; /* ref */
Eina_Stringshare *name;
Eina_Stringshare *desc;
Efl_Input_Device_Class klass;
Efl_Input_Device_Sub_Class subclass;
};
#endif

View File

@ -0,0 +1,106 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <Efl.h>
#define EFL_INTERNAL_UNSTABLE
#include "efl_common_internal.h"
/* Efl Input Device = Evas Device */
EOLIAN static Eo_Base *
_efl_input_device_eo_base_constructor(Eo *obj, Efl_Input_Device_Data *pd)
{
obj = eo_constructor(eo_super(obj, EFL_INPUT_DEVICE_CLASS));
pd->eo = obj;
return obj;
}
EOLIAN static void
_efl_input_device_eo_base_destructor(Eo *obj, Efl_Input_Device_Data *pd)
{
Eo *eo_child;
eina_stringshare_del(pd->name);
eina_stringshare_del(pd->desc);
EINA_LIST_FREE(pd->children, eo_child)
{
Efl_Input_Device_Data *child = eo_data_scope_get(eo_child, EFL_INPUT_DEVICE_CLASS);
child->parent = NULL;
eo_unref(eo_child);
}
eo_unref(pd->source);
return eo_destructor(eo_super(obj, EFL_INPUT_DEVICE_CLASS));
}
EOLIAN static void
_efl_input_device_device_type_set(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd, Efl_Input_Device_Class klass)
{
pd->klass= klass;
}
EOLIAN static Efl_Input_Device_Class
_efl_input_device_device_type_get(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd)
{
return pd->klass;
}
EOLIAN static void
_efl_input_device_device_subtype_set(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd, Efl_Input_Device_Sub_Class klass)
{
pd->subclass = klass;
}
EOLIAN static Efl_Input_Device_Sub_Class
_efl_input_device_device_subtype_get(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd)
{
return pd->subclass;
}
EOLIAN static void
_efl_input_device_source_set(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd, Efl_Input_Device *src)
{
if (pd->source == src) return;
eo_unref(pd->source);
pd->source = eo_ref(src);
}
EOLIAN static Efl_Input_Device *
_efl_input_device_source_get(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd)
{
return pd->source;
}
EOLIAN static void
_efl_input_device_name_set(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd, const char *name)
{
eina_stringshare_replace(&pd->name, name);
}
EOLIAN static const char *
_efl_input_device_name_get(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd)
{
return pd->name;
}
EOLIAN static void
_efl_input_device_description_set(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd, const char *desc)
{
eina_stringshare_replace(&pd->desc, desc);
}
EOLIAN static const char *
_efl_input_device_description_get(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd)
{
return pd->desc;
}
EOLIAN static Efl_Input_Device *
_efl_input_device_parent_get(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd)
{
return pd->parent;
}
#include "interfaces/efl_input_device.eo.c"

View File

@ -0,0 +1,90 @@
enum Efl.Input.Device.Class
{
[[General type of input device.
Legacy support since 1.8.
@since 1.18
]]
none, [[Not a device.]]
seat, [[The user/seat (the user themselves).]]
keyboard, [[A regular keyboard, numberpad or attached buttons.]]
mouse, [[A mouse, trackball or touchpad relative motion device.]]
touch, [[A touchscreen with fingers or stylus.]]
pen, [[A special pen device.]]
pointer, [[A laser pointer, wii-style or "minority report" pointing device.]]
gamepad, [[A gamepad controller or joystick.]]
}
enum Efl.Input.Device.Sub_Class
{
[[Specific type of input device.
Legacy support since 1.8.
@since 1.18
]]
none, [[Not a device.]]
finger, [[The normal flat of your finger.]]
fingernail, [[A fingernail.]]
knuckle, [[A Knuckle.]]
palm, [[The palm of a users hand.]]
hand_size, [[The side of your hand.]]
hand_flat, [[The flat of your hand.]]
pen_tip, [[The tip of a pen.]]
trackpad, [[A trackpad style mouse.]]
trackpoint, [[A trackpoint style mouse.]]
trackball, [[A trackball style mouse.]]
}
/* This represents Evas_Device */
/* FIXME: no parent, no children and no Evas */
class Efl.Input.Device (Eo.Base)
{
[[Represents a pointing device, such as a touch finger, a pen or a mouse.
@since 1.18
]]
legacy_prefix: null;
methods {
/* FIXME: device_class makes compilation error because of class_get() */
@property device_type {
values {
klass: Efl.Input.Device.Class;
}
}
@property device_subtype {
values {
klass: Efl.Input.Device.Sub_Class;
}
}
@property source {
values {
src: Efl.Input.Device;
}
}
@property name {
values {
name: const(char)*;
}
}
@property description {
values {
desc: const(char)*;
}
}
@property parent {
/* set {} */
get {}
values {
parent: Efl.Input.Device;
}
}
}
implements {
Eo.Base.constructor;
Eo.Base.destructor;
}
}

View File

@ -34,6 +34,7 @@ EAPI const Eo_Event_Description _EFL_GFX_CHANGED =
EAPI const Eo_Event_Description _EFL_GFX_PATH_CHANGED =
EO_EVENT_DESCRIPTION("Graphics path changed");
/* Packing & containers */
#include "interfaces/efl_container.eo.c"
#include "interfaces/efl_pack.eo.c"
#include "interfaces/efl_pack_layout.eo.c"

View File

@ -232,7 +232,6 @@ struct _Evas_Precision_Position /** A position with precision*/
};
typedef struct _Evas_Pixel_Import_Source Evas_Pixel_Import_Source; /**< A source description of pixels for importing pixels */
typedef struct _Evas_Device Evas_Device; /**< A source device handle - where the event came from */
typedef struct _Evas_Event_Mouse_Down Evas_Event_Mouse_Down; /**< Event structure for #EVAS_CALLBACK_MOUSE_DOWN event callbacks */
typedef struct _Evas_Event_Mouse_Up Evas_Event_Mouse_Up; /**< Event structure for #EVAS_CALLBACK_MOUSE_UP event callbacks */
typedef struct _Evas_Event_Mouse_In Evas_Event_Mouse_In; /**< Event structure for #EVAS_CALLBACK_MOUSE_IN event callbacks */
@ -248,6 +247,9 @@ typedef struct _Evas_Event_Hold Evas_Event_Hold; /**< Event structure f
typedef struct _Evas_Event_Render_Post Evas_Event_Render_Post; /**< Event structure that may come with #EVAS_CALLBACK_RENDER_POST event callbacks @since 1.8 */
typedef struct _Evas_Event_Axis_Update Evas_Event_Axis_Update; /**< Event structure for #EVAS_CALLBACK_AXIS_UPDATE event callbacks @since 1.13 */
/* Opaque types */
typedef Eo Evas_Device; /**< A source device handle - where the event came from */
typedef Efl_Image_Content_Hint Evas_Image_Content_Hint;
#define EVAS_IMAGE_CONTENT_HINT_NONE EFL_IMAGE_CONTENT_HINT_NONE
#define EVAS_IMAGE_CONTENT_HINT_DYNAMIC EFL_IMAGE_CONTENT_HINT_DYNAMIC
@ -315,32 +317,30 @@ typedef enum _Evas_Engine_Render_Mode
EVAS_RENDER_MODE_NONBLOCKING = 1, /**< The rendering is non blocking mode*/
} Evas_Engine_Render_Mode; /**< behaviour of the renderer*/
typedef enum _Evas_Device_Class
{
EVAS_DEVICE_CLASS_NONE, /**< Not a device @since 1.8 */
EVAS_DEVICE_CLASS_SEAT, /**< The user/seat (the user themselves) @since 1.8 */
EVAS_DEVICE_CLASS_KEYBOARD, /**< A regular keyboard, numberpad or attached buttons @since 1.8 */
EVAS_DEVICE_CLASS_MOUSE, /**< A mouse, trackball or touchpad relative motion device @since 1.8 */
EVAS_DEVICE_CLASS_TOUCH, /**< A touchscreen with fingers or stylus @since 1.8 */
EVAS_DEVICE_CLASS_PEN, /**< A special pen device @since 1.8 */
EVAS_DEVICE_CLASS_POINTER, /**< A laser pointer, wii-style or "minority report" pointing device @since 1.8 */
EVAS_DEVICE_CLASS_GAMEPAD /**< A gamepad controller or joystick @since 1.8 */
} Evas_Device_Class; /**< A general class of device @since 1.8 */
typedef Efl_Input_Device_Class Evas_Device_Class;
typedef enum _Evas_Device_Subclass
{
EVAS_DEVICE_SUBCLASS_NONE, /**< Not a device @since 1.8 */
EVAS_DEVICE_SUBCLASS_FINGER, /**< The normal flat of your finger @since 1.8 */
EVAS_DEVICE_SUBCLASS_FINGERNAIL, /**< A fingernail @since 1.8 */
EVAS_DEVICE_SUBCLASS_KNUCKLE, /**< A Knuckle @since 1.8 */
EVAS_DEVICE_SUBCLASS_PALM, /**< The palm of a users hand @since 1.8 */
EVAS_DEVICE_SUBCLASS_HAND_SIZE, /**< The side of your hand @since 1.8 */
EVAS_DEVICE_SUBCLASS_HAND_FLAT, /**< The flat of your hand @since 1.8 */
EVAS_DEVICE_SUBCLASS_PEN_TIP, /**< The tip of a pen @since 1.8 */
EVAS_DEVICE_SUBCLASS_TRACKPAD, /**< A trackpad style mouse @since 1.8 */
EVAS_DEVICE_SUBCLASS_TRACKPOINT, /**< A trackpoint style mouse @since 1.8 */
EVAS_DEVICE_SUBCLASS_TRACKBALL, /**< A trackball style mouse @since 1.8 */
} Evas_Device_Subclass; /**< A general subclass of device @since 1.8 */
#define EVAS_DEVICE_CLASS_NONE EFL_INPUT_DEVICE_CLASS_NONE /**< Not a device @since 1.8 */
#define EVAS_DEVICE_CLASS_SEAT EFL_INPUT_DEVICE_CLASS_SEAT /**< The user/seat (the user themselves) @since 1.8 */
#define EVAS_DEVICE_CLASS_KEYBOARD EFL_INPUT_DEVICE_CLASS_KEYBOARD /**< A regular keyboard, numberpad or attached buttons @since 1.8 */
#define EVAS_DEVICE_CLASS_MOUSE EFL_INPUT_DEVICE_CLASS_MOUSE /**< A mouse, trackball or touchpad relative motion device @since 1.8 */
#define EVAS_DEVICE_CLASS_TOUCH EFL_INPUT_DEVICE_CLASS_TOUCH /**< A touchscreen with fingers or stylus @since 1.8 */
#define EVAS_DEVICE_CLASS_PEN EFL_INPUT_DEVICE_CLASS_PEN /**< A special pen device @since 1.8 */
#define EVAS_DEVICE_CLASS_POINTER EFL_INPUT_DEVICE_CLASS_POINTER /**< A laser pointer, wii-style or "minority report" pointing device @since 1.8 */
#define EVAS_DEVICE_CLASS_GAMEPAD EFL_INPUT_DEVICE_CLASS_GAMEPAD /**< A gamepad controller or joystick @since 1.8 */
typedef Efl_Input_Device_Sub_Class Evas_Device_Subclass;
#define EVAS_DEVICE_SUBCLASS_NONE EFL_INPUT_DEVICE_SUBCLASS_NONE /**< Not a device @since 1.8 */
#define EVAS_DEVICE_SUBCLASS_FINGER EFL_INPUT_DEVICE_SUBCLASS_FINGER /**< The normal flat of your finger @since 1.8 */
#define EVAS_DEVICE_SUBCLASS_FINGERNAIL EFL_INPUT_DEVICE_SUBCLASS_FINGERNAIL /**< A fingernail @since 1.8 */
#define EVAS_DEVICE_SUBCLASS_KNUCKLE EFL_INPUT_DEVICE_SUBCLASS_KNUCKLE /**< A Knuckle @since 1.8 */
#define EVAS_DEVICE_SUBCLASS_PALM EFL_INPUT_DEVICE_SUBCLASS_PALM /**< The palm of a users hand @since 1.8 */
#define EVAS_DEVICE_SUBCLASS_HAND_SIZE EFL_INPUT_DEVICE_SUBCLASS_HAND_SIZE /**< The side of your hand @since 1.8 */
#define EVAS_DEVICE_SUBCLASS_HAND_FLAT EFL_INPUT_DEVICE_SUBCLASS_HAND_FLAT /**< The flat of your hand @since 1.8 */
#define EVAS_DEVICE_SUBCLASS_PEN_TIP EFL_INPUT_DEVICE_SUBCLASS_PEN_TIP /**< The tip of a pen @since 1.8 */
#define EVAS_DEVICE_SUBCLASS_TRACKPAD EFL_INPUT_DEVICE_SUBCLASS_TRACKPAD /**< A trackpad style mouse @since 1.8 */
#define EVAS_DEVICE_SUBCLASS_TRACKPOINT EFL_INPUT_DEVICE_SUBCLASS_TRACKPOINT /**< A trackpoint style mouse @since 1.8 */
#define EVAS_DEVICE_SUBCLASS_TRACKBALL EFL_INPUT_DEVICE_SUBCLASS_TRACKBALL /**< A trackball style mouse @since 1.8 */
struct _Evas_Engine_Info /** Generic engine information. Generic info is useless */
{

View File

@ -1,66 +1,84 @@
#include "evas_common_private.h"
#include "evas_private.h"
#define EFL_INTERNAL_UNSTABLE
#include "interfaces/efl_common_internal.h"
/* WARNING: This API is not used across EFL, hard to test! */
#ifdef DEBUG_UNTESTED_
// booh
#define SAFETY_CHECK(obj, klass, ...) \
do { MAGIC_CHECK(dev, Evas_Device, 1); \
return __VA_ARGS__; \
MAGIC_CHECK_END(); \
} while (0)
#else
#define SAFETY_CHECK(obj, klass, ...) \
do { if (!obj) return __VA_ARGS__; } while (0)
#endif
/* FIXME: Ideally no work besides calling the Efl_Input_Device API
* should be done here. But unfortunately, some knowledge of Evas is required
* here (callbacks and canvas private data).
*/
static Eina_Bool
_del_cb(void *data, const Eo_Event *ev)
{
Evas_Public_Data *e = data;
// can not be done in std destructor
e->devices = eina_list_remove(e->devices, ev->object);
return EO_CALLBACK_CONTINUE;
}
EAPI Evas_Device *
evas_device_add(Evas *eo_e)
{
Efl_Input_Device_Data *d;
Evas_Public_Data *e;
Evas_Device *dev;
MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS);
return NULL;
MAGIC_CHECK_END();
dev = calloc(1, sizeof(Evas_Device));
if (!dev) return NULL;
dev->magic = MAGIC_DEV;
dev->evas = eo_e;
dev->ref = 1;
Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
SAFETY_CHECK(eo_e, EVAS_CANVAS_CLASS, NULL);
dev = eo_add(EFL_INPUT_DEVICE_CLASS, eo_e);
d = eo_data_scope_get(dev, EFL_INPUT_DEVICE_CLASS);
d->evas = eo_e;
e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
e->devices = eina_list_append(e->devices, dev);
eo_event_callback_add(dev, EO_EVENT_DEL, _del_cb, e);
evas_event_callback_call(eo_e, EVAS_CALLBACK_DEVICE_CHANGED, dev);
return dev;
}
EAPI void
evas_device_del(Evas_Device *dev)
{
MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV);
return;
MAGIC_CHECK_END();
if (dev->ref == 1)
{
Evas_Device *dev2;
EINA_LIST_FREE(dev->children, dev2)
{
dev2->parent = NULL;
evas_device_del(dev2);
}
if (dev->src)
{
_evas_device_unref(dev->src);
dev->src = NULL;
}
dev->parent = NULL;
}
_evas_device_unref(dev);
SAFETY_CHECK(dev, EFL_INPUT_DEVICE_CLASS);
eo_unref(dev);
}
EAPI void
evas_device_push(Evas *eo_e, Evas_Device *dev)
{
MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS);
return;
MAGIC_CHECK_END();
MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV);
return;
MAGIC_CHECK_END();
SAFETY_CHECK(eo_e, EVAS_CANVAS_CLASS);
SAFETY_CHECK(dev, EFL_INPUT_DEVICE_CLASS);
Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
if (!e->cur_device)
{
e->cur_device = eina_array_new(4);
if (!e->cur_device) return;
}
dev->ref++;
eo_ref(dev);
eina_array_push(e->cur_device, dev);
}
@ -68,28 +86,27 @@ EAPI void
evas_device_pop(Evas *eo_e)
{
Evas_Device *dev;
MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS);
return;
MAGIC_CHECK_END();
SAFETY_CHECK(eo_e, EVAS_CANVAS_CLASS);
Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
dev = eina_array_pop(e->cur_device);
if (dev) _evas_device_unref(dev);
if (dev) eo_unref(dev);
}
EAPI const Eina_List *
evas_device_list(Evas *eo_e, const Evas_Device *dev)
{
MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS);
return NULL;
MAGIC_CHECK_END();
SAFETY_CHECK(eo_e, EVAS_CANVAS_CLASS, NULL);
if (dev)
{
MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV);
return NULL;
MAGIC_CHECK_END();
SAFETY_CHECK(dev, EFL_INPUT_DEVICE_CLASS, NULL);
Efl_Input_Device_Data *d = eo_data_scope_get(dev, EFL_INPUT_DEVICE_CLASS);
return d->children;
}
if (dev) return dev->children;
Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
return e->devices;
}
@ -97,141 +114,123 @@ evas_device_list(Evas *eo_e, const Evas_Device *dev)
EAPI void
evas_device_name_set(Evas_Device *dev, const char *name)
{
MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV);
return;
MAGIC_CHECK_END();
eina_stringshare_replace(&(dev->name), name);
evas_event_callback_call(dev->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
SAFETY_CHECK(dev, EFL_INPUT_DEVICE_CLASS);
Efl_Input_Device_Data *d = eo_data_scope_get(dev, EFL_INPUT_DEVICE_CLASS);
efl_input_device_name_set(dev, name);
evas_event_callback_call(d->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
}
EAPI const char *
evas_device_name_get(const Evas_Device *dev)
{
MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV);
return NULL;
MAGIC_CHECK_END();
return dev->name;
return efl_input_device_name_get(dev);
}
EAPI void
evas_device_description_set(Evas_Device *dev, const char *desc)
{
MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV);
return;
MAGIC_CHECK_END();
eina_stringshare_replace(&(dev->desc), desc);
evas_event_callback_call(dev->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
SAFETY_CHECK(dev, EFL_INPUT_DEVICE_CLASS);
efl_input_device_description_set(dev, desc);
Efl_Input_Device_Data *d = eo_data_scope_get(dev, EFL_INPUT_DEVICE_CLASS);
evas_event_callback_call(d->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
}
EAPI const char *
evas_device_description_get(const Evas_Device *dev)
{
MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV);
return NULL;
MAGIC_CHECK_END();
return dev->desc;
return efl_input_device_description_get(dev);
}
EAPI void
evas_device_parent_set(Evas_Device *dev, Evas_Device *parent)
{
MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV);
return;
MAGIC_CHECK_END();
Evas_Public_Data *e = eo_data_scope_get(dev->evas, EVAS_CANVAS_CLASS);
SAFETY_CHECK(dev, EFL_INPUT_DEVICE_CLASS);
Efl_Input_Device_Data *d = eo_data_scope_get(dev, EFL_INPUT_DEVICE_CLASS);
Evas_Public_Data *e = eo_data_scope_get(d->evas, EVAS_CANVAS_CLASS);
if (parent)
{
MAGIC_CHECK(parent, Evas_Device, MAGIC_DEV);
return;
MAGIC_CHECK_END();
SAFETY_CHECK(parent, EFL_INPUT_DEVICE_CLASS);
}
/* FIXME: move this to Efl.Input.Device */
if (d->parent == parent) return;
if (d->parent)
{
Efl_Input_Device_Data *p = eo_data_scope_get(d->parent, EFL_INPUT_DEVICE_CLASS);
p->children = eina_list_remove(p->children, dev);
}
if (dev->parent == parent) return;
if (dev->parent)
dev->parent->children = eina_list_remove(dev->parent->children, dev);
else if (parent)
e->devices = eina_list_remove(e->devices, dev);
dev->parent = parent;
d->parent = parent;
if (parent)
parent->children = eina_list_append(parent->children, dev);
{
Efl_Input_Device_Data *p = eo_data_scope_get(parent, EFL_INPUT_DEVICE_CLASS);
p->children = eina_list_append(p->children, dev);
}
else
e->devices = eina_list_append(e->devices, dev);
evas_event_callback_call(dev->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
evas_event_callback_call(d->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
}
EAPI const Evas_Device *
evas_device_parent_get(const Evas_Device *dev)
{
MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV);
return NULL;
MAGIC_CHECK_END();
return dev->parent;
return efl_input_device_parent_get(dev);
}
EAPI void
evas_device_class_set(Evas_Device *dev, Evas_Device_Class clas)
{
MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV);
return;
MAGIC_CHECK_END();
dev->clas = clas;
evas_event_callback_call(dev->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
SAFETY_CHECK(dev, EFL_INPUT_DEVICE_CLASS);
Efl_Input_Device_Data *d = eo_data_scope_get(dev, EFL_INPUT_DEVICE_CLASS);
efl_input_device_type_set(dev, clas);
evas_event_callback_call(d->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
}
EAPI Evas_Device_Class
evas_device_class_get(const Evas_Device *dev)
{
MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV);
return EVAS_DEVICE_CLASS_NONE;
MAGIC_CHECK_END();
return dev->clas;
return efl_input_device_type_get(dev);
}
EAPI void
evas_device_subclass_set(Evas_Device *dev, Evas_Device_Subclass clas)
{
MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV);
return;
MAGIC_CHECK_END();
dev->subclas = clas;
evas_event_callback_call(dev->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
SAFETY_CHECK(dev, EFL_INPUT_DEVICE_CLASS);
Efl_Input_Device_Data *d = eo_data_scope_get(dev, EFL_INPUT_DEVICE_CLASS);
efl_input_device_subtype_set(dev, clas);
evas_event_callback_call(d->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
}
EAPI Evas_Device_Subclass
evas_device_subclass_get(const Evas_Device *dev)
{
MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV);
return EVAS_DEVICE_SUBCLASS_NONE;
MAGIC_CHECK_END();
return dev->subclas;
return efl_input_device_subtype_get(dev);
}
EAPI void
evas_device_emulation_source_set(Evas_Device *dev, Evas_Device *src)
{
MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV);
return;
MAGIC_CHECK_END();
if (src)
{
MAGIC_CHECK(src, Evas_Device, MAGIC_DEV);
return;
MAGIC_CHECK_END();
}
if (dev->src == src) return;
if (dev->src) _evas_device_unref(dev->src);
dev->src = src;
if (dev->src) dev->src->ref++;
evas_event_callback_call(dev->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
SAFETY_CHECK(dev, EFL_INPUT_DEVICE_CLASS);
Efl_Input_Device_Data *d = eo_data_scope_get(dev, EFL_INPUT_DEVICE_CLASS);
efl_input_device_source_set(dev, src);
evas_event_callback_call(d->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
}
EAPI const Evas_Device *
evas_device_emulation_source_get(const Evas_Device *dev)
{
MAGIC_CHECK(dev, Evas_Device, MAGIC_DEV);
return NULL;
MAGIC_CHECK_END();
return dev->src;
return efl_input_device_source_get(dev);
}
void
@ -243,7 +242,7 @@ _evas_device_cleanup(Evas *eo_e)
if (e->cur_device)
{
while ((dev = eina_array_pop(e->cur_device)))
_evas_device_unref(dev);
eo_unref(dev);
eina_array_free(e->cur_device);
e->cur_device = NULL;
}
@ -264,21 +263,3 @@ _evas_device_top_get(const Evas *eo_e)
if (num < 1) return NULL;
return eina_array_data_get(e->cur_device, num - 1);
}
void
_evas_device_ref(Evas_Device *dev)
{
dev->ref++;
}
void
_evas_device_unref(Evas_Device *dev)
{
dev->ref--;
if (dev->ref > 0) return;
if (dev->name) eina_stringshare_del(dev->name);
if (dev->desc) eina_stringshare_del(dev->desc);
dev->magic = 0;
free(dev);
}

View File

@ -1041,7 +1041,7 @@ _evas_canvas_event_feed_mouse_down(Eo *eo_e, Evas_Public_Data *e, int b, Evas_Bu
ev.timestamp = timestamp;
ev.event_flags = e->default_event_flags;
ev.dev = _evas_device_top_get(eo_e);
if (ev.dev) _evas_device_ref(ev.dev);
if (ev.dev) eo_ref(ev.dev);
_evas_walk(e);
/* append new touch point to the touch point list */
@ -1101,7 +1101,7 @@ _evas_canvas_event_feed_mouse_down(Eo *eo_e, Evas_Public_Data *e, int b, Evas_Bu
_evas_post_event_callback_call(eo_e, e);
/* update touch point's state to EVAS_TOUCH_POINT_STILL */
_evas_touch_point_update(eo_e, 0, e->pointer.x, e->pointer.y, EVAS_TOUCH_POINT_STILL);
if (ev.dev) _evas_device_unref(ev.dev);
if (ev.dev) eo_unref(ev.dev);
_evas_unwalk(e);
}
@ -1129,7 +1129,7 @@ _post_up_handle(Evas *eo_e, unsigned int timestamp, const void *data)
ev.timestamp = timestamp;
ev.event_flags = e->default_event_flags;
ev.dev = _evas_device_top_get(eo_e);
if (ev.dev) _evas_device_ref(ev.dev);
if (ev.dev) eo_ref(ev.dev);
/* get new list of ins */
ins = evas_event_objects_event_list(eo_e, NULL, e->pointer.x, e->pointer.y);
@ -1226,7 +1226,7 @@ _post_up_handle(Evas *eo_e, unsigned int timestamp, const void *data)
}
if (e->pointer.inside)
evas_event_feed_mouse_move(eo_e, e->pointer.x, e->pointer.y, timestamp, data);
if (ev.dev) _evas_device_unref(ev.dev);
if (ev.dev) eo_unref(ev.dev);
return post_called;
}
@ -1265,7 +1265,7 @@ _evas_canvas_event_feed_mouse_up(Eo *eo_e, Evas_Public_Data *e, int b, Evas_Butt
ev.timestamp = timestamp;
ev.event_flags = e->default_event_flags;
ev.dev = _evas_device_top_get(eo_e);
if (ev.dev) _evas_device_ref(ev.dev);
if (ev.dev) eo_ref(ev.dev);
_evas_walk(e);
/* update released touch point */
@ -1309,7 +1309,7 @@ _evas_canvas_event_feed_mouse_up(Eo *eo_e, Evas_Public_Data *e, int b, Evas_Butt
eina_list_free(copy);
e->last_mouse_up_counter++;
_evas_post_event_callback_call(eo_e, e);
if (ev.dev) _evas_device_unref(ev.dev);
if (ev.dev) eo_unref(ev.dev);
}
if (e->pointer.mouse_grabbed == 0)
@ -1385,7 +1385,7 @@ _evas_canvas_event_feed_mouse_wheel(Eo *eo_e, Evas_Public_Data *e, int direction
ev.timestamp = timestamp;
ev.event_flags = e->default_event_flags;
ev.dev = _evas_device_top_get(eo_e);
if (ev.dev) _evas_device_ref(ev.dev);
if (ev.dev) eo_ref(ev.dev);
_evas_walk(e);
copy = evas_event_list_copy(e->pointer.object.in);
@ -1410,7 +1410,7 @@ _evas_canvas_event_feed_mouse_wheel(Eo *eo_e, Evas_Public_Data *e, int direction
eina_list_free(copy);
_evas_post_event_callback_call(eo_e, e);
if (ev.dev) _evas_device_unref(ev.dev);
if (ev.dev) eo_unref(ev.dev);
_evas_unwalk(e);
}
@ -1464,7 +1464,7 @@ _canvas_event_feed_mouse_move_internal(Eo *eo_e, void *_pd, int x, int y, unsign
ev.timestamp = timestamp;
ev.event_flags = e->default_event_flags;
ev.dev = _evas_device_top_get(eo_e);
if (ev.dev) _evas_device_ref(ev.dev);
if (ev.dev) eo_ref(ev.dev);
copy = evas_event_list_copy(e->pointer.object.in);
EINA_LIST_FOREACH(copy, l, eo_obj)
{
@ -1507,7 +1507,7 @@ _canvas_event_feed_mouse_move_internal(Eo *eo_e, void *_pd, int x, int y, unsign
if (e->delete_me) break;
}
_evas_post_event_callback_call(eo_e, e);
if (ev.dev) _evas_device_unref(ev.dev);
if (ev.dev) eo_unref(ev.dev);
}
{
Evas_Event_Mouse_Out ev;
@ -1527,7 +1527,7 @@ _canvas_event_feed_mouse_move_internal(Eo *eo_e, void *_pd, int x, int y, unsign
ev.timestamp = timestamp;
ev.event_flags = e->default_event_flags;
ev.dev = _evas_device_top_get(eo_e);
if (ev.dev) _evas_device_ref(ev.dev);
if (ev.dev) eo_ref(ev.dev);
eina_list_free(copy);
@ -1558,7 +1558,7 @@ _canvas_event_feed_mouse_move_internal(Eo *eo_e, void *_pd, int x, int y, unsign
}
}
_evas_post_event_callback_call(eo_e, e);
if (ev.dev) _evas_device_unref(ev.dev);
if (ev.dev) eo_unref(ev.dev);
}
}
else
@ -1589,7 +1589,7 @@ _canvas_event_feed_mouse_move_internal(Eo *eo_e, void *_pd, int x, int y, unsign
ev.timestamp = timestamp;
ev.event_flags = e->default_event_flags;
ev.dev = _evas_device_top_get(eo_e);
if (ev.dev) _evas_device_ref(ev.dev);
if (ev.dev) eo_ref(ev.dev);
ev2.buttons = e->pointer.button;
ev2.output.x = e->pointer.x;
@ -1721,7 +1721,7 @@ _canvas_event_feed_mouse_move_internal(Eo *eo_e, void *_pd, int x, int y, unsign
eina_list_free(ins);
}
_evas_post_event_callback_call(eo_e, e);
if (ev.dev) _evas_device_unref(ev.dev);
if (ev.dev) eo_unref(ev.dev);
}
_evas_unwalk(e);
return;
@ -1755,7 +1755,7 @@ nogrep:
ev.timestamp = timestamp;
ev.event_flags = e->default_event_flags;
ev.dev = _evas_device_top_get(eo_e);
if (ev.dev) _evas_device_ref(ev.dev);
if (ev.dev) eo_ref(ev.dev);
ev2.buttons = e->pointer.button;
ev2.output.x = e->pointer.x;
@ -1899,7 +1899,7 @@ nogrep:
e->pointer.object.in = newin;
_evas_post_event_callback_call(eo_e, e);
if (ev.dev) _evas_device_unref(ev.dev);
if (ev.dev) eo_unref(ev.dev);
}
_evas_unwalk(e);
}
@ -1947,7 +1947,7 @@ _evas_canvas_event_feed_mouse_in(Eo *eo_e, Evas_Public_Data *e, unsigned int tim
ev.timestamp = timestamp;
ev.event_flags = e->default_event_flags;
ev.dev = _evas_device_top_get(eo_e);
if (ev.dev) _evas_device_ref(ev.dev);
if (ev.dev) eo_ref(ev.dev);
_evas_walk(e);
/* get new list of ins */
@ -1977,7 +1977,7 @@ _evas_canvas_event_feed_mouse_in(Eo *eo_e, Evas_Public_Data *e, unsigned int tim
e->pointer.object.in = ins;
_evas_post_event_callback_call(eo_e, e);
evas_event_feed_mouse_move(eo_e, e->pointer.x, e->pointer.y, timestamp, data);
if (ev.dev) _evas_device_unref(ev.dev);
if (ev.dev) eo_unref(ev.dev);
_evas_unwalk(e);
}
@ -2007,7 +2007,7 @@ _evas_canvas_event_feed_mouse_out(Eo *eo_e, Evas_Public_Data *e, unsigned int ti
ev.timestamp = timestamp;
ev.event_flags = e->default_event_flags;
ev.dev = _evas_device_top_get(eo_e);
if (ev.dev) _evas_device_ref(ev.dev);
if (ev.dev) eo_ref(ev.dev);
_evas_walk(e);
/* if our mouse button is inside any objects */
@ -2042,7 +2042,7 @@ _evas_canvas_event_feed_mouse_out(Eo *eo_e, Evas_Public_Data *e, unsigned int ti
e->pointer.object.in = eina_list_free(e->pointer.object.in);
e->pointer.mouse_grabbed = 0;
_evas_post_event_callback_call(eo_e, e);
if (ev.dev) _evas_device_unref(ev.dev);
if (ev.dev) eo_unref(ev.dev);
_evas_unwalk(e);
}
@ -2089,7 +2089,7 @@ _canvas_event_feed_multi_down_internal(Evas *eo_e, void *_pd,
ev.timestamp = timestamp;
ev.event_flags = e->default_event_flags;
ev.dev = _evas_device_top_get(eo_e);
if (ev.dev) _evas_device_ref(ev.dev);
if (ev.dev) eo_ref(ev.dev);
_evas_walk(e);
/* append new touch point to the touch point list */
@ -2132,7 +2132,7 @@ _canvas_event_feed_multi_down_internal(Evas *eo_e, void *_pd,
_evas_post_event_callback_call(eo_e, e);
/* update touch point's state to EVAS_TOUCH_POINT_STILL */
_evas_touch_point_update(eo_e, d, x, y, EVAS_TOUCH_POINT_STILL);
if (ev.dev) _evas_device_unref(ev.dev);
if (ev.dev) eo_unref(ev.dev);
_evas_unwalk(e);
}
@ -2200,7 +2200,7 @@ _canvas_event_feed_multi_up_internal(Evas *eo_e, void *_pd,
ev.timestamp = timestamp;
ev.event_flags = e->default_event_flags;
ev.dev = _evas_device_top_get(eo_e);
if (ev.dev) _evas_device_ref(ev.dev);
if (ev.dev) eo_ref(ev.dev);
_evas_walk(e);
/* update released touch point */
@ -2236,7 +2236,7 @@ _canvas_event_feed_multi_up_internal(Evas *eo_e, void *_pd,
_evas_post_event_callback_call(eo_e, e);
/* remove released touch point from the touch point list */
_evas_touch_point_remove(eo_e, d);
if (ev.dev) _evas_device_unref(ev.dev);
if (ev.dev) eo_unref(ev.dev);
_evas_unwalk(e);
}
@ -2308,7 +2308,7 @@ _canvas_event_feed_multi_move_internal(Eo *eo_e, void *_pd, int d, int x,
ev.timestamp = timestamp;
ev.event_flags = e->default_event_flags;
ev.dev = _evas_device_top_get(eo_e);
if (ev.dev) _evas_device_ref(ev.dev);
if (ev.dev) eo_ref(ev.dev);
copy = evas_event_list_copy(e->pointer.object.in);
EINA_LIST_FOREACH(copy, l, eo_obj)
@ -2341,7 +2341,7 @@ _canvas_event_feed_multi_move_internal(Eo *eo_e, void *_pd, int d, int x,
}
eina_list_free(copy);
_evas_post_event_callback_call(eo_e, e);
if (ev.dev) _evas_device_unref(ev.dev);
if (ev.dev) eo_unref(ev.dev);
}
else
{
@ -2372,7 +2372,7 @@ _canvas_event_feed_multi_move_internal(Eo *eo_e, void *_pd, int d, int x,
ev.timestamp = timestamp;
ev.event_flags = e->default_event_flags;
ev.dev = _evas_device_top_get(eo_e);
if (ev.dev) _evas_device_ref(ev.dev);
if (ev.dev) eo_ref(ev.dev);
/* get all new in objects */
ins = evas_event_objects_event_list(eo_e, NULL, x, y);
@ -2427,7 +2427,7 @@ _canvas_event_feed_multi_move_internal(Eo *eo_e, void *_pd, int d, int x,
eina_list_free(ins);
}
_evas_post_event_callback_call(eo_e, e);
if (ev.dev) _evas_device_unref(ev.dev);
if (ev.dev) eo_unref(ev.dev);
}
_evas_unwalk(e);
}
@ -2487,7 +2487,7 @@ _canvas_event_feed_key_down_internal(Eo *eo_e,
ev.event_flags = e->default_event_flags;
ev.dev = _evas_device_top_get(eo_e);
ev.keycode = keycode;
if (ev.dev) _evas_device_ref(ev.dev);
if (ev.dev) eo_ref(ev.dev);
if (e->grabs)
{
@ -2552,7 +2552,7 @@ _canvas_event_feed_key_down_internal(Eo *eo_e,
&ev, event_id);
}
_evas_post_event_callback_call(eo_e, e);
if (ev.dev) _evas_device_unref(ev.dev);
if (ev.dev) eo_unref(ev.dev);
_evas_unwalk(e);
}
@ -2592,7 +2592,7 @@ _canvas_event_feed_key_up_internal(Eo *eo_e,
ev.event_flags = e->default_event_flags;
ev.dev = _evas_device_top_get(eo_e);
ev.keycode = keycode;
if (ev.dev) _evas_device_ref(ev.dev);
if (ev.dev) eo_ref(ev.dev);
if (e->grabs)
{
@ -2657,7 +2657,7 @@ _canvas_event_feed_key_up_internal(Eo *eo_e,
&ev, event_id);
}
_evas_post_event_callback_call(eo_e, e);
if (ev.dev) _evas_device_unref(ev.dev);
if (ev.dev) eo_unref(ev.dev);
_evas_unwalk(e);
}
@ -2709,7 +2709,7 @@ _evas_canvas_event_feed_hold(Eo *eo_e, Evas_Public_Data *e, int hold, unsigned i
ev.timestamp = timestamp;
ev.event_flags = e->default_event_flags;
ev.dev = _evas_device_top_get(eo_e);
if (ev.dev) _evas_device_ref(ev.dev);
if (ev.dev) eo_ref(ev.dev);
_evas_walk(e);
copy = evas_event_list_copy(e->pointer.object.in);
@ -2727,7 +2727,7 @@ _evas_canvas_event_feed_hold(Eo *eo_e, Evas_Public_Data *e, int hold, unsigned i
}
eina_list_free(copy);
_evas_post_event_callback_call(eo_e, e);
if (ev.dev) _evas_device_unref(ev.dev);
if (ev.dev) eo_unref(ev.dev);
_evas_unwalk(e);
_evas_object_event_new();
}
@ -2753,7 +2753,7 @@ _canvas_event_feed_axis_update_internal(Evas *eo_e, Evas_Public_Data *e, unsigne
ev.naxis = naxis;
ev.axis = (Evas_Axis *)axis;
ev.dev = _evas_device_top_get(eo_e);
if (ev.dev) _evas_device_ref(ev.dev);
if (ev.dev) eo_ref(ev.dev);
_evas_walk(e);
copy = evas_event_list_copy(e->pointer.object.in);

View File

@ -1208,20 +1208,6 @@ struct _Evas_Font_Description
Eina_Bool is_new : 1;
};
struct _Evas_Device
{
DATA32 magic;
Evas *evas;
Evas_Device *parent;
Evas_Device *src;
Eina_List *children;
const char *name;
const char *desc;
int ref;
Evas_Device_Class clas;
Evas_Device_Subclass subclas;
};
struct _Evas_Object_Filter_Data
{
Eina_Stringshare *name;
@ -1946,8 +1932,6 @@ void _evas_touch_point_remove(Evas *e, int id);
void _evas_device_cleanup(Evas *e);
Evas_Device *_evas_device_top_get(const Evas *e);
void _evas_device_ref(Evas_Device *dev);
void _evas_device_unref(Evas_Device *dev);
Eina_Bool evas_vg_loader_svg(Evas_Object *vg, const Eina_File *f, const char *key EINA_UNUSED);