fix code review issues
This commit is contained in:
parent
9d33b4cbcb
commit
cb2b32e6c5
@ -247,6 +247,12 @@
|
|||||||
#define BUTTON_STATE_UP 0
|
#define BUTTON_STATE_UP 0
|
||||||
#define BUTTON_STATE_DOWN 1
|
#define BUTTON_STATE_DOWN 1
|
||||||
|
|
||||||
|
/* touch gestures */
|
||||||
|
#define TOUCH_TWO_FINGERS_DOWN 0
|
||||||
|
#define TOUCH_TWO_FINGERS_UP 1
|
||||||
|
#define TOUCH_TWO_FINGERS_LEFT 2
|
||||||
|
#define TOUCH_TWO_FINGERS_RIGHT 3
|
||||||
|
|
||||||
/* messages */
|
/* messages */
|
||||||
#define WM_PAINT 3
|
#define WM_PAINT 3
|
||||||
#define WM_KEYDOWN 15
|
#define WM_KEYDOWN 15
|
||||||
|
@ -119,6 +119,8 @@ xrdp_wm_get_vis_region(struct xrdp_wm *self, struct xrdp_bitmap *bitmap,
|
|||||||
int
|
int
|
||||||
xrdp_wm_mouse_move(struct xrdp_wm *self, int x, int y);
|
xrdp_wm_mouse_move(struct xrdp_wm *self, int x, int y);
|
||||||
int
|
int
|
||||||
|
xrdp_wm_mouse_touch(struct xrdp_wm *self, int gesture, int param);
|
||||||
|
int
|
||||||
xrdp_wm_mouse_click(struct xrdp_wm *self, int x, int y, int but, int down);
|
xrdp_wm_mouse_click(struct xrdp_wm *self, int x, int y, int but, int down);
|
||||||
int
|
int
|
||||||
xrdp_wm_key(struct xrdp_wm *self, int device_flags, int scan_code);
|
xrdp_wm_key(struct xrdp_wm *self, int device_flags, int scan_code);
|
||||||
|
@ -1238,13 +1238,13 @@ xrdp_wm_mouse_touch(struct xrdp_wm *self, int gesture, int param)
|
|||||||
|
|
||||||
switch (gesture)
|
switch (gesture)
|
||||||
{
|
{
|
||||||
// vertical scroll
|
case TOUCH_TWO_FINGERS_UP:
|
||||||
case 0:
|
case TOUCH_TWO_FINGERS_DOWN:
|
||||||
self->mm->mod->mod_event(self->mm->mod, WM_TOUCH_VSCROLL,
|
self->mm->mod->mod_event(self->mm->mod, WM_TOUCH_VSCROLL,
|
||||||
self->mouse_x, self->mouse_y, param, 0);
|
self->mouse_x, self->mouse_y, param, 0);
|
||||||
break;
|
break;
|
||||||
// horizantal scroll
|
case TOUCH_TWO_FINGERS_RIGHT:
|
||||||
case 1:
|
case TOUCH_TWO_FINGERS_LEFT:
|
||||||
self->mm->mod->mod_event(self->mm->mod, WM_TOUCH_HSCROLL,
|
self->mm->mod->mod_event(self->mm->mod, WM_TOUCH_HSCROLL,
|
||||||
self->mouse_x, self->mouse_y, param, 0);
|
self->mouse_x, self->mouse_y, param, 0);
|
||||||
break;
|
break;
|
||||||
@ -1801,11 +1801,21 @@ xrdp_wm_process_input_mouse(struct xrdp_wm *self, int device_flags,
|
|||||||
int delta = 0;
|
int delta = 0;
|
||||||
if (device_flags & PTRFLAGS_WHEEL_NEGATIVE)
|
if (device_flags & PTRFLAGS_WHEEL_NEGATIVE)
|
||||||
{
|
{
|
||||||
// [MS-RDPBCGR] In negative scrolling, rotation distance is negative.
|
/**
|
||||||
|
* [MS-RDPBCGR] 2.2.8.1.1.3.1.1.3 Mouse Event (TS_POINTER_EVENT)
|
||||||
|
* In negative scrolling, rotation distance is negative and the delta
|
||||||
|
* is represented by the lowest byte.
|
||||||
|
* Examples:
|
||||||
|
* device_flags = 0x020a, positive vertical scrolling, distance 10
|
||||||
|
* device_flags = 0x03f6, negative vertical scrolling, distance -10
|
||||||
|
*
|
||||||
|
* The negative number is represented by complement.
|
||||||
|
*/
|
||||||
delta = (device_flags & WheelRotationMask) | ~WheelRotationMask;
|
delta = (device_flags & WheelRotationMask) | ~WheelRotationMask;
|
||||||
if (delta != 0)
|
if (delta != 0)
|
||||||
{
|
{
|
||||||
xrdp_wm_mouse_touch(self, 0, delta);
|
// Use nature scrolling, up direction is negative.
|
||||||
|
xrdp_wm_mouse_touch(self, TOUCH_TWO_FINGERS_UP, delta);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1817,7 +1827,7 @@ xrdp_wm_process_input_mouse(struct xrdp_wm *self, int device_flags,
|
|||||||
delta = device_flags & WheelRotationMask;
|
delta = device_flags & WheelRotationMask;
|
||||||
if (delta != 0)
|
if (delta != 0)
|
||||||
{
|
{
|
||||||
xrdp_wm_mouse_touch(self, 0, delta);
|
xrdp_wm_mouse_touch(self, TOUCH_TWO_FINGERS_DOWN, delta);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1837,11 +1847,21 @@ xrdp_wm_process_input_mouse(struct xrdp_wm *self, int device_flags,
|
|||||||
int delta = 0;
|
int delta = 0;
|
||||||
if (device_flags & PTRFLAGS_WHEEL_NEGATIVE)
|
if (device_flags & PTRFLAGS_WHEEL_NEGATIVE)
|
||||||
{
|
{
|
||||||
// [MS-RDPBCGR] In negative scrolling, rotation distance is negative.
|
/**
|
||||||
|
* [MS-RDPBCGR] 2.2.8.1.1.3.1.1.3 Mouse Event (TS_POINTER_EVENT)
|
||||||
|
* In negative scrolling, rotation distance is negative and the delta
|
||||||
|
* is represented by the lowest byte.
|
||||||
|
* Examples:
|
||||||
|
* device_flags = 0x040a, positive horizontal scrolling, distance 10
|
||||||
|
* device_flags = 0x05f6, negative horizontal scrolling, distance -10
|
||||||
|
*
|
||||||
|
* The negative number is represented by complement.
|
||||||
|
*/
|
||||||
delta = (device_flags & WheelRotationMask) | ~WheelRotationMask;
|
delta = (device_flags & WheelRotationMask) | ~WheelRotationMask;
|
||||||
if (delta != 0)
|
if (delta != 0)
|
||||||
{
|
{
|
||||||
xrdp_wm_mouse_touch(self, 1, delta);
|
// Use nature scrolling, right direction is negative.
|
||||||
|
xrdp_wm_mouse_touch(self, TOUCH_TWO_FINGERS_RIGHT, delta);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1853,7 +1873,7 @@ xrdp_wm_process_input_mouse(struct xrdp_wm *self, int device_flags,
|
|||||||
delta = device_flags & WheelRotationMask;
|
delta = device_flags & WheelRotationMask;
|
||||||
if (delta != 0)
|
if (delta != 0)
|
||||||
{
|
{
|
||||||
xrdp_wm_mouse_touch(self, 1, delta);
|
xrdp_wm_mouse_touch(self, TOUCH_TWO_FINGERS_LEFT, delta);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user