Commit 04e7801f authored by David Fuhrmann's avatar David Fuhrmann
Browse files

macosx: implemented scroll wheel behaviour for fullscreen volume slider, too

parent da6798a9
......@@ -109,7 +109,7 @@
@end
@interface VLCFSVolumeSlider : NSSlider
@interface VLCFSVolumeSlider : VLCVolumeSliderCommon
{
}
- (void)drawKnobInRect: (NSRect)knobRect;
......
......@@ -144,11 +144,21 @@
@end
/*****************************************************************************
* VLCVolumeSliderCommon
*****************************************************************************/
@interface VLCVolumeSliderCommon : NSSlider
- (void)scrollWheel:(NSEvent *)o_event;
@end
/*****************************************************************************
* ITSlider
*****************************************************************************/
@interface ITSlider : NSSlider
@interface ITSlider : VLCVolumeSliderCommon
{
NSImage *img;
NSRect image_rect;
......
......@@ -663,6 +663,43 @@ void _drawFrameInRect(NSRect frameRect)
@end
/*****************************************************************************
* VLCVolumeSliderCommon
*****************************************************************************/
@implementation VLCVolumeSliderCommon : NSSlider
- (void)scrollWheel:(NSEvent *)o_event
{
intf_thread_t * p_intf = VLCIntf;
CGFloat f_deltaY = [o_event deltaY];
CGFloat f_deltaX = [o_event deltaX];
if (!OSX_SNOW_LEOPARD && [o_event isDirectionInvertedFromDevice])
f_deltaX = -f_deltaX; // optimisation, actually double invertion of f_deltaY here
else
f_deltaY = -f_deltaY;
// positive for left / down, negative otherwise
CGFloat f_delta = f_deltaX + f_deltaY;
CGFloat f_abs;
int i_vlckey;
if (f_delta > 0.0f) {
i_vlckey = ACTIONID_VOL_DOWN;
f_abs = f_delta;
}
else {
i_vlckey = ACTIONID_VOL_UP;
f_abs = -f_delta;
}
for (NSUInteger i = 0; i < (int)(f_abs/4.+1.) && f_abs > 0.05 ; i++)
var_SetInteger(p_intf->p_libvlc, "key-action", i_vlckey);
}
@end
/*****************************************************************************
* ITSlider
*****************************************************************************/
......@@ -707,35 +744,6 @@ void _drawFrameInRect(NSRect frameRect)
[self drawKnobInRect: knobRect];
}
- (void)scrollWheel:(NSEvent *)o_event
{
intf_thread_t * p_intf = VLCIntf;
CGFloat f_deltaY = [o_event deltaY];
CGFloat f_deltaX = [o_event deltaX];
if (!OSX_SNOW_LEOPARD && [o_event isDirectionInvertedFromDevice])
f_deltaX = -f_deltaX; // optimisation, actually double invertion of f_deltaY here
else
f_deltaY = -f_deltaY;
// positive for left / down, negative otherwise
CGFloat f_delta = f_deltaX + f_deltaY;
CGFloat f_abs;
int i_vlckey;
if (f_delta > 0.0f) {
i_vlckey = ACTIONID_VOL_DOWN;
f_abs = f_delta;
}
else {
i_vlckey = ACTIONID_VOL_UP;
f_abs = -f_delta;
}
for (NSUInteger i = 0; i < (int)(f_abs/4.+1.) && f_abs > 0.05 ; i++)
var_SetInteger( p_intf->p_libvlc, "key-action", i_vlckey );
}
@end
/*****************************************************************************
......
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