From 7d34b1f2b7c612c3171e0b9758b5fc094bc33f63 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Fri, 18 Jun 2021 11:04:45 +0200 Subject: [PATCH] xwayland: add -noTouchPointerEmulation In some scenarios, the Wayland compositor might have more knowledge than the X11 server and may be able to perform pointer emulation for touch events better. Add a command-line switch to allow compositors to turn Xwayland pointer emulation off. Signed-off-by: Simon Ser --- dix/touch.c | 4 +++- hw/xwayland/man/Xwayland.man | 5 +++++ hw/xwayland/xwayland.c | 4 ++++ hw/xwayland/xwayland.pc.in | 1 + include/dix.h | 1 + 5 files changed, 14 insertions(+), 1 deletion(-) diff --git a/dix/touch.c b/dix/touch.c index 1705d85aa..d0d286f80 100644 --- a/dix/touch.c +++ b/dix/touch.c @@ -42,6 +42,8 @@ #define TOUCH_HISTORY_SIZE 100 +Bool touchEmulatePointer = TRUE; + /** * Some documentation about touch points: * The driver submits touch events with its own (unique) touch point ID. @@ -142,7 +144,7 @@ TouchBeginDDXTouch(DeviceIntPtr dev, uint32_t ddx_id) if (!t) return NULL; - emulate_pointer = (t->mode == XIDirectTouch); + emulate_pointer = touchEmulatePointer && (t->mode == XIDirectTouch); /* Look for another active touchpoint with the same DDX ID. DDX * touchpoints must be unique. */ diff --git a/hw/xwayland/man/Xwayland.man b/hw/xwayland/man/Xwayland.man index a3e04c74b..15eb7f5f4 100644 --- a/hw/xwayland/man/Xwayland.man +++ b/hw/xwayland/man/Xwayland.man @@ -66,6 +66,11 @@ deprecated, use \fI\-listenfd\fP instead. Add given fd as a listen socket. This option is used by the \fIWayland\fP server to pass \fIXwayland\fP the socket where X clients connect. .TP 8 +.B \-noTouchPointerEmulation +Disable touch pointer emulation. This allows the Wayland compositor to +implement its own pointer emulation mechanism for X11 clients that don't +support touch input. +.TP 8 .B \-rootless Run \fIXwayland\fP rootless, so that X clients integrate seamlessly with Wayland clients in a Wayland desktop. That requires the Wayland server diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c index 27fbdf28e..801af38aa 100644 --- a/hw/xwayland/xwayland.c +++ b/hw/xwayland/xwayland.c @@ -95,6 +95,7 @@ ddxUseMsg(void) ErrorF("-shm use shared memory for passing buffers\n"); ErrorF("-verbose [n] verbose startup messages\n"); ErrorF("-version show the server version and exit\n"); + ErrorF("-noTouchPointerEmulation disable touch pointer emulation\n"); } static int init_fd = -1; @@ -185,6 +186,9 @@ ddxProcessArgument(int argc, char *argv[], int i) xwl_show_version(); exit(0); } + else if (strcmp(argv[i], "-noTouchPointerEmulation") == 0) { + touchEmulatePointer = FALSE; + } return 0; } diff --git a/hw/xwayland/xwayland.pc.in b/hw/xwayland/xwayland.pc.in index 8816bb6e9..9d727b002 100644 --- a/hw/xwayland/xwayland.pc.in +++ b/hw/xwayland/xwayland.pc.in @@ -11,3 +11,4 @@ have_initfd=true have_listenfd=true have_verbose=true have_terminate_delay=true +have_no_touch_pointer_emulation=true diff --git a/include/dix.h b/include/dix.h index 595b18bdd..22daa510f 100644 --- a/include/dix.h +++ b/include/dix.h @@ -147,6 +147,7 @@ extern _X_EXPORT ClientPtr serverClient; extern _X_EXPORT int currentMaxClients; extern _X_EXPORT char dispatchExceptionAtReset; extern _X_EXPORT int terminateDelay; +extern _X_EXPORT Bool touchEmulatePointer; typedef int HWEventQueueType; typedef HWEventQueueType *HWEventQueuePtr;