aboutsummaryrefslogtreecommitdiff
path: root/backend/libinput/tablet_pad.c
diff options
context:
space:
mode:
Diffstat (limited to 'backend/libinput/tablet_pad.c')
-rw-r--r--backend/libinput/tablet_pad.c49
1 files changed, 23 insertions, 26 deletions
diff --git a/backend/libinput/tablet_pad.c b/backend/libinput/tablet_pad.c
index 9bf45ba6..64aecb52 100644
--- a/backend/libinput/tablet_pad.c
+++ b/backend/libinput/tablet_pad.c
@@ -23,20 +23,19 @@ void handle_tablet_pad_button(struct libinput_event *event,
}
struct libinput_event_tablet_pad *pevent =
libinput_event_get_tablet_pad_event(event);
- struct wlr_event_tablet_pad_button *wlr_event =
- calloc(1, sizeof(struct wlr_event_tablet_pad_button));
- wlr_event->time_sec = libinput_event_tablet_pad_get_time(pevent);
- wlr_event->time_usec = libinput_event_tablet_pad_get_time_usec(pevent);
- wlr_event->button = libinput_event_tablet_pad_get_button_number(pevent);
+ struct wlr_event_tablet_pad_button wlr_event = { 0 };
+ wlr_event.time_sec = libinput_event_tablet_pad_get_time(pevent);
+ wlr_event.time_usec = libinput_event_tablet_pad_get_time_usec(pevent);
+ wlr_event.button = libinput_event_tablet_pad_get_button_number(pevent);
switch (libinput_event_tablet_pad_get_button_state(pevent)) {
case LIBINPUT_BUTTON_STATE_PRESSED:
- wlr_event->state = WLR_BUTTON_PRESSED;
+ wlr_event.state = WLR_BUTTON_PRESSED;
break;
case LIBINPUT_BUTTON_STATE_RELEASED:
- wlr_event->state = WLR_BUTTON_RELEASED;
+ wlr_event.state = WLR_BUTTON_RELEASED;
break;
}
- wl_signal_emit(&dev->tablet_pad->events.button, wlr_event);
+ wl_signal_emit(&dev->tablet_pad->events.button, &wlr_event);
}
void handle_tablet_pad_ring(struct libinput_event *event,
@@ -49,21 +48,20 @@ void handle_tablet_pad_ring(struct libinput_event *event,
}
struct libinput_event_tablet_pad *pevent =
libinput_event_get_tablet_pad_event(event);
- struct wlr_event_tablet_pad_ring *wlr_event =
- calloc(1, sizeof(struct wlr_event_tablet_pad_ring));
- wlr_event->time_sec = libinput_event_tablet_pad_get_time(pevent);
- wlr_event->time_usec = libinput_event_tablet_pad_get_time_usec(pevent);
- wlr_event->ring = libinput_event_tablet_pad_get_ring_number(pevent);
- wlr_event->position = libinput_event_tablet_pad_get_ring_position(pevent);
+ struct wlr_event_tablet_pad_ring wlr_event = { 0 };
+ wlr_event.time_sec = libinput_event_tablet_pad_get_time(pevent);
+ wlr_event.time_usec = libinput_event_tablet_pad_get_time_usec(pevent);
+ wlr_event.ring = libinput_event_tablet_pad_get_ring_number(pevent);
+ wlr_event.position = libinput_event_tablet_pad_get_ring_position(pevent);
switch (libinput_event_tablet_pad_get_ring_source(pevent)) {
case LIBINPUT_TABLET_PAD_RING_SOURCE_UNKNOWN:
- wlr_event->source = WLR_TABLET_PAD_RING_SOURCE_UNKNOWN;
+ wlr_event.source = WLR_TABLET_PAD_RING_SOURCE_UNKNOWN;
break;
case LIBINPUT_TABLET_PAD_RING_SOURCE_FINGER:
- wlr_event->source = WLR_TABLET_PAD_RING_SOURCE_FINGER;
+ wlr_event.source = WLR_TABLET_PAD_RING_SOURCE_FINGER;
break;
}
- wl_signal_emit(&dev->tablet_pad->events.ring, wlr_event);
+ wl_signal_emit(&dev->tablet_pad->events.ring, &wlr_event);
}
void handle_tablet_pad_strip(struct libinput_event *event,
@@ -76,19 +74,18 @@ void handle_tablet_pad_strip(struct libinput_event *event,
}
struct libinput_event_tablet_pad *pevent =
libinput_event_get_tablet_pad_event(event);
- struct wlr_event_tablet_pad_strip *wlr_event =
- calloc(1, sizeof(struct wlr_event_tablet_pad_strip));
- wlr_event->time_sec = libinput_event_tablet_pad_get_time(pevent);
- wlr_event->time_usec = libinput_event_tablet_pad_get_time_usec(pevent);
- wlr_event->strip = libinput_event_tablet_pad_get_strip_number(pevent);
- wlr_event->position = libinput_event_tablet_pad_get_strip_position(pevent);
+ struct wlr_event_tablet_pad_strip wlr_event = { 0 };
+ wlr_event.time_sec = libinput_event_tablet_pad_get_time(pevent);
+ wlr_event.time_usec = libinput_event_tablet_pad_get_time_usec(pevent);
+ wlr_event.strip = libinput_event_tablet_pad_get_strip_number(pevent);
+ wlr_event.position = libinput_event_tablet_pad_get_strip_position(pevent);
switch (libinput_event_tablet_pad_get_strip_source(pevent)) {
case LIBINPUT_TABLET_PAD_STRIP_SOURCE_UNKNOWN:
- wlr_event->source = WLR_TABLET_PAD_STRIP_SOURCE_UNKNOWN;
+ wlr_event.source = WLR_TABLET_PAD_STRIP_SOURCE_UNKNOWN;
break;
case LIBINPUT_TABLET_PAD_STRIP_SOURCE_FINGER:
- wlr_event->source = WLR_TABLET_PAD_STRIP_SOURCE_FINGER;
+ wlr_event.source = WLR_TABLET_PAD_STRIP_SOURCE_FINGER;
break;
}
- wl_signal_emit(&dev->tablet_pad->events.strip, wlr_event);
+ wl_signal_emit(&dev->tablet_pad->events.strip, &wlr_event);
}