]> git.sesse.net Git - vlc/commitdiff
Mac OS X gui: Use the scroll wheel to set the sound volume. This may need some tuning...
authorPierre d'Herbemont <pdherbemont@videolan.org>
Sun, 22 Apr 2007 14:07:46 +0000 (14:07 +0000)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Sun, 22 Apr 2007 14:07:46 +0000 (14:07 +0000)
modules/gui/macosx/vout.m

index f4b0f4dc754f0b1bec1b0d1cd90752edfa81b8d9..279cfdcfe25fb786f7650a7021a39f1ce9ba8c4f 100644 (file)
@@ -439,6 +439,27 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
     return o_window;
 }
 
+- (void)scrollWheel:(NSEvent *)theEvent
+{
+    VLCControls * o_controls = (VLCControls *)[[NSApp delegate] getControls];
+    float f_absvalue = [theEvent deltaY] > 0.0f ? [theEvent deltaY] : -[theEvent deltaY];
+    int i;
+    f_absvalue /= 2.0f;
+    f_absvalue += 1.0f;
+
+    /* Set the volume */
+    if (f_absvalue > 1.1f)
+    {
+        for (i = 0; i < (int)f_absvalue; i++)
+        {
+            if ([theEvent deltaY] < 0.0f)
+                [o_controls volumeDown: self];
+            else
+                [o_controls volumeUp: self];
+        }
+    }
+}
+
 - (void)keyDown:(NSEvent *)o_event
 {
     unichar key = 0;