summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMun, Gwan-gyeong <kk.moon@samsung.com>2015-04-29 08:55:06 -0400
committerChris Michael <cp.michael@samsung.com>2015-04-29 08:55:06 -0400
commit34fd2cfa4a3befe09f4338cab9e0f2bcbefe1af0 (patch)
treed5fee3920f088f18d4731591773487ac11b112e9
parent5c7cfdc133c1edc21b8ece39bd306d0eace623da (diff)
ecore-drm: add touch_motion event on touch_down event handler.
Summary: ecore-drm touch down handler does not produce ECORE_EVENT_MOUSE_MOVE event. so, when user touches screen, application can't handle mouse down event correctly. this fix adds touch_motion event on touch_down event handler. Reviewers: zmike, cedric, raster, gwanglim, devilhorns Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D2427
-rw-r--r--src/lib/ecore_drm/ecore_drm_evdev.c84
1 files changed, 47 insertions, 37 deletions
diff --git a/src/lib/ecore_drm/ecore_drm_evdev.c b/src/lib/ecore_drm/ecore_drm_evdev.c
index 2e4ada101a..e40ad400b3 100644
--- a/src/lib/ecore_drm/ecore_drm_evdev.c
+++ b/src/lib/ecore_drm/ecore_drm_evdev.c
@@ -661,8 +661,8 @@ _ecore_drm_evdev_device_create(Ecore_Drm_Seat *seat, struct libinput_device *dev
661 return edev; 661 return edev;
662} 662}
663 663
664static void 664static void
665_device_handle_touch_event(Ecore_Drm_Evdev *edev, struct libinput_event_touch *event, int state) 665_device_handle_touch_event_send(Ecore_Drm_Evdev *edev, struct libinput_event_touch *event, int state)
666{ 666{
667 Ecore_Drm_Input *input; 667 Ecore_Drm_Input *input;
668 Ecore_Event_Mouse_Button *ev; 668 Ecore_Event_Mouse_Button *ev;
@@ -738,48 +738,17 @@ _device_handle_touch_event(Ecore_Drm_Evdev *edev, struct libinput_event_touch *e
738 ecore_event_add(state, ev, NULL, NULL); 738 ecore_event_add(state, ev, NULL, NULL);
739} 739}
740 740
741static void 741static void
742_device_handle_touch_down(struct libinput_device *device, struct libinput_event_touch *event) 742_device_handle_touch_motion_send(Ecore_Drm_Evdev *edev, struct libinput_event_touch *event)
743{
744 Ecore_Drm_Evdev *edev;
745
746 if (!(edev = libinput_device_get_user_data(device))) return;
747
748 edev->mouse.ix = edev->mouse.dx =
749 libinput_event_touch_get_x_transformed(event, edev->output->current_mode->width);
750 edev->mouse.iy = edev->mouse.dy =
751 libinput_event_touch_get_y_transformed(event, edev->output->current_mode->height);
752
753 edev->mt_slot = libinput_event_touch_get_seat_slot(event);
754
755 _device_handle_touch_event(edev, event, ECORE_EVENT_MOUSE_BUTTON_DOWN);
756}
757
758static void
759_device_handle_touch_motion(struct libinput_device *device, struct libinput_event_touch *event)
760{ 743{
761 Ecore_Drm_Evdev *edev;
762 Ecore_Drm_Input *input; 744 Ecore_Drm_Input *input;
763 Ecore_Event_Mouse_Move *ev; 745 Ecore_Event_Mouse_Move *ev;
764 746
765 if (!(edev = libinput_device_get_user_data(device))) return; 747 if (!edev) return;
766 if (!(input = edev->seat->input)) return; 748 if (!(input = edev->seat->input)) return;
767 749
768 if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Move)))) return; 750 if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Move)))) return;
769 751
770 edev->mouse.dx =
771 libinput_event_touch_get_x_transformed(event, edev->output->current_mode->width);
772 edev->mouse.dy =
773 libinput_event_touch_get_y_transformed(event, edev->output->current_mode->height);
774
775 if (floor(edev->mouse.dx) == edev->mouse.ix &&
776 floor(edev->mouse.dy) == edev->mouse.iy) return;
777
778 edev->mouse.ix = edev->mouse.dx;
779 edev->mouse.iy = edev->mouse.dy;
780
781 edev->mt_slot = libinput_event_touch_get_seat_slot(event);
782
783 ev->window = (Ecore_Window)input->dev->window; 752 ev->window = (Ecore_Window)input->dev->window;
784 ev->event_window = (Ecore_Window)input->dev->window; 753 ev->event_window = (Ecore_Window)input->dev->window;
785 ev->root_window = (Ecore_Window)input->dev->window; 754 ev->root_window = (Ecore_Window)input->dev->window;
@@ -809,6 +778,47 @@ _device_handle_touch_motion(struct libinput_device *device, struct libinput_even
809 ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL); 778 ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL);
810} 779}
811 780
781static void
782_device_handle_touch_down(struct libinput_device *device, struct libinput_event_touch *event)
783{
784 Ecore_Drm_Evdev *edev;
785
786 if (!(edev = libinput_device_get_user_data(device))) return;
787
788 edev->mouse.ix = edev->mouse.dx =
789 libinput_event_touch_get_x_transformed(event, edev->output->current_mode->width);
790 edev->mouse.iy = edev->mouse.dy =
791 libinput_event_touch_get_y_transformed(event, edev->output->current_mode->height);
792
793 edev->mt_slot = libinput_event_touch_get_seat_slot(event);
794
795 _device_handle_touch_motion_send(edev, event);
796 _device_handle_touch_event_send(edev, event, ECORE_EVENT_MOUSE_BUTTON_DOWN);
797}
798
799static void
800_device_handle_touch_motion(struct libinput_device *device, struct libinput_event_touch *event)
801{
802 Ecore_Drm_Evdev *edev;
803
804 if (!(edev = libinput_device_get_user_data(device))) return;
805
806 edev->mouse.dx =
807 libinput_event_touch_get_x_transformed(event, edev->output->current_mode->width);
808 edev->mouse.dy =
809 libinput_event_touch_get_y_transformed(event, edev->output->current_mode->height);
810
811 if (floor(edev->mouse.dx) == edev->mouse.ix &&
812 floor(edev->mouse.dy) == edev->mouse.iy) return;
813
814 edev->mouse.ix = edev->mouse.dx;
815 edev->mouse.iy = edev->mouse.dy;
816
817 edev->mt_slot = libinput_event_touch_get_seat_slot(event);
818
819 _device_handle_touch_motion_send(edev, event);
820}
821
812static void 822static void
813_device_handle_touch_up(struct libinput_device *device, struct libinput_event_touch *event) 823_device_handle_touch_up(struct libinput_device *device, struct libinput_event_touch *event)
814{ 824{
@@ -818,7 +828,7 @@ _device_handle_touch_up(struct libinput_device *device, struct libinput_event_to
818 828
819 edev->mt_slot = libinput_event_touch_get_seat_slot(event); 829 edev->mt_slot = libinput_event_touch_get_seat_slot(event);
820 830
821 _device_handle_touch_event(edev, event, ECORE_EVENT_MOUSE_BUTTON_UP); 831 _device_handle_touch_event_send(edev, event, ECORE_EVENT_MOUSE_BUTTON_UP);
822} 832}
823 833
824static void 834static void