aboutsummaryrefslogtreecommitdiff
path: root/backend/libinput
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-02-12 09:12:31 +0100
committeremersion <contact@emersion.fr>2018-02-12 09:12:31 +0100
commit5e58d46cc1a90810e3ee76203cee8ca2f14fb462 (patch)
treea5019d87cdc121842ab7cf867fbcac0fde4ccff0 /backend/libinput
parent3497e53516d96ad67b26115e2e06218f68e1114d (diff)
Add wlr_signal_emit_safe
Diffstat (limited to 'backend/libinput')
-rw-r--r--backend/libinput/backend.c5
-rw-r--r--backend/libinput/events.c13
-rw-r--r--backend/libinput/pointer.c9
-rw-r--r--backend/libinput/tablet_pad.c7
-rw-r--r--backend/libinput/tablet_tool.c9
-rw-r--r--backend/libinput/touch.c9
6 files changed, 29 insertions, 23 deletions
diff --git a/backend/libinput/backend.c b/backend/libinput/backend.c
index 86477947..dfbe1d20 100644
--- a/backend/libinput/backend.c
+++ b/backend/libinput/backend.c
@@ -4,6 +4,7 @@
#include <wlr/backend/session.h>
#include <wlr/backend/interface.h>
#include <wlr/util/log.h>
+#include <wlr/util/signal.h>
#include "backend/libinput.h"
static int wlr_libinput_open_restricted(const char *path,
@@ -106,13 +107,13 @@ static void wlr_libinput_backend_destroy(struct wlr_backend *wlr_backend) {
struct wl_list *wlr_devices = backend->wlr_device_lists.items[i];
struct wlr_input_device *wlr_dev, *next;
wl_list_for_each_safe(wlr_dev, next, wlr_devices, link) {
- wl_signal_emit(&backend->backend.events.input_remove, wlr_dev);
+ wlr_signal_emit_safe(&backend->backend.events.input_remove, wlr_dev);
wlr_input_device_destroy(wlr_dev);
}
free(wlr_devices);
}
- wl_signal_emit(&wlr_backend->events.destroy, wlr_backend);
+ wlr_signal_emit_safe(&wlr_backend->events.destroy, wlr_backend);
wl_list_remove(&backend->display_destroy.link);
wl_list_remove(&backend->session_signal.link);
diff --git a/backend/libinput/events.c b/backend/libinput/events.c
index 758a9f25..60088a40 100644
--- a/backend/libinput/events.c
+++ b/backend/libinput/events.c
@@ -5,6 +5,7 @@
#include <wlr/interfaces/wlr_input_device.h>
#include <wlr/util/log.h>
#include <wayland-util.h>
+#include <wlr/util/signal.h>
#include "backend/libinput.h"
struct wlr_input_device *get_appropriate_device(
@@ -88,7 +89,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend,
free(wlr_dev);
goto fail;
}
- wl_signal_emit(&backend->backend.events.input_add, wlr_dev);
+ wlr_signal_emit_safe(&backend->backend.events.input_add, wlr_dev);
}
if (libinput_device_has_capability(libinput_dev, LIBINPUT_DEVICE_CAP_POINTER)) {
struct wlr_input_device *wlr_dev = allocate_device(backend,
@@ -101,7 +102,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend,
free(wlr_dev);
goto fail;
}
- wl_signal_emit(&backend->backend.events.input_add, wlr_dev);
+ wlr_signal_emit_safe(&backend->backend.events.input_add, wlr_dev);
}
if (libinput_device_has_capability(libinput_dev, LIBINPUT_DEVICE_CAP_TOUCH)) {
struct wlr_input_device *wlr_dev = allocate_device(backend,
@@ -114,7 +115,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend,
free(wlr_dev);
goto fail;
}
- wl_signal_emit(&backend->backend.events.input_add, wlr_dev);
+ wlr_signal_emit_safe(&backend->backend.events.input_add, wlr_dev);
}
if (libinput_device_has_capability(libinput_dev, LIBINPUT_DEVICE_CAP_TABLET_TOOL)) {
struct wlr_input_device *wlr_dev = allocate_device(backend,
@@ -127,7 +128,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend,
free(wlr_dev);
goto fail;
}
- wl_signal_emit(&backend->backend.events.input_add, wlr_dev);
+ wlr_signal_emit_safe(&backend->backend.events.input_add, wlr_dev);
}
if (libinput_device_has_capability(libinput_dev, LIBINPUT_DEVICE_CAP_TABLET_PAD)) {
struct wlr_input_device *wlr_dev = allocate_device(backend,
@@ -140,7 +141,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend,
free(wlr_dev);
goto fail;
}
- wl_signal_emit(&backend->backend.events.input_add, wlr_dev);
+ wlr_signal_emit_safe(&backend->backend.events.input_add, wlr_dev);
}
if (libinput_device_has_capability(libinput_dev, LIBINPUT_DEVICE_CAP_GESTURE)) {
// TODO
@@ -178,7 +179,7 @@ static void handle_device_removed(struct wlr_libinput_backend *backend,
}
struct wlr_input_device *dev, *tmp_dev;
wl_list_for_each_safe(dev, tmp_dev, wlr_devices, link) {
- wl_signal_emit(&backend->backend.events.input_remove, dev);
+ wlr_signal_emit_safe(&backend->backend.events.input_remove, dev);
wlr_input_device_destroy(dev);
}
for (size_t i = 0; i < backend->wlr_device_lists.length; i++) {
diff --git a/backend/libinput/pointer.c b/backend/libinput/pointer.c
index 13402ac2..f80f4f84 100644
--- a/backend/libinput/pointer.c
+++ b/backend/libinput/pointer.c
@@ -5,6 +5,7 @@
#include <wlr/types/wlr_input_device.h>
#include <wlr/interfaces/wlr_pointer.h>
#include <wlr/util/log.h>
+#include <wlr/util/signal.h>
#include "backend/libinput.h"
struct wlr_pointer *wlr_libinput_pointer_create(
@@ -35,7 +36,7 @@ void handle_pointer_motion(struct libinput_event *event,
usec_to_msec(libinput_event_pointer_get_time_usec(pevent));
wlr_event.delta_x = libinput_event_pointer_get_dx(pevent);
wlr_event.delta_y = libinput_event_pointer_get_dy(pevent);
- wl_signal_emit(&wlr_dev->pointer->events.motion, &wlr_event);
+ wlr_signal_emit_safe(&wlr_dev->pointer->events.motion, &wlr_event);
}
void handle_pointer_motion_abs(struct libinput_event *event,
@@ -55,7 +56,7 @@ void handle_pointer_motion_abs(struct libinput_event *event,
wlr_event.x_mm = libinput_event_pointer_get_absolute_x(pevent);
wlr_event.y_mm = libinput_event_pointer_get_absolute_y(pevent);
libinput_device_get_size(libinput_dev, &wlr_event.width_mm, &wlr_event.height_mm);
- wl_signal_emit(&wlr_dev->pointer->events.motion_absolute, &wlr_event);
+ wlr_signal_emit_safe(&wlr_dev->pointer->events.motion_absolute, &wlr_event);
}
void handle_pointer_button(struct libinput_event *event,
@@ -81,7 +82,7 @@ void handle_pointer_button(struct libinput_event *event,
wlr_event.state = WLR_BUTTON_RELEASED;
break;
}
- wl_signal_emit(&wlr_dev->pointer->events.button, &wlr_event);
+ wlr_signal_emit_safe(&wlr_dev->pointer->events.button, &wlr_event);
}
void handle_pointer_axis(struct libinput_event *event,
@@ -128,7 +129,7 @@ void handle_pointer_axis(struct libinput_event *event,
}
wlr_event.delta = libinput_event_pointer_get_axis_value(
pevent, axies[i]);
- wl_signal_emit(&wlr_dev->pointer->events.axis, &wlr_event);
+ wlr_signal_emit_safe(&wlr_dev->pointer->events.axis, &wlr_event);
}
}
}
diff --git a/backend/libinput/tablet_pad.c b/backend/libinput/tablet_pad.c
index 7dac3b7c..54315581 100644
--- a/backend/libinput/tablet_pad.c
+++ b/backend/libinput/tablet_pad.c
@@ -5,6 +5,7 @@
#include <wlr/types/wlr_input_device.h>
#include <wlr/interfaces/wlr_tablet_pad.h>
#include <wlr/util/log.h>
+#include <wlr/util/signal.h>
#include "backend/libinput.h"
struct wlr_tablet_pad *wlr_libinput_tablet_pad_create(
@@ -41,7 +42,7 @@ void handle_tablet_pad_button(struct libinput_event *event,
wlr_event.state = WLR_BUTTON_RELEASED;
break;
}
- wl_signal_emit(&wlr_dev->tablet_pad->events.button, &wlr_event);
+ wlr_signal_emit_safe(&wlr_dev->tablet_pad->events.button, &wlr_event);
}
void handle_tablet_pad_ring(struct libinput_event *event,
@@ -67,7 +68,7 @@ void handle_tablet_pad_ring(struct libinput_event *event,
wlr_event.source = WLR_TABLET_PAD_RING_SOURCE_FINGER;
break;
}
- wl_signal_emit(&wlr_dev->tablet_pad->events.ring, &wlr_event);
+ wlr_signal_emit_safe(&wlr_dev->tablet_pad->events.ring, &wlr_event);
}
void handle_tablet_pad_strip(struct libinput_event *event,
@@ -93,5 +94,5 @@ void handle_tablet_pad_strip(struct libinput_event *event,
wlr_event.source = WLR_TABLET_PAD_STRIP_SOURCE_FINGER;
break;
}
- wl_signal_emit(&wlr_dev->tablet_pad->events.strip, &wlr_event);
+ wlr_signal_emit_safe(&wlr_dev->tablet_pad->events.strip, &wlr_event);
}
diff --git a/backend/libinput/tablet_tool.c b/backend/libinput/tablet_tool.c
index 3d5fafc3..2f28540b 100644
--- a/backend/libinput/tablet_tool.c
+++ b/backend/libinput/tablet_tool.c
@@ -5,6 +5,7 @@
#include <wlr/types/wlr_input_device.h>
#include <wlr/interfaces/wlr_tablet_tool.h>
#include <wlr/util/log.h>
+#include <wlr/util/signal.h>
#include "backend/libinput.h"
struct wlr_tablet_tool *wlr_libinput_tablet_tool_create(
@@ -72,7 +73,7 @@ void handle_tablet_tool_axis(struct libinput_event *event,
}
wlr_log(L_DEBUG, "Tablet tool axis event %d @ %f,%f",
wlr_event.updated_axes, wlr_event.x_mm, wlr_event.y_mm);
- wl_signal_emit(&wlr_dev->tablet_tool->events.axis, &wlr_event);
+ wlr_signal_emit_safe(&wlr_dev->tablet_tool->events.axis, &wlr_event);
}
void handle_tablet_tool_proximity(struct libinput_event *event,
@@ -98,7 +99,7 @@ void handle_tablet_tool_proximity(struct libinput_event *event,
handle_tablet_tool_axis(event, libinput_dev);
break;
}
- wl_signal_emit(&wlr_dev->tablet_tool->events.proximity, &wlr_event);
+ wlr_signal_emit_safe(&wlr_dev->tablet_tool->events.proximity, &wlr_event);
}
void handle_tablet_tool_tip(struct libinput_event *event,
@@ -124,7 +125,7 @@ void handle_tablet_tool_tip(struct libinput_event *event,
wlr_event.state = WLR_TABLET_TOOL_TIP_DOWN;
break;
}
- wl_signal_emit(&wlr_dev->tablet_tool->events.tip, &wlr_event);
+ wlr_signal_emit_safe(&wlr_dev->tablet_tool->events.tip, &wlr_event);
}
void handle_tablet_tool_button(struct libinput_event *event,
@@ -151,5 +152,5 @@ void handle_tablet_tool_button(struct libinput_event *event,
wlr_event.state = WLR_BUTTON_PRESSED;
break;
}
- wl_signal_emit(&wlr_dev->tablet_tool->events.button, &wlr_event);
+ wlr_signal_emit_safe(&wlr_dev->tablet_tool->events.button, &wlr_event);
}
diff --git a/backend/libinput/touch.c b/backend/libinput/touch.c
index 0ba6ec86..d496d792 100644
--- a/backend/libinput/touch.c
+++ b/backend/libinput/touch.c
@@ -5,6 +5,7 @@
#include <wlr/types/wlr_input_device.h>
#include <wlr/interfaces/wlr_touch.h>
#include <wlr/util/log.h>
+#include <wlr/util/signal.h>
#include "backend/libinput.h"
struct wlr_touch *wlr_libinput_touch_create(
@@ -37,7 +38,7 @@ void handle_touch_down(struct libinput_event *event,
wlr_event.x_mm = libinput_event_touch_get_x(tevent);
wlr_event.y_mm = libinput_event_touch_get_y(tevent);
libinput_device_get_size(libinput_dev, &wlr_event.width_mm, &wlr_event.height_mm);
- wl_signal_emit(&wlr_dev->touch->events.down, &wlr_event);
+ wlr_signal_emit_safe(&wlr_dev->touch->events.down, &wlr_event);
}
void handle_touch_up(struct libinput_event *event,
@@ -55,7 +56,7 @@ void handle_touch_up(struct libinput_event *event,
wlr_event.time_msec =
usec_to_msec(libinput_event_touch_get_time_usec(tevent));
wlr_event.touch_id = libinput_event_touch_get_slot(tevent);
- wl_signal_emit(&wlr_dev->touch->events.up, &wlr_event);
+ wlr_signal_emit_safe(&wlr_dev->touch->events.up, &wlr_event);
}
void handle_touch_motion(struct libinput_event *event,
@@ -76,7 +77,7 @@ void handle_touch_motion(struct libinput_event *event,
wlr_event.x_mm = libinput_event_touch_get_x(tevent);
wlr_event.y_mm = libinput_event_touch_get_y(tevent);
libinput_device_get_size(libinput_dev, &wlr_event.width_mm, &wlr_event.height_mm);
- wl_signal_emit(&wlr_dev->touch->events.motion, &wlr_event);
+ wlr_signal_emit_safe(&wlr_dev->touch->events.motion, &wlr_event);
}
void handle_touch_cancel(struct libinput_event *event,
@@ -94,5 +95,5 @@ void handle_touch_cancel(struct libinput_event *event,
wlr_event.time_msec =
usec_to_msec(libinput_event_touch_get_time_usec(tevent));
wlr_event.touch_id = libinput_event_touch_get_slot(tevent);
- wl_signal_emit(&wlr_dev->touch->events.cancel, &wlr_event);
+ wlr_signal_emit_safe(&wlr_dev->touch->events.cancel, &wlr_event);
}