summaryrefslogtreecommitdiff
path: root/src/eventsmanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-09-09 00:45:03 +0300
committerAndrei Karas <akaras@inbox.ru>2017-09-09 00:45:03 +0300
commitaf5cdf2f017a012bfc2ea4a5157607f12ce76ce9 (patch)
tree32da3eeb415f01c40d87132bf1546e2e1ab74b38 /src/eventsmanager.cpp
parent13f1cb248d227d25901ed222109b552e2068b073 (diff)
downloadmanaplus-af5cdf2f017a012bfc2ea4a5157607f12ce76ce9.tar.gz
manaplus-af5cdf2f017a012bfc2ea4a5157607f12ce76ce9.tar.bz2
manaplus-af5cdf2f017a012bfc2ea4a5157607f12ce76ce9.tar.xz
manaplus-af5cdf2f017a012bfc2ea4a5157607f12ce76ce9.zip
Add logging wm events for SDL2.
Diffstat (limited to 'src/eventsmanager.cpp')
-rw-r--r--src/eventsmanager.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/eventsmanager.cpp b/src/eventsmanager.cpp
index 36c6e2d23..9a4c8b0f2 100644
--- a/src/eventsmanager.cpp
+++ b/src/eventsmanager.cpp
@@ -38,6 +38,8 @@
#include "input/inputmanager.h"
#ifdef USE_SDL2
+#include "utils/x11logger.h"
+
#include "render/graphics.h"
#else // USE_SDL2
#include "logger.h"
@@ -67,6 +69,17 @@ void EventsManager::init()
config.addListener("logInput", this);
}
+void EventsManager::enableEvents()
+{
+ // disable unused SDL events
+#ifndef USE_SDL2
+ SDL_EventState(SDL_VIDEOEXPOSE, SDL_IGNORE);
+#endif // USE_SDL2
+
+ SDL_EventState(SDL_SYSWMEVENT, mLogInput ? SDL_ENABLE : SDL_IGNORE);
+ SDL_EventState(SDL_USEREVENT, SDL_IGNORE);
+}
+
void EventsManager::shutdown()
{
config.removeListeners(this);
@@ -435,8 +448,23 @@ void EventsManager::logEvent(const SDL_Event &event)
logger->log("event: SDL_QUIT");
break;
case SDL_SYSWMEVENT:
+ {
+#ifdef USE_SDL2
+ bool res = false;
+#ifdef USE_X11
+ res = X11Logger::logEvent(event);
+#endif // USE_X11
+
+ if (res == false)
+ logger->assertLog("event: SDL_SYSWMEVENT: not supported:");
+ break;
+#else // USE_SDL2
+
logger->log("event: SDL_SYSWMEVENT");
+#endif // USE_SDL2
+
break;
+ }
case SDL_USEREVENT:
logger->log("event: SDL_USEREVENT");
break;