|
@@ -150,13 +150,19 @@ SDL_PollSentinelChanged(void *userdata, const char *name, const char *oldValue,
|
|
|
SDL_EventState(SDL_POLLSENTINEL, SDL_GetStringBoolean(hint, SDL_TRUE) ? SDL_ENABLE : SDL_DISABLE);
|
|
|
}
|
|
|
|
|
|
-/* 0 (default) means no logging, 1 means logging, 2 means logging with mouse and finger motion */
|
|
|
-static int SDL_DoEventLogging = 0;
|
|
|
+/**
|
|
|
+ * Verbosity of logged events as defined in SDL_HINT_EVENT_LOGGING:
|
|
|
+ * - 0: (default) no logging
|
|
|
+ * - 1: logging of most events
|
|
|
+ * - 2: as above, plus mouse and finger motion
|
|
|
+ * - 3: as above, plus SDL_SysWMEvents
|
|
|
+ */
|
|
|
+static int SDL_EventLoggingVerbosity = 0;
|
|
|
|
|
|
static void SDLCALL
|
|
|
SDL_EventLoggingChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
|
|
|
{
|
|
|
- SDL_DoEventLogging = (hint && *hint) ? SDL_clamp(SDL_atoi(hint), 0, 2) : 0;
|
|
|
+ SDL_EventLoggingVerbosity = (hint && *hint) ? SDL_clamp(SDL_atoi(hint), 0, 3) : 0;
|
|
|
}
|
|
|
|
|
|
static void
|
|
@@ -166,7 +172,7 @@ SDL_LogEvent(const SDL_Event *event)
|
|
|
char details[128];
|
|
|
|
|
|
/* sensor/mouse/finger motion are spammy, ignore these if they aren't demanded. */
|
|
|
- if ( (SDL_DoEventLogging < 2) &&
|
|
|
+ if ( (SDL_EventLoggingVerbosity < 2) &&
|
|
|
( (event->type == SDL_MOUSEMOTION) ||
|
|
|
(event->type == SDL_FINGERMOTION) ||
|
|
|
(event->type == SDL_CONTROLLERTOUCHPADMOTION) ||
|
|
@@ -175,6 +181,11 @@ SDL_LogEvent(const SDL_Event *event)
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ /* window manager events are even more spammy, and don't provide much useful info. */
|
|
|
+ if ((SDL_EventLoggingVerbosity < 3) && (event->type == SDL_SYSWMEVENT)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
/* this is to make SDL_snprintf() calls cleaner. */
|
|
|
#define uint unsigned int
|
|
|
|
|
@@ -590,7 +601,7 @@ SDL_AddEvent(SDL_Event * event)
|
|
|
SDL_EventQ.free = entry->next;
|
|
|
}
|
|
|
|
|
|
- if (SDL_DoEventLogging) {
|
|
|
+ if (SDL_EventLoggingVerbosity > 0) {
|
|
|
SDL_LogEvent(event);
|
|
|
}
|
|
|
|