summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-11-09 11:38:35 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-11-09 11:42:29 +0900
commit1e83d963d905447588a91e1beafd382631d447bd (patch)
treeda1ca0d8bb121927e261a0c8f167723de16084c8 /src
parent6c444bebcbb8858364c88f9aba4b217b23b28a07 (diff)
elput - ref device that is in the event queue
Diffstat (limited to 'src')
-rw-r--r--src/lib/elput/elput_evdev.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/lib/elput/elput_evdev.c b/src/lib/elput/elput_evdev.c
index afa42df68c..b41fbe508b 100644
--- a/src/lib/elput/elput_evdev.c
+++ b/src/lib/elput/elput_evdev.c
@@ -1596,6 +1596,15 @@ _tablet_tool_tip(struct libinput_device *idev, struct libinput_event_tablet_tool
1596} 1596}
1597 1597
1598static void 1598static void
1599_switch_event_free(void *data EINA_UNUSED, void *event)
1600{
1601 Elput_Event_Switch *ev = event;
1602
1603 _evdev_device_destroy(ev->device);
1604 free(ev);
1605}
1606
1607static void
1599_switch_toggle(struct libinput_device *idev, struct libinput_event_switch *event) 1608_switch_toggle(struct libinput_device *idev, struct libinput_event_switch *event)
1600{ 1609{
1601 Elput_Event_Switch *ev; 1610 Elput_Event_Switch *ev;
@@ -1603,10 +1612,11 @@ _switch_toggle(struct libinput_device *idev, struct libinput_event_switch *event
1603 ev = calloc(1, sizeof(Elput_Event_Switch)); 1612 ev = calloc(1, sizeof(Elput_Event_Switch));
1604 if (!ev) return; 1613 if (!ev) return;
1605 ev->device = libinput_device_get_user_data(idev); 1614 ev->device = libinput_device_get_user_data(idev);
1615 ev->device->refs++;
1606 ev->time_usec = libinput_event_switch_get_time_usec(event); 1616 ev->time_usec = libinput_event_switch_get_time_usec(event);
1607 ev->type = (Elput_Switch_Type)libinput_event_switch_get_switch(event); 1617 ev->type = (Elput_Switch_Type)libinput_event_switch_get_switch(event);
1608 ev->state = (Elput_Switch_State)libinput_event_switch_get_switch_state(event); 1618 ev->state = (Elput_Switch_State)libinput_event_switch_get_switch_state(event);
1609 ecore_event_add(ELPUT_EVENT_SWITCH, ev, NULL, NULL); 1619 ecore_event_add(ELPUT_EVENT_SWITCH, ev, _switch_event_free, NULL);
1610} 1620}
1611 1621
1612int 1622int