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
{
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,
......
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