Added a command line option `--info event_motion` to show mouse and finger motion events
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
diff --git a/include/SDL_test_common.h b/include/SDL_test_common.h
index 0f50967..b86520d 100644
--- a/include/SDL_test_common.h
+++ b/include/SDL_test_common.h
@@ -50,6 +50,7 @@
#define VERBOSE_RENDER 0x00000004
#define VERBOSE_EVENT 0x00000008
#define VERBOSE_AUDIO 0x00000010
+#define VERBOSE_MOTION 0x00000020
typedef struct
{
diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c
index 44013f6..c86742c 100644
--- a/src/test/SDL_test_common.c
+++ b/src/test/SDL_test_common.c
@@ -28,7 +28,7 @@
static const char *video_usage[] = {
"[--video driver]", "[--renderer driver]", "[--gldebug]",
- "[--info all|video|modes|render|event]",
+ "[--info all|video|modes|render|event|event_motion]",
"[--log all|error|system|audio|video|render|input]", "[--display N]",
"[--metal-window | --opengl-window | --vulkan-window]",
"[--fullscreen | --fullscreen-desktop | --windows N]", "[--title title]",
@@ -168,6 +168,10 @@ SDLTest_CommonArg(SDLTest_CommonState * state, int index)
state->verbose |= VERBOSE_EVENT;
return 2;
}
+ if (SDL_strcasecmp(argv[index], "event_motion") == 0) {
+ state->verbose |= (VERBOSE_EVENT | VERBOSE_MOTION);
+ return 2;
+ }
return -1;
}
if (SDL_strcasecmp(argv[index], "--log") == 0) {
@@ -1464,13 +1468,6 @@ default: return "???";
static void
SDLTest_PrintEvent(SDL_Event * event)
{
-#ifndef VERBOSE_MOTION_EVENTS
- if ((event->type == SDL_MOUSEMOTION) || (event->type == SDL_FINGERMOTION)) {
- /* Mouse and finger motion are really spammy */
- return;
- }
-#endif
-
switch (event->type) {
case SDL_DISPLAYEVENT:
switch (event->display.event) {
@@ -1826,7 +1823,11 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done)
static SDL_MouseMotionEvent lastEvent;
if (state->verbose & VERBOSE_EVENT) {
- SDLTest_PrintEvent(event);
+ if (((event->type != SDL_MOUSEMOTION) &&
+ (event->type != SDL_FINGERMOTION)) ||
+ ((state->verbose & VERBOSE_MOTION) != 0)) {
+ SDLTest_PrintEvent(event);
+ }
}
switch (event->type) {