Skip to content

Commit

Permalink
Set up alternative definitions for some window messages
Browse files Browse the repository at this point in the history
FreeRDP silently redefines WM_LBUTTONUP, WM_LBUTTONDOWN, WM_RBUTTONUP
and WM_RBUTTONDOWN. This fixes a regression introduced by neutrinolabs#2864
  • Loading branch information
matt335672 committed Jan 25, 2024
1 parent 17ba2e0 commit b569293
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions common/xrdp_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,12 @@
#define WM_LBUTTONDOWN 102
#define WM_RBUTTONUP 103
#define WM_RBUTTONDOWN 104
/* Alternative definitions needed for buttons 1 and 2 -
* FreeRDP silently redefines the above ones */
#define WM_BUTTON1UP 101
#define WM_BUTTON1DOWN 102
#define WM_BUTTON2UP 103
#define WM_BUTTON2DOWN 104
#define WM_BUTTON3UP 105
#define WM_BUTTON3DOWN 106
#define WM_BUTTON4UP 107
Expand Down
8 changes: 4 additions & 4 deletions neutrinordp/xrdp-neutrinordp.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,31 +359,31 @@ lxrdp_event(struct mod *mod, int msg, long param1, long param2,
mod->inst->input->MouseEvent(mod->inst->input, flags, x, y);
break;

case WM_LBUTTONUP:
case WM_BUTTON1UP:
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 WM_LBUTTONDOWN:
case WM_BUTTON1DOWN:
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 WM_RBUTTONUP:
case WM_BUTTON2UP:
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 WM_RBUTTONDOWN:
case WM_BUTTON2DOWN:
LOG_DEVEL(LOG_LEVEL_DEBUG, "right button down %ld %ld", param1, param2);
x = param1;
y = param2;
Expand Down

0 comments on commit b569293

Please sign in to comment.