Skip to content

Commit

Permalink
x11: Don't try to use XInput2 multitouch if not supported.
Browse files Browse the repository at this point in the history
Fixes #5889.
  • Loading branch information
icculus committed Jul 4, 2022
1 parent b085c18 commit fdb86b8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
4 changes: 1 addition & 3 deletions src/video/x11/SDL_x11touch.c
Expand Up @@ -31,9 +31,7 @@
void
X11_InitTouch(_THIS)
{
if (X11_Xinput2IsMultitouchSupported()) {
X11_InitXinput2Multitouch(_this);
}
X11_InitXinput2Multitouch(_this);
}

void
Expand Down
13 changes: 13 additions & 0 deletions src/video/x11/SDL_x11xinput2.c
Expand Up @@ -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++) {
Expand Down Expand Up @@ -354,6 +359,10 @@ X11_Xinput2GrabTouch(_THIS, SDL_Window *window)
XIGrabModifiers mods;
XIEventMask eventmask;

if (!X11_Xinput2IsMultitouchSupported()) {
return;
}

mods.modifiers = XIAnyModifier;
mods.status = 0;

Expand All @@ -379,6 +388,10 @@ X11_Xinput2UngrabTouch(_THIS, SDL_Window *window)

XIGrabModifiers mods;

if (!X11_Xinput2IsMultitouchSupported()) {
return;
}

mods.modifiers = XIAnyModifier;
mods.status = 0;

Expand Down

0 comments on commit fdb86b8

Please sign in to comment.