[vlc-commits] macosx/fspanel: allow continued clicks on the backward/ forward buttons like we do in windowed mode (close #7258)

Felix Paul Kühne git at videolan.org
Tue Aug 7 20:20:54 CEST 2012


vlc/vlc-2.0 | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Tue Aug  7 20:08:15 2012 +0200| [eb5530916d64223f2f3579739e6bc1bfe70b09e1] | committer: Felix Paul Kühne

macosx/fspanel: allow continued clicks on the backward/forward buttons like we do in windowed mode (close #7258)
(cherry picked from commit 14cc1eed64be69186f1076136fcc5154123b5b36)

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

 modules/gui/macosx/fspanel.h |    2 ++
 modules/gui/macosx/fspanel.m |   16 ++++++++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/modules/gui/macosx/fspanel.h b/modules/gui/macosx/fspanel.h
index b6c32db..a3d7dd4 100644
--- a/modules/gui/macosx/fspanel.h
+++ b/modules/gui/macosx/fspanel.h
@@ -80,6 +80,8 @@
     NSTextField *o_streamTitle_txt, *o_streamPosition_txt;
     NSSlider *o_fs_timeSlider, *o_fs_volumeSlider;
     NSImage *o_background_img, *o_vol_sld_img, *o_vol_mute_img, *o_vol_max_img, *o_time_sld_img;
+    NSTimeInterval last_fwd_event;
+    NSTimeInterval last_bwd_event;
 }
 - (id)initWithFrame: (NSRect)frameRect;
 - (void)drawRect: (NSRect)rect;
diff --git a/modules/gui/macosx/fspanel.m b/modules/gui/macosx/fspanel.m
index 2d925cf..ad76588 100644
--- a/modules/gui/macosx/fspanel.m
+++ b/modules/gui/macosx/fspanel.m
@@ -429,6 +429,8 @@
 /*
     addButton( o_button, @"image (off state)", @"image (on state)", 38, 51, something );
  */
+    [o_fwd setContinuous:YES];
+    [o_bwd setContinuous:YES];
 
     /* time slider */
     s_rc = [self frame];
@@ -543,12 +545,22 @@
 
 - (IBAction)forward:(id)sender
 {
-    [[VLCCoreInteraction sharedInstance] forward];
+    if (([NSDate timeIntervalSinceReferenceDate] - last_fwd_event) > 0.16 )
+    {
+        // we just skipped 4 "continous" events, otherwise we are too fast
+        [[VLCCoreInteraction sharedInstance] forwardExtraShort];
+        last_fwd_event = [NSDate timeIntervalSinceReferenceDate];
+    }
 }
 
 - (IBAction)backward:(id)sender
 {
-    [[VLCCoreInteraction sharedInstance] backward];
+    if (([NSDate timeIntervalSinceReferenceDate] - last_bwd_event) > 0.16 )
+    {
+        // we just skipped 4 "continous" events, otherwise we are too fast
+        [[VLCCoreInteraction sharedInstance] backwardExtraShort];
+        last_bwd_event = [NSDate timeIntervalSinceReferenceDate];
+    }
 }
 
 - (IBAction)prev:(id)sender



More information about the vlc-commits mailing list