From 810b06273539cdcfb64b1b39edc1be5d01e77af6 Mon Sep 17 00:00:00 2001 From: Jim Grandpre Date: Mon, 2 Aug 2010 00:14:53 -0400 Subject: [PATCH] Fixed some Gesture bugs --- configure.in | 4 ++-- src/events/SDL_gesture.c | 3 ++- src/events/SDL_touch.c | 3 +-- src/video/x11/SDL_eventtouch.c | 5 +++-- src/video/x11/SDL_x11events.c | 4 ++-- touchTest/gestureSDLTest.c | 13 ++++++++----- 6 files changed, 18 insertions(+), 14 deletions(-) diff --git a/configure.in b/configure.in index a0d6dfc5b..24e49019e 100644 --- a/configure.in +++ b/configure.in @@ -285,8 +285,6 @@ if test x$have_inttypes != xyes; then AC_DEFINE(uintptr_t, unsigned long) fi -AC_CHECK_HEADER(Linux/input.h,AC_DEFINE(HAVE_LINUX_INPUT_H)) - # Standard C sources SOURCES="$SOURCES $srcdir/src/*.c" SOURCES="$SOURCES $srcdir/src/audio/*.c" @@ -1007,6 +1005,8 @@ CheckVisibilityHidden() dnl Find the X11 include and library directories CheckX11() { + + AC_ARG_ENABLE(video-x11, AC_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]), , enable_video_x11=yes) diff --git a/src/events/SDL_gesture.c b/src/events/SDL_gesture.c index c73d6f11a..b625dedc9 100644 --- a/src/events/SDL_gesture.c +++ b/src/events/SDL_gesture.c @@ -27,7 +27,7 @@ #include "SDL_gesture_c.h" //TODO: Replace with malloc -#define MAXFINGERS 3 +#define MAXFINGERS 5 #define MAXTOUCHES 2 #define MAXTEMPLATES 4 #define MAXPATHSIZE 1024 @@ -496,6 +496,7 @@ void SDL_GestureProcessEvent(SDL_Event* event) } } inTouch->gestureLast[j] = inTouch->gestureLast[inTouch->numDownFingers]; + j = -1; break; } else { diff --git a/src/events/SDL_touch.c b/src/events/SDL_touch.c index 26c2ba5ff..71426f1bf 100644 --- a/src/events/SDL_touch.c +++ b/src/events/SDL_touch.c @@ -392,8 +392,7 @@ SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, int relative, //scale to Integer coordinates Uint16 x = (xin+touch->x_min)*(touch->xres)/(touch->native_xres); Uint16 y = (yin+touch->y_min)*(touch->yres)/(touch->native_yres); - Uint16 pressure = (yin+touch->pressure_min)*(touch->pressureres)/(touch->native_pressureres); - printf("(%f,%f) --> (%i,%i)\n",xin,yin,x,y); + Uint16 pressure = (yin+touch->pressure_min)*(touch->pressureres)/(touch->native_pressureres); if(touch->flush_motion) { return 0; } diff --git a/src/video/x11/SDL_eventtouch.c b/src/video/x11/SDL_eventtouch.c index ce2edc8a7..85e5f12af 100644 --- a/src/video/x11/SDL_eventtouch.c +++ b/src/video/x11/SDL_eventtouch.c @@ -24,7 +24,8 @@ #include "SDL_eventtouch.h" #include "../../events/SDL_touch_c.h" -#ifdef HAVE_LINUX_INPUT_H + +#ifdef SDL_INPUT_LINUXEV #include #include #endif @@ -32,7 +33,7 @@ void X11_InitTouch(_THIS) { -#ifdef HAVE_LINUX_INPUT_H +#ifdef SDL_INPUT_LINUXEV printf("Initializing touch...\n"); FILE *fd; diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c index 9b15ef798..9069ab55b 100644 --- a/src/video/x11/SDL_x11events.c +++ b/src/video/x11/SDL_x11events.c @@ -37,7 +37,7 @@ #include -#ifdef HAVE_LINUX_INPUT_H +#ifdef SDL_INPUT_LINUXEV //Touch Input/event* includes #include #include @@ -402,7 +402,7 @@ X11_PumpEvents(_THIS) X11_DispatchEvent(_this); } -#ifdef HAVE_LINUX_INPUT_H +#ifdef SDL_INPUT_LINUXEV /* Process Touch events - TODO When X gets touch support, use that instead*/ int i = 0,rd; char name[256]; diff --git a/touchTest/gestureSDLTest.c b/touchTest/gestureSDLTest.c index 9bf5ffb6b..75479b106 100644 --- a/touchTest/gestureSDLTest.c +++ b/touchTest/gestureSDLTest.c @@ -131,7 +131,7 @@ void setpix(SDL_Surface *screen, int x, int y, unsigned int col) memcpy(&colour,pixmem32,screen->format->BytesPerPixel); - SDL_GetRGB(colour,screen->format,&r,&g,&b); //Always returns 0xFFFFFF? + SDL_GetRGB(colour,screen->format,&r,&g,&b); //r = 0;g = 0; b = 0; a = (col>>24)&0xFF; if(a == 0) a = 0xFF; //Hack, to make things easier. @@ -400,8 +400,7 @@ int main(int argc, char* argv[]) break; case SDL_FINGERDOWN: - printf("Finger: %"PRIs64" down - x: %i, y: %i\n",event.tfinger.fingerId, - event.tfinger.x,event.tfinger.y); + //printf("Finger: %"PRIs64" down - x: %i, y: %i\n",event.tfinger.fingerId,event.tfinger.x,event.tfinger.y); for(i = 0;i