X11 touch handling fixed for one device (LPC32xx Touchscreen).
This commit is contained in:
parent
961d8e70e6
commit
7ab5cda6fc
2 changed files with 31 additions and 24 deletions
|
@ -549,6 +549,7 @@ X11_PumpEvents(_THIS)
|
||||||
struct input_event ev[64];
|
struct input_event ev[64];
|
||||||
int size = sizeof (struct input_event);
|
int size = sizeof (struct input_event);
|
||||||
|
|
||||||
|
/* !!! FIXME: clean the tabstops out of here. */
|
||||||
for(i = 0;i < SDL_GetNumTouch();++i) {
|
for(i = 0;i < SDL_GetNumTouch();++i) {
|
||||||
SDL_Touch* touch = SDL_GetTouchIndex(i);
|
SDL_Touch* touch = SDL_GetTouchIndex(i);
|
||||||
if(!touch) printf("Touch %i/%i DNE\n",i,SDL_GetNumTouch());
|
if(!touch) printf("Touch %i/%i DNE\n",i,SDL_GetNumTouch());
|
||||||
|
@ -561,12 +562,10 @@ X11_PumpEvents(_THIS)
|
||||||
if(data->eventStream <= 0)
|
if(data->eventStream <= 0)
|
||||||
printf("Error: Couldn't open stream\n");
|
printf("Error: Couldn't open stream\n");
|
||||||
rd = read(data->eventStream, ev, size * 64);
|
rd = read(data->eventStream, ev, size * 64);
|
||||||
//printf("Got %i/%i bytes\n",rd,size);
|
|
||||||
if(rd >= size) {
|
if(rd >= size) {
|
||||||
for (i = 0; i < rd / sizeof(struct input_event); i++) {
|
for (i = 0; i < rd / sizeof(struct input_event); i++) {
|
||||||
switch (ev[i].type) {
|
switch (ev[i].type) {
|
||||||
case EV_ABS:
|
case EV_ABS:
|
||||||
//printf("Got position x: %i!\n",data->x);
|
|
||||||
switch (ev[i].code) {
|
switch (ev[i].code) {
|
||||||
case ABS_X:
|
case ABS_X:
|
||||||
data->x = ev[i].value;
|
data->x = ev[i].value;
|
||||||
|
@ -585,29 +584,37 @@ X11_PumpEvents(_THIS)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EV_MSC:
|
case EV_MSC:
|
||||||
if(ev[i].code == MSC_SERIAL)
|
if(ev[i].code == MSC_SERIAL)
|
||||||
data->finger = ev[i].value;
|
data->finger = ev[i].value;
|
||||||
break;
|
break;
|
||||||
|
case EV_KEY:
|
||||||
|
if(ev[i].code == BTN_TOUCH)
|
||||||
|
if(ev[i].value == 0)
|
||||||
|
data->up = SDL_TRUE;
|
||||||
|
break;
|
||||||
case EV_SYN:
|
case EV_SYN:
|
||||||
//printf("Id: %i\n",touch->id);
|
if(!data->down) {
|
||||||
if(data->up) {
|
data->down = SDL_TRUE;
|
||||||
SDL_SendFingerDown(touch->id,data->finger,
|
SDL_SendFingerDown(touch->id,data->finger,
|
||||||
SDL_FALSE,data->x,data->y,
|
data->down, data->x, data->y,
|
||||||
data->pressure);
|
data->pressure);
|
||||||
}
|
}
|
||||||
else if(data->x >= 0 || data->y >= 0)
|
else if(!data->up)
|
||||||
SDL_SendTouchMotion(touch->id,data->finger,
|
SDL_SendTouchMotion(touch->id,data->finger,
|
||||||
SDL_FALSE,data->x,data->y,
|
SDL_FALSE, data->x,data->y,
|
||||||
data->pressure);
|
data->pressure);
|
||||||
|
else
|
||||||
//printf("Synched: %i tx: %i, ty: %i\n",
|
{
|
||||||
// data->finger,data->x,data->y);
|
data->down = SDL_FALSE;
|
||||||
data->x = -1;
|
SDL_SendFingerDown(touch->id,data->finger,
|
||||||
data->y = -1;
|
data->down, data->x,data->y,
|
||||||
data->pressure = -1;
|
data->pressure);
|
||||||
data->finger = 0;
|
data->x = -1;
|
||||||
data->up = SDL_FALSE;
|
data->y = -1;
|
||||||
|
data->pressure = -1;
|
||||||
|
data->finger = 0;
|
||||||
|
data->up = SDL_FALSE;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,10 +47,9 @@ X11_InitTouch(_THIS)
|
||||||
while(!feof(fd)) {
|
while(!feof(fd)) {
|
||||||
if(fgets(line,256,fd) <=0) continue;
|
if(fgets(line,256,fd) <=0) continue;
|
||||||
if(line[0] == '\n') {
|
if(line[0] == '\n') {
|
||||||
if(vendor == 1386){
|
if(vendor == 1386 || vendor==1){
|
||||||
/*printf("Wacom... Assuming it is a touch device\n");*/
|
|
||||||
/*sprintf(tstr,"/dev/input/event%i",event);*/
|
sprintf(tstr,"/dev/input/event%i",event);
|
||||||
/*printf("At location: %s\n",tstr);*/
|
|
||||||
|
|
||||||
SDL_Touch touch;
|
SDL_Touch touch;
|
||||||
touch.pressure_max = 0;
|
touch.pressure_max = 0;
|
||||||
|
@ -66,6 +65,7 @@ X11_InitTouch(_THIS)
|
||||||
data->pressure = -1;
|
data->pressure = -1;
|
||||||
data->finger = 0;
|
data->finger = 0;
|
||||||
data->up = SDL_FALSE;
|
data->up = SDL_FALSE;
|
||||||
|
data->down = SDL_FALSE;
|
||||||
|
|
||||||
|
|
||||||
data->eventStream = open(tstr,
|
data->eventStream = open(tstr,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue