}
// TODO : make this variable configurable e.g. e.cfg
+ g_rec_mutex_init(&e_input->libinput_mutex);
e_input->input_base_dir = eina_stringshare_add("/dev/input");
e_input->use_thread = EINA_FALSE;
if (e_input->input_base_dir)
eina_stringshare_del(e_input->input_base_dir);
e_input_device_close(e_input->dev);
+
+ g_rec_mutex_clear(&e_input->libinput_mutex);
free(e_input);
ecore_event_evas_shutdown();
EINA_SAFETY_ON_NULL_RETURN_VAL(seat, NULL);
+ E_Input *e_input = e_input_get();
+
/* try to allocate space for new evdev */
if (!(edev = calloc(1, sizeof(E_Input_Evdev)))) return NULL;
g_rec_mutex_init(&edev->touch.raw_pressed_mutex);
g_rec_mutex_init(&edev->touch.blocked_mutex);
+ if (e_input)
+ g_rec_mutex_lock(&e_input->libinput_mutex);
+
if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_KEYBOARD))
{
edev->caps |= E_INPUT_SEAT_KEYBOARD;
/* configure device */
_device_configure(edev);
+ if (e_input)
+ g_rec_mutex_unlock(&e_input->libinput_mutex);
+
return edev;
}
_e_input_evdev_device_destroy(E_Input_Evdev *edev)
{
Ecore_Device *dev;
+ E_Input *e_input = e_input_get();
EINA_SAFETY_ON_NULL_RETURN(edev);
}
}
if (edev->path) eina_stringshare_del(edev->path);
+ if (e_input) g_rec_mutex_lock(&e_input->libinput_mutex);
if (edev->device) libinput_device_unref(edev->device);
+ if (e_input) g_rec_mutex_unlock(&e_input->libinput_mutex);
if (edev->key_remap_hash) eina_hash_free(edev->key_remap_hash);
if (edev->touch.coords)
{
{
Eina_Bool res = EINA_FALSE;
E_Input_Backend *input;
+ E_Input *e_input = e_input_get();
EINA_SAFETY_ON_NULL_RETURN_VAL(seatname, EINA_FALSE);
EINA_SAFETY_ON_NULL_RETURN_VAL(evdev, EINA_FALSE);
{
input = evdev->seat->input;
if (!input) return EINA_FALSE;
+
+ if (e_input)
+ g_rec_mutex_lock(&e_input->libinput_mutex);
+
if (libinput_dispatch(input->libinput) != 0)
{
ERR("Failed to dispatch libinput events: %m");
+
+ if (e_input)
+ g_rec_mutex_unlock(&e_input->libinput_mutex);
+
return EINA_FALSE;
}
+ if (e_input)
+ g_rec_mutex_unlock(&e_input->libinput_mutex);
+
/* process pending events */
_input_events_process(input);
res = EINA_TRUE;
_input_events_process(E_Input_Backend *input)
{
struct libinput_event *event;
+ E_Input *e_input = e_input_get();
+
+ if (e_input)
+ g_rec_mutex_lock(&e_input->libinput_mutex);
while ((event = libinput_get_event(input->libinput)))
{
_input_event_process(event);
libinput_event_destroy(event);
}
+
+ if (e_input)
+ g_rec_mutex_unlock(&e_input->libinput_mutex);
}
static Eina_Bool
if (!src) return G_SOURCE_REMOVE;
if (!input) return G_SOURCE_REMOVE;
+ E_Input *e_input = e_input_get();
+
GIOCondition cond;
cond = g_source_query_unix_fd(source, src->tag);
if (!input->libinput)
return G_SOURCE_REMOVE;
+ if (e_input)
+ g_rec_mutex_lock(&e_input->libinput_mutex);
+
if (libinput_dispatch(input->libinput) != 0)
ERR("Failed to dispatch libinput events: %m");
+ if (e_input)
+ g_rec_mutex_unlock(&e_input->libinput_mutex);
+
/* process pending events */
_input_events_process(input);