Don't crash if we have the extension but couldn't load the XInput shared library.
This commit is contained in:
parent
73eaf569f4
commit
963c65929d
4 changed files with 14 additions and 7 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -62,7 +62,8 @@ static void parse_valuators(const double *input_values,unsigned char *mask,int m
|
||||||
#endif /* SDL_VIDEO_DRIVER_X11_XINPUT2 */
|
#endif /* SDL_VIDEO_DRIVER_X11_XINPUT2 */
|
||||||
|
|
||||||
void
|
void
|
||||||
X11_InitXinput2(_THIS) {
|
X11_InitXinput2(_THIS)
|
||||||
|
{
|
||||||
#if SDL_VIDEO_DRIVER_X11_XINPUT2
|
#if SDL_VIDEO_DRIVER_X11_XINPUT2
|
||||||
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
|
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
|
||||||
|
|
||||||
|
@ -83,7 +84,8 @@ X11_InitXinput2(_THIS) {
|
||||||
*
|
*
|
||||||
* FIXME:event and err are not needed but if not passed XQueryExtension returns SegmentationFault
|
* FIXME:event and err are not needed but if not passed XQueryExtension returns SegmentationFault
|
||||||
*/
|
*/
|
||||||
if (!XQueryExtension(data->display, "XInputExtension", &xinput2_opcode, &event, &err)) {
|
if (!SDL_X11_HAVE_XINPUT2 ||
|
||||||
|
!XQueryExtension(data->display, "XInputExtension", &xinput2_opcode, &event, &err)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +124,8 @@ X11_InitXinput2(_THIS) {
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
X11_HandleXinput2Event(SDL_VideoData *videodata,XGenericEventCookie *cookie) {
|
X11_HandleXinput2Event(SDL_VideoData *videodata,XGenericEventCookie *cookie)
|
||||||
|
{
|
||||||
#if SDL_VIDEO_DRIVER_X11_XINPUT2
|
#if SDL_VIDEO_DRIVER_X11_XINPUT2
|
||||||
if(cookie->extension != xinput2_opcode) {
|
if(cookie->extension != xinput2_opcode) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -175,7 +178,8 @@ X11_HandleXinput2Event(SDL_VideoData *videodata,XGenericEventCookie *cookie) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
X11_InitXinput2Multitouch(_THIS) {
|
X11_InitXinput2Multitouch(_THIS)
|
||||||
|
{
|
||||||
#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH
|
#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH
|
||||||
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
|
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
|
||||||
XIDeviceInfo *info;
|
XIDeviceInfo *info;
|
||||||
|
@ -218,7 +222,8 @@ X11_InitXinput2Multitouch(_THIS) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
X11_Xinput2SelectTouch(_THIS, SDL_Window *window) {
|
X11_Xinput2SelectTouch(_THIS, SDL_Window *window)
|
||||||
|
{
|
||||||
#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH
|
#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH
|
||||||
if (!X11_Xinput2IsMultitouchSupported()) {
|
if (!X11_Xinput2IsMultitouchSupported()) {
|
||||||
return;
|
return;
|
||||||
|
@ -243,7 +248,8 @@ X11_Xinput2SelectTouch(_THIS, SDL_Window *window) {
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
X11_Xinput2IsInitialized() {
|
X11_Xinput2IsInitialized()
|
||||||
|
{
|
||||||
#if SDL_VIDEO_DRIVER_X11_XINPUT2
|
#if SDL_VIDEO_DRIVER_X11_XINPUT2
|
||||||
return xinput2_initialized;
|
return xinput2_initialized;
|
||||||
#else
|
#else
|
||||||
|
@ -252,7 +258,8 @@ X11_Xinput2IsInitialized() {
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
X11_Xinput2IsMultitouchSupported() {
|
X11_Xinput2IsMultitouchSupported()
|
||||||
|
{
|
||||||
#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH
|
#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH
|
||||||
return xinput2_initialized && xinput2_multitouch_supported;
|
return xinput2_initialized && xinput2_multitouch_supported;
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue