[vlc-commits] macOS: Avoid double-seeking to the same position

Marvin Scholz git at videolan.org
Wed Feb 1 11:58:09 CET 2017


vlc | branch: master | Marvin Scholz <epirat07 at gmail.com> | Wed Feb  1 11:57:55 2017 +0100| [1fe7c233bf5fc86cafebaf658c7c6ea13b4dd3c9] | committer: Marvin Scholz

macOS: Avoid double-seeking to the same position

The sliders for seeking are continuous, that means they send events
for every action, which is useful to seek when the slider is dragged.
But when the slider is clicked, this results in two seeks nearly at the
same time to the same position.
Therefore this commit introduces a check that ignores the slider update
if it originated from a NSLeftMouseUp event to workaround that.

Ref. #17954

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1fe7c233bf5fc86cafebaf658c7c6ea13b4dd3c9
---

 modules/gui/macosx/VLCControlsBarCommon.m |  8 ++++++++
 modules/gui/macosx/VLCFSPanelController.m | 17 +++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/modules/gui/macosx/VLCControlsBarCommon.m b/modules/gui/macosx/VLCControlsBarCommon.m
index 18cbd13..02bc764 100644
--- a/modules/gui/macosx/VLCControlsBarCommon.m
+++ b/modules/gui/macosx/VLCControlsBarCommon.m
@@ -291,6 +291,14 @@
 
     switch([[NSApp currentEvent] type]) {
         case NSLeftMouseUp:
+            /* Ignore mouse up, as this is a continous slider and
+             * when the user does a single click to a position on the slider,
+             * the action is called twice, once for the mouse down and once
+             * for the mouse up event. This results in two short seeks one
+             * after another to the same position, which results in weird
+             * audio quirks.
+             */
+            return;
         case NSLeftMouseDown:
         case NSLeftMouseDragged:
             f_updated = [sender floatValue];
diff --git a/modules/gui/macosx/VLCFSPanelController.m b/modules/gui/macosx/VLCFSPanelController.m
index 0994ea0..54ee756 100644
--- a/modules/gui/macosx/VLCFSPanelController.m
+++ b/modules/gui/macosx/VLCFSPanelController.m
@@ -173,6 +173,23 @@
 
 - (IBAction)timeSliderUpdate:(id)sender
 {
+    switch([[NSApp currentEvent] type]) {
+        case NSLeftMouseUp:
+            /* Ignore mouse up, as this is a continous slider and
+             * when the user does a single click to a position on the slider,
+             * the action is called twice, once for the mouse down and once
+             * for the mouse up event. This results in two short seeks one
+             * after another to the same position, which results in weird
+             * audio quirks.
+             */
+            return;
+        case NSLeftMouseDown:
+        case NSLeftMouseDragged:
+            break;
+
+        default:
+            return;
+    }
     input_thread_t *p_input;
     p_input = pl_CurrentInput(getIntf());
 



More information about the vlc-commits mailing list