Commit 1a95c088 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: invert scrolling direction if the devices inverts its event

aka if you scroll to the right, you want the movie to skip to the right, etc.
parent 4b1c0e54
...@@ -393,10 +393,31 @@ ...@@ -393,10 +393,31 @@
- (void)scrollWheel:(NSEvent *)theEvent - (void)scrollWheel:(NSEvent *)theEvent
{ {
intf_thread_t * p_intf = VLCIntf; intf_thread_t * p_intf = VLCIntf;
BOOL b_invertedEventFromDevice = NO;
if ([theEvent respondsToSelector:@selector(isDirectionInvertedFromDevice)])
{
if ([theEvent isDirectionInvertedFromDevice])
b_invertedEventFromDevice = YES;
}
float f_yabsvalue = [theEvent deltaY] > 0.0f ? [theEvent deltaY] : -[theEvent deltaY]; float f_yabsvalue = [theEvent deltaY] > 0.0f ? [theEvent deltaY] : -[theEvent deltaY];
float f_xabsvalue = [theEvent deltaX] > 0.0f ? [theEvent deltaX] : -[theEvent deltaX]; float f_xabsvalue = [theEvent deltaX] > 0.0f ? [theEvent deltaX] : -[theEvent deltaX];
int i, i_yvlckey, i_xvlckey; int i, i_yvlckey, i_xvlckey;
if (b_invertedEventFromDevice)
{
if ([theEvent deltaY] > 0.0f)
i_yvlckey = KEY_MOUSEWHEELDOWN;
else
i_yvlckey = KEY_MOUSEWHEELUP;
if ([theEvent deltaX] > 0.0f)
i_xvlckey = KEY_MOUSEWHEELRIGHT;
else
i_xvlckey = KEY_MOUSEWHEELLEFT;
}
else
{
if ([theEvent deltaY] < 0.0f) if ([theEvent deltaY] < 0.0f)
i_yvlckey = KEY_MOUSEWHEELDOWN; i_yvlckey = KEY_MOUSEWHEELDOWN;
else else
...@@ -406,6 +427,7 @@ ...@@ -406,6 +427,7 @@
i_xvlckey = KEY_MOUSEWHEELRIGHT; i_xvlckey = KEY_MOUSEWHEELRIGHT;
else else
i_xvlckey = KEY_MOUSEWHEELLEFT; i_xvlckey = KEY_MOUSEWHEELLEFT;
}
/* Send multiple key event, depending on the intensity of the event */ /* Send multiple key event, depending on the intensity of the event */
for (i = 0; i < (int)(f_yabsvalue/4.+1.) && f_yabsvalue > 0.05 ; i++) for (i = 0; i < (int)(f_yabsvalue/4.+1.) && f_yabsvalue > 0.05 ; i++)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment