Commit 44b4a5d9 authored by Felix Paul Kühne's avatar Felix Paul Kühne

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

(cherry picked from commit 8ac54d15ab03b66d68fa6b329f9dd8a5c8d0c7a1)
parent 5d3891a4
......@@ -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,
......
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