add unicode support

master
Jay Sorg 8 years ago
parent 42272c0f18
commit 2f8d3ba9da

@ -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

@ -872,9 +872,10 @@ xrdp_caps_send_demand_active(struct xrdp_rdp *self)
/* INPUT_FLAG_SCANCODES 0x0001
INPUT_FLAG_MOUSEX 0x0004
INPUT_FLAG_UNICODE 0x0010
INPUT_FLAG_FASTPATH_INPUT 0x0008
INPUT_FLAG_FASTPATH_INPUT2 0x0020 */
flags = 0x0001 | 0x0004;
flags = 0x0001 | 0x0004 | 0x0010;
if (self->client_info.use_fast_path & 2)
{
/* 0x0008 INPUT_FLAG_FASTPATH_INPUT */

@ -265,12 +265,30 @@ static int APP_CC
xrdp_fastpath_process_EVENT_UNICODE(struct xrdp_fastpath *self,
int eventFlags, struct stream *s)
{
if (!s_check_rem(s, 2))
{
return 1;
}
in_uint8s(s, 2);
return 0;
int flags;
int code;
flags = 0;
if (!s_check_rem(s, 2))
{
return 1;
}
in_uint16_le(s, code); /* keyCode (1 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,80 @@ 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 = 8; index < 256; index++)
{
if (unicode == self->keymap.keys_noshift[index].chr)
{
xrdp_wm_key(self, device_flags, index - 8);
return 0;
}
}
for (index = 8; index < 256; index++)
{
if (unicode == self->keymap.keys_shift[index].chr)
{
if (device_flags & KBD_FLAG_UP)
{
xrdp_wm_key(self, device_flags, index - 8);
xrdp_wm_key(self, KBD_FLAG_UP, 42);
}
else
{
xrdp_wm_key(self, KBD_FLAG_DOWN, 42);
xrdp_wm_key(self, device_flags, index - 8);
}
return 0;
}
}
for (index = 8; index < 256; index++)
{
if (unicode == self->keymap.keys_altgr[index].chr)
{
if (device_flags & KBD_FLAG_UP)
{
xrdp_wm_key(self, device_flags, index - 8);
xrdp_wm_key(self, KBD_FLAG_UP | KBD_FLAG_EXT, 56);
}
else
{
xrdp_wm_key(self, KBD_FLAG_DOWN | KBD_FLAG_EXT, 56);
xrdp_wm_key(self, device_flags, index - 8);
}
return 0;
}
}
for (index = 8; index < 256; index++)
{
if (unicode == self->keymap.keys_shiftaltgr[index].chr)
{
if (device_flags & KBD_FLAG_UP)
{
xrdp_wm_key(self, device_flags, index - 8);
xrdp_wm_key(self, KBD_FLAG_UP | KBD_FLAG_EXT, 56);
xrdp_wm_key(self, KBD_FLAG_UP, 42);
}
else
{
xrdp_wm_key(self, KBD_FLAG_DOWN, 42);
xrdp_wm_key(self, KBD_FLAG_DOWN | KBD_FLAG_EXT, 56);
xrdp_wm_key(self, device_flags, index - 8);
}
return 0;
}
}
return 0;
}
/*****************************************************************************/
int APP_CC
xrdp_wm_pu(struct xrdp_wm *self, struct xrdp_bitmap *control)
@ -1721,6 +1795,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