We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2974 - X11 touch device not found first time after boot
Summary: X11 touch device not found first time after boot
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: 2.0.3
Hardware: x86_64 Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
: 2196 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-05-01 21:13 UTC by Volumetric
Modified: 2017-08-15 05:08 UTC (History)
3 users (show)

See Also:


Attachments
Patch for querying all X11 input devices, so some touch devices aren't skipped (879 bytes, patch)
2015-05-01 21:13 UTC, Volumetric
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Volumetric 2015-05-01 21:13:20 UTC
Created attachment 2147 [details]
Patch for querying all X11 input devices, so some touch devices aren't skipped

On my systems the X11 code that looks for touch input devices misses the touch screen the first time after boot.  Subsequent times work.  This is under Fedora 20 and it manifests on very different hardware (workstation + touch screen, and also a tablet).

Below and attached please find a patch that fixes this by looking at all X input devices, not just the master devices.  It does redundantly checks some devices but correctly handles those duplicates, and fixes the problem.

diff -r -C 3 SDL-2.0.4-9574/src/video/x11/SDL_x11xinput2.c SDL-2.0.4-9574.mod/src/video/x11/SDL_x11xinput2.c
*** SDL-2.0.4-9574/src/video/x11/SDL_x11xinput2.c	2014-03-02 22:14:59.000000000 -0600
--- SDL-2.0.4-9574.mod/src/video/x11/SDL_x11xinput2.c	2015-05-01 15:55:27.181289471 -0500
***************
*** 183,189 ****
      SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
      XIDeviceInfo *info;
      int ndevices,i,j;
!     info = X11_XIQueryDevice(data->display, XIAllMasterDevices, &ndevices);
  
      for (i = 0; i < ndevices; i++) {
          XIDeviceInfo *dev = &info[i];
--- 183,189 ----
      SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
      XIDeviceInfo *info;
      int ndevices,i,j;
!     info = X11_XIQueryDevice(data->display, XIAllDevices, &ndevices);
  
      for (i = 0; i < ndevices; i++) {
          XIDeviceInfo *dev = &info[i];
Comment 1 Ryan C. Gordon 2015-06-01 03:00:45 UTC
This patch is now https://hg.libsdl.org/SDL/rev/a7e9b75ec1c9, thanks!

--ryan.
Comment 2 Sam Lantinga 2017-08-15 05:08:28 UTC
*** Bug 2196 has been marked as a duplicate of this bug. ***