Commit dc981886 authored by Felix Paul Kühne's avatar 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)
parent 2d59a460
...@@ -100,7 +100,7 @@ struct vout_display_sys_t ...@@ -100,7 +100,7 @@ struct vout_display_sys_t
{ {
VLCOpenGLES2VideoView *glESView; VLCOpenGLES2VideoView *glESView;
UIView* viewContainer; UIView* viewContainer;
UILongPressGestureRecognizer *longTouchRecognizer; UITapGestureRecognizer *tapRecognizer;
vlc_gl_t gl; vlc_gl_t gl;
vout_display_opengl_t *vgl; vout_display_opengl_t *vgl;
...@@ -157,16 +157,15 @@ static int Open(vlc_object_t *this) ...@@ -157,16 +157,15 @@ static int Open(vlc_object_t *this)
waitUntilDone:YES]; waitUntilDone:YES];
/* add tap gesture recognizer for DVD menus and stuff */ /* add tap gesture recognizer for DVD menus and stuff */
sys->longTouchRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:sys->glESView sys->tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:sys->glESView
action:@selector(longTouchRecognized:)]; action:@selector(tapRecognized:)];
sys->longTouchRecognizer.allowableMovement = 20.;
if (sys->viewContainer.window) { if (sys->viewContainer.window) {
if (sys->viewContainer.window.rootViewController) { if (sys->viewContainer.window.rootViewController) {
if (sys->viewContainer.window.rootViewController.view) 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 */ /* Initialize common OpenGL video display */
sys->gl.lock = OpenglESClean; sys->gl.lock = OpenglESClean;
...@@ -230,9 +229,9 @@ void Close (vlc_object_t *this) ...@@ -230,9 +229,9 @@ void Close (vlc_object_t *this)
vout_display_t *vd = (vout_display_t *)this; vout_display_t *vd = (vout_display_t *)this;
vout_display_sys_t *sys = vd->sys; vout_display_sys_t *sys = vd->sys;
if (sys->longTouchRecognizer) { if (sys->tapRecognizer) {
[sys->longTouchRecognizer.view removeGestureRecognizer:sys->longTouchRecognizer]; [sys->tapRecognizer.view removeGestureRecognizer:sys->tapRecognizer];
[sys->longTouchRecognizer release]; [sys->tapRecognizer release];
} }
[sys->glESView setVoutDisplay:nil]; [sys->glESView setVoutDisplay:nil];
...@@ -511,10 +510,10 @@ static void OpenglESSwap(vlc_gl_t *gl) ...@@ -511,10 +510,10 @@ static void OpenglESSwap(vlc_gl_t *gl)
glViewport(place.x, place.y, place.width, place.height); glViewport(place.x, place.y, place.width, place.height);
} }
- (void)longTouchRecognized:(UITapGestureRecognizer *)longTouchRecognizer - (void)tapRecognized:(UITapGestureRecognizer *)tapRecognizer
{ {
UIGestureRecognizerState state = [longTouchRecognizer state]; UIGestureRecognizerState state = [tapRecognizer state];
CGPoint touchPoint = [longTouchRecognizer locationInView:self]; CGPoint touchPoint = [tapRecognizer locationInView:self];
CGFloat scaleFactor = self.contentScaleFactor; CGFloat scaleFactor = self.contentScaleFactor;
vout_display_SendMouseMovedDisplayCoordinates(_voutDisplay, ORIENT_NORMAL, vout_display_SendMouseMovedDisplayCoordinates(_voutDisplay, ORIENT_NORMAL,
(int)touchPoint.x * scaleFactor, (int)touchPoint.y * scaleFactor, (int)touchPoint.x * scaleFactor, (int)touchPoint.y * scaleFactor,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment