* @return the device node created or NULL if an error occurred.
*
* @see evas_device_del
+ * @see evas_device_full_add
* @since 1.8
*/
EAPI Evas_Device *evas_device_add(Evas *e);
/**
+ * Add a new device type
+ *
+ * @param e The canvas to create the device node for.
+ * @param name The name of the device.
+ * @param desc The description of the device.
+ * @param parent_dev The parent device.
+ * @param emulation_dev The source device.
+ * @param clas The device class.
+ * @param sub_class The device subclass.
+ *
+ * Adds a new device node to the given canvas @p e. All devices created as
+ * part of the canvas @p e will automatically be deleted when the canvas
+ * is freed.
+ *
+ * @return the device node created or NULL if an error occurred.
+ *
+ * @see evas_device_del
+ * @since 1.19
+ */
+EAPI Evas_Device *evas_device_full_add(Evas *eo_e, const char *name,
+ const char *desc,
+ Evas_Device *parent_dev,
+ Evas_Device *emulation_dev,
+ Evas_Device_Class clas,
+ Evas_Device_Subclass sub_clas);
+
+/**
* Delete a new device type
*
* @param dev The device node you want to delete.
EAPI Evas_Device *
evas_device_add(Evas *eo_e)
{
+ return evas_device_full_add(eo_e, NULL, NULL, NULL, NULL,
+ EVAS_DEVICE_CLASS_NONE,
+ EVAS_DEVICE_SUBCLASS_NONE);
+}
+
+EAPI Evas_Device *
+evas_device_full_add(Evas *eo_e, const char *name, const char *desc,
+ Evas_Device *parent_dev, Evas_Device *emulation_dev,
+ Evas_Device_Class clas, Evas_Device_Subclass sub_clas)
+{
Efl_Input_Device_Data *d;
Evas_Public_Data *e;
Evas_Device *dev;
SAFETY_CHECK(eo_e, EVAS_CANVAS_CLASS, NULL);
- dev = efl_add(EFL_INPUT_DEVICE_CLASS, eo_e);
+ dev = efl_add(EFL_INPUT_DEVICE_CLASS, eo_e,
+ efl_input_device_name_set(efl_added, name),
+ efl_input_device_description_set(efl_added, desc),
+ efl_input_device_type_set(efl_added, clas),
+ efl_input_device_subtype_set(efl_added, sub_clas),
+ efl_input_device_source_set(efl_added, emulation_dev),
+ efl_input_device_parent_set(efl_added, parent_dev));
d = efl_data_scope_get(dev, EFL_INPUT_DEVICE_CLASS);
d->evas = eo_e;
e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
- e->devices = eina_list_append(e->devices, dev);
+ if (!parent_dev)
+ e->devices = eina_list_append(e->devices, dev);
efl_event_callback_add(dev, EFL_EVENT_DEL, _del_cb, e);
evas_event_callback_call(eo_e, EVAS_CALLBACK_DEVICE_CHANGED, dev);