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/SMsgWriter.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/SMsgWriter.cxx')
-rw-r--r-- | common/rfb/SMsgWriter.cxx | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/common/rfb/SMsgWriter.cxx b/common/rfb/SMsgWriter.cxx index d8adfbc1..2d4998b3 100644 --- a/common/rfb/SMsgWriter.cxx +++ b/common/rfb/SMsgWriter.cxx @@ -39,7 +39,7 @@ SMsgWriter::SMsgWriter(ConnParams* cp_, rdr::OutStream* os_) needSetDesktopSize(false), needExtendedDesktopSize(false), needSetDesktopName(false), needSetCursor(false), needSetXCursor(false), needSetCursorWithAlpha(false), - needLEDState(false) + needLEDState(false), needQEMUKeyEvent(false) { } @@ -207,6 +207,16 @@ bool SMsgWriter::writeLEDState() return true; } +bool SMsgWriter::writeQEMUKeyEvent() +{ + if (!cp->supportsQEMUKeyEvent) + return false; + + needQEMUKeyEvent = true; + + return true; +} + bool SMsgWriter::needFakeUpdate() { if (needSetDesktopName) @@ -215,6 +225,8 @@ bool SMsgWriter::needFakeUpdate() return true; if (needLEDState) return true; + if (needQEMUKeyEvent) + return true; if (needNoDataUpdate()) return true; @@ -265,6 +277,8 @@ void SMsgWriter::writeFramebufferUpdateStart(int nRects) nRects++; if (needLEDState) nRects++; + if (needQEMUKeyEvent) + nRects++; } os->writeU16(nRects); @@ -385,6 +399,11 @@ void SMsgWriter::writePseudoRects() writeLEDStateRect(cp->ledState()); needLEDState = false; } + + if (needQEMUKeyEvent) { + writeQEMUKeyEventRect(); + needQEMUKeyEvent = false; + } } void SMsgWriter::writeNoDataRects() @@ -565,3 +584,17 @@ void SMsgWriter::writeLEDStateRect(rdr::U8 state) os->writeU32(pseudoEncodingLEDState); os->writeU8(state); } + +void SMsgWriter::writeQEMUKeyEventRect() +{ + if (!cp->supportsQEMUKeyEvent) + throw Exception("Client does not support QEMU extended key events"); + if (++nRectsInUpdate > nRectsInHeader && nRectsInHeader) + throw Exception("SMsgWriter::writeQEMUKeyEventRect: nRects out of sync"); + + os->writeS16(0); + os->writeS16(0); + os->writeU16(0); + os->writeU16(0); + os->writeU32(pseudoEncodingQEMUKeyEvent); +} |