[vlc-commits] vout ios: use long touch instead of double tap gesture to control on screen elements

Felix Paul Kühne git at videolan.org
Sat Jan 17 21:09:33 CET 2015


vlc/vlc-2.2 | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Sat Jan 17 18:53:10 2015 +0100| [44b4a5d90d33145129b890b39edd22409f0b3ce2] | committer: Felix Paul Kühne

vout ios: use long touch instead of double tap gesture to control on screen elements

(cherry picked from commit 8ac54d15ab03b66d68fa6b329f9dd8a5c8d0c7a1)

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

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

diff --git a/modules/video_output/ios2.m b/modules/video_output/ios2.m
index e369307..40bf994 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;
-    UITapGestureRecognizer *tapRecognizer;
+    UILongPressGestureRecognizer *longTouchRecognizer;
 
     vlc_gl_t gl;
     vout_display_opengl_t *vgl;
@@ -157,16 +157,16 @@ static int Open(vlc_object_t *this)
                                       waitUntilDone:YES];
 
     /* add tap gesture recognizer for DVD menus and stuff */
-    sys->tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:sys->glESView
-                                                                 action:@selector(tapRecognized:)];
-    sys->tapRecognizer.numberOfTapsRequired = 2;
+    sys->longTouchRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:sys->glESView
+                                                                             action:@selector(longTouchRecognized:)];
+    sys->longTouchRecognizer.allowableMovement = 20.;
     if (sys->viewContainer.window) {
         if (sys->viewContainer.window.rootViewController) {
             if (sys->viewContainer.window.rootViewController.view)
-                [sys->viewContainer.superview addGestureRecognizer:sys->tapRecognizer];
+                [sys->viewContainer.superview addGestureRecognizer:sys->longTouchRecognizer];
         }
     }
-    sys->tapRecognizer.cancelsTouchesInView = NO;
+    sys->longTouchRecognizer.cancelsTouchesInView = YES;
 
     /* Initialize common OpenGL video display */
     sys->gl.lock = OpenglESClean;
@@ -230,9 +230,9 @@ void Close (vlc_object_t *this)
     vout_display_t *vd = (vout_display_t *)this;
     vout_display_sys_t *sys = vd->sys;
 
-    if (sys->tapRecognizer) {
-        [sys->glESView removeGestureRecognizer:sys->tapRecognizer];
-        [sys->tapRecognizer release];
+    if (sys->longTouchRecognizer) {
+        [sys->glESView removeGestureRecognizer:sys->longTouchRecognizer];
+        [sys->longTouchRecognizer release];
     }
 
     [sys->glESView setVoutDisplay:nil];
@@ -511,10 +511,10 @@ static void OpenglESSwap(vlc_gl_t *gl)
     glViewport(place.x, place.y, place.width, place.height);
 }
 
-- (void)tapRecognized:(UITapGestureRecognizer *)tapRecognizer
+- (void)longTouchRecognized:(UITapGestureRecognizer *)longTouchRecognizer
 {
-    UIGestureRecognizerState state = [tapRecognizer state];
-    CGPoint touchPoint = [tapRecognizer locationInView:self];
+    UIGestureRecognizerState state = [longTouchRecognizer state];
+    CGPoint touchPoint = [longTouchRecognizer 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