[vlc-commits] iOS vout 2: use simple tap instead of long touch gesture

Felix Paul Kühne git at videolan.org
Fri Feb 6 18:29:20 CET 2015


vlc/vlc-2.2 | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Tue Feb  3 19:05:56 2015 +0100| [dc98188662414ada1e1811ca9ae65b3cb1be2ebc] | committer: Felix Paul Kühne

iOS vout 2: use simple tap instead of long touch gesture

This proved to be more natural for on-screen navigation

(cherry picked from commit 048ea8aae465093cfba2030786132d61e1b9237e)

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

 modules/video_output/ios2.m |   23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/modules/video_output/ios2.m b/modules/video_output/ios2.m
index e6274d5..24ab213 100644
--- a/modules/video_output/ios2.m
+++ b/modules/video_output/ios2.m
@@ -100,7 +100,7 @@ struct vout_display_sys_t
 {
     VLCOpenGLES2VideoView *glESView;
     UIView* viewContainer;
-    UILongPressGestureRecognizer *longTouchRecognizer;
+    UITapGestureRecognizer *tapRecognizer;
 
     vlc_gl_t gl;
     vout_display_opengl_t *vgl;
@@ -157,16 +157,15 @@ static int Open(vlc_object_t *this)
                                       waitUntilDone:YES];
 
     /* add tap gesture recognizer for DVD menus and stuff */
-    sys->longTouchRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:sys->glESView
-                                                                             action:@selector(longTouchRecognized:)];
-    sys->longTouchRecognizer.allowableMovement = 20.;
+    sys->tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:sys->glESView
+                                                                 action:@selector(tapRecognized:)];
     if (sys->viewContainer.window) {
         if (sys->viewContainer.window.rootViewController) {
             if (sys->viewContainer.window.rootViewController.view)
-                [sys->viewContainer.superview addGestureRecognizer:sys->longTouchRecognizer];
+                [sys->viewContainer.superview addGestureRecognizer:sys->tapRecognizer];
         }
     }
-    sys->longTouchRecognizer.cancelsTouchesInView = YES;
+    sys->tapRecognizer.cancelsTouchesInView = YES;
 
     /* Initialize common OpenGL video display */
     sys->gl.lock = OpenglESClean;
@@ -230,9 +229,9 @@ void Close (vlc_object_t *this)
     vout_display_t *vd = (vout_display_t *)this;
     vout_display_sys_t *sys = vd->sys;
 
-    if (sys->longTouchRecognizer) {
-        [sys->longTouchRecognizer.view removeGestureRecognizer:sys->longTouchRecognizer];
-        [sys->longTouchRecognizer release];
+    if (sys->tapRecognizer) {
+        [sys->tapRecognizer.view removeGestureRecognizer:sys->tapRecognizer];
+        [sys->tapRecognizer release];
     }
 
     [sys->glESView setVoutDisplay:nil];
@@ -511,10 +510,10 @@ static void OpenglESSwap(vlc_gl_t *gl)
     glViewport(place.x, place.y, place.width, place.height);
 }
 
-- (void)longTouchRecognized:(UITapGestureRecognizer *)longTouchRecognizer
+- (void)tapRecognized:(UITapGestureRecognizer *)tapRecognizer
 {
-    UIGestureRecognizerState state = [longTouchRecognizer state];
-    CGPoint touchPoint = [longTouchRecognizer locationInView:self];
+    UIGestureRecognizerState state = [tapRecognizer state];
+    CGPoint touchPoint = [tapRecognizer locationInView:self];
     CGFloat scaleFactor = self.contentScaleFactor;
     vout_display_SendMouseMovedDisplayCoordinates(_voutDisplay, ORIENT_NORMAL,
                                                   (int)touchPoint.x * scaleFactor, (int)touchPoint.y * scaleFactor,



More information about the vlc-commits mailing list