diff options
author | Pierre Ossman <ossman@cendio.se> | 2017-05-16 14:30:38 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2017-08-28 13:54:30 +0200 |
commit | 5ae282135f982505fab655d4f597e7329fb8b0d1 (patch) | |
tree | fe4b2315735c1db49be288fee04dcb4674296364 /common/rfb/SMsgReader.cxx | |
parent | c719e4a0c9e1e3e5b7d22aa42cdaedda3cb06803 (diff) | |
download | tigervnc-5ae282135f982505fab655d4f597e7329fb8b0d1.tar.gz tigervnc-5ae282135f982505fab655d4f597e7329fb8b0d1.zip |
Basic support for QEMU Extended Key Events
This adds the basic infrastructure and handshake for the QEMU
Extended Key Events extension. No viewer or server makes use of
the extra functionality yet though.
Diffstat (limited to 'common/rfb/SMsgReader.cxx')
-rw-r--r-- | common/rfb/SMsgReader.cxx | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/common/rfb/SMsgReader.cxx b/common/rfb/SMsgReader.cxx index 3c08fd6f..cb71ac84 100644 --- a/common/rfb/SMsgReader.cxx +++ b/common/rfb/SMsgReader.cxx @@ -19,6 +19,7 @@ #include <stdio.h> #include <rdr/InStream.h> #include <rfb/msgTypes.h> +#include <rfb/qemuTypes.h> #include <rfb/Exception.h> #include <rfb/util.h> #include <rfb/SMsgHandler.h> @@ -78,6 +79,9 @@ void SMsgReader::readMsg() case msgTypeClientCutText: readClientCutText(); break; + case msgTypeQEMUClientMessage: + readQEMUMessage(); + break; default: fprintf(stderr, "unknown message type %d\n", msgType); throw Exception("unknown message type"); @@ -184,7 +188,7 @@ void SMsgReader::readKeyEvent() bool down = is->readU8(); is->skip(2); rdr::U32 key = is->readU32(); - handler->keyEvent(key, down); + handler->keyEvent(key, 0, down); } void SMsgReader::readPointerEvent() @@ -214,3 +218,26 @@ void SMsgReader::readClientCutText() handler->clientCutText(ca.buf, len); } +void SMsgReader::readQEMUMessage() +{ + int subType = is->readU8(); + switch (subType) { + case qemuExtendedKeyEvent: + readQEMUKeyEvent(); + break; + default: + throw Exception("unknown QEMU submessage type %d", subType); + } +} + +void SMsgReader::readQEMUKeyEvent() +{ + bool down = is->readU16(); + rdr::U32 keysym = is->readU32(); + rdr::U32 keycode = is->readU32(); + if (!keycode) { + vlog.error("Key event without keycode - ignoring"); + return; + } + handler->keyEvent(keysym, keycode, down); +} |