elput - ref device that is in the event queue

This commit is contained in:
Carsten Haitzler 2017-11-09 11:38:35 +09:00
parent 6c444bebcb
commit 1e83d963d9
1 changed files with 11 additions and 1 deletions

View File

@ -1595,6 +1595,15 @@ _tablet_tool_tip(struct libinput_device *idev, struct libinput_event_tablet_tool
_pointer_button_send(dev, press[state]);
}
static void
_switch_event_free(void *data EINA_UNUSED, void *event)
{
Elput_Event_Switch *ev = event;
_evdev_device_destroy(ev->device);
free(ev);
}
static void
_switch_toggle(struct libinput_device *idev, struct libinput_event_switch *event)
{
@ -1603,10 +1612,11 @@ _switch_toggle(struct libinput_device *idev, struct libinput_event_switch *event
ev = calloc(1, sizeof(Elput_Event_Switch));
if (!ev) return;
ev->device = libinput_device_get_user_data(idev);
ev->device->refs++;
ev->time_usec = libinput_event_switch_get_time_usec(event);
ev->type = (Elput_Switch_Type)libinput_event_switch_get_switch(event);
ev->state = (Elput_Switch_State)libinput_event_switch_get_switch_state(event);
ecore_event_add(ELPUT_EVENT_SWITCH, ev, NULL, NULL);
ecore_event_add(ELPUT_EVENT_SWITCH, ev, _switch_event_free, NULL);
}
int