diff options
| author | BossCode45 <human.cyborg42@gmail.com> | 2023-08-24 12:58:40 +1200 |
|---|---|---|
| committer | BossCode45 <human.cyborg42@gmail.com> | 2023-08-24 12:58:40 +1200 |
| commit | 6b5c246a431dcaff119833724137f0716fa2a002 (patch) | |
| tree | 99ced8d93809cf675b55ea683f28f847e84d9722 /util.cpp | |
| parent | 87b7f6c47d8eab8bfe7f126652a88939aac58a6a (diff) | |
| parent | d22b5d2363ed8a90960446a209482180f6d27fc0 (diff) | |
| download | YATwm-6b5c246a431dcaff119833724137f0716fa2a002.tar.gz YATwm-6b5c246a431dcaff119833724137f0716fa2a002.zip | |
Merge branch 'keybind-refactor'
Diffstat (limited to 'util.cpp')
| -rw-r--r-- | util.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -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; +} |
