Skip to content

Commit

Permalink
Include key code for fake key events
Browse files Browse the repository at this point in the history
Let's try to mimic a real event as much as possible to avoid bugs.

(cherry picked from commit 6111c05)
  • Loading branch information
CendioOssman authored and LMattsson committed Oct 18, 2024
1 parent 4b859ca commit 0db0c3d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions common/rfb/VNCSConnectionST.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -496,12 +496,12 @@ class VNCSConnectionSTShiftPresser {
~VNCSConnectionSTShiftPresser() {
if (pressed) {
vlog.debug("Releasing fake Shift_L");
server->keyEvent(XK_Shift_L, 0, false);
server->keyEvent(XK_Shift_L, 0x2a, false);
}
}
void press() {
vlog.debug("Pressing fake Shift_L");
server->keyEvent(XK_Shift_L, 0, true);
server->keyEvent(XK_Shift_L, 0x2a, true);
pressed = true;
}
VNCServerST* server;
Expand Down Expand Up @@ -550,8 +550,8 @@ void VNCSConnectionST::keyEvent(uint32_t keysym, uint32_t keycode, bool down) {

if (lock == (uppercase == shift)) {
vlog.debug("Inserting fake CapsLock to get in sync with client");
server->keyEvent(XK_Caps_Lock, 0, true);
server->keyEvent(XK_Caps_Lock, 0, false);
server->keyEvent(XK_Caps_Lock, 0x3a, true);
server->keyEvent(XK_Caps_Lock, 0x3a, false);
}
}

Expand Down Expand Up @@ -580,8 +580,8 @@ void VNCSConnectionST::keyEvent(uint32_t keysym, uint32_t keycode, bool down) {
//
} else if (lock == (number == shift)) {
vlog.debug("Inserting fake NumLock to get in sync with client");
server->keyEvent(XK_Num_Lock, 0, true);
server->keyEvent(XK_Num_Lock, 0, false);
server->keyEvent(XK_Num_Lock, 0x45, true);
server->keyEvent(XK_Num_Lock, 0x45, false);
}
}
}
Expand Down

0 comments on commit 0db0c3d

Please sign in to comment.