summaryrefslogtreecommitdiffstats
path: root/src/wth-receiver-seat.c
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2020-10-22 12:27:59 +0300
committerMarius Vlad <marius.vlad@collabora.com>2020-12-01 13:07:57 +0200
commit2373db4b31a646d4936f6700ecc2af857302444b (patch)
tree5d7a890f131335032100fac8731bc77124c363eb /src/wth-receiver-seat.c
parent694ec412b5ae13b84229e5c65f2e3dce2babee34 (diff)
wth-receiver-seat: Display a message when we don't have a valid seat
This way we inform the users that the receiver won't relaying back events. This could happen if the user starts the transmitter side after starts the receiver. For now this just informs the users, requiring a follow-up fix, as to determine why we do not have a valid seat and input devices, if the order in which the transmitter and receiver is started is changed. Bug-AGL: SPEC-3601, SPEC-3605 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I0c398358f22697323bd90cdaedcbfac03ca5c8dc
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);
}