Mercurial > sdl-ios-xcode
comparison src/video/x11/SDL_eventtouch.c @ 4646:eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
author | Jim Grandpre <jim.tla@gmail.com> |
---|---|
date | Tue, 01 Jun 2010 02:54:33 -0400 |
parents | 0375d020e7e3 |
children | 62e6a6e9720b |
comparison
equal
deleted
inserted
replaced
4645:0375d020e7e3 | 4646:eea1bf53effa |
---|---|
51 | 51 |
52 SDL_Touch touch; | 52 SDL_Touch touch; |
53 touch.pressure_max = 0; | 53 touch.pressure_max = 0; |
54 touch.pressure_min = 0; | 54 touch.pressure_min = 0; |
55 touch.id = event; | 55 touch.id = event; |
56 | 56 |
57 | |
58 | |
57 | 59 |
58 | 60 |
59 touch.driverdata = SDL_malloc(sizeof(EventTouchData)); | 61 touch.driverdata = SDL_malloc(sizeof(EventTouchData)); |
60 EventTouchData* data = (EventTouchData*)(touch.driverdata); | 62 EventTouchData* data = (EventTouchData*)(touch.driverdata); |
61 printf("Opening device...\n"); | 63 printf("Opening device...\n"); |
62 //printf("New Touch - DataPtr: %i\n",data); | 64 //printf("New Touch - DataPtr: %i\n",data); |
63 data->eventStream = open(tstr, | 65 data->eventStream = open(tstr, |
64 O_RDONLY | O_NONBLOCK); | 66 O_RDONLY | O_NONBLOCK); |
65 ioctl (data->eventStream, EVIOCGNAME (sizeof (tstr)), tstr); | 67 ioctl (data->eventStream, EVIOCGNAME (sizeof (tstr)), tstr); |
66 printf ("Reading From : %s\n", tstr); | 68 printf ("Reading From : %s\n", tstr); |
69 | |
70 | |
71 | |
72 int abs[5]; | |
73 ioctl(data->eventStream,EVIOCGABS(0),abs); | |
74 touch.x_min = abs[1]; | |
75 touch.x_max = abs[2]; | |
76 touch.xres = touch.x_max - touch.x_min; | |
77 ioctl(data->eventStream,EVIOCGABS(ABS_Y),abs); | |
78 touch.y_min = abs[1]; | |
79 touch.y_max = abs[2]; | |
80 touch.yres = touch.y_max - touch.y_min; | |
81 ioctl(data->eventStream,EVIOCGABS(ABS_PRESSURE),abs); | |
82 touch.pressure_min = abs[1]; | |
83 touch.pressure_max = abs[2]; | |
84 touch.pressureres = touch.pressure_max - touch.pressure_min; | |
85 | |
86 | |
67 SDL_AddTouch(&touch, tstr); | 87 SDL_AddTouch(&touch, tstr); |
68 | 88 |
69 } | 89 } |
70 vendor = -1; | 90 vendor = -1; |
71 product = -1; | 91 product = -1; |