From 903a2bf83a35a92ffba1a5fc0c4da4a87271b6db Mon Sep 17 00:00:00 2001 From: Koichiro IWAO Date: Mon, 30 Oct 2017 13:56:46 +0900 Subject: [PATCH] xrdp_wm: make mouse button 6 and 7 act like button 4 and 5 because 6 and 7 are horizontal scroll. They should acts as same as vertical scroll. --- xrdp/xrdp_wm.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/xrdp/xrdp_wm.c b/xrdp/xrdp_wm.c index 7f2ccfd4..1f5b4953 100644 --- a/xrdp/xrdp_wm.c +++ b/xrdp/xrdp_wm.c @@ -1264,6 +1264,8 @@ xrdp_wm_mouse_click(struct xrdp_wm *self, int x, int y, int but, int down) self->mm->mod->mod_event(self->mm->mod, WM_BUTTON3UP, x, y, 0, 0); } + /* vertical scroll */ + if (but == 4) { self->mm->mod->mod_event(self->mm->mod, WM_BUTTON4DOWN, @@ -1279,21 +1281,23 @@ xrdp_wm_mouse_click(struct xrdp_wm *self, int x, int y, int but, int down) self->mm->mod->mod_event(self->mm->mod, WM_BUTTON5UP, self->mouse_x, self->mouse_y, 0, 0); } - if (but == 6 && down) - { - self->mm->mod->mod_event(self->mm->mod, WM_BUTTON6DOWN, x, y, 0, 0); - } - else if (but == 6 && !down) - { - self->mm->mod->mod_event(self->mm->mod, WM_BUTTON6UP, x, y, 0, 0); - } - if (but == 7 && down) + + /* horizontal scroll */ + + if (but == 6) { - self->mm->mod->mod_event(self->mm->mod, WM_BUTTON7DOWN, x, y, 0, 0); + self->mm->mod->mod_event(self->mm->mod, WM_BUTTON6DOWN, + self->mouse_x, self->mouse_y, 0, 0); + self->mm->mod->mod_event(self->mm->mod, WM_BUTTON6UP, + self->mouse_x, self->mouse_y, 0, 0); } - else if (but == 7 && !down) + + if (but == 7) { - self->mm->mod->mod_event(self->mm->mod, WM_BUTTON7UP, x, y, 0, 0); + self->mm->mod->mod_event(self->mm->mod, WM_BUTTON7DOWN, + self->mouse_x, self->mouse_y, 0, 0); + self->mm->mod->mod_event(self->mm->mod, WM_BUTTON7UP, + self->mouse_x, self->mouse_y, 0, 0); } } }