input: use CONNECT_SIGNAL macro

This commit is contained in:
Jens Peters 2024-11-10 19:05:55 +01:00 committed by Consolatis
parent a88c721979
commit 37b4e17788

View file

@ -1,10 +1,11 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
#include <wlr/types/wlr_pointer_gestures_v1.h> #include <wlr/types/wlr_pointer_gestures_v1.h>
#include "common/macros.h"
#include "input/gestures.h" #include "input/gestures.h"
#include "labwc.h" #include "labwc.h"
static void static void
handle_pointer_pinch_begin(struct wl_listener *listener, void *data) handle_pinch_begin(struct wl_listener *listener, void *data)
{ {
struct seat *seat = wl_container_of(listener, seat, pinch_begin); struct seat *seat = wl_container_of(listener, seat, pinch_begin);
struct wlr_pointer_pinch_begin_event *event = data; struct wlr_pointer_pinch_begin_event *event = data;
@ -13,7 +14,7 @@ handle_pointer_pinch_begin(struct wl_listener *listener, void *data)
} }
static void static void
handle_pointer_pinch_update(struct wl_listener *listener, void *data) handle_pinch_update(struct wl_listener *listener, void *data)
{ {
struct seat *seat = wl_container_of(listener, seat, pinch_update); struct seat *seat = wl_container_of(listener, seat, pinch_update);
struct wlr_pointer_pinch_update_event *event = data; struct wlr_pointer_pinch_update_event *event = data;
@ -23,7 +24,7 @@ handle_pointer_pinch_update(struct wl_listener *listener, void *data)
} }
static void static void
handle_pointer_pinch_end(struct wl_listener *listener, void *data) handle_pinch_end(struct wl_listener *listener, void *data)
{ {
struct seat *seat = wl_container_of(listener, seat, pinch_end); struct seat *seat = wl_container_of(listener, seat, pinch_end);
struct wlr_pointer_pinch_end_event *event = data; struct wlr_pointer_pinch_end_event *event = data;
@ -32,7 +33,7 @@ handle_pointer_pinch_end(struct wl_listener *listener, void *data)
} }
static void static void
handle_pointer_swipe_begin(struct wl_listener *listener, void *data) handle_swipe_begin(struct wl_listener *listener, void *data)
{ {
struct seat *seat = wl_container_of(listener, seat, swipe_begin); struct seat *seat = wl_container_of(listener, seat, swipe_begin);
struct wlr_pointer_swipe_begin_event *event = data; struct wlr_pointer_swipe_begin_event *event = data;
@ -41,7 +42,7 @@ handle_pointer_swipe_begin(struct wl_listener *listener, void *data)
} }
static void static void
handle_pointer_swipe_update(struct wl_listener *listener, void *data) handle_swipe_update(struct wl_listener *listener, void *data)
{ {
struct seat *seat = wl_container_of(listener, seat, swipe_update); struct seat *seat = wl_container_of(listener, seat, swipe_update);
struct wlr_pointer_swipe_update_event *event = data; struct wlr_pointer_swipe_update_event *event = data;
@ -50,7 +51,7 @@ handle_pointer_swipe_update(struct wl_listener *listener, void *data)
} }
static void static void
handle_pointer_swipe_end(struct wl_listener *listener, void *data) handle_swipe_end(struct wl_listener *listener, void *data)
{ {
struct seat *seat = wl_container_of(listener, seat, swipe_end); struct seat *seat = wl_container_of(listener, seat, swipe_end);
struct wlr_pointer_swipe_end_event *event = data; struct wlr_pointer_swipe_end_event *event = data;
@ -63,23 +64,12 @@ gestures_init(struct seat *seat)
{ {
seat->pointer_gestures = wlr_pointer_gestures_v1_create(seat->server->wl_display); seat->pointer_gestures = wlr_pointer_gestures_v1_create(seat->server->wl_display);
seat->pinch_begin.notify = handle_pointer_pinch_begin; CONNECT_SIGNAL(seat->cursor, seat, pinch_begin);
wl_signal_add(&seat->cursor->events.pinch_begin, &seat->pinch_begin); CONNECT_SIGNAL(seat->cursor, seat, pinch_update);
CONNECT_SIGNAL(seat->cursor, seat, pinch_end);
seat->pinch_update.notify = handle_pointer_pinch_update; CONNECT_SIGNAL(seat->cursor, seat, swipe_begin);
wl_signal_add(&seat->cursor->events.pinch_update, &seat->pinch_update); CONNECT_SIGNAL(seat->cursor, seat, swipe_update);
CONNECT_SIGNAL(seat->cursor, seat, swipe_end);
seat->pinch_end.notify = handle_pointer_pinch_end;
wl_signal_add(&seat->cursor->events.pinch_end, &seat->pinch_end);
seat->swipe_begin.notify = handle_pointer_swipe_begin;
wl_signal_add(&seat->cursor->events.swipe_begin, &seat->swipe_begin);
seat->swipe_update.notify = handle_pointer_swipe_update;
wl_signal_add(&seat->cursor->events.swipe_update, &seat->swipe_update);
seat->swipe_end.notify = handle_pointer_swipe_end;
wl_signal_add(&seat->cursor->events.swipe_end, &seat->swipe_end);
} }
void void