Skip to content

Commit

Permalink
TEMP: low level keyboard events debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
CendioOssman committed Dec 8, 2024
1 parent 476c170 commit 4991df3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions vncviewer/KeyboardMacOS.mm
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@
systemKeyCode);
}

vlog.debug("%d / 0x%02x => 0x%04x", systemKeyCode, modifiers, keySym);

handler->handleKeyPress(systemKeyCode, keyCode, keySym);

// We don't get any release events for CapsLock, so we have to
Expand Down Expand Up @@ -217,6 +219,8 @@
if (iter != keySyms.end())
continue;

vlog.debug("%d / 0x%02x => 0x%04x", systemKeyCode, mods, ks);

keySyms.push_back(ks);
}

Expand All @@ -232,6 +236,7 @@
if (iter != keySyms.end())
continue;

vlog.debug("%d / 0x%02x => 0x%04x", systemKeyCode, mods, ks);
keySyms.push_back(ks);
}

Expand Down
6 changes: 6 additions & 0 deletions vncviewer/KeyboardWin32.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,8 @@ std::list<uint32_t> KeyboardWin32::translateToKeySyms(int systemKeyCode)
if (ks != NoSymbol)
keySyms.push_back(ks);

vlog.debug("%d / 0x%x => 0x%02x %s => 0x%04x", systemKeyCode, 0, vkey, extended ? "(extended)" : "", ks);

// Next just a single modifier at a time
for (mods = 1; mods < 16; mods <<= 1) {
std::list<uint32_t>::const_iterator iter;
Expand All @@ -421,6 +423,8 @@ std::list<uint32_t> KeyboardWin32::translateToKeySyms(int systemKeyCode)
if (ks == NoSymbol)
continue;

vlog.debug("%d / 0x%x => 0x%02x %s => 0x%04x", systemKeyCode, mods, vkey, extended ? "(extended)" : "", ks);

iter = std::find(keySyms.begin(), keySyms.end(), ks);
if (iter != keySyms.end())
continue;
Expand Down Expand Up @@ -448,6 +452,8 @@ std::list<uint32_t> KeyboardWin32::translateToKeySyms(int systemKeyCode)
if (ks == NoSymbol)
continue;

vlog.debug("%d / 0x%x => 0x%02x %s => 0x%04x", systemKeyCode, mods, vkey, extended ? "(extended)" : "", ks);

iter = std::find(keySyms.begin(), keySyms.end(), ks);
if (iter != keySyms.end())
continue;
Expand Down
3 changes: 3 additions & 0 deletions vncviewer/KeyboardX11.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -279,5 +279,8 @@ void KeyboardX11::translateToKeySyms(int systemKeyCode,
if (iter != keySyms->end())
return;

vlog.debug("%d / %d / 0x%02x => 0x%04x", systemKeyCode,
(int)group, (int)mods, (int)ks);

keySyms->push_back(ks);
}
4 changes: 4 additions & 0 deletions vncviewer/Viewport.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,10 @@ void Viewport::handleKeyPress(int systemKeyCode,
// just the current one
keySyms = keyboard->translateToKeySyms(systemKeyCode);

vlog.debug("Hot key %d / 0x%04x:", systemKeyCode, keyCode);
for (iter = keySyms.begin(); iter != keySyms.end(); iter++)
vlog.debug("%s (0x%04x)", KeySymName(*iter), *iter);

// Then we pick the one that matches first
keySym = NoSymbol;
for (iter = keySyms.begin(); iter != keySyms.end(); iter++) {
Expand Down

0 comments on commit 4991df3

Please sign in to comment.