touchpad scrolling works now

This commit is contained in:
sefler 2022-09-12 13:29:11 +08:00
parent d80d096e32
commit c4d6714979
2 changed files with 45 additions and 2 deletions

View File

@ -270,6 +270,10 @@
#define WM_BUTTON8DOWN 116
#define WM_BUTTON9UP 117
#define WM_BUTTON9DOWN 118
#define WM_TOUCH_VSCROLL 140
#define WM_TOUCH_HSCROLL 141
#define WM_INVALIDATE 200
#define CB_ITEMCHANGE 300

View File

@ -1230,6 +1230,28 @@ xrdp_wm_clear_popup(struct xrdp_wm *self)
return 0;
}
/*****************************************************************************/
int
xrdp_wm_mouse_touch(struct xrdp_wm *self, int gesture, int param)
{
LOG(LOG_LEVEL_INFO, "mouse touch event gesture %d param %d", gesture, param);
switch (gesture) {
// vertical scroll
case 0:
self->mm->mod->mod_event(self->mm->mod, WM_TOUCH_VSCROLL,
self->mouse_x, self->mouse_y, param, 0);
break;
// horizantal scroll
case 1:
self->mm->mod->mod_event(self->mm->mod, WM_TOUCH_HSCROLL,
self->mouse_x, self->mouse_y, param, 0);
break;
}
return 0;
}
/*****************************************************************************/
int
xrdp_wm_mouse_click(struct xrdp_wm *self, int x, int y, int but, int down)
@ -1775,13 +1797,30 @@ xrdp_wm_process_input_mouse(struct xrdp_wm *self, int device_flags,
/* vertical mouse wheel */
if (device_flags & PTRFLAGS_WHEEL)
{
int delta = 0;
if (device_flags & PTRFLAGS_WHEEL_NEGATIVE)
{
xrdp_wm_mouse_click(self, 0, 0, 5, 0);
delta = (device_flags & WheelRotationMask) | ~WheelRotationMask;
if (delta != 0)
{
xrdp_wm_mouse_touch(self, 0, delta);
}
else
{
xrdp_wm_mouse_click(self, 0, 0, 5, 0);
}
}
else
{
xrdp_wm_mouse_click(self, 0, 0, 4, 0);
delta = device_flags & WheelRotationMask;
if (delta != 0)
{
xrdp_wm_mouse_touch(self, 0, delta);
}
else
{
xrdp_wm_mouse_click(self, 0, 0, 4, 0);
}
}
}