diff options
Diffstat (limited to 'backend/libinput')
-rw-r--r-- | backend/libinput/backend.c | 8 | ||||
-rw-r--r-- | backend/libinput/events.c | 16 | ||||
-rw-r--r-- | backend/libinput/keyboard.c | 6 | ||||
-rw-r--r-- | backend/libinput/pointer.c | 13 | ||||
-rw-r--r-- | backend/libinput/tablet_pad.c | 11 | ||||
-rw-r--r-- | backend/libinput/tablet_tool.c | 13 | ||||
-rw-r--r-- | backend/libinput/touch.c | 13 |
7 files changed, 42 insertions, 38 deletions
diff --git a/backend/libinput/backend.c b/backend/libinput/backend.c index 86477947..71fe0d93 100644 --- a/backend/libinput/backend.c +++ b/backend/libinput/backend.c @@ -1,10 +1,11 @@ -#include <stdlib.h> #include <assert.h> #include <libinput.h> -#include <wlr/backend/session.h> +#include <stdlib.h> #include <wlr/backend/interface.h> +#include <wlr/backend/session.h> #include <wlr/util/log.h> #include "backend/libinput.h" +#include "util/signal.h" static int wlr_libinput_open_restricted(const char *path, int flags, void *_backend) { @@ -106,13 +107,12 @@ 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_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..603eed07 100644 --- a/backend/libinput/events.c +++ b/backend/libinput/events.c @@ -1,11 +1,12 @@ -#include <stdlib.h> #include <assert.h> #include <libinput.h> +#include <stdlib.h> +#include <wayland-util.h> #include <wlr/backend/session.h> #include <wlr/interfaces/wlr_input_device.h> #include <wlr/util/log.h> -#include <wayland-util.h> #include "backend/libinput.h" +#include "util/signal.h" struct wlr_input_device *get_appropriate_device( enum wlr_input_device_type desired_type, @@ -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.new_input, 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.new_input, 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.new_input, 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.new_input, 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.new_input, wlr_dev); } if (libinput_device_has_capability(libinput_dev, LIBINPUT_DEVICE_CAP_GESTURE)) { // TODO @@ -178,7 +179,6 @@ 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_input_device_destroy(dev); } for (size_t i = 0; i < backend->wlr_device_lists.length; i++) { diff --git a/backend/libinput/keyboard.c b/backend/libinput/keyboard.c index 065d8ead..b44bc892 100644 --- a/backend/libinput/keyboard.c +++ b/backend/libinput/keyboard.c @@ -1,9 +1,9 @@ -#include <stdlib.h> #include <assert.h> #include <libinput.h> +#include <stdlib.h> #include <wlr/backend/session.h> -#include <wlr/types/wlr_input_device.h> #include <wlr/interfaces/wlr_keyboard.h> +#include <wlr/types/wlr_input_device.h> #include <wlr/util/log.h> #include "backend/libinput.h" @@ -57,7 +57,7 @@ void handle_keyboard_key(struct libinput_event *event, wlr_event.time_msec = usec_to_msec(libinput_event_keyboard_get_time_usec(kbevent)); wlr_event.keycode = libinput_event_keyboard_get_key(kbevent); - enum libinput_key_state state = + enum libinput_key_state state = libinput_event_keyboard_get_key_state(kbevent); switch (state) { case LIBINPUT_KEY_STATE_RELEASED: diff --git a/backend/libinput/pointer.c b/backend/libinput/pointer.c index 13402ac2..8a31d312 100644 --- a/backend/libinput/pointer.c +++ b/backend/libinput/pointer.c @@ -1,11 +1,12 @@ -#include <stdlib.h> #include <assert.h> #include <libinput.h> +#include <stdlib.h> #include <wlr/backend/session.h> -#include <wlr/types/wlr_input_device.h> #include <wlr/interfaces/wlr_pointer.h> +#include <wlr/types/wlr_input_device.h> #include <wlr/util/log.h> #include "backend/libinput.h" +#include "util/signal.h" struct wlr_pointer *wlr_libinput_pointer_create( struct libinput_device *libinput_dev) { @@ -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..70e4c677 100644 --- a/backend/libinput/tablet_pad.c +++ b/backend/libinput/tablet_pad.c @@ -1,11 +1,12 @@ -#include <stdlib.h> #include <assert.h> #include <libinput.h> +#include <stdlib.h> #include <wlr/backend/session.h> -#include <wlr/types/wlr_input_device.h> #include <wlr/interfaces/wlr_tablet_pad.h> +#include <wlr/types/wlr_input_device.h> #include <wlr/util/log.h> #include "backend/libinput.h" +#include "util/signal.h" struct wlr_tablet_pad *wlr_libinput_tablet_pad_create( struct libinput_device *libinput_dev) { @@ -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..4e60367f 100644 --- a/backend/libinput/tablet_tool.c +++ b/backend/libinput/tablet_tool.c @@ -1,11 +1,12 @@ -#include <stdlib.h> #include <assert.h> #include <libinput.h> +#include <stdlib.h> #include <wlr/backend/session.h> -#include <wlr/types/wlr_input_device.h> #include <wlr/interfaces/wlr_tablet_tool.h> +#include <wlr/types/wlr_input_device.h> #include <wlr/util/log.h> #include "backend/libinput.h" +#include "util/signal.h" struct wlr_tablet_tool *wlr_libinput_tablet_tool_create( struct libinput_device *libinput_dev) { @@ -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..2b87f9cd 100644 --- a/backend/libinput/touch.c +++ b/backend/libinput/touch.c @@ -1,11 +1,12 @@ -#include <stdlib.h> #include <assert.h> #include <libinput.h> +#include <stdlib.h> #include <wlr/backend/session.h> -#include <wlr/types/wlr_input_device.h> #include <wlr/interfaces/wlr_touch.h> +#include <wlr/types/wlr_input_device.h> #include <wlr/util/log.h> #include "backend/libinput.h" +#include "util/signal.h" struct wlr_touch *wlr_libinput_touch_create( struct libinput_device *libinput_dev) { @@ -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); } |