Commit ba1684f7 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 15f4f967
Changes between 1.1.10 and 1.1.11-git: Changes between 1.1.10 and 1.1.11-git:
---------------------------------- ----------------------------------
Mac OS X Interface:
* Fixed scrolling direction if the input device's signal is inverted
Translations: Translations:
* Update of Slovak, Lithunanian * Update of Slovak, Lithunanian
......
...@@ -559,10 +559,31 @@ ...@@ -559,10 +559,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
...@@ -572,6 +593,7 @@ ...@@ -572,6 +593,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