aboutsummaryrefslogtreecommitdiffstats
path: root/src/wth-receiver-seat.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/wth-receiver-seat.c')
-rw-r--r--src/wth-receiver-seat.c60
1 files changed, 55 insertions, 5 deletions
diff --git a/src/wth-receiver-seat.c b/src/wth-receiver-seat.c
index 3457748..f4b4886 100644
--- a/src/wth-receiver-seat.c
+++ b/src/wth-receiver-seat.c
@@ -39,6 +39,11 @@ waltham_touch_down(struct window *window, uint32_t serial,
struct seat *seat = window->receiver_seat;
struct touch *touch = seat->touch;
+ if (!touch) {
+ fprintf(stderr, "We do not have touch device!\n");
+ return;
+ }
+
if (touch->obj) {
fprintf(stdout, "waltham_touch_down() sending touch_down\n");
wthp_touch_send_down(touch->obj, serial, time, surface->obj, id, x_w, y_w);
@@ -53,6 +58,11 @@ waltham_touch_up(struct window *window, uint32_t serial,
struct seat *seat = window->receiver_seat;
struct touch *touch = seat->touch;
+ if (!touch) {
+ fprintf(stderr, "We do not have touch device!\n");
+ return;
+ }
+
if (touch->obj) {
fprintf(stdout, "waltham_touch_motion() sending touch_up\n");
wthp_touch_send_up(touch->obj, serial, time, id);
@@ -67,6 +77,11 @@ waltham_touch_motion(struct window *window, uint32_t time,
struct seat *seat = window->receiver_seat;
struct touch *touch = seat->touch;
+ if (!touch) {
+ fprintf(stderr, "We do not have touch device!\n");
+ return;
+ }
+
if (touch->obj) {
fprintf(stdout, "waltham_touch_motion() sending touch_motion\n");
wthp_touch_send_motion(touch->obj, time, id, x_w, y_w);
@@ -79,6 +94,11 @@ waltham_touch_frame(struct window *window)
struct seat *seat = window->receiver_seat;
struct touch *touch = seat->touch;
+ if (!touch) {
+ fprintf(stderr, "We do not have touch device!\n");
+ return;
+ }
+
if (touch->obj) {
fprintf(stdout, "waltham_touch_frame() sending frame\n");
wthp_touch_send_frame(touch->obj);
@@ -91,6 +111,11 @@ waltham_touch_cancel(struct window *window)
struct seat *seat = window->receiver_seat;
struct touch *touch = seat->touch;
+ if (!touch) {
+ fprintf(stderr, "We do not have touch device!\n");
+ return;
+ }
+
if (touch->obj) {
fprintf(stdout, "waltham_touch_cancel() sending cancel\n");
wthp_touch_send_cancel(touch->obj);
@@ -109,7 +134,12 @@ waltham_pointer_enter(struct window *window, uint32_t serial,
struct seat *seat = window->receiver_seat;
struct pointer *pointer = seat->pointer;
- if (pointer->obj) {
+ if (!pointer) {
+ fprintf(stderr, "We do not have pointer device!\n");
+ return;
+ }
+
+ if (pointer && pointer->obj) {
fprintf(stdout, "waltham_pointer_enter() sending enter\n");
wthp_pointer_send_enter(pointer->obj, serial, surface->obj, sx, sy);
}
@@ -122,7 +152,12 @@ waltham_pointer_leave(struct window *window, uint32_t serial)
struct seat *seat = window->receiver_seat;
struct pointer *pointer = seat->pointer;
- if (pointer->obj) {
+ if (!pointer) {
+ fprintf(stderr, "We do not have pointer device!\n");
+ return;
+ }
+
+ if (pointer && pointer->obj) {
fprintf(stdout, "waltham_pointer_leave() sending leave\n");
wthp_pointer_send_leave(pointer->obj, serial, surface->obj);
}
@@ -135,7 +170,12 @@ waltham_pointer_motion(struct window *window, uint32_t time,
struct seat *seat = window->receiver_seat;
struct pointer *pointer = seat->pointer;
- if (pointer->obj) {
+ if (!pointer) {
+ fprintf(stderr, "We do not have pointer device!\n");
+ return;
+ }
+
+ if (pointer && pointer->obj) {
fprintf(stdout, "waltham_pointer_motion() sending motion\n");
wthp_pointer_send_motion(pointer->obj, time, sx, sy);
}
@@ -149,7 +189,12 @@ waltham_pointer_button(struct window *window, uint32_t serial,
struct seat *seat = window->receiver_seat;
struct pointer *pointer = seat->pointer;
- if (pointer->obj) {
+ if (!pointer) {
+ fprintf(stderr, "We do not have pointer device!\n");
+ return;
+ }
+
+ if (pointer && pointer->obj) {
fprintf(stdout, "waltham_pointer_button() sending button\n");
wthp_pointer_send_button(pointer->obj, serial, time, button, state);
}
@@ -162,7 +207,12 @@ waltham_pointer_axis(struct window *window, uint32_t time,
struct seat *seat = window->receiver_seat;
struct pointer *pointer = seat->pointer;
- if (pointer->obj) {
+ if (!pointer) {
+ fprintf(stderr, "We do not have pointer device!\n");
+ return;
+ }
+
+ if (pointer && pointer->obj) {
fprintf(stdout, "waltham_pointer_axis() sending pointer_axis\n");
wthp_pointer_send_axis(pointer->obj, time, axis, value);
}