Skip to content

Commit

Permalink
Merge pull request #2864 from matt335672/neutrinordp-sidebutton-click
Browse files Browse the repository at this point in the history
Neutrinordp sidebutton click
  • Loading branch information
matt335672 authored Nov 27, 2023
2 parents 94b1481 + c52a173 commit 04db78f
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 23 deletions.
2 changes: 2 additions & 0 deletions common/xrdp_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@
#define WM_PAINT 3
#define WM_KEYDOWN 15
#define WM_KEYUP 16
#define WM_KEYBRD_SYNC 17
#define WM_MOUSEMOVE 100
#define WM_LBUTTONUP 101
#define WM_LBUTTONDOWN 102
Expand All @@ -281,6 +282,7 @@
#define WM_TOUCH_HSCROLL 141

#define WM_INVALIDATE 200
#define WM_CHANNEL_DATA 201

#define CB_ITEMCHANGE 300

Expand Down
64 changes: 48 additions & 16 deletions neutrinordp/xrdp-neutrinordp.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ lxrdp_event(struct mod *mod, int msg, long param1, long param2,

switch (msg)
{
case 15: /* key down */
case WM_KEYDOWN:

/* Before we handle the first character we synchronize
capslock and numlock. */
Expand All @@ -331,11 +331,11 @@ lxrdp_event(struct mod *mod, int msg, long param1, long param2,
mod->inst->input->KeyboardEvent(mod->inst->input, param4, param3);
break;

case 16: /* key up */
case WM_KEYUP:
mod->inst->input->KeyboardEvent(mod->inst->input, param4, param3);
break;

case 17: /* Synchronize */
case WM_KEYBRD_SYNC:
LOG_DEVEL(LOG_LEVEL_DEBUG, "Synchronized event handled : %ld", param1);
/* In some situations the Synchronize event come to early.
Therefore we store this information and use it when we
Expand All @@ -351,79 +351,111 @@ lxrdp_event(struct mod *mod, int msg, long param1, long param2,

break;

case 100: /* mouse move */
case WM_MOUSEMOVE: /* mouse move */
LOG_DEVEL(LOG_LEVEL_DEBUG, "mouse move %ld %ld", param1, param2);
x = param1;
y = param2;
flags = PTR_FLAGS_MOVE;
mod->inst->input->MouseEvent(mod->inst->input, flags, x, y);
break;

case 101: /* left button up */
case WM_LBUTTONUP:
LOG_DEVEL(LOG_LEVEL_DEBUG, "left button up %ld %ld", param1, param2);
x = param1;
y = param2;
flags = PTR_FLAGS_BUTTON1;
mod->inst->input->MouseEvent(mod->inst->input, flags, x, y);
break;

case 102: /* left button down */
case WM_LBUTTONDOWN:
LOG_DEVEL(LOG_LEVEL_DEBUG, "left button down %ld %ld", param1, param2);
x = param1;
y = param2;
flags = PTR_FLAGS_BUTTON1 | PTR_FLAGS_DOWN;
mod->inst->input->MouseEvent(mod->inst->input, flags, x, y);
break;

case 103: /* right button up */
case WM_RBUTTONUP:
LOG_DEVEL(LOG_LEVEL_DEBUG, "right button up %ld %ld", param1, param2);
x = param1;
y = param2;
flags = PTR_FLAGS_BUTTON2;
mod->inst->input->MouseEvent(mod->inst->input, flags, x, y);
break;

case 104: /* right button down */
case WM_RBUTTONDOWN:
LOG_DEVEL(LOG_LEVEL_DEBUG, "right button down %ld %ld", param1, param2);
x = param1;
y = param2;
flags = PTR_FLAGS_BUTTON2 | PTR_FLAGS_DOWN;
mod->inst->input->MouseEvent(mod->inst->input, flags, x, y);
break;

case 105: /* middle button up */
case WM_BUTTON3UP: /* middle button up */
LOG_DEVEL(LOG_LEVEL_DEBUG, "middle button up %ld %ld", param1, param2);
x = param1;
y = param2;
flags = PTR_FLAGS_BUTTON3;
mod->inst->input->MouseEvent(mod->inst->input, flags, x, y);
break;

case 106: /* middle button down */
case WM_BUTTON3DOWN: /* middle button down */
LOG_DEVEL(LOG_LEVEL_DEBUG, "middle button down %ld %ld", param1, param2);
x = param1;
y = param2;
flags = PTR_FLAGS_BUTTON3 | PTR_FLAGS_DOWN;
mod->inst->input->MouseEvent(mod->inst->input, flags, x, y);
break;

case 107: /* wheel up */
case WM_BUTTON4UP: /* wheel up */
flags = PTR_FLAGS_WHEEL | 0x0078;
mod->inst->input->MouseEvent(mod->inst->input, flags, 0, 0);
break;

case 108:
case WM_BUTTON4DOWN:
break;

case 109: /* wheel down */
case WM_BUTTON5UP: /* wheel down */
flags = PTR_FLAGS_WHEEL | PTR_FLAGS_WHEEL_NEGATIVE | 0x0088;
mod->inst->input->MouseEvent(mod->inst->input, flags, 0, 0);
break;

case 110:
case WM_BUTTON5DOWN:
break;

case 200:
case WM_BUTTON8UP:
LOG_DEVEL(LOG_LEVEL_DEBUG, "extended mouse button8 up %ld %ld", param1, param2);
x = param1;
y = param2;
flags = PTR_XFLAGS_BUTTON1;
mod->inst->input->ExtendedMouseEvent(mod->inst->input, flags, x, y);
break;

case WM_BUTTON8DOWN:
LOG_DEVEL(LOG_LEVEL_DEBUG, "extended mouse button8 down %ld %ld", param1, param2);
x = param1;
y = param2;
flags = PTR_XFLAGS_BUTTON1 | PTR_XFLAGS_DOWN;
mod->inst->input->ExtendedMouseEvent(mod->inst->input, flags, x, y);
break;

case WM_BUTTON9UP:
LOG_DEVEL(LOG_LEVEL_DEBUG, "extended mouse button9 up %ld %ld", param1, param2);
x = param1;
y = param2;
flags = PTR_XFLAGS_BUTTON2;
mod->inst->input->ExtendedMouseEvent(mod->inst->input, flags, x, y);
break;

case WM_BUTTON9DOWN:
LOG_DEVEL(LOG_LEVEL_DEBUG, "extended mouse button9 down %ld %ld", param1, param2);
x = param1;
y = param2;
flags = PTR_XFLAGS_BUTTON2 | PTR_XFLAGS_DOWN;
mod->inst->input->ExtendedMouseEvent(mod->inst->input, flags, x, y);
break;

case WM_INVALIDATE:
LOG_DEVEL(LOG_LEVEL_DEBUG, "Invalidate request sent from client");
x = (param1 >> 16) & 0xffff;
y = (param1 >> 0) & 0xffff;
Expand All @@ -432,7 +464,7 @@ lxrdp_event(struct mod *mod, int msg, long param1, long param2,
mod->inst->SendInvalidate(mod->inst, -1, x, y, cx, cy);
break;

case 0x5555:
case WM_CHANNEL_DATA:
chanid = LOWORD(param1);
flags = HIWORD(param1);
size = (int)param2;
Expand Down
2 changes: 1 addition & 1 deletion vnc/vnc.c
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ lib_mod_event(struct vnc *v, int msg, long param1, long param2,
error = 0;
make_stream(s);

if (msg == 0x5555) /* channel data */
if (msg == WM_CHANNEL_DATA)
{
chanid = LOWORD(param1);
flags = HIWORD(param1);
Expand Down
4 changes: 2 additions & 2 deletions xrdp/xrdp_mm.c
Original file line number Diff line number Diff line change
Expand Up @@ -557,8 +557,8 @@ xrdp_mm_setup_mod2(struct xrdp_mm *self)
{
if (self->mod->mod_event != 0)
{
self->mod->mod_event(self->mod, 17, key_flags, device_flags,
key_flags, device_flags);
self->mod->mod_event(self->mod, WM_KEYBRD_SYNC, key_flags,
device_flags, key_flags, device_flags);
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions xrdp/xrdp_wm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1636,8 +1636,8 @@ xrdp_wm_key_sync(struct xrdp_wm *self, int device_flags, int key_flags)
{
if (self->mm->mod->mod_event != 0)
{
self->mm->mod->mod_event(self->mm->mod, 17, key_flags, device_flags,
key_flags, device_flags);
self->mm->mod->mod_event(self->mm->mod, WM_KEYBRD_SYNC, key_flags,
device_flags, key_flags, device_flags);
}
}

Expand Down Expand Up @@ -1946,8 +1946,8 @@ xrdp_wm_process_channel_data(struct xrdp_wm *self,
{
if (self->mm->mod->mod_event != 0)
{
rv = self->mm->mod->mod_event(self->mm->mod, 0x5555, param1, param2,
param3, param4);
rv = self->mm->mod->mod_event(self->mm->mod, WM_CHANNEL_DATA,
param1, param2, param3, param4);
}
}
}
Expand Down

0 comments on commit 04db78f

Please sign in to comment.