mirror of https://github.com/encounter/SDL.git
Added a command line option `--info event_motion` to show mouse and finger motion events
This commit is contained in:
parent
13e0c40ec2
commit
2241bd669f
|
@ -50,6 +50,7 @@
|
||||||
#define VERBOSE_RENDER 0x00000004
|
#define VERBOSE_RENDER 0x00000004
|
||||||
#define VERBOSE_EVENT 0x00000008
|
#define VERBOSE_EVENT 0x00000008
|
||||||
#define VERBOSE_AUDIO 0x00000010
|
#define VERBOSE_AUDIO 0x00000010
|
||||||
|
#define VERBOSE_MOTION 0x00000020
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
static const char *video_usage[] = {
|
static const char *video_usage[] = {
|
||||||
"[--video driver]", "[--renderer driver]", "[--gldebug]",
|
"[--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]",
|
"[--log all|error|system|audio|video|render|input]", "[--display N]",
|
||||||
"[--metal-window | --opengl-window | --vulkan-window]",
|
"[--metal-window | --opengl-window | --vulkan-window]",
|
||||||
"[--fullscreen | --fullscreen-desktop | --windows N]", "[--title title]",
|
"[--fullscreen | --fullscreen-desktop | --windows N]", "[--title title]",
|
||||||
|
@ -168,6 +168,10 @@ SDLTest_CommonArg(SDLTest_CommonState * state, int index)
|
||||||
state->verbose |= VERBOSE_EVENT;
|
state->verbose |= VERBOSE_EVENT;
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
if (SDL_strcasecmp(argv[index], "event_motion") == 0) {
|
||||||
|
state->verbose |= (VERBOSE_EVENT | VERBOSE_MOTION);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (SDL_strcasecmp(argv[index], "--log") == 0) {
|
if (SDL_strcasecmp(argv[index], "--log") == 0) {
|
||||||
|
@ -1464,13 +1468,6 @@ default: return "???";
|
||||||
static void
|
static void
|
||||||
SDLTest_PrintEvent(SDL_Event * event)
|
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) {
|
switch (event->type) {
|
||||||
case SDL_DISPLAYEVENT:
|
case SDL_DISPLAYEVENT:
|
||||||
switch (event->display.event) {
|
switch (event->display.event) {
|
||||||
|
@ -1826,8 +1823,12 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done)
|
||||||
static SDL_MouseMotionEvent lastEvent;
|
static SDL_MouseMotionEvent lastEvent;
|
||||||
|
|
||||||
if (state->verbose & VERBOSE_EVENT) {
|
if (state->verbose & VERBOSE_EVENT) {
|
||||||
|
if (((event->type != SDL_MOUSEMOTION) &&
|
||||||
|
(event->type != SDL_FINGERMOTION)) ||
|
||||||
|
((state->verbose & VERBOSE_MOTION) != 0)) {
|
||||||
SDLTest_PrintEvent(event);
|
SDLTest_PrintEvent(event);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (event->type) {
|
switch (event->type) {
|
||||||
case SDL_WINDOWEVENT:
|
case SDL_WINDOWEVENT:
|
||||||
|
|
Loading…
Reference in New Issue