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 ...@@ -100,7 +100,7 @@ struct vout_display_sys_t
{ {
VLCOpenGLES2VideoView *glESView; VLCOpenGLES2VideoView *glESView;
UIView* viewContainer; UIView* viewContainer;
UITapGestureRecognizer *tapRecognizer; UILongPressGestureRecognizer *longTouchRecognizer;
vlc_gl_t gl; vlc_gl_t gl;
vout_display_opengl_t *vgl; vout_display_opengl_t *vgl;
...@@ -157,16 +157,16 @@ static int Open(vlc_object_t *this) ...@@ -157,16 +157,16 @@ 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->tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:sys->glESView sys->longTouchRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:sys->glESView
action:@selector(tapRecognized:)]; action:@selector(longTouchRecognized:)];
sys->tapRecognizer.numberOfTapsRequired = 2; 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->tapRecognizer]; [sys->viewContainer.superview addGestureRecognizer:sys->longTouchRecognizer];
} }
} }
sys->tapRecognizer.cancelsTouchesInView = NO; sys->longTouchRecognizer.cancelsTouchesInView = YES;
/* Initialize common OpenGL video display */ /* Initialize common OpenGL video display */
sys->gl.lock = OpenglESClean; sys->gl.lock = OpenglESClean;
...@@ -230,9 +230,9 @@ void Close (vlc_object_t *this) ...@@ -230,9 +230,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->tapRecognizer) { if (sys->longTouchRecognizer) {
[sys->glESView removeGestureRecognizer:sys->tapRecognizer]; [sys->glESView removeGestureRecognizer:sys->longTouchRecognizer];
[sys->tapRecognizer release]; [sys->longTouchRecognizer release];
} }
[sys->glESView setVoutDisplay:nil]; [sys->glESView setVoutDisplay:nil];
...@@ -511,10 +511,10 @@ static void OpenglESSwap(vlc_gl_t *gl) ...@@ -511,10 +511,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)tapRecognized:(UITapGestureRecognizer *)tapRecognizer - (void)longTouchRecognized:(UITapGestureRecognizer *)longTouchRecognizer
{ {
UIGestureRecognizerState state = [tapRecognizer state]; UIGestureRecognizerState state = [longTouchRecognizer state];
CGPoint touchPoint = [tapRecognizer locationInView:self]; CGPoint touchPoint = [longTouchRecognizer 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