vlc/vlc-1.1 | branch: master | Felix Paul Kühne <[email protected]> | Sun Jul 3 20:25:54 2011 +0200| [ba1684f7e5ca3dff1117f4574c2e2581aa5285e5] | committer: 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. > http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=ba1684f7e5ca3dff1117f4574c2e2581aa5285e5 --- NEWS | 3 +++ modules/gui/macosx/controls.m | 36 +++++++++++++++++++++++++++++------- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index 7fd99e6..36770ae 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,9 @@ 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: * Update of Slovak, Lithunanian diff --git a/modules/gui/macosx/controls.m b/modules/gui/macosx/controls.m index 134e8bb..01050f0 100644 --- a/modules/gui/macosx/controls.m +++ b/modules/gui/macosx/controls.m @@ -559,19 +559,41 @@ - (void)scrollWheel:(NSEvent *)theEvent { 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_xabsvalue = [theEvent deltaX] > 0.0f ? [theEvent deltaX] : -[theEvent deltaX]; int i, i_yvlckey, i_xvlckey; - if ([theEvent deltaY] < 0.0f) - i_yvlckey = KEY_MOUSEWHEELDOWN; - else - i_yvlckey = KEY_MOUSEWHEELUP; + 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; + if ([theEvent deltaX] > 0.0f) + i_xvlckey = KEY_MOUSEWHEELRIGHT; + else + i_xvlckey = KEY_MOUSEWHEELLEFT; + } else - i_xvlckey = KEY_MOUSEWHEELLEFT; + { + 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; + } /* 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++) _______________________________________________ vlc-commits mailing list [email protected] http://mailman.videolan.org/listinfo/vlc-commits
