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 <contact@emersion.fr>
This commit is contained in:
Simon Ser 2021-06-18 11:04:45 +02:00 committed by Povilas Kanapickas
parent 7c63c582a1
commit 7d34b1f2b7
5 changed files with 14 additions and 1 deletions

View File

@ -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. */

View File

@ -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

View File

@ -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;
}

View File

@ -11,3 +11,4 @@ have_initfd=true
have_listenfd=true
have_verbose=true
have_terminate_delay=true
have_no_touch_pointer_emulation=true

View File

@ -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;