aboutsummaryrefslogtreecommitdiffstats
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
parentelm_code: fix bugs in the highlighting of full line comments (diff)
downloadefl-9a8931c3de9690755ee4e943160021d8c3cd7232.tar.gz
elput: add event for relative motion
@feature
-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
Eina_Bool active : 1;
} Elput_Event_Session_Active;
+/** @since 1.19 */
+typedef struct Elput_Event_Pointer_Motion
+{
+ uint64_t time_usec;
+ double dx;
+ double dy;
+ double dx_unaccel;
+ double dy_unaccel;
+} Elput_Event_Pointer_Motion;
+
+
EAPI extern int ELPUT_EVENT_SEAT_CAPS;
EAPI extern int ELPUT_EVENT_SEAT_FRAME;
EAPI extern int ELPUT_EVENT_KEYMAP_SEND;
@@ -105,6 +116,9 @@ EAPI extern int ELPUT_EVENT_MODIFIERS_SEND;
EAPI extern int ELPUT_EVENT_DEVICE_CHANGE;
EAPI extern int ELPUT_EVENT_SESSION_ACTIVE;
+/** @since 1.19 */
+EAPI extern int ELPUT_EVENT_POINTER_MOTION;
+
/**
* @file
* @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;
EAPI int ELPUT_EVENT_MODIFIERS_SEND = -1;
EAPI int ELPUT_EVENT_DEVICE_CHANGE = -1;
EAPI int ELPUT_EVENT_SESSION_ACTIVE = -1;
+EAPI int ELPUT_EVENT_POINTER_MOTION = -1;
EAPI int
elput_init(void)
@@ -36,6 +37,7 @@ elput_init(void)
ELPUT_EVENT_MODIFIERS_SEND = ecore_event_type_new();
ELPUT_EVENT_DEVICE_CHANGE = ecore_event_type_new();
ELPUT_EVENT_SESSION_ACTIVE = ecore_event_type_new();
+ ELPUT_EVENT_POINTER_MOTION = ecore_event_type_new();
return _elput_init_count;
@@ -63,6 +65,7 @@ elput_shutdown(void)
ELPUT_EVENT_MODIFIERS_SEND = -1;
ELPUT_EVENT_DEVICE_CHANGE = -1;
ELPUT_EVENT_SESSION_ACTIVE = -1;
+ ELPUT_EVENT_POINTER_MOTION = -1;
eina_log_domain_unregister(_elput_log_dom);
_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)
ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL);
}
+static void
+_pointer_motion_relative(struct libinput_event_pointer *event)
+{
+ Elput_Event_Pointer_Motion *ev;
+
+ ev = calloc(1, sizeof(Elput_Event_Pointer_Motion));
+ EINA_SAFETY_ON_NULL_RETURN(ev);
+
+ ev->time_usec = libinput_event_pointer_get_time_usec(event);
+ ev->dx = libinput_event_pointer_get_dx(event);
+ ev->dy = libinput_event_pointer_get_dy(event);
+ ev->dx_unaccel = libinput_event_pointer_get_dx_unaccelerated(event);
+ ev->dy_unaccel = libinput_event_pointer_get_dy_unaccelerated(event);
+
+ ecore_event_add(ELPUT_EVENT_POINTER_MOTION, ev, NULL, NULL);
+}
+
static Eina_Bool
_pointer_motion(struct libinput_device *idev, struct libinput_event_pointer *event)
{
@@ -702,6 +719,7 @@ _pointer_motion(struct libinput_device *idev, struct libinput_event_pointer *eve
ptr->timestamp = libinput_event_pointer_get_time(event);
_pointer_motion_send(edev);
+ _pointer_motion_relative(event);
return EINA_TRUE;
}
@@ -725,6 +743,7 @@ _pointer_motion_abs(struct libinput_device *idev, struct libinput_event_pointer
/* TODO: these needs to run a matrix transform based on output */
_pointer_motion_send(edev);
+ _pointer_motion_relative(event);
return EINA_TRUE;
}