summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Sorg <jay.sorg@gmail.com>2016-12-10 01:06:45 -0800
committerJay Sorg <jay.sorg@gmail.com>2016-12-10 01:06:45 -0800
commitc264862afe5ef3b21f0774bc108782fbc68bede3 (patch)
tree21b02d70bbec46640ff858d0edd8aff857acab31
parent7a1a481ff997d64028de6f0cdc5ab6b42b28f91d (diff)
downloadxrdp-proprietary-c264862afe5ef3b21f0774bc108782fbc68bede3.tar.gz
xrdp-proprietary-c264862afe5ef3b21f0774bc108782fbc68bede3.zip
change some magics to defines
-rw-r--r--common/xrdp_constants.h6
-rw-r--r--libxrdp/xrdp_fastpath.c2
-rw-r--r--xrdp/xrdp_wm.c41
3 files changed, 29 insertions, 20 deletions
diff --git a/common/xrdp_constants.h b/common/xrdp_constants.h
index 795264a5..3ac8504f 100644
--- a/common/xrdp_constants.h
+++ b/common/xrdp_constants.h
@@ -623,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
diff --git a/libxrdp/xrdp_fastpath.c b/libxrdp/xrdp_fastpath.c
index daa08373..33e9c9d0 100644
--- a/libxrdp/xrdp_fastpath.c
+++ b/libxrdp/xrdp_fastpath.c
@@ -273,7 +273,7 @@ xrdp_fastpath_process_EVENT_UNICODE(struct xrdp_fastpath *self,
{
return 1;
}
- in_uint16_le(s, code); /* keyCode (1 byte) */
+ in_uint16_le(s, code); /* unicode (2 byte) */
if (eventFlags & FASTPATH_INPUT_KBDFLAGS_RELEASE)
{
flags |= KBD_FLAG_UP;
diff --git a/xrdp/xrdp_wm.c b/xrdp/xrdp_wm.c
index 26d488ec..446939bc 100644
--- a/xrdp/xrdp_wm.c
+++ b/xrdp/xrdp_wm.c
@@ -1531,66 +1531,69 @@ xrdp_wm_key_unicode(struct xrdp_wm *self, int device_flags, int unicode)
{
int index;
- for (index = 8; index < 256; 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 - 8);
+ xrdp_wm_key(self, device_flags, index - XR_MIN_KEY_CODE);
return 0;
}
}
- for (index = 8; index < 256; index++)
+ 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 - 8);
- xrdp_wm_key(self, KBD_FLAG_UP, 42);
+ 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, 42);
- xrdp_wm_key(self, device_flags, index - 8);
+ 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 = 8; index < 256; index++)
+ 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 - 8);
- xrdp_wm_key(self, KBD_FLAG_UP | KBD_FLAG_EXT, 56);
+ 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, 56);
- xrdp_wm_key(self, device_flags, index - 8);
+ 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 = 8; index < 256; index++)
+ 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 - 8);
- xrdp_wm_key(self, KBD_FLAG_UP | KBD_FLAG_EXT, 56);
- xrdp_wm_key(self, KBD_FLAG_UP, 42);
+ 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, 42);
- xrdp_wm_key(self, KBD_FLAG_DOWN | KBD_FLAG_EXT, 56);
- xrdp_wm_key(self, device_flags, index - 8);
+ 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;
}