[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:15:17 CEST 2012


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

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

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

 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 ea06de8..2644ce1 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 3553780..4620bf5 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