Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed some Gesture bugs
  • Loading branch information
jimtla committed Aug 2, 2010
1 parent 218673f commit 810b062
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 14 deletions.
4 changes: 2 additions & 2 deletions configure.in
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion src/events/SDL_gesture.c
Expand Up @@ -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
Expand Down Expand Up @@ -496,6 +496,7 @@ void SDL_GestureProcessEvent(SDL_Event* event)
}
}
inTouch->gestureLast[j] = inTouch->gestureLast[inTouch->numDownFingers];
j = -1;
break;
}
else {
Expand Down
3 changes: 1 addition & 2 deletions src/events/SDL_touch.c
Expand Up @@ -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;
}
Expand Down
5 changes: 3 additions & 2 deletions src/video/x11/SDL_eventtouch.c
Expand Up @@ -24,15 +24,16 @@
#include "SDL_eventtouch.h"
#include "../../events/SDL_touch_c.h"

#ifdef HAVE_LINUX_INPUT_H

#ifdef SDL_INPUT_LINUXEV
#include <linux/input.h>
#include <fcntl.h>
#endif

void
X11_InitTouch(_THIS)
{
#ifdef HAVE_LINUX_INPUT_H
#ifdef SDL_INPUT_LINUXEV
printf("Initializing touch...\n");

FILE *fd;
Expand Down
4 changes: 2 additions & 2 deletions src/video/x11/SDL_x11events.c
Expand Up @@ -37,7 +37,7 @@

#include <stdio.h>

#ifdef HAVE_LINUX_INPUT_H
#ifdef SDL_INPUT_LINUXEV
//Touch Input/event* includes
#include <linux/input.h>
#include <fcntl.h>
Expand Down Expand Up @@ -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];
Expand Down
13 changes: 8 additions & 5 deletions touchTest/gestureSDLTest.c
Expand Up @@ -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.
Expand Down Expand Up @@ -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<MAXFINGERS;i++)
if(index2fingerid[i] == -1) {
Expand All @@ -412,8 +411,7 @@ int main(int argc, char* argv[])
finger[i].p.y = event.tfinger.y;
break;
case SDL_FINGERUP:
printf("Finger: %"PRIs64" up - x: %i, y: %i\n",event.tfinger.fingerId,
event.tfinger.x,event.tfinger.y);
//printf("Finger: %"PRIs64" up - x: %i, y: %i\n",event.tfinger.fingerId,event.tfinger.x,event.tfinger.y);
for(i = 0;i<MAXFINGERS;i++)
if(index2fingerid[i] == event.tfinger.fingerId) {
index2fingerid[i] = -1;
Expand All @@ -423,6 +421,11 @@ int main(int argc, char* argv[])
finger[i].p.y = -1;
break;
case SDL_MULTIGESTURE:
printf("Multi Gesture: x = %f, y = %f, dAng = %f, dR = %f\n",
event.mgesture.x,
event.mgesture.y,
event.mgesture.dTheta,
event.mgesture.dDist);
knob.p.x = event.mgesture.x;
knob.p.y = event.mgesture.y;
knob.ang += event.mgesture.dTheta;
Expand Down

0 comments on commit 810b062

Please sign in to comment.