summaryrefslogtreecommitdiff
path: root/util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'util.cpp')
-rw-r--r--util.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/util.cpp b/util.cpp
index dff3428..58116d0 100644
--- a/util.cpp
+++ b/util.cpp
@@ -1,6 +1,7 @@
#include "util.h"
#include <sstream>
+#include <algorithm>
using std::string;
@@ -15,3 +16,17 @@ std::vector<string> split (const string &s, char delim) {
return result;
}
+
+const string evNames[] = {"", "", "KeyPress", "KeyRelease", "ButtonPress", "ButtonRelease", "MotionNotify", "EnterNotify", "LeaveNotify", "FocusIn", "FocusOut", "KeymapNotify", "Expose", "GraphicsExpose", "NoExpose", "VisibilityNotify", "CreateNotify", "DestroyNotify", "UnmapNotify", "MapNotify", "MapRequest", "ReparentNotify", "ConfigureNotify", "ConfigureRequest", "GravityNotify", "ResizeRequest", "CirculateNotify", "CirculateRequest", "PropertyNotify", "SelectionClear", "SelectionRequest", "SelectionNotify", "ColormapNotify", "ClientMessage", "MappingNotify", "GenericEvent", "LASTEvent"};
+
+string getEventName(int e)
+{
+ return evNames[e];
+}
+
+string lowercase(string s)
+{
+ string s2 = s;
+ std::transform(s2.begin(), s2.end(), s2.begin(), [](unsigned char c){ return std::tolower(c); });
+ return s2;
+}