Added "localstate" support to keymapping: Send local modifier state. This fixes problems with Shift-Home etc
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@68 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
parent
b4e19ef71a
commit
df8c2e47ce
@ -249,6 +249,8 @@ enum RDP_INPUT_DEVICE
|
||||
#define MapNumLockMask (1<<8)
|
||||
#define MapCapsLockMask (1<<9)
|
||||
|
||||
#define MapLocalStateMask (1<<10)
|
||||
|
||||
#define MASK_ADD_BITS(var, mask) (var |= mask)
|
||||
#define MASK_REMOVE_BITS(var, mask) (var &= ~mask)
|
||||
#define MASK_HAS_BITS(var, mask) ((var & mask)>0)
|
||||
|
@ -39,6 +39,8 @@ would specify:
|
||||
|
||||
X 2d shift
|
||||
|
||||
If flags include "localstate", the modifier to send will be determined
|
||||
by the local modifier state.
|
||||
|
||||
Suggested X11 keysym mapping on PCs
|
||||
===================================
|
||||
|
@ -60,19 +60,19 @@ space 0x39
|
||||
#
|
||||
# Esc and Function keys
|
||||
#
|
||||
Escape 0x1
|
||||
F1 0x3b
|
||||
F2 0x3c
|
||||
F3 0x3d
|
||||
F4 0x3e
|
||||
F5 0x3f
|
||||
F6 0x40
|
||||
F7 0x41
|
||||
F8 0x42
|
||||
F9 0x43
|
||||
F10 0x44
|
||||
F11 0x57
|
||||
F12 0x58
|
||||
Escape 0x1 localstate
|
||||
F1 0x3b localstate
|
||||
F2 0x3c localstate
|
||||
F3 0x3d localstate
|
||||
F4 0x3e localstate
|
||||
F5 0x3f localstate
|
||||
F6 0x40 localstate
|
||||
F7 0x41 localstate
|
||||
F8 0x42 localstate
|
||||
F9 0x43 localstate
|
||||
F10 0x44 localstate
|
||||
F11 0x57 localstate
|
||||
F12 0x58 localstate
|
||||
|
||||
# Printscreen, Scrollock and Pause
|
||||
# Printscreen really requires four scancodes (0xe0, 0x2a, 0xe0, 0x37),
|
||||
@ -84,20 +84,20 @@ Scroll_Lock 0x46
|
||||
#
|
||||
# Insert - PgDown
|
||||
#
|
||||
Insert 0xd2
|
||||
Delete 0xd3
|
||||
Home 0xc7
|
||||
End 0xcf
|
||||
Page_Up 0xc9
|
||||
Page_Down 0xd1
|
||||
Insert 0xd2 localstate
|
||||
Delete 0xd3 localstate
|
||||
Home 0xc7 localstate
|
||||
End 0xcf localstate
|
||||
Page_Up 0xc9 localstate
|
||||
Page_Down 0xd1 localstate
|
||||
|
||||
#
|
||||
# Arrow keys
|
||||
#
|
||||
Left 0xcb
|
||||
Up 0xc8
|
||||
Down 0xd0
|
||||
Right 0xcd
|
||||
Left 0xcb localstate
|
||||
Up 0xc8 localstate
|
||||
Down 0xd0 localstate
|
||||
Right 0xcd localstate
|
||||
|
||||
#
|
||||
# Numpad
|
||||
|
@ -76,3 +76,4 @@ period 0x34
|
||||
colon 0x34 shift
|
||||
minus 0x35
|
||||
underscore 0x35 shift
|
||||
|
||||
|
3
proto.h
3
proto.h
@ -72,7 +72,8 @@ void tcp_disconnect(void);
|
||||
/* xkeymap.c */
|
||||
void xkeymap_init1(void);
|
||||
void xkeymap_init2(void);
|
||||
key_translation xkeymap_translate_key(KeySym keysym, unsigned int keycode);
|
||||
key_translation xkeymap_translate_key(KeySym keysym, unsigned int keycode,
|
||||
unsigned int state);
|
||||
uint16 xkeymap_translate_button(unsigned int button);
|
||||
char *get_ksname(KeySym keysym);
|
||||
BOOL inhibit_key(KeySym keysym);
|
||||
|
17
xkeymap.c
17
xkeymap.c
@ -163,6 +163,11 @@ xkeymap_read(char *mapname)
|
||||
MASK_ADD_BITS(modifiers, MapNumLockMask);
|
||||
}
|
||||
|
||||
if (strstr(line_rest, "localstate"))
|
||||
{
|
||||
MASK_ADD_BITS(modifiers, MapLocalStateMask);
|
||||
}
|
||||
|
||||
add_to_keymap(keyname, scancode, modifiers, mapname);
|
||||
|
||||
if (strstr(line_rest, "addupper"))
|
||||
@ -211,12 +216,22 @@ xkeymap_init2(void)
|
||||
|
||||
|
||||
key_translation
|
||||
xkeymap_translate_key(KeySym keysym, unsigned int keycode)
|
||||
xkeymap_translate_key(KeySym keysym, unsigned int keycode, unsigned int state)
|
||||
{
|
||||
key_translation tr = { 0, 0 };
|
||||
|
||||
tr = keymap[keysym & KEYMAP_MASK];
|
||||
|
||||
if (tr.modifiers & MapLocalStateMask)
|
||||
{
|
||||
/* The modifiers to send for this key should be obtained
|
||||
from the local state. Currently, only shift is implemented. */
|
||||
if (state & ShiftMask)
|
||||
{
|
||||
tr.modifiers = MapLeftShiftMask;
|
||||
}
|
||||
}
|
||||
|
||||
if (tr.scancode != 0)
|
||||
{
|
||||
DEBUG_KBD
|
||||
|
7
xwin.c
7
xwin.c
@ -456,7 +456,9 @@ xwin_process_events()
|
||||
|
||||
tr = xkeymap_translate_key(keysym,
|
||||
xevent.xkey.
|
||||
keycode);
|
||||
keycode,
|
||||
xevent.xkey.state);
|
||||
|
||||
ensure_remote_modifiers(ev_time, tr);
|
||||
|
||||
if (tr.scancode == 0)
|
||||
@ -479,7 +481,8 @@ xwin_process_events()
|
||||
|
||||
tr = xkeymap_translate_key(keysym,
|
||||
xevent.xkey.
|
||||
keycode);
|
||||
keycode,
|
||||
xevent.xkey.state);
|
||||
|
||||
if (tr.scancode == 0)
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user