Merge pull request #536 from jsorg71/unicode

add unicode support
master
jsorg71 8 years ago committed by GitHub
commit 5966de4ee2

@ -160,6 +160,7 @@
#define RDP_INPUT_CODEPOINT 1
#define RDP_INPUT_VIRTKEY 2
#define RDP_INPUT_SCANCODE 4
#define RDP_INPUT_UNICODE 5
#define RDP_INPUT_MOUSE 0x8001
#define RDP_INPUT_MOUSEX 0x8002
@ -622,4 +623,10 @@
#define XRDP_MAX_BITMAP_CACHE_IDX 2000
#define XRDP_BITMAP_CACHE_ENTRIES 2048
#define XR_MIN_KEY_CODE 8
#define XR_MAX_KEY_CODE 256
#define XR_RDP_SCAN_LSHIFT 42
#define XR_RDP_SCAN_ALT 56
#endif

@ -872,16 +872,10 @@ xrdp_caps_send_demand_active(struct xrdp_rdp *self)
out_uint16_le(s, RDP_CAPSET_INPUT); /* 13(0xd) */
out_uint16_le(s, RDP_CAPLEN_INPUT); /* 88(0x58) */
/* INPUT_FLAG_SCANCODES 0x0001
INPUT_FLAG_MOUSEX 0x0004
INPUT_FLAG_FASTPATH_INPUT 0x0008
INPUT_FLAG_FASTPATH_INPUT2 0x0020 */
flags = 0x0001 | 0x0004;
flags = INPUT_FLAG_SCANCODES | INPUT_FLAG_MOUSEX | INPUT_FLAG_UNICODE;
if (self->client_info.use_fast_path & 2)
{
/* 0x0008 INPUT_FLAG_FASTPATH_INPUT */
/* 0x0020 INPUT_FLAG_FASTPATH_INPUT2 */
flags |= 0x0008 | 0x0020;
flags |= INPUT_FLAG_FASTPATH_INPUT | INPUT_FLAG_FASTPATH_INPUT2;
}
out_uint16_le(s, flags);
out_uint8s(s, 82);

@ -265,11 +265,29 @@ static int APP_CC
xrdp_fastpath_process_EVENT_UNICODE(struct xrdp_fastpath *self,
int eventFlags, struct stream *s)
{
int flags;
int code;
flags = 0;
if (!s_check_rem(s, 2))
{
return 1;
}
in_uint8s(s, 2);
in_uint16_le(s, code); /* unicode (2 byte) */
if (eventFlags & FASTPATH_INPUT_KBDFLAGS_RELEASE)
{
flags |= KBD_FLAG_UP;
}
else
{
flags |= KBD_FLAG_DOWN;
}
if (eventFlags & FASTPATH_INPUT_KBDFLAGS_EXTENDED)
{
flags |= KBD_FLAG_EXT;
}
xrdp_fastpath_session_callback(self, RDP_INPUT_UNICODE,
code, 0, flags, 0);
return 0;
}

@ -1525,6 +1525,83 @@ xrdp_wm_key_sync(struct xrdp_wm *self, int device_flags, int key_flags)
return 0;
}
/*****************************************************************************/
int APP_CC
xrdp_wm_key_unicode(struct xrdp_wm *self, int device_flags, int unicode)
{
int index;
for (index = XR_MIN_KEY_CODE; index < XR_MAX_KEY_CODE; index++)
{
if (unicode == self->keymap.keys_noshift[index].chr)
{
xrdp_wm_key(self, device_flags, index - XR_MIN_KEY_CODE);
return 0;
}
}
for (index = XR_MIN_KEY_CODE; index < XR_MAX_KEY_CODE; index++)
{
if (unicode == self->keymap.keys_shift[index].chr)
{
if (device_flags & KBD_FLAG_UP)
{
xrdp_wm_key(self, device_flags, index - XR_MIN_KEY_CODE);
xrdp_wm_key(self, KBD_FLAG_UP, XR_RDP_SCAN_LSHIFT);
}
else
{
xrdp_wm_key(self, KBD_FLAG_DOWN, XR_RDP_SCAN_LSHIFT);
xrdp_wm_key(self, device_flags, index - XR_MIN_KEY_CODE);
}
return 0;
}
}
for (index = XR_MIN_KEY_CODE; index < XR_MAX_KEY_CODE; index++)
{
if (unicode == self->keymap.keys_altgr[index].chr)
{
if (device_flags & KBD_FLAG_UP)
{
xrdp_wm_key(self, device_flags, index - XR_MIN_KEY_CODE);
xrdp_wm_key(self, KBD_FLAG_UP | KBD_FLAG_EXT,
XR_RDP_SCAN_ALT);
}
else
{
xrdp_wm_key(self, KBD_FLAG_DOWN | KBD_FLAG_EXT,
XR_RDP_SCAN_ALT);
xrdp_wm_key(self, device_flags, index - XR_MIN_KEY_CODE);
}
return 0;
}
}
for (index = XR_MIN_KEY_CODE; index < XR_MAX_KEY_CODE; index++)
{
if (unicode == self->keymap.keys_shiftaltgr[index].chr)
{
if (device_flags & KBD_FLAG_UP)
{
xrdp_wm_key(self, device_flags, index - XR_MIN_KEY_CODE);
xrdp_wm_key(self, KBD_FLAG_UP | KBD_FLAG_EXT, XR_RDP_SCAN_ALT);
xrdp_wm_key(self, KBD_FLAG_UP, XR_RDP_SCAN_LSHIFT);
}
else
{
xrdp_wm_key(self, KBD_FLAG_DOWN, XR_RDP_SCAN_LSHIFT);
xrdp_wm_key(self, KBD_FLAG_DOWN | KBD_FLAG_EXT,
XR_RDP_SCAN_ALT);
xrdp_wm_key(self, device_flags, index - XR_MIN_KEY_CODE);
}
return 0;
}
}
return 0;
}
/*****************************************************************************/
int APP_CC
xrdp_wm_pu(struct xrdp_wm *self, struct xrdp_bitmap *control)
@ -1721,6 +1798,9 @@ callback(long id, int msg, long param1, long param2, long param3, long param4)
case 4: /* RDP_INPUT_SCANCODE */
rv = xrdp_wm_key(wm, param3, param1);
break;
case 5: /* RDP_INPUT_UNICODE */
rv = xrdp_wm_key_unicode(wm, param3, param1);
break;
case 0x8001: /* RDP_INPUT_MOUSE */
rv = xrdp_wm_process_input_mouse(wm, param3, param1, param2);
break;

Loading…
Cancel
Save