src/video/x11/SDL_x11events.c
changeset 4645 0375d020e7e3
parent 4644 fb500b3e1717
child 4646 eea1bf53effa
     1.1 --- a/src/video/x11/SDL_x11events.c	Sat May 29 02:09:16 2010 -0400
     1.2 +++ b/src/video/x11/SDL_x11events.c	Mon May 31 00:24:37 2010 -0400
     1.3 @@ -109,7 +109,6 @@
     1.4  #endif
     1.5          }
     1.6          break;
     1.7 -
     1.8          /* Losing mouse coverage? */
     1.9      case LeaveNotify:{
    1.10  #ifdef DEBUG_XEVENTS
    1.11 @@ -422,23 +421,16 @@
    1.12      char name[256];
    1.13      struct input_event ev[64];
    1.14      int size = sizeof (struct input_event);
    1.15 -    static int initd = 0; //TODO - HACK!
    1.16 +
    1.17      for(i = 0;i < SDL_GetNumTouch();++i) {
    1.18  	SDL_Touch* touch = SDL_GetTouchIndex(i);
    1.19  	if(!touch) printf("Touch %i/%i DNE\n",i,SDL_GetNumTouch());
    1.20  	EventTouchData* data;
    1.21 -	if(!initd){//data->eventStream <= 0) {
    1.22 -	    touch->driverdata = SDL_malloc(sizeof(EventTouchData));
    1.23 -	    data = (EventTouchData*)(touch->driverdata);
    1.24 -	    printf("Openning device...\n");
    1.25 -	    data->eventStream = open("/dev/input/wacom", 
    1.26 -				     O_RDONLY | O_NONBLOCK);
    1.27 -	    ioctl (data->eventStream, EVIOCGNAME (sizeof (name)), name);
    1.28 -	    printf ("Reading From : %s\n", name);
    1.29 -	    initd = 1;
    1.30 +	data = (EventTouchData*)(touch->driverdata);
    1.31 +	if(data == NULL) {
    1.32 +	  printf("No driver data\n");
    1.33 +	  continue;
    1.34  	}
    1.35 -	else
    1.36 -	 data = (EventTouchData*)(touch->driverdata);
    1.37  	if(data->eventStream <= 0) 
    1.38  	    printf("Error: Couldn't open stream\n");
    1.39  	rd = read(data->eventStream, ev, size * 64);
    1.40 @@ -469,6 +461,7 @@
    1.41  			data->finger = ev[i].value;
    1.42  		    break;
    1.43  		case EV_SYN:
    1.44 +  		    printf("Id: %i\n",touch->id); 
    1.45  		    if(data->x >= 0 || data->y >= 0)
    1.46  			SDL_SendTouchMotion(touch->id,data->finger, 
    1.47  					    SDL_FALSE,data->x,data->y,