x11: Don't try to use XInput2 multitouch if not supported. Fixes #5889.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
diff --git a/src/video/x11/SDL_x11touch.c b/src/video/x11/SDL_x11touch.c
index 958bee9..c608cf2 100644
--- a/src/video/x11/SDL_x11touch.c
+++ b/src/video/x11/SDL_x11touch.c
@@ -31,9 +31,7 @@
void
X11_InitTouch(_THIS)
{
- if (X11_Xinput2IsMultitouchSupported()) {
- X11_InitXinput2Multitouch(_this);
- }
+ X11_InitXinput2Multitouch(_this);
}
void
diff --git a/src/video/x11/SDL_x11xinput2.c b/src/video/x11/SDL_x11xinput2.c
index abfbdf0..21d8bd6 100644
--- a/src/video/x11/SDL_x11xinput2.c
+++ b/src/video/x11/SDL_x11xinput2.c
@@ -265,6 +265,11 @@ X11_InitXinput2Multitouch(_THIS)
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
XIDeviceInfo *info;
int ndevices,i,j;
+
+ if (!X11_Xinput2IsMultitouchSupported()) {
+ return;
+ }
+
info = X11_XIQueryDevice(data->display, XIAllDevices, &ndevices);
for (i = 0; i < ndevices; i++) {
@@ -354,6 +359,10 @@ X11_Xinput2GrabTouch(_THIS, SDL_Window *window)
XIGrabModifiers mods;
XIEventMask eventmask;
+ if (!X11_Xinput2IsMultitouchSupported()) {
+ return;
+ }
+
mods.modifiers = XIAnyModifier;
mods.status = 0;
@@ -379,6 +388,10 @@ X11_Xinput2UngrabTouch(_THIS, SDL_Window *window)
XIGrabModifiers mods;
+ if (!X11_Xinput2IsMultitouchSupported()) {
+ return;
+ }
+
mods.modifiers = XIAnyModifier;
mods.status = 0;