From c89c8b7419fe210fb0e2e836c0bce0ad4fce1a8b Mon Sep 17 00:00:00 2001 From: C-o-r-E Date: Thu, 28 Feb 2013 15:02:56 -0500 Subject: [PATCH] mfreerdp-server: vertical scroll input support --- server/Mac/mf_input.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/server/Mac/mf_input.c b/server/Mac/mf_input.c index dd1904e1d..ab6354057 100644 --- a/server/Mac/mf_input.c +++ b/server/Mac/mf_input.c @@ -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 {