From c4ae2465ee7171c09373a734876956dccea84166 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 14 Feb 2013 15:40:19 -0800 Subject: [PATCH] Don't crash if we have the extension but couldn't load the XInput shared library. --- .../English.lproj/InfoPlist.strings | Bin 588 -> 588 bytes .../English.lproj/InfoPlist.strings | Bin 588 -> 588 bytes .../English.lproj/InfoPlist.strings | Bin 588 -> 588 bytes src/video/x11/SDL_x11xinput2.c | 21 ++++++++++++------ 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Xcode/TemplatesForXcodeTiger/SDL Application/English.lproj/InfoPlist.strings b/Xcode/TemplatesForXcodeTiger/SDL Application/English.lproj/InfoPlist.strings index 38224b5a6dc9494230bdffbcad9c8bd915f478d9..e612457676d964a8021d20ec90290d5c6c3d88c1 100755 GIT binary patch delta 12 TcmX@Za)yQZ-+zXUOrA^tB1QzC delta 13 UcmX@Za)yQJ|G$mQo=l7k04L%Epa1{> diff --git a/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/English.lproj/InfoPlist.strings b/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/English.lproj/InfoPlist.strings index 38224b5a6dc9494230bdffbcad9c8bd915f478d9..e612457676d964a8021d20ec90290d5c6c3d88c1 100755 GIT binary patch delta 12 TcmX@Za)yQZ-+zXUOrA^tB1QzC delta 13 UcmX@Za)yQJ|G$mQo=l7k04L%Epa1{> diff --git a/Xcode/TemplatesForXcodeTiger/SDL OpenGL Application/English.lproj/InfoPlist.strings b/Xcode/TemplatesForXcodeTiger/SDL OpenGL Application/English.lproj/InfoPlist.strings index 38224b5a6dc9494230bdffbcad9c8bd915f478d9..e612457676d964a8021d20ec90290d5c6c3d88c1 100755 GIT binary patch delta 12 TcmX@Za)yQZ-+zXUOrA^tB1QzC delta 13 UcmX@Za)yQJ|G$mQo=l7k04L%Epa1{> diff --git a/src/video/x11/SDL_x11xinput2.c b/src/video/x11/SDL_x11xinput2.c index 94f7599a5..899c269c6 100644 --- a/src/video/x11/SDL_x11xinput2.c +++ b/src/video/x11/SDL_x11xinput2.c @@ -62,7 +62,8 @@ static void parse_valuators(const double *input_values,unsigned char *mask,int m #endif /* SDL_VIDEO_DRIVER_X11_XINPUT2 */ void -X11_InitXinput2(_THIS) { +X11_InitXinput2(_THIS) +{ #if SDL_VIDEO_DRIVER_X11_XINPUT2 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 */ - if (!XQueryExtension(data->display, "XInputExtension", &xinput2_opcode, &event, &err)) { + if (!SDL_X11_HAVE_XINPUT2 || + !XQueryExtension(data->display, "XInputExtension", &xinput2_opcode, &event, &err)) { return; } @@ -122,7 +124,8 @@ X11_InitXinput2(_THIS) { int -X11_HandleXinput2Event(SDL_VideoData *videodata,XGenericEventCookie *cookie) { +X11_HandleXinput2Event(SDL_VideoData *videodata,XGenericEventCookie *cookie) +{ #if SDL_VIDEO_DRIVER_X11_XINPUT2 if(cookie->extension != xinput2_opcode) { return 0; @@ -175,7 +178,8 @@ X11_HandleXinput2Event(SDL_VideoData *videodata,XGenericEventCookie *cookie) { } void -X11_InitXinput2Multitouch(_THIS) { +X11_InitXinput2Multitouch(_THIS) +{ #if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; XIDeviceInfo *info; @@ -218,7 +222,8 @@ X11_InitXinput2Multitouch(_THIS) { } void -X11_Xinput2SelectTouch(_THIS, SDL_Window *window) { +X11_Xinput2SelectTouch(_THIS, SDL_Window *window) +{ #if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH if (!X11_Xinput2IsMultitouchSupported()) { return; @@ -243,7 +248,8 @@ X11_Xinput2SelectTouch(_THIS, SDL_Window *window) { int -X11_Xinput2IsInitialized() { +X11_Xinput2IsInitialized() +{ #if SDL_VIDEO_DRIVER_X11_XINPUT2 return xinput2_initialized; #else @@ -252,7 +258,8 @@ X11_Xinput2IsInitialized() { } int -X11_Xinput2IsMultitouchSupported() { +X11_Xinput2IsMultitouchSupported() +{ #if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH return xinput2_initialized && xinput2_multitouch_supported; #else