aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2017-02-02 10:39:10 -0500
committerChris Michael <cp.michael@samsung.com>2017-02-07 09:38:33 -0500
commitff3dc80f7612dd30d1228356d366e312fbded261 (patch)
tree606a55539c16578c98eb7abaf9ad2210d054a235
parentelput: Add API function to set an evas device (diff)
downloadefl-ff3dc80f7612dd30d1228356d366e312fbded261.tar.gz
elput: Add API funtion to set evas device on a given seat
Small API function to allow us to set an Evas_Device on a given Elput_Seat. This is an internal API and should not be used by application developers. This patch also adds an event we can raise when a seat gets added. This is part of a patch set that will allow us to send devices during events like mouse_move, mouse_down, etc. @feature Signed-off-by: Chris Michael <cp.michael@samsung.com>
-rw-r--r--src/lib/elput/Elput.h21
-rw-r--r--src/lib/elput/elput.c3
-rw-r--r--src/lib/elput/elput_input.c22
3 files changed, 46 insertions, 0 deletions
diff --git a/src/lib/elput/Elput.h b/src/lib/elput/Elput.h
index ba362e292b..0799a21d13 100644
--- a/src/lib/elput/Elput.h
+++ b/src/lib/elput/Elput.h
@@ -115,7 +115,13 @@ typedef struct Elput_Event_Pointer_Motion
double dy_unaccel;
} Elput_Event_Pointer_Motion;
+/* structure to represent event for seat being added */
+typedef struct _Elput_Event_Seat_Add
+{
+ Elput_Seat *seat;
+} Elput_Event_Seat_Add;
+EAPI extern int ELPUT_EVENT_SEAT_ADD;
EAPI extern int ELPUT_EVENT_SEAT_CAPS;
EAPI extern int ELPUT_EVENT_SEAT_FRAME;
EAPI extern int ELPUT_EVENT_KEYMAP_SEND;
@@ -463,6 +469,21 @@ EAPI Elput_Device_Capability elput_input_device_capabilities_get(Elput_Device *d
EAPI void elput_input_device_evas_device_set(Elput_Device *device, Eo *evas_device);
/**
+ * Set the Evas_Device to use for events on a given seat
+ *
+ * @param seat
+ * @param evas_device
+ *
+ * @note: Do not ever use this function in applications !!!
+ * This is a special-purpose API function and should not be used by
+ * application developers.
+ *
+ * @ingroup Elput_Input_Group
+ * @since 1.19
+ */
+EAPI void elput_input_seat_evas_device_set(Elput_Seat *seat, Eo *evas_device);
+
+/**
* Set the pointer acceleration profile
*
* @param manager
diff --git a/src/lib/elput/elput.c b/src/lib/elput/elput.c
index 561c98addd..4d0f645716 100644
--- a/src/lib/elput/elput.c
+++ b/src/lib/elput/elput.c
@@ -6,6 +6,7 @@ static int _elput_init_count = 0;
/* external variables */
int _elput_log_dom = -1;
+EAPI int ELPUT_EVENT_SEAT_ADD = -1;
EAPI int ELPUT_EVENT_SEAT_CAPS = -1;
EAPI int ELPUT_EVENT_SEAT_FRAME = -1;
EAPI int ELPUT_EVENT_KEYMAP_SEND = -1;
@@ -31,6 +32,7 @@ elput_init(void)
goto log_err;
}
+ ELPUT_EVENT_SEAT_ADD = ecore_event_type_new();
ELPUT_EVENT_SEAT_CAPS = ecore_event_type_new();
ELPUT_EVENT_SEAT_FRAME = ecore_event_type_new();
ELPUT_EVENT_KEYMAP_SEND = ecore_event_type_new();
@@ -59,6 +61,7 @@ elput_shutdown(void)
if (_elput_init_count < 1) return 0;
if (--_elput_init_count != 0) return _elput_init_count;
+ ELPUT_EVENT_SEAT_ADD = -1;
ELPUT_EVENT_SEAT_CAPS = -1;
ELPUT_EVENT_SEAT_FRAME = -1;
ELPUT_EVENT_KEYMAP_SEND = -1;
diff --git a/src/lib/elput/elput_input.c b/src/lib/elput/elput_input.c
index bb6df31d41..d80e109007 100644
--- a/src/lib/elput/elput_input.c
+++ b/src/lib/elput/elput_input.c
@@ -71,6 +71,7 @@ static Elput_Seat *
_udev_seat_create(Elput_Manager *em, const char *name)
{
Elput_Seat *eseat;
+ Elput_Event_Seat_Add *ev;
eseat = calloc(1, sizeof(Elput_Seat));
if (!eseat) return NULL;
@@ -80,6 +81,13 @@ _udev_seat_create(Elput_Manager *em, const char *name)
eseat->name = eina_stringshare_add(name);
em->input.seats = eina_list_append(em->input.seats, eseat);
+ ev = calloc(1, sizeof(Elput_Event_Seat_Add));
+ if (!ev) goto err;
+
+ ev->seat = eseat;
+ ecore_event_add(ELPUT_EVENT_SEAT_ADD, ev, NULL, NULL);
+
+err:
return eseat;
}
@@ -88,6 +96,9 @@ _udev_seat_destroy(Elput_Seat *eseat)
{
Elput_Device *edev;
+ if (eseat->evas_device)
+ efl_unref(eseat->evas_device);
+
EINA_LIST_FREE(eseat->devices, edev)
_evdev_device_destroy(edev);
@@ -714,3 +725,14 @@ elput_input_device_evas_device_set(Elput_Device *device, Eo *evas_device)
else
device->evas_device = NULL;
}
+
+EAPI void
+elput_input_seat_evas_device_set(Elput_Seat *seat, Eo *evas_device)
+{
+ EINA_SAFETY_ON_NULL_RETURN(seat);
+
+ if (evas_device)
+ seat->evas_device = evas_device;
+ else
+ seat->evas_device = NULL;
+}