src/video/x11/SDL_x11events.c
changeset 3003 699d68ef2aca
parent 2997 e4f025078c1c
child 3011 8f4ed5ec2b06
equal deleted inserted replaced
3002:0deb3e94c251 3003:699d68ef2aca
   279                                 0);
   279                                 0);
   280         }
   280         }
   281         break;
   281         break;
   282 
   282 
   283     default:{
   283     default:{
   284 #if SDL_VIDEO_DRIVER_X11_XINPUT
       
   285             for (i = 0; i < SDL_GetNumMice(); ++i) {
   284             for (i = 0; i < SDL_GetNumMice(); ++i) {
   286                 SDL_Mouse *mouse;
   285                 SDL_Mouse *mouse;
       
   286 #if SDL_VIDEO_DRIVER_X11_XINPUT
   287                 X11_MouseData *data;
   287                 X11_MouseData *data;
       
   288 #endif
   288 
   289 
   289                 mouse = SDL_GetMouse(i);
   290                 mouse = SDL_GetMouse(i);
   290                 data = (X11_MouseData *) mouse->driverdata;
   291                 if (!mouse->driverdata) {
   291                 if (!data) {
       
   292                     switch (xevent.type) {
   292                     switch (xevent.type) {
   293                     case MotionNotify:
   293                     case MotionNotify:
   294 #ifdef DEBUG_MOTION
   294 #ifdef DEBUG_MOTION
   295                         printf("X11 motion: %d,%d\n", xevent.xmotion.x,
   295                         printf("X11 motion: %d,%d\n", xevent.xmotion.x,
   296                                xevent.xmotion.y);
   296                                xevent.xmotion.y);
   310                         break;
   310                         break;
   311                     }
   311                     }
   312                     continue;
   312                     continue;
   313                 }
   313                 }
   314 
   314 
   315                 if (xevent.type == data->motion) {      /* MotionNotify */
   315 #if SDL_VIDEO_DRIVER_X11_XINPUT
       
   316                 data = (X11_MouseData *) mouse->driverdata;
       
   317                 if (xevent.type == data->motion) {
   316                     XDeviceMotionEvent *move =
   318                     XDeviceMotionEvent *move =
   317                         (XDeviceMotionEvent *) & xevent;
   319                         (XDeviceMotionEvent *) & xevent;
   318 #ifdef DEBUG_MOTION
   320 #ifdef DEBUG_MOTION
   319                     printf("X11 motion: %d,%d\n", move->x, move->y);
   321                     printf("X11 motion: %d,%d\n", move->x, move->y);
   320 #endif
   322 #endif
   321                     SDL_SendMouseMotion(move->deviceid, 0, move->x, move->y,
   323                     SDL_SendMouseMotion(move->deviceid, 0, move->x, move->y,
   322                                         move->axis_data[2]);
   324                                         move->axis_data[2]);
   323                     return;
   325                     return;
   324                 }
   326                 }
   325                 if (xevent.type == data->button_pressed) {      /* ButtonPress */
   327                 if (xevent.type == data->button_pressed) {
   326                     XDeviceButtonPressedEvent *pressed =
   328                     XDeviceButtonPressedEvent *pressed =
   327                         (XDeviceButtonPressedEvent *) & xevent;
   329                         (XDeviceButtonPressedEvent *) & xevent;
   328                     SDL_SendMouseButton(pressed->deviceid, SDL_PRESSED,
   330                     SDL_SendMouseButton(pressed->deviceid, SDL_PRESSED,
   329                                         pressed->button);
   331                                         pressed->button);
   330                     return;
   332                     return;
   331                 }
   333                 }
   332                 if (xevent.type == data->button_released) {     /* ButtonRelease */
   334                 if (xevent.type == data->button_released) {
   333                     XDeviceButtonReleasedEvent *released =
   335                     XDeviceButtonReleasedEvent *released =
   334                         (XDeviceButtonReleasedEvent *) & xevent;
   336                         (XDeviceButtonReleasedEvent *) & xevent;
   335                     SDL_SendMouseButton(released->deviceid, SDL_RELEASED,
   337                     SDL_SendMouseButton(released->deviceid, SDL_RELEASED,
   336                                         released->button);
   338                                         released->button);
   337                     return;
   339                     return;
   348                         (XProximityNotifyEvent *) & xevent;
   350                         (XProximityNotifyEvent *) & xevent;
   349                     SDL_SendProximity(proximity->deviceid, proximity->x,
   351                     SDL_SendProximity(proximity->deviceid, proximity->x,
   350                                       proximity->y, SDL_PROXIMITYOUT);
   352                                       proximity->y, SDL_PROXIMITYOUT);
   351                     return;
   353                     return;
   352                 }
   354                 }
   353             }
   355 #endif
   354 #endif
   356             }
   355 #ifdef DEBUG_XEVENTS
   357 #ifdef DEBUG_XEVENTS
   356             printf("Unhandled event %d\n", xevent.type);
   358             printf("Unhandled event %d\n", xevent.type);
   357 #endif
   359 #endif
   358         }
   360         }
   359         break;
   361         break;