summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2017-02-03 15:14:01 -0500
committerMike Blumenkrantz <zmike@osg.samsung.com>2017-02-03 15:13:57 -0500
commit9a8931c3de9690755ee4e943160021d8c3cd7232 (patch)
tree509bfb744cc945035df5c500c62f5cf77d315d72 /src
parent9d0923e847ab1ec6a12360e9a5d8ea4b9bf6bd38 (diff)
elput: add event for relative motion
@feature
Diffstat (limited to 'src')
-rw-r--r--src/lib/elput/Elput.h14
-rw-r--r--src/lib/elput/elput.c3
-rw-r--r--src/lib/elput/elput_evdev.c19
3 files changed, 36 insertions, 0 deletions
diff --git a/src/lib/elput/Elput.h b/src/lib/elput/Elput.h
index b48caa12a3..378912eb90 100644
--- a/src/lib/elput/Elput.h
+++ b/src/lib/elput/Elput.h
@@ -98,6 +98,17 @@ typedef struct _Elput_Event_Session_Active
98 Eina_Bool active : 1; 98 Eina_Bool active : 1;
99} Elput_Event_Session_Active; 99} Elput_Event_Session_Active;
100 100
101/** @since 1.19 */
102typedef struct Elput_Event_Pointer_Motion
103{
104 uint64_t time_usec;
105 double dx;
106 double dy;
107 double dx_unaccel;
108 double dy_unaccel;
109} Elput_Event_Pointer_Motion;
110
111
101EAPI extern int ELPUT_EVENT_SEAT_CAPS; 112EAPI extern int ELPUT_EVENT_SEAT_CAPS;
102EAPI extern int ELPUT_EVENT_SEAT_FRAME; 113EAPI extern int ELPUT_EVENT_SEAT_FRAME;
103EAPI extern int ELPUT_EVENT_KEYMAP_SEND; 114EAPI extern int ELPUT_EVENT_KEYMAP_SEND;
@@ -105,6 +116,9 @@ EAPI extern int ELPUT_EVENT_MODIFIERS_SEND;
105EAPI extern int ELPUT_EVENT_DEVICE_CHANGE; 116EAPI extern int ELPUT_EVENT_DEVICE_CHANGE;
106EAPI extern int ELPUT_EVENT_SESSION_ACTIVE; 117EAPI extern int ELPUT_EVENT_SESSION_ACTIVE;
107 118
119/** @since 1.19 */
120EAPI extern int ELPUT_EVENT_POINTER_MOTION;
121
108/** 122/**
109 * @file 123 * @file
110 * @brief Ecore functions for dealing with libinput 124 * @brief Ecore functions for dealing with libinput
diff --git a/src/lib/elput/elput.c b/src/lib/elput/elput.c
index 95d7a1e6c4..561c98addd 100644
--- a/src/lib/elput/elput.c
+++ b/src/lib/elput/elput.c
@@ -12,6 +12,7 @@ EAPI int ELPUT_EVENT_KEYMAP_SEND = -1;
12EAPI int ELPUT_EVENT_MODIFIERS_SEND = -1; 12EAPI int ELPUT_EVENT_MODIFIERS_SEND = -1;
13EAPI int ELPUT_EVENT_DEVICE_CHANGE = -1; 13EAPI int ELPUT_EVENT_DEVICE_CHANGE = -1;
14EAPI int ELPUT_EVENT_SESSION_ACTIVE = -1; 14EAPI int ELPUT_EVENT_SESSION_ACTIVE = -1;
15EAPI int ELPUT_EVENT_POINTER_MOTION = -1;
15 16
16EAPI int 17EAPI int
17elput_init(void) 18elput_init(void)
@@ -36,6 +37,7 @@ elput_init(void)
36 ELPUT_EVENT_MODIFIERS_SEND = ecore_event_type_new(); 37 ELPUT_EVENT_MODIFIERS_SEND = ecore_event_type_new();
37 ELPUT_EVENT_DEVICE_CHANGE = ecore_event_type_new(); 38 ELPUT_EVENT_DEVICE_CHANGE = ecore_event_type_new();
38 ELPUT_EVENT_SESSION_ACTIVE = ecore_event_type_new(); 39 ELPUT_EVENT_SESSION_ACTIVE = ecore_event_type_new();
40 ELPUT_EVENT_POINTER_MOTION = ecore_event_type_new();
39 41
40 return _elput_init_count; 42 return _elput_init_count;
41 43
@@ -63,6 +65,7 @@ elput_shutdown(void)
63 ELPUT_EVENT_MODIFIERS_SEND = -1; 65 ELPUT_EVENT_MODIFIERS_SEND = -1;
64 ELPUT_EVENT_DEVICE_CHANGE = -1; 66 ELPUT_EVENT_DEVICE_CHANGE = -1;
65 ELPUT_EVENT_SESSION_ACTIVE = -1; 67 ELPUT_EVENT_SESSION_ACTIVE = -1;
68 ELPUT_EVENT_POINTER_MOTION = -1;
66 69
67 eina_log_domain_unregister(_elput_log_dom); 70 eina_log_domain_unregister(_elput_log_dom);
68 _elput_log_dom = -1; 71 _elput_log_dom = -1;
diff --git a/src/lib/elput/elput_evdev.c b/src/lib/elput/elput_evdev.c
index c7698538c3..9580f49909 100644
--- a/src/lib/elput/elput_evdev.c
+++ b/src/lib/elput/elput_evdev.c
@@ -685,6 +685,23 @@ _pointer_motion_send(Elput_Device *edev)
685 ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL); 685 ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL);
686} 686}
687 687
688static void
689_pointer_motion_relative(struct libinput_event_pointer *event)
690{
691 Elput_Event_Pointer_Motion *ev;
692
693 ev = calloc(1, sizeof(Elput_Event_Pointer_Motion));
694 EINA_SAFETY_ON_NULL_RETURN(ev);
695
696 ev->time_usec = libinput_event_pointer_get_time_usec(event);
697 ev->dx = libinput_event_pointer_get_dx(event);
698 ev->dy = libinput_event_pointer_get_dy(event);
699 ev->dx_unaccel = libinput_event_pointer_get_dx_unaccelerated(event);
700 ev->dy_unaccel = libinput_event_pointer_get_dy_unaccelerated(event);
701
702 ecore_event_add(ELPUT_EVENT_POINTER_MOTION, ev, NULL, NULL);
703}
704
688static Eina_Bool 705static Eina_Bool
689_pointer_motion(struct libinput_device *idev, struct libinput_event_pointer *event) 706_pointer_motion(struct libinput_device *idev, struct libinput_event_pointer *event)
690{ 707{
@@ -702,6 +719,7 @@ _pointer_motion(struct libinput_device *idev, struct libinput_event_pointer *eve
702 ptr->timestamp = libinput_event_pointer_get_time(event); 719 ptr->timestamp = libinput_event_pointer_get_time(event);
703 720
704 _pointer_motion_send(edev); 721 _pointer_motion_send(edev);
722 _pointer_motion_relative(event);
705 723
706 return EINA_TRUE; 724 return EINA_TRUE;
707} 725}
@@ -725,6 +743,7 @@ _pointer_motion_abs(struct libinput_device *idev, struct libinput_event_pointer
725 /* TODO: these needs to run a matrix transform based on output */ 743 /* TODO: these needs to run a matrix transform based on output */
726 744
727 _pointer_motion_send(edev); 745 _pointer_motion_send(edev);
746 _pointer_motion_relative(event);
728 747
729 return EINA_TRUE; 748 return EINA_TRUE;
730} 749}