Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement reverse touch scroll #315

Draft
wants to merge 1 commit into
base: v0.10
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading