From 27aef96e81c498905413e532ab75648df7d89905 Mon Sep 17 00:00:00 2001 From: Koichiro IWAO Date: Mon, 30 Oct 2017 16:23:14 +0900 Subject: [PATCH] Constify mouse event flags, use the MS name for constants --- common/xrdp_constants.h | 17 ++++++++++------- xrdp/xrdp_wm.c | 22 +++++++++++----------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/common/xrdp_constants.h b/common/xrdp_constants.h index 94376cb6..76c12c13 100644 --- a/common/xrdp_constants.h +++ b/common/xrdp_constants.h @@ -190,13 +190,16 @@ #define RDP_KEYPRESS 0 #define RDP_KEYRELEASE (KBD_FLAG_DOWN | KBD_FLAG_UP) -#define MOUSE_FLAG_MOVE 0x0800 -#define MOUSE_FLAG_BUTTON1 0x1000 -#define MOUSE_FLAG_BUTTON2 0x2000 -#define MOUSE_FLAG_BUTTON3 0x4000 -#define MOUSE_FLAG_BUTTON4 0x0280 -#define MOUSE_FLAG_BUTTON5 0x0380 -#define MOUSE_FLAG_DOWN 0x8000 +/* Mouse Event (MS-RDPBCGR 2.2.8.1.1.3.1.1.3) */ +#define PTRFLAGS_HWHEEL 0x0400 +#define PTRFLAGS_WHEEL 0x0200 +#define PTRFLAGS_WHEEL_NEGATIVE 0x0100 +#define WheelRorationMask 0x01FF +#define PTRFLAGS_MOVE 0x0800 +#define PTRFLAGS_DOWN 0x8000 +#define PTRFLAGS_BUTTON1 0x1000 +#define PTRFLAGS_BUTTON2 0x2000 +#define PTRFLAGS_BUTTON3 0x4000 /* Raster operation masks */ #define ROP2_S(rop3) (rop3 & 0xf) diff --git a/xrdp/xrdp_wm.c b/xrdp/xrdp_wm.c index 8c35c5ef..7379979d 100644 --- a/xrdp/xrdp_wm.c +++ b/xrdp/xrdp_wm.c @@ -1642,14 +1642,14 @@ xrdp_wm_process_input_mouse(struct xrdp_wm *self, int device_flags, { DEBUG(("mouse event flags %4.4x x %d y %d", device_flags, x, y)); - if (device_flags & MOUSE_FLAG_MOVE) /* 0x0800 */ + if (device_flags & PTRFLAGS_MOVE) { xrdp_wm_mouse_move(self, x, y); } - if (device_flags & MOUSE_FLAG_BUTTON1) /* 0x1000 */ + if (device_flags & PTRFLAGS_BUTTON1) { - if (device_flags & MOUSE_FLAG_DOWN) /* 0x8000 */ + if (device_flags & PTRFLAGS_DOWN) { xrdp_wm_mouse_click(self, x, y, 1, 1); } @@ -1659,9 +1659,9 @@ xrdp_wm_process_input_mouse(struct xrdp_wm *self, int device_flags, } } - if (device_flags & MOUSE_FLAG_BUTTON2) /* 0x2000 */ + if (device_flags & PTRFLAGS_BUTTON2) { - if (device_flags & MOUSE_FLAG_DOWN) /* 0x8000 */ + if (device_flags & PTRFLAGS_DOWN) { xrdp_wm_mouse_click(self, x, y, 2, 1); } @@ -1671,9 +1671,9 @@ xrdp_wm_process_input_mouse(struct xrdp_wm *self, int device_flags, } } - if (device_flags & MOUSE_FLAG_BUTTON3) /* 0x4000 */ + if (device_flags & PTRFLAGS_BUTTON3) { - if (device_flags & MOUSE_FLAG_DOWN) /* 0x8000 */ + if (device_flags & PTRFLAGS_DOWN) { xrdp_wm_mouse_click(self, x, y, 3, 1); } @@ -1684,9 +1684,9 @@ xrdp_wm_process_input_mouse(struct xrdp_wm *self, int device_flags, } /* vertical mouse wheel */ - if (device_flags & 0x200) /* PTRFLAGS_WHEEL */ + if (device_flags & PTRFLAGS_WHEEL) { - if (device_flags & 0x100) /* PTRFLAGS_WHEEL_NEGATIVE */ + if (device_flags & PTRFLAGS_WHEEL_NEGATIVE) { xrdp_wm_mouse_click(self, 0, 0, 5, 0); } @@ -1702,9 +1702,9 @@ xrdp_wm_process_input_mouse(struct xrdp_wm *self, int device_flags, * As mstsc does MOUSE not MOUSEX for horizontal scrolling, * PTRFLAGS_HWHEEL must be handled here. */ - if (device_flags & 0x400) /* PTRFLAGS_HWHEEL */ + if (device_flags & PTRFLAGS_HWHEEL) { - if (device_flags & 0x100) /* PTRFLAGS_WHEEL_NEGATIVE */ + if (device_flags & PTRFLAGS_WHEEL_NEGATIVE) { xrdp_wm_mouse_click(self, 0, 0, 6, 0); }