mirror of
https://github.com/encounter/SDL.git
synced 2025-12-17 00:47:15 +00:00
Fixed bug 3583 - X11 touch device can be permanently lost
Volumetric In X11 the SDL error "Unknown touch device" can occur after which the application stops recognizing touch events. For a kiosk-type application this results in a hang as far as the user is concerned. This is reproducible on HP Z220/Z230/Z240 workstations by swapping USB cables for a while and it also occurs with no physical changes, probably due to USB device power management. A workaround is to make SDL re-enumerate the touch devices like it does at startup. A patch is attached.
This commit is contained in:
@@ -163,6 +163,11 @@ struct SDL_VideoDevice
|
||||
*/
|
||||
void (*VideoQuit) (_THIS);
|
||||
|
||||
/*
|
||||
* Reinitialize the touch devices -- called if an unknown touch ID occurs.
|
||||
*/
|
||||
void (*ResetTouch) (_THIS);
|
||||
|
||||
/* * * */
|
||||
/*
|
||||
* Display functions
|
||||
|
||||
@@ -42,6 +42,13 @@ X11_QuitTouch(_THIS)
|
||||
SDL_TouchQuit();
|
||||
}
|
||||
|
||||
void
|
||||
X11_ResetTouch(_THIS)
|
||||
{
|
||||
X11_QuitTouch(_this);
|
||||
X11_InitTouch(_this);
|
||||
}
|
||||
|
||||
#endif /* SDL_VIDEO_DRIVER_X11 */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
extern void X11_InitTouch(_THIS);
|
||||
extern void X11_QuitTouch(_THIS);
|
||||
extern void X11_ResetTouch(_THIS);
|
||||
|
||||
#endif /* SDL_x11touch_h_ */
|
||||
|
||||
|
||||
@@ -216,6 +216,7 @@ X11_CreateDevice(int devindex)
|
||||
/* Set the function pointers */
|
||||
device->VideoInit = X11_VideoInit;
|
||||
device->VideoQuit = X11_VideoQuit;
|
||||
device->ResetTouch = X11_ResetTouch;
|
||||
device->GetDisplayModes = X11_GetDisplayModes;
|
||||
device->GetDisplayBounds = X11_GetDisplayBounds;
|
||||
device->GetDisplayUsableBounds = X11_GetDisplayUsableBounds;
|
||||
|
||||
Reference in New Issue
Block a user