diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2017-03-23 22:46:35 +0100 |
---|---|---|
committer | Ulrich Sibiller <uli42@gmx.de> | 2017-04-03 21:28:11 +0200 |
commit | 79520f9c614d40f0e7d92a43241b1043ef240f5d (patch) | |
tree | bf9e090d776a8fb5c993eb9fa5951163f365d911 /nx-X11/programs/Xserver/hw | |
parent | a45a348c44d5c39e8b8de3289f764f4ab397dff7 (diff) | |
download | nx-libs-79520f9c614d40f0e7d92a43241b1043ef240f5d.tar.gz nx-libs-79520f9c614d40f0e7d92a43241b1043ef240f5d.tar.bz2 nx-libs-79520f9c614d40f0e7d92a43241b1043ef240f5d.zip |
Keystroke.c: introduce nxagentDumpKeystrokes()
Diffstat (limited to 'nx-X11/programs/Xserver/hw')
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Keystroke.c | 34 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Keystroke.h | 1 |
2 files changed, 35 insertions, 0 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c index f6b3e420c..c66d6cc91 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c @@ -36,6 +36,7 @@ #include "Keyboard.h" #include "Drawable.h" #include "Init.h" /* extern int nxagentX2go */ +#include "Utils.h" #include <unistd.h> @@ -433,6 +434,39 @@ static void parse_keystroke_file(Bool force) free(filename); filename = NULL; } + + nxagentDumpKeystrokes(); +} + +void nxagentDumpKeystrokes(void) +{ + int maxlen = 0; + for (int i = 0; nxagentSpecialKeystrokeNames[i]; i++) + maxlen = MAX(maxlen, strlen(nxagentSpecialKeystrokeNames[i])); + + fprintf(stderr, "Current known keystrokes:\n"); + + for (struct nxagentSpecialKeystrokeMap *cur = map; cur->stroke != KEYSTROKE_END_MARKER; cur++) { + unsigned int mask = cur->modifierMask; + fprintf(stderr, " %-*s ", maxlen, nxagentSpecialKeystrokeNames[cur->stroke]); + if (mask & ControlMask) {fprintf(stderr, "Ctrl+"); mask &= ~ControlMask;} + if (mask & ShiftMask) {fprintf(stderr, "Shift+"); mask &= ~ShiftMask;} + + /* these are only here for better readable modifier + names. Normally they are covered by the Mod<n> and Lock lines + below */ + if (cur->modifierAltMeta) {fprintf(stderr, "Alt+"); mask &= ~(cur->modifierAltMeta);} + if (mask & nxagentCapsMask) {fprintf(stderr, "CapsLock+"); mask &= ~nxagentCapsMask;} + if (mask & nxagentNumlockMask) {fprintf(stderr, "NumLock+"); mask &= ~nxagentNumlockMask;} + + if (mask & Mod1Mask) {fprintf(stderr, "Mod1+"); mask &= ~Mod1Mask;} + if (mask & Mod2Mask) {fprintf(stderr, "Mod2+"); mask &= ~Mod2Mask;} + if (mask & Mod3Mask) {fprintf(stderr, "Mod3+"); mask &= ~Mod3Mask;} + if (mask & Mod4Mask) {fprintf(stderr, "Mod4+"); mask &= ~Mod4Mask;} + if (mask & Mod5Mask) {fprintf(stderr, "Mod5+"); mask &= ~Mod5Mask;} + if (mask & LockMask) {fprintf(stderr, "Lock+"); mask &= ~LockMask;} + fprintf(stderr, "%s\n", XKeysymToString(cur->keysym)); + } } static enum nxagentSpecialKeystroke find_keystroke(XKeyEvent *X) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.h b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.h index caf72f78c..777540aa0 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.h @@ -29,6 +29,7 @@ #include "Events.h" extern Bool nxagentCheckSpecialKeystroke(XKeyEvent*, enum HandleEventResult*); +extern void nxagentDumpKeystrokes(void); /* keep this sorted, do not rely on any numerical value in this enum, and be aware * that KEYSTROKE_MAX may be used in a malloc */ |