mfreerdp-server: vertical scroll input support

This commit is contained in:
C-o-r-E 2013-02-28 15:02:56 -05:00
parent 3e24f4e886
commit c89c8b7419
1 changed files with 25 additions and 0 deletions

View File

@ -349,6 +349,10 @@ void mf_input_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
{
float width, height;
CGWheelCount wheelCount = 2;
UINT32 scroll_x = 0;
UINT32 scroll_y = 0;
if (flags & PTR_FLAGS_WHEEL)
{
/*
@ -360,6 +364,27 @@ void mf_input_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
SendInput(1, &mouse_event, sizeof(INPUT));
*/
scroll_y = flags & WheelRotationMask;
if (flags & PTR_FLAGS_WHEEL_NEGATIVE)
{
scroll_y = -(flags & WheelRotationMask) / 392;
}
else
{
scroll_y = (flags & WheelRotationMask) / 120;
}
CGEventSourceRef source = CGEventSourceCreate (kCGEventSourceStateCombinedSessionState);
CGEventRef scroll = CGEventCreateScrollWheelEvent(source,
kCGScrollEventUnitLine,
wheelCount,
scroll_y,
scroll_x);
CGEventPost(kCGHIDEventTap, scroll);
CFRelease(scroll);
CFRelease(source);
}
else
{