From 6111c0587aec6ea4700a91a460c7027572ab5011 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Sat, 25 Feb 2023 15:32:24 +0100 Subject: [PATCH] Include key code for fake key events Let's try to mimic a real event as much as possible to avoid bugs. --- common/rfb/VNCSConnectionST.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/common/rfb/VNCSConnectionST.cxx b/common/rfb/VNCSConnectionST.cxx index bc036004..88deff8c 100644 --- a/common/rfb/VNCSConnectionST.cxx +++ b/common/rfb/VNCSConnectionST.cxx @@ -496,12 +496,12 @@ public: ~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; @@ -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); } } @@ -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); } } } -- 2.39.5