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 MapNumLockMask (1<<8)
|
||||||
#define MapCapsLockMask (1<<9)
|
#define MapCapsLockMask (1<<9)
|
||||||
|
|
||||||
|
#define MapLocalStateMask (1<<10)
|
||||||
|
|
||||||
#define MASK_ADD_BITS(var, mask) (var |= mask)
|
#define MASK_ADD_BITS(var, mask) (var |= mask)
|
||||||
#define MASK_REMOVE_BITS(var, mask) (var &= ~mask)
|
#define MASK_REMOVE_BITS(var, mask) (var &= ~mask)
|
||||||
#define MASK_HAS_BITS(var, mask) ((var & mask)>0)
|
#define MASK_HAS_BITS(var, mask) ((var & mask)>0)
|
||||||
|
@ -39,6 +39,8 @@ would specify:
|
|||||||
|
|
||||||
X 2d shift
|
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
|
Suggested X11 keysym mapping on PCs
|
||||||
===================================
|
===================================
|
||||||
|
@ -60,19 +60,19 @@ space 0x39
|
|||||||
#
|
#
|
||||||
# Esc and Function keys
|
# Esc and Function keys
|
||||||
#
|
#
|
||||||
Escape 0x1
|
Escape 0x1 localstate
|
||||||
F1 0x3b
|
F1 0x3b localstate
|
||||||
F2 0x3c
|
F2 0x3c localstate
|
||||||
F3 0x3d
|
F3 0x3d localstate
|
||||||
F4 0x3e
|
F4 0x3e localstate
|
||||||
F5 0x3f
|
F5 0x3f localstate
|
||||||
F6 0x40
|
F6 0x40 localstate
|
||||||
F7 0x41
|
F7 0x41 localstate
|
||||||
F8 0x42
|
F8 0x42 localstate
|
||||||
F9 0x43
|
F9 0x43 localstate
|
||||||
F10 0x44
|
F10 0x44 localstate
|
||||||
F11 0x57
|
F11 0x57 localstate
|
||||||
F12 0x58
|
F12 0x58 localstate
|
||||||
|
|
||||||
# Printscreen, Scrollock and Pause
|
# Printscreen, Scrollock and Pause
|
||||||
# Printscreen really requires four scancodes (0xe0, 0x2a, 0xe0, 0x37),
|
# Printscreen really requires four scancodes (0xe0, 0x2a, 0xe0, 0x37),
|
||||||
@ -84,20 +84,20 @@ Scroll_Lock 0x46
|
|||||||
#
|
#
|
||||||
# Insert - PgDown
|
# Insert - PgDown
|
||||||
#
|
#
|
||||||
Insert 0xd2
|
Insert 0xd2 localstate
|
||||||
Delete 0xd3
|
Delete 0xd3 localstate
|
||||||
Home 0xc7
|
Home 0xc7 localstate
|
||||||
End 0xcf
|
End 0xcf localstate
|
||||||
Page_Up 0xc9
|
Page_Up 0xc9 localstate
|
||||||
Page_Down 0xd1
|
Page_Down 0xd1 localstate
|
||||||
|
|
||||||
#
|
#
|
||||||
# Arrow keys
|
# Arrow keys
|
||||||
#
|
#
|
||||||
Left 0xcb
|
Left 0xcb localstate
|
||||||
Up 0xc8
|
Up 0xc8 localstate
|
||||||
Down 0xd0
|
Down 0xd0 localstate
|
||||||
Right 0xcd
|
Right 0xcd localstate
|
||||||
|
|
||||||
#
|
#
|
||||||
# Numpad
|
# Numpad
|
||||||
|
@ -76,3 +76,4 @@ period 0x34
|
|||||||
colon 0x34 shift
|
colon 0x34 shift
|
||||||
minus 0x35
|
minus 0x35
|
||||||
underscore 0x35 shift
|
underscore 0x35 shift
|
||||||
|
|
||||||
|
3
proto.h
3
proto.h
@ -72,7 +72,8 @@ void tcp_disconnect(void);
|
|||||||
/* xkeymap.c */
|
/* xkeymap.c */
|
||||||
void xkeymap_init1(void);
|
void xkeymap_init1(void);
|
||||||
void xkeymap_init2(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);
|
uint16 xkeymap_translate_button(unsigned int button);
|
||||||
char *get_ksname(KeySym keysym);
|
char *get_ksname(KeySym keysym);
|
||||||
BOOL inhibit_key(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);
|
MASK_ADD_BITS(modifiers, MapNumLockMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strstr(line_rest, "localstate"))
|
||||||
|
{
|
||||||
|
MASK_ADD_BITS(modifiers, MapLocalStateMask);
|
||||||
|
}
|
||||||
|
|
||||||
add_to_keymap(keyname, scancode, modifiers, mapname);
|
add_to_keymap(keyname, scancode, modifiers, mapname);
|
||||||
|
|
||||||
if (strstr(line_rest, "addupper"))
|
if (strstr(line_rest, "addupper"))
|
||||||
@ -211,12 +216,22 @@ xkeymap_init2(void)
|
|||||||
|
|
||||||
|
|
||||||
key_translation
|
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 };
|
key_translation tr = { 0, 0 };
|
||||||
|
|
||||||
tr = keymap[keysym & KEYMAP_MASK];
|
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)
|
if (tr.scancode != 0)
|
||||||
{
|
{
|
||||||
DEBUG_KBD
|
DEBUG_KBD
|
||||||
|
7
xwin.c
7
xwin.c
@ -456,7 +456,9 @@ xwin_process_events()
|
|||||||
|
|
||||||
tr = xkeymap_translate_key(keysym,
|
tr = xkeymap_translate_key(keysym,
|
||||||
xevent.xkey.
|
xevent.xkey.
|
||||||
keycode);
|
keycode,
|
||||||
|
xevent.xkey.state);
|
||||||
|
|
||||||
ensure_remote_modifiers(ev_time, tr);
|
ensure_remote_modifiers(ev_time, tr);
|
||||||
|
|
||||||
if (tr.scancode == 0)
|
if (tr.scancode == 0)
|
||||||
@ -479,7 +481,8 @@ xwin_process_events()
|
|||||||
|
|
||||||
tr = xkeymap_translate_key(keysym,
|
tr = xkeymap_translate_key(keysym,
|
||||||
xevent.xkey.
|
xevent.xkey.
|
||||||
keycode);
|
keycode,
|
||||||
|
xevent.xkey.state);
|
||||||
|
|
||||||
if (tr.scancode == 0)
|
if (tr.scancode == 0)
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user