src/events/SDL_events.c
changeset 13600 e42055c6d8b5
parent 13567 e5e55d467f7e
child 13717 3b90978ddf04
equal deleted inserted replaced
13599:5cfc87d218e1 13600:e42055c6d8b5
    30 #if !SDL_JOYSTICK_DISABLED
    30 #if !SDL_JOYSTICK_DISABLED
    31 #include "../joystick/SDL_joystick_c.h"
    31 #include "../joystick/SDL_joystick_c.h"
    32 #endif
    32 #endif
    33 #include "../video/SDL_sysvideo.h"
    33 #include "../video/SDL_sysvideo.h"
    34 #include "SDL_syswm.h"
    34 #include "SDL_syswm.h"
       
    35 
       
    36 #undef SDL_PRIs64
       
    37 #ifdef __WIN32__
       
    38 #define SDL_PRIs64	"I64d"
       
    39 #else
       
    40 #define SDL_PRIs64	"lld"
       
    41 #endif
    35 
    42 
    36 /* An arbitrary limit so we don't have unbounded growth */
    43 /* An arbitrary limit so we don't have unbounded growth */
    37 #define SDL_MAX_QUEUED_EVENTS   65535
    44 #define SDL_MAX_QUEUED_EVENTS   65535
    38 
    45 
    39 typedef struct SDL_EventWatcher {
    46 typedef struct SDL_EventWatcher {
   276         SDL_EVENT_CASE(SDL_CONTROLLERDEVICEREMOVED) PRINT_CONTROLLERDEV_EVENT(event); break;
   283         SDL_EVENT_CASE(SDL_CONTROLLERDEVICEREMOVED) PRINT_CONTROLLERDEV_EVENT(event); break;
   277         SDL_EVENT_CASE(SDL_CONTROLLERDEVICEREMAPPED) PRINT_CONTROLLERDEV_EVENT(event); break;
   284         SDL_EVENT_CASE(SDL_CONTROLLERDEVICEREMAPPED) PRINT_CONTROLLERDEV_EVENT(event); break;
   278         #undef PRINT_CONTROLLERDEV_EVENT
   285         #undef PRINT_CONTROLLERDEV_EVENT
   279 
   286 
   280         #define PRINT_FINGER_EVENT(event) \
   287         #define PRINT_FINGER_EVENT(event) \
   281             SDL_snprintf(details, sizeof (details), " (timestamp=%u touchid=%lld fingerid=%lld x=%f y=%f dx=%f dy=%f pressure=%f)", \
   288             SDL_snprintf(details, sizeof (details), " (timestamp=%u touchid=%"SDL_PRIs64" fingerid=%"SDL_PRIs64" x=%f y=%f dx=%f dy=%f pressure=%f)", \
   282                 (uint) event->tfinger.timestamp, (long long)event->tfinger.touchId, \
   289                 (uint) event->tfinger.timestamp, (long long)event->tfinger.touchId, \
   283                 (long long)event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, \
   290                 (long long)event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, \
   284                 event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure)
   291                 event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure)
   285         SDL_EVENT_CASE(SDL_FINGERDOWN) PRINT_FINGER_EVENT(event); break;
   292         SDL_EVENT_CASE(SDL_FINGERDOWN) PRINT_FINGER_EVENT(event); break;
   286         SDL_EVENT_CASE(SDL_FINGERUP) PRINT_FINGER_EVENT(event); break;
   293         SDL_EVENT_CASE(SDL_FINGERUP) PRINT_FINGER_EVENT(event); break;
   287         SDL_EVENT_CASE(SDL_FINGERMOTION) PRINT_FINGER_EVENT(event); break;
   294         SDL_EVENT_CASE(SDL_FINGERMOTION) PRINT_FINGER_EVENT(event); break;
   288         #undef PRINT_FINGER_EVENT
   295         #undef PRINT_FINGER_EVENT
   289 
   296 
   290         #define PRINT_DOLLAR_EVENT(event) \
   297         #define PRINT_DOLLAR_EVENT(event) \
   291             SDL_snprintf(details, sizeof (details), " (timestamp=%u touchid=%lld gestureid=%lld numfingers=%u error=%f x=%f y=%f)", \
   298             SDL_snprintf(details, sizeof (details), " (timestamp=%u touchid=%"SDL_PRIs64" gestureid=%"SDL_PRIs64" numfingers=%u error=%f x=%f y=%f)", \
   292                 (uint) event->dgesture.timestamp, (long long)event->dgesture.touchId, \
   299                 (uint) event->dgesture.timestamp, (long long)event->dgesture.touchId, \
   293                 (long long)event->dgesture.gestureId, (uint) event->dgesture.numFingers, \
   300                 (long long)event->dgesture.gestureId, (uint) event->dgesture.numFingers, \
   294                 event->dgesture.error, event->dgesture.x, event->dgesture.y);
   301                 event->dgesture.error, event->dgesture.x, event->dgesture.y);
   295         SDL_EVENT_CASE(SDL_DOLLARGESTURE) PRINT_DOLLAR_EVENT(event); break;
   302         SDL_EVENT_CASE(SDL_DOLLARGESTURE) PRINT_DOLLAR_EVENT(event); break;
   296         SDL_EVENT_CASE(SDL_DOLLARRECORD) PRINT_DOLLAR_EVENT(event); break;
   303         SDL_EVENT_CASE(SDL_DOLLARRECORD) PRINT_DOLLAR_EVENT(event); break;
   297         #undef PRINT_DOLLAR_EVENT
   304         #undef PRINT_DOLLAR_EVENT
   298 
   305 
   299         SDL_EVENT_CASE(SDL_MULTIGESTURE)
   306         SDL_EVENT_CASE(SDL_MULTIGESTURE)
   300             SDL_snprintf(details, sizeof (details), " (timestamp=%u touchid=%lld dtheta=%f ddist=%f x=%f y=%f numfingers=%u)",
   307             SDL_snprintf(details, sizeof (details), " (timestamp=%u touchid=%"SDL_PRIs64" dtheta=%f ddist=%f x=%f y=%f numfingers=%u)",
   301                 (uint) event->mgesture.timestamp, (long long)event->mgesture.touchId,
   308                 (uint) event->mgesture.timestamp, (long long)event->mgesture.touchId,
   302                 event->mgesture.dTheta, event->mgesture.dDist,
   309                 event->mgesture.dTheta, event->mgesture.dDist,
   303                 event->mgesture.x, event->mgesture.y, (uint) event->mgesture.numFingers);
   310                 event->mgesture.x, event->mgesture.y, (uint) event->mgesture.numFingers);
   304             break;
   311             break;
   305 
   312