From 2733e47af7d8f2e7a9f28594bc09f72b224ba813 Mon Sep 17 00:00:00 2001 From: Sibbi <> Date: Fri, 25 Jan 2013 16:52:23 +0100 Subject: [PATCH] Add modifiers to X11 remote key names. --- video.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/video.c b/video.c index 8df0e78..ef83fb0 100644 --- a/video.c +++ b/video.c @@ -9302,7 +9302,8 @@ static void VideoEvent(void) { XEvent event; KeySym keysym; - char buf[32]; + const char *keynam; + char buf[64]; uint32_t values[1]; XNextEvent(XlibDisplay, &event); @@ -9343,7 +9344,21 @@ static void VideoEvent(void) event.xkey.keycode); break; } - FeedKeyPress("XKeySym", XKeysymToString(keysym), 0, 0); + keynam = XKeysymToString(keysym); + // check for key modifiers (Alt/Ctrl) + if (event.xkey.state & (Mod1Mask | ControlMask)) { + if (event.xkey.state & Mod1Mask) { + strcpy(buf, "Alt+"); + } else { + buf[0] = '\0'; + } + if (event.xkey.state & ControlMask) { + strcat(buf, "Ctrl+"); + } + strncat(buf, keynam, sizeof(buf) - 10); + keynam = buf; + } + FeedKeyPress("XKeySym", keynam, 0, 0); break; case KeyRelease: break;