Skip to content

Commit

Permalink
Implement reverse touch scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
metalefty committed Jun 1, 2024
1 parent 0e13e5d commit 29be824
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
3 changes: 3 additions & 0 deletions module/rdp.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,9 @@ struct _rdpRec
CARD32 last_event_time_ms;
CARD32 last_wheel_time_ms;

int reverse_touch_vscroll; /* boolean */
int reverse_touch_hscroll; /* boolean */

int conNumber;

struct _rdpCounts counts;
Expand Down
29 changes: 29 additions & 0 deletions module/rdpClientCon.c
Original file line number Diff line number Diff line change
Expand Up @@ -1641,6 +1641,35 @@ rdpClientConInit(rdpPtr dev)
LLOGLN(0, ("rdpClientConInit: kill disconnected [%d] timeout [%d] sec",
dev->do_kill_disconnected, dev->disconnect_timeout_s));

ptext = getenv("XRDP_REVERSE_TOUCH_VSCROLL");
if (ptext != 0)
{
i = atoi(ptext);
if (i == 0)
{
dev->reverse_touch_vscroll = 0;
}
else
{
dev->reverse_touch_vscroll = 1;
}
}

ptext = getenv("XRDP_REVERSE_TOUCH_HSCROLL");
if (ptext != 0)
{
i = atoi(ptext);
if (i == 0)
{
dev->reverse_touch_hscroll = 0;
}
else
{
dev->reverse_touch_hscroll = 1;
}
}
LLOGLN(0, ("rdpClientInit: reverse scroll vertical [%d] horizontal [%d]",
dev->reverse_touch_vscroll, dev->reverse_touch_hscroll));

return 0;
}
Expand Down
15 changes: 13 additions & 2 deletions xrdpmouse/rdpMouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ rdpInputMouse(rdpPtr dev, int msg,
long param3, long param4)
{
rdpPointer *pointer;
int scroll_delta;

LLOGLN(10, ("rdpInputMouse: msg %d param1 %ld param2 %ld param3 %ld param4 %ld",
msg, param1, param2, param3, param4));
Expand Down Expand Up @@ -280,10 +281,20 @@ rdpInputMouse(rdpPtr dev, int msg,
PtrAddEvent(pointer);
break;
case WM_TOUCH_VSCROLL:
PtrAddScrollEvent(pointer, TRUE, param3);
scroll_delta = param3;
if (dev->reverse_touch_vscroll)
{
scroll_delta = -scroll_delta;
}
PtrAddScrollEvent(pointer, TRUE, scroll_delta);
break;
case WM_TOUCH_HSCROLL:
PtrAddScrollEvent(pointer, FALSE, param3);
scroll_delta = param3;
if (dev->reverse_touch_hscroll)
{
scroll_delta = -scroll_delta;
}
PtrAddScrollEvent(pointer, FALSE, scroll_delta);
break;
}
return 0;
Expand Down

0 comments on commit 29be824

Please sign in to comment.