summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2015-08-31 10:01:14 +0200
committerPierre Ossman <ossman@cendio.se>2015-08-31 10:01:14 +0200
commit9a153b0a7ad6e0bdf709142e2feb60ac74a4b44c (patch)
tree106a83ec2a509d3d8e18dd3940dc8ed2fb01104f
parent6b9a0b70da7867418d896eb48ca274c90a63ef42 (diff)
downloadtigervnc-9a153b0a7ad6e0bdf709142e2feb60ac74a4b44c.tar.gz
tigervnc-9a153b0a7ad6e0bdf709142e2feb60ac74a4b44c.zip
Add keyboard debug log to servers
Makes it easier to troubleshoot keyboard issues by printing exactly what key events the server is getting from the client.
-rw-r--r--common/rfb/VNCSConnectionST.cxx25
1 files changed, 21 insertions, 4 deletions
diff --git a/common/rfb/VNCSConnectionST.cxx b/common/rfb/VNCSConnectionST.cxx
index 49975cbf..932f5796 100644
--- a/common/rfb/VNCSConnectionST.cxx
+++ b/common/rfb/VNCSConnectionST.cxx
@@ -100,8 +100,10 @@ VNCSConnectionST::~VNCSConnectionST()
// Release any keys the client still had pressed
std::set<rdr::U32>::iterator i;
- for (i=pressedKeys.begin(); i!=pressedKeys.end(); i++)
+ for (i=pressedKeys.begin(); i!=pressedKeys.end(); i++) {
+ vlog.debug("Releasing key 0x%x on client disconnect", *i);
server->desktop->keyEvent(*i, false);
+ }
if (server->pointerClient == this)
server->pointerClient = 0;
@@ -499,9 +501,13 @@ public:
VNCSConnectionSTShiftPresser(SDesktop* desktop_)
: desktop(desktop_), pressed(false) {}
~VNCSConnectionSTShiftPresser() {
- if (pressed) { desktop->keyEvent(XK_Shift_L, false); }
+ if (pressed) {
+ vlog.debug("Releasing fake Shift_L");
+ desktop->keyEvent(XK_Shift_L, false);
+ }
}
void press() {
+ vlog.debug("Pressing fake Shift_L");
desktop->keyEvent(XK_Shift_L, true);
pressed = true;
}
@@ -517,9 +523,20 @@ void VNCSConnectionST::keyEvent(rdr::U32 key, bool down) {
if (!(accessRights & AccessKeyEvents)) return;
if (!rfb::Server::acceptKeyEvents) return;
+ if (down)
+ vlog.debug("Key pressed: 0x%x", key);
+ else
+ vlog.debug("Key released: 0x%x", key);
+
// Remap the key if required
- if (server->keyRemapper)
- key = server->keyRemapper->remapKey(key);
+ if (server->keyRemapper) {
+ rdr::U32 newkey;
+ newkey = server->keyRemapper->remapKey(key);
+ if (newkey != key) {
+ vlog.debug("Key remapped to 0x%x", newkey);
+ key = newkey;
+ }
+ }
// Turn ISO_Left_Tab into shifted Tab.
VNCSConnectionSTShiftPresser shiftPresser(server->desktop);