Fix for mac mousewheel.

(cherry picked from commit 87a4a8484e65ab591ef815ed0700ab0c90994a77)
(cherry picked from commit c0ecee9d69533095bfdb3dbaf9e76747e5e3a7ab)
This commit is contained in:
Keith Johnston 2020-10-06 16:11:36 -07:00 committed by akallabeth
parent e4b30a5cb6
commit 04d2db2730

View File

@ -416,7 +416,7 @@ DWORD WINAPI mac_client_thread(void *param)
if (fabsf(dy) > FLT_EPSILON) if (fabsf(dy) > FLT_EPSILON)
{ {
flags = PTR_FLAGS_HWHEEL; flags = PTR_FLAGS_WHEEL;
units = fabsf(dy) * 120; units = fabsf(dy) * 120;
if (dy < 0) if (dy < 0)
@ -424,7 +424,7 @@ DWORD WINAPI mac_client_thread(void *param)
} }
else if (fabsf(dx) > FLT_EPSILON) else if (fabsf(dx) > FLT_EPSILON)
{ {
flags = PTR_FLAGS_WHEEL; flags = PTR_FLAGS_HWHEEL;
units = fabsf(dx) * 120; units = fabsf(dx) * 120;
if (dx > 0) if (dx > 0)
@ -433,17 +433,20 @@ DWORD WINAPI mac_client_thread(void *param)
else else
return; return;
/* send out all accumulated rotations */ /* Wheel rotation steps:
if (units > WheelRotationMask) *
units = WheelRotationMask; * positive: 0 ... 0xFF -> slow ... fast
* negative: 0 ... 0xFF -> fast ... slow
*/
UINT16 step = units;
if (step > 0xFF)
step = 0xFF;
while (units != 0) /* Negative rotation, so count down steps from top */
{ if (flags & PTR_FLAGS_WHEEL_NEGATIVE)
/* limit to maximum value in WheelRotationMask (9bit signed value) */ step = 0xFF - step;
const UINT16 step = units & WheelRotationMask;
mf_scale_mouse_event(context, instance->input, flags | step, 0, 0); mf_scale_mouse_event(context, instance->input, flags | step, 0, 0);
units -= step;
}
} }
- (void)mouseDragged:(NSEvent *)event - (void)mouseDragged:(NSEvent *)event