aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/evas/canvas/evas_device.c
diff options
context:
space:
mode:
authorGuilherme Iscaro <iscaro@profusion.mobi>2016-10-21 10:25:41 -0200
committerBruno Dilly <bdilly@profusion.mobi>2016-12-02 09:57:50 -0200
commit484dae76e675318a579e90ac05d4371acc1f8891 (patch)
treeec41e13d5fc110083a7c37bd75258b1227aab61f /src/lib/evas/canvas/evas_device.c
parentEcore Input Evas: Ecore_Input_Last should contain the Evas device. (diff)
downloadefl-484dae76e675318a579e90ac05d4371acc1f8891.tar.gz
Evas: Add support for per mouse pointer mode/properties.
This patch introduces the possibility to set the pointer mode and query other properties like current position per pointer device. The old API will still works, however it will only act on the default seat.
Diffstat (limited to 'src/lib/evas/canvas/evas_device.c')
-rw-r--r--src/lib/evas/canvas/evas_device.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/lib/evas/canvas/evas_device.c b/src/lib/evas/canvas/evas_device.c
index 14ebfe3216..4398efa898 100644
--- a/src/lib/evas/canvas/evas_device.c
+++ b/src/lib/evas/canvas/evas_device.c
@@ -29,8 +29,9 @@ _is_pointer(Evas_Device_Class clas)
{
if (clas == EVAS_DEVICE_CLASS_MOUSE ||
clas == EVAS_DEVICE_CLASS_TOUCH ||
- clas == EVAS_DEVICE_CLASS_WAND ||
- clas == EVAS_DEVICE_CLASS_PEN)
+ clas == EVAS_DEVICE_CLASS_PEN ||
+ clas == EVAS_DEVICE_CLASS_POINTER ||
+ clas == EVAS_DEVICE_CLASS_WAND)
return EINA_TRUE;
return EINA_FALSE;
}
@@ -86,6 +87,7 @@ _del_cb(void *data, const Efl_Event *ev)
else if (e->default_keyboard == ev->object)
e->default_keyboard = _new_default_device_find(e, ev->object);
+ _evas_pointer_data_remove(e, ev->object);
efl_event_callback_call(e->evas, EFL_CANVAS_EVENT_DEVICE_REMOVED,
ev->object);
}
@@ -128,8 +130,17 @@ evas_device_add_full(Evas *eo_e, const char *name, const char *desc,
e->default_seat = dev;
else if (!e->default_keyboard && clas == EVAS_DEVICE_CLASS_KEYBOARD)
e->default_keyboard = dev;
- else if (!e->default_mouse && _is_pointer(clas))
- e->default_mouse = dev;
+ else if (_is_pointer(clas))
+ {
+ if (!_evas_pointer_data_add(e, dev))
+ {
+ efl_del(dev);
+ return NULL;
+ }
+
+ if (!e->default_mouse)
+ e->default_mouse = dev;
+ }
e->devices = eina_list_append(e->devices, dev);
efl_event_callback_add(dev, EFL_EVENT_DEL, _del_cb, e);
@@ -255,8 +266,19 @@ evas_device_class_set(Evas_Device *dev, Evas_Device_Class clas)
SAFETY_CHECK(dev, EFL_INPUT_DEVICE_CLASS);
Efl_Input_Device_Data *d = efl_data_scope_get(dev, EFL_INPUT_DEVICE_CLASS);
+ Evas_Public_Data *edata = efl_data_scope_get(d->evas, EVAS_CANVAS_CLASS);
+
+ if (d->klass == clas)
+ return;
+
+ if (_is_pointer(d->klass))
+ _evas_pointer_data_remove(edata, dev);
efl_input_device_type_set(dev, clas);
+
+ if (_is_pointer(clas))
+ _evas_pointer_data_add(edata, dev);
+
evas_event_callback_call(d->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
}