Merge the device added/removed events into a single device notify event

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2014-01-15 17:10:30 +10:00 committed by Jonas Ådahl
parent b569272a7a
commit f98d427713
2 changed files with 6 additions and 12 deletions

View file

@ -53,12 +53,7 @@ struct libinput_event {
struct libinput_device *device;
};
struct libinput_event_added_device {
struct libinput_event base;
struct libinput_device *device;
};
struct libinput_event_removed_device {
struct libinput_event_device_notify {
struct libinput_event base;
struct libinput_device *device;
};
@ -598,13 +593,13 @@ post_device_event(struct libinput_device *device,
void
notify_added_device(struct libinput_device *device)
{
struct libinput_event_added_device *added_device_event;
struct libinput_event_device_notify *added_device_event;
added_device_event = malloc(sizeof *added_device_event);
if (!added_device_event)
return;
*added_device_event = (struct libinput_event_added_device) {
*added_device_event = (struct libinput_event_device_notify) {
.device = device,
};
@ -616,13 +611,13 @@ notify_added_device(struct libinput_device *device)
void
notify_removed_device(struct libinput_device *device)
{
struct libinput_event_removed_device *removed_device_event;
struct libinput_event_device_notify *removed_device_event;
removed_device_event = malloc(sizeof *removed_device_event);
if (!removed_device_event)
return;
*removed_device_event = (struct libinput_event_removed_device) {
*removed_device_event = (struct libinput_event_device_notify) {
.device = device,
};

View file

@ -142,8 +142,7 @@ struct libinput_device;
struct libinput_seat;
struct libinput_event;
struct libinput_event_added_device;
struct libinput_event_removed_device;
struct libinput_event_device_notify;
struct libinput_event_keyboard_key;
struct libinput_event_pointer_motion;
struct libinput_event_pointer_motion_absolute;