diff options
author | Jean-Philippe Andre <jp.andre@samsung.com> | 2016-07-07 16:57:14 +0900 |
---|---|---|
committer | Jean-Philippe Andre <jp.andre@samsung.com> | 2016-07-21 11:24:58 +0900 |
commit | 41ca49fccc40c22511a86b2f424dd2cb758ce049 (patch) | |
tree | 40929a58dc808f1184a6fc96122f15a2f6f96a50 | |
parent | 1dcb2778e4dbf947554683e0a2a5344691120cf6 (diff) | |
download | efl-devs/jpeg/ecore_device.tar.gz |
ecore_drm: Revert changes to input handlingdevs/jpeg/ecore_device
Since ecore_drm is deprecated, let's not add anything new there.
-rw-r--r-- | src/lib/ecore_drm/Ecore_Drm.h | 2 | ||||
-rw-r--r-- | src/lib/ecore_drm/ecore_drm_device.c | 11 | ||||
-rw-r--r-- | src/lib/ecore_drm/ecore_drm_evdev.c | 32 | ||||
-rw-r--r-- | src/lib/ecore_drm/ecore_drm_inputs.c | 161 | ||||
-rw-r--r-- | src/lib/ecore_drm/ecore_drm_private.h | 2 |
5 files changed, 2 insertions, 206 deletions
diff --git a/src/lib/ecore_drm/Ecore_Drm.h b/src/lib/ecore_drm/Ecore_Drm.h index b540077b31..62717e5ba6 100644 --- a/src/lib/ecore_drm/Ecore_Drm.h +++ b/src/lib/ecore_drm/Ecore_Drm.h @@ -140,7 +140,6 @@ struct _Ecore_Drm_Device Eina_Bool active : 1; Eina_Bool left_handed : 1; - Eina_Bool window_valid : 1; }; struct _Ecore_Drm_Event_Activate @@ -1044,7 +1043,6 @@ EAPI Eina_Bool ecore_drm_output_rotation_set(Ecore_Drm_Output *output, Ecore_Drm * @since 1.17 */ EAPI Eina_Bool ecore_drm_evdev_key_remap_enable(Ecore_Drm_Evdev *edev, Eina_Bool enable); -EAPI Ecore_Device *ecore_drm_evdev_get_ecore_device(const char *path, Ecore_Device_Class clas); /** * Set a given set of keys as remapped keys on a Ecore_Drm_Evdev diff --git a/src/lib/ecore_drm/ecore_drm_device.c b/src/lib/ecore_drm/ecore_drm_device.c index 544baeb9b3..ca560340dc 100644 --- a/src/lib/ecore_drm/ecore_drm_device.c +++ b/src/lib/ecore_drm/ecore_drm_device.c @@ -503,21 +503,10 @@ ecore_drm_device_fd_get(Ecore_Drm_Device *dev) EAPI void ecore_drm_device_window_set(Ecore_Drm_Device *dev, unsigned int window) { - Eina_List *l, *ll; - Ecore_Drm_Seat *seat; - Ecore_Drm_Evdev *edev; - /* check for valid device */ EINA_SAFETY_ON_TRUE_RETURN((!dev) || (dev->drm.fd < 0)); dev->window = window; - dev->window_valid = EINA_TRUE; - - EINA_LIST_FOREACH(dev->seats, l , seat) - { - EINA_LIST_FOREACH(seat->devices, ll, edev) - _ecore_drm_device_add(window, edev); - } } EAPI const char * diff --git a/src/lib/ecore_drm/ecore_drm_evdev.c b/src/lib/ecore_drm/ecore_drm_evdev.c index 06d94f468e..4e5ad4527b 100644 --- a/src/lib/ecore_drm/ecore_drm_evdev.c +++ b/src/lib/ecore_drm/ecore_drm_evdev.c @@ -288,32 +288,6 @@ _device_remapped_key_get(Ecore_Drm_Evdev *edev, int code) return code; } -EAPI Ecore_Device * -ecore_drm_evdev_get_ecore_device(const char *path, Ecore_Device_Class clas) -{ - Eina_Iterator *it; - Ecore_Device *dev; - - EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL); - - if (path) return EINA_FALSE; - - it = ecore_device_iterate(); - EINA_ITERATOR_FOREACH(it, dev) - { - if (!dev) continue; - if ((ecore_device_class_get(dev) == clas) && - (eina_streq(ecore_device_identifier_get(dev), path))) - { - eina_iterator_free(it); - return dev; - } - } - eina_iterator_free(it); - - return NULL; -} - static void _device_handle_key(struct libinput_device *device, struct libinput_event_keyboard *event) { @@ -414,7 +388,6 @@ _device_handle_key(struct libinput_device *device, struct libinput_event_keyboar _device_modifiers_update(edev); e->modifiers = edev->xkb.modifiers; - e->dev = ecore_drm_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_KEYBOARD); if (state) ecore_event_add(ECORE_EVENT_KEY_DOWN, e, NULL, NULL); @@ -471,7 +444,6 @@ _device_pointer_motion(Ecore_Drm_Evdev *edev, struct libinput_event_pointer *eve ev->multi.y = ev->y; ev->multi.root.x = ev->x; ev->multi.root.y = ev->y; - ev->dev = ecore_drm_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_MOUSE); ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL); } @@ -571,7 +543,6 @@ _device_handle_button(struct libinput_device *device, struct libinput_event_poin ev->multi.y = ev->y; ev->multi.root.x = ev->x; ev->multi.root.y = ev->y; - ev->dev = ecore_drm_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_MOUSE); if (state) { @@ -659,7 +630,6 @@ _device_handle_axis(struct libinput_device *device, struct libinput_event_pointe ev->y = edev->seat->ptr.iy; ev->root.x = ev->x; ev->root.y = ev->y; - ev->dev = ecore_drm_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_MOUSE); #if LIBINPUT_HIGHER_08 axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL; @@ -795,7 +765,6 @@ _device_handle_touch_event_send(Ecore_Drm_Evdev *edev, struct libinput_event_tou ev->multi.y = ev->y; ev->multi.root.x = ev->x; ev->multi.root.y = ev->y; - ev->dev = ecore_drm_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_TOUCH); if (state == ECORE_EVENT_MOUSE_BUTTON_DOWN) { @@ -870,7 +839,6 @@ _device_handle_touch_motion_send(Ecore_Drm_Evdev *edev, struct libinput_event_to ev->multi.y = ev->y; ev->multi.root.x = ev->x; ev->multi.root.y = ev->y; - ev->dev = ecore_drm_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_TOUCH); ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL); } diff --git a/src/lib/ecore_drm/ecore_drm_inputs.c b/src/lib/ecore_drm/ecore_drm_inputs.c index e5c2361a84..d0896eced3 100644 --- a/src/lib/ecore_drm/ecore_drm_inputs.c +++ b/src/lib/ecore_drm/ecore_drm_inputs.c @@ -108,158 +108,7 @@ _seat_get(Ecore_Drm_Input *input, const char *seat) return _seat_create(input, seat); } -static void -_ecore_event_device_info_free(void *data EINA_UNUSED, void *ev) -{ - Ecore_Event_Device_Info *e; - - e = ev; - eina_stringshare_del(e->name); - eina_stringshare_del(e->identifier); - eina_stringshare_del(e->seatname); - - free(e); -} - -static Ecore_Device_Class -_ecore_drm_seat_cap_to_ecore_device_class(unsigned int cap) -{ - switch(cap) - { - case EVDEV_SEAT_POINTER: - return ECORE_DEVICE_CLASS_MOUSE; - case EVDEV_SEAT_KEYBOARD: - return ECORE_DEVICE_CLASS_KEYBOARD; - case EVDEV_SEAT_TOUCH: - return ECORE_DEVICE_CLASS_TOUCH; - default: - return ECORE_DEVICE_CLASS_NONE; - } - return ECORE_DEVICE_CLASS_NONE; -} - -void -_ecore_drm_device_info_send(unsigned int window, Ecore_Drm_Evdev *edev, Ecore_Device_Class clas, Eina_Bool flag) -{ - Ecore_Event_Device_Info *e; - - if (!(e = calloc(1, sizeof(Ecore_Event_Device_Info)))) return; - - e->name = eina_stringshare_ref(libinput_device_get_name(edev->device)); - e->identifier = eina_stringshare_ref(edev->path); - e->seatname = eina_stringshare_ref(edev->seat->name); - e->clas = clas; - e->window = window; - - if (flag) - ecore_event_add(ECORE_EVENT_DEVICE_ADD, e, _ecore_event_device_info_free, NULL); - else - ecore_event_add(ECORE_EVENT_DEVICE_DEL, e, _ecore_event_device_info_free, NULL); -} - -static Eina_Bool -_ecore_drm_device_add_ecore_device(Ecore_Drm_Evdev *edev, Ecore_Device_Class clas) -{ - Eina_Iterator *it; - Ecore_Device *dev; - - if (!edev->path) return EINA_FALSE; - - it = ecore_device_iterate(); - EINA_ITERATOR_FOREACH(it, dev) - { - if (!dev) continue; - if ((ecore_device_class_get(dev) == clas) && - (eina_streq(ecore_device_identifier_get(dev), edev->path))) - { - eina_iterator_free(it); - return EINA_FALSE; - } - } - eina_iterator_free(it); - - dev = ecore_device_add(clas, ECORE_DEVICE_SUBCLASS_NONE, - libinput_device_get_name(edev->device), - libinput_device_get_name(edev->device), - edev->path); - return !!dev; -} - -static Eina_Bool -_ecore_drm_device_del_ecore_device(Ecore_Drm_Evdev *edev, Ecore_Device_Class clas) -{ - Eina_Iterator *it; - Ecore_Device *dev; - - if (!edev->path) return EINA_FALSE; - - it = ecore_device_iterate(); - if (!it) return EINA_FALSE; - EINA_ITERATOR_FOREACH(it, dev) - { - if (!dev) continue; - if ((ecore_device_class_get(dev) == clas) && - (eina_streq(ecore_device_identifier_get(dev), edev->path))) - { - ecore_device_del(dev); - return EINA_TRUE; - } - } - eina_iterator_free(it); - return EINA_FALSE; -} - -void -_ecore_drm_device_add(unsigned int window, Ecore_Drm_Evdev *edev) -{ - Ecore_Device_Class clas; - - if (edev->seat_caps & EVDEV_SEAT_POINTER) - { - clas = _ecore_drm_seat_cap_to_ecore_device_class(EVDEV_SEAT_POINTER); - if (_ecore_drm_device_add_ecore_device(edev, clas)) - _ecore_drm_device_info_send(window, edev, clas, 1); - } - if (edev->seat_caps & EVDEV_SEAT_KEYBOARD) - { - clas = _ecore_drm_seat_cap_to_ecore_device_class(EVDEV_SEAT_KEYBOARD); - if (_ecore_drm_device_add_ecore_device(edev, clas)) - _ecore_drm_device_info_send(window, edev, clas, 1); - } - if (edev->seat_caps & EVDEV_SEAT_TOUCH) - { - clas = _ecore_drm_seat_cap_to_ecore_device_class(EVDEV_SEAT_TOUCH); - if (_ecore_drm_device_add_ecore_device(edev, clas)) - _ecore_drm_device_info_send(window, edev, clas, 1); - } -} - -void -_ecore_drm_device_remove(unsigned int window, Ecore_Drm_Evdev *edev) -{ - Ecore_Device_Class clas; - - if (edev->seat_caps & EVDEV_SEAT_POINTER) - { - clas = _ecore_drm_seat_cap_to_ecore_device_class(EVDEV_SEAT_POINTER); - if (_ecore_drm_device_del_ecore_device(edev, clas)) - _ecore_drm_device_info_send(window, edev, clas, 0); - } - if (edev->seat_caps & EVDEV_SEAT_KEYBOARD) - { - clas = _ecore_drm_seat_cap_to_ecore_device_class(EVDEV_SEAT_KEYBOARD); - if (_ecore_drm_device_del_ecore_device(edev, clas)) - _ecore_drm_device_info_send(window, edev, clas, 0); - } - if (edev->seat_caps & EVDEV_SEAT_TOUCH) - { - clas = _ecore_drm_seat_cap_to_ecore_device_class(EVDEV_SEAT_TOUCH); - if (_ecore_drm_device_del_ecore_device(edev, clas)) - _ecore_drm_device_info_send(window, edev, clas, 0); - } -} - -static void +static void _device_added(Ecore_Drm_Input *input, struct libinput_device *device) { struct libinput_seat *libinput_seat; @@ -288,13 +137,10 @@ _device_added(Ecore_Drm_Input *input, struct libinput_device *device) /* append this device to the seat */ seat->devices = eina_list_append(seat->devices, edev); - - if (input->dev->window_valid) - _ecore_drm_device_add(input->dev->window, edev); } static void -_device_removed(Ecore_Drm_Input *input, struct libinput_device *device) +_device_removed(Ecore_Drm_Input *input EINA_UNUSED, struct libinput_device *device) { Ecore_Drm_Evdev *edev; @@ -302,9 +148,6 @@ _device_removed(Ecore_Drm_Input *input, struct libinput_device *device) if (!(edev = libinput_device_get_user_data(device))) return; - if (input->dev->window_valid) - _ecore_drm_device_remove(input->dev->window, edev); - /* remove this evdev from the seat's list of devices */ edev->seat->devices = eina_list_remove(edev->seat->devices, edev); diff --git a/src/lib/ecore_drm/ecore_drm_private.h b/src/lib/ecore_drm/ecore_drm_private.h index 1544d9f9d8..91781d0f55 100644 --- a/src/lib/ecore_drm/ecore_drm_private.h +++ b/src/lib/ecore_drm/ecore_drm_private.h @@ -339,8 +339,6 @@ void _ecore_drm_dbus_device_release(uint32_t major, uint32_t minor); Eina_Bool _ecore_drm_dbus_session_take(void); Eina_Bool _ecore_drm_dbus_session_release(void); -void _ecore_drm_device_add(unsigned int window, Ecore_Drm_Evdev *edev); - void _ecore_drm_inputs_init(void); void _ecore_drm_inputs_shutdown(void); |