Shift-Pause did not work because a PAUSE key press was not sending the proper sequence

This commit is contained in:
Pierre G. Bogossian 2017-07-09 15:32:24 +02:00
parent f616b2c1f9
commit ba94ac028d
2 changed files with 15 additions and 19 deletions

View File

@ -238,6 +238,7 @@ enum RDP_INPUT_DEVICE
/* Device flags */
#define KBD_FLAG_RIGHT 0x0001
#define KBD_FLAG_EXT 0x0100
#define KBD_FLAG_EXT1 0x0200
#define KBD_FLAG_QUIET 0x1000
#define KBD_FLAG_DOWN 0x4000
#define KBD_FLAG_UP 0x8000

View File

@ -667,28 +667,23 @@ handle_special_keys(uint32 keysym, unsigned int state, uint32 ev_time, RD_BOOL p
break;
case XK_Pause:
/* According to MS Keyboard Scan Code
Specification, pressing Pause should result
in E1 1D 45 E1 9D C5. I'm not exactly sure
of how this is supposed to be sent via
RDP. The code below seems to work, but with
the side effect that Left Ctrl stays
down. Therefore, we release it when Pause
is released. */
/* According to the RDP documentation (MS-RDPBCGR, page 164),
pressing Pause must result in:
CTRL (0x1D) DOWN with the KBDFLAGS_EXTENDED1 flag
NUMLOCK (0x45) DOWN
CTRL (0x1D) UP with the KBDFLAGS_EXTENDED1 flag
NUMLOCK (0x45) UP
*/
if (pressed)
{
rdp_send_input(ev_time, RDP_INPUT_SCANCODE, RDP_KEYPRESS, 0xe1, 0);
rdp_send_input(ev_time, RDP_INPUT_SCANCODE, RDP_KEYPRESS, 0x1d, 0);
rdp_send_input(ev_time, RDP_INPUT_SCANCODE, RDP_KEYPRESS, 0x45, 0);
rdp_send_input(ev_time, RDP_INPUT_SCANCODE, RDP_KEYPRESS, 0xe1, 0);
rdp_send_input(ev_time, RDP_INPUT_SCANCODE, RDP_KEYPRESS, 0x9d, 0);
rdp_send_input(ev_time, RDP_INPUT_SCANCODE, RDP_KEYPRESS, 0xc5, 0);
}
else
{
/* Release Left Ctrl */
rdp_send_input(ev_time, RDP_INPUT_SCANCODE, RDP_KEYPRESS | KBD_FLAG_EXT1,
0x1d, 0);
rdp_send_input(ev_time, RDP_INPUT_SCANCODE, RDP_KEYPRESS,
0x45, 0);
rdp_send_input(ev_time, RDP_INPUT_SCANCODE, RDP_KEYRELEASE | KBD_FLAG_EXT1,
0x1d, 0);
rdp_send_input(ev_time, RDP_INPUT_SCANCODE, RDP_KEYRELEASE,
0x1d, 0);
0x45, 0);
}
return True;
break;