Extended mouse wheel handling in Cocoa backend

Horizontal scrolling using mouse wheel with Shift keyboard button hold is no longer ignored
This commit is contained in:
alexey.lysiuk 2017-02-09 16:07:28 +02:00
parent 14ca635dc1
commit 7c8babceba

View file

@ -680,7 +680,10 @@ void ProcessMouseButtonEvent(NSEvent* theEvent)
void ProcessMouseWheelEvent(NSEvent* theEvent) void ProcessMouseWheelEvent(NSEvent* theEvent)
{ {
const CGFloat delta = [theEvent deltaY]; const SWORD modifiers = ModifierFlagsToGUIKeyModifiers(theEvent);
const CGFloat delta = (modifiers & GKM_SHIFT)
? [theEvent deltaX]
: [theEvent deltaY];
const bool isZeroDelta = fabs(delta) < 1.0E-5; const bool isZeroDelta = fabs(delta) < 1.0E-5;
if (isZeroDelta && GUICapture) if (isZeroDelta && GUICapture)
@ -694,7 +697,7 @@ void ProcessMouseWheelEvent(NSEvent* theEvent)
{ {
event.type = EV_GUI_Event; event.type = EV_GUI_Event;
event.subtype = delta > 0.0f ? EV_GUI_WheelUp : EV_GUI_WheelDown; event.subtype = delta > 0.0f ? EV_GUI_WheelUp : EV_GUI_WheelDown;
event.data3 = ModifierFlagsToGUIKeyModifiers(theEvent); event.data3 = modifiers;
} }
else else
{ {