From 533cc6ca046a9e59503bd0763ab28f66284f7dc7 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Fri, 10 Apr 2020 16:34:06 +0200 Subject: [PATCH] xwayland: Fix crashes when there is no pointer When running with a weston session without a pointer device (thus with the wl_seat not having a pointer) xwayland pointer warping and pointer confining should simply be ignored to avoid crashes. Signed-off-by: Sjoerd Simons (cherry picked from commit d35f68336b0a462dc660797d1779581f348af04e) --- hw/xwayland/xwayland-input.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c index d069f72f6..c0916f87d 100644 --- a/hw/xwayland/xwayland-input.c +++ b/hw/xwayland/xwayland-input.c @@ -2782,6 +2782,9 @@ xwl_seat_can_emulate_pointer_warp(struct xwl_seat *xwl_seat) { struct xwl_screen *xwl_screen = xwl_seat->xwl_screen; + if (!xwl_seat->pointer) + return FALSE; + if (!xwl_screen->relative_pointer_manager) return FALSE; @@ -2874,6 +2877,9 @@ xwl_seat_confine_pointer(struct xwl_seat *xwl_seat, if (!pointer_constraints) return; + if (!xwl_seat->wl_pointer) + return; + if (xwl_seat->cursor_confinement_window == xwl_window && xwl_seat->confined_pointer) return;