Skip to content

Commit

Permalink
- on touchbegan call the proper handler for focusing the control
Browse files Browse the repository at this point in the history
  • Loading branch information
Memphiz authored and koying committed Feb 6, 2014
1 parent 1ef9387 commit 590de11
Showing 1 changed file with 26 additions and 31 deletions.
57 changes: 26 additions & 31 deletions xbmc/osx/ios/XBMCController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ - (void)createGestureRecognizers
UITapGestureRecognizer *singleFingerSingleTap = [[UITapGestureRecognizer alloc]
initWithTarget:self action:@selector(handleSingleFingerSingleTap:)];

singleFingerSingleTap.delaysTouchesBegan = YES;
singleFingerSingleTap.delaysTouchesBegan = NO;
singleFingerSingleTap.numberOfTapsRequired = 1;
singleFingerSingleTap.numberOfTouchesRequired = 1;

Expand All @@ -401,7 +401,7 @@ - (void)createGestureRecognizers
UITapGestureRecognizer *doubleFingerSingleTap = [[UITapGestureRecognizer alloc]
initWithTarget:self action:@selector(handleDoubleFingerSingleTap:)];

doubleFingerSingleTap.delaysTouchesBegan = YES;
doubleFingerSingleTap.delaysTouchesBegan = NO;
doubleFingerSingleTap.numberOfTapsRequired = 1;
doubleFingerSingleTap.numberOfTouchesRequired = 2;
[m_glView addGestureRecognizer:doubleFingerSingleTap];
Expand All @@ -411,16 +411,16 @@ - (void)createGestureRecognizers
UILongPressGestureRecognizer *singleFingerSingleLongTap = [[UILongPressGestureRecognizer alloc]
initWithTarget:self action:@selector(handleSingleFingerSingleLongTap:)];

singleFingerSingleLongTap.delaysTouchesBegan = YES;
singleFingerSingleLongTap.delaysTouchesEnded = YES;
singleFingerSingleLongTap.delaysTouchesBegan = NO;
singleFingerSingleLongTap.delaysTouchesEnded = NO;
[m_glView addGestureRecognizer:singleFingerSingleLongTap];
[singleFingerSingleLongTap release];

//double finger swipe left for backspace ... i like this fast backspace feature ;)
UISwipeGestureRecognizer *swipeLeft2 = [[UISwipeGestureRecognizer alloc]
initWithTarget:self action:@selector(handleSwipe:)];

swipeLeft2.delaysTouchesBegan = YES;
swipeLeft2.delaysTouchesBegan = NO;
swipeLeft2.numberOfTouchesRequired = 2;
swipeLeft2.direction = UISwipeGestureRecognizerDirectionLeft;
swipeLeft2.delegate = self;
Expand All @@ -431,7 +431,7 @@ - (void)createGestureRecognizers
UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc]
initWithTarget:self action:@selector(handleSwipe:)];

swipeLeft.delaysTouchesBegan = YES;
swipeLeft.delaysTouchesBegan = NO;
swipeLeft.numberOfTouchesRequired = 1;
swipeLeft.direction = UISwipeGestureRecognizerDirectionLeft;
swipeLeft.delegate = self;
Expand All @@ -442,7 +442,7 @@ - (void)createGestureRecognizers
UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc]
initWithTarget:self action:@selector(handleSwipe:)];

swipeRight.delaysTouchesBegan = YES;
swipeRight.delaysTouchesBegan = NO;
swipeRight.numberOfTouchesRequired = 1;
swipeRight.direction = UISwipeGestureRecognizerDirectionRight;
swipeRight.delegate = self;
Expand All @@ -453,7 +453,7 @@ - (void)createGestureRecognizers
UISwipeGestureRecognizer *swipeUp = [[UISwipeGestureRecognizer alloc]
initWithTarget:self action:@selector(handleSwipe:)];

swipeUp.delaysTouchesBegan = YES;
swipeUp.delaysTouchesBegan = NO;
swipeUp.numberOfTouchesRequired = 1;
swipeUp.direction = UISwipeGestureRecognizerDirectionUp;
swipeUp.delegate = self;
Expand All @@ -464,7 +464,7 @@ - (void)createGestureRecognizers
UISwipeGestureRecognizer *swipeDown = [[UISwipeGestureRecognizer alloc]
initWithTarget:self action:@selector(handleSwipe:)];

swipeDown.delaysTouchesBegan = YES;
swipeDown.delaysTouchesBegan = NO;
swipeDown.numberOfTouchesRequired = 1;
swipeDown.direction = UISwipeGestureRecognizerDirectionDown;
swipeDown.delegate = self;
Expand All @@ -475,7 +475,7 @@ - (void)createGestureRecognizers
UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc]
initWithTarget:self action:@selector(handlePan:)];

pan.delaysTouchesBegan = YES;
pan.delaysTouchesBegan = NO;
pan.maximumNumberOfTouches = 1;
[m_glView addGestureRecognizer:pan];
[pan release];
Expand All @@ -484,7 +484,7 @@ - (void)createGestureRecognizers
UIPinchGestureRecognizer *pinch = [[UIPinchGestureRecognizer alloc]
initWithTarget:self action:@selector(handlePinch:)];

pinch.delaysTouchesBegan = YES;
pinch.delaysTouchesBegan = NO;
pinch.delegate = self;
[m_glView addGestureRecognizer:pinch];
[pinch release];
Expand All @@ -493,7 +493,7 @@ - (void)createGestureRecognizers
UIRotationGestureRecognizer *rotate = [[UIRotationGestureRecognizer alloc]
initWithTarget:self action:@selector(handleRotate:)];

rotate.delaysTouchesBegan = YES;
rotate.delaysTouchesBegan = NO;
rotate.delegate = self;
[m_glView addGestureRecognizer:rotate];
[rotate release];
Expand All @@ -512,7 +512,19 @@ - (void) deactivateKeyboard:(UIView *)view
[self becomeFirstResponder];
}
//--------------------------------------------------------------
-(void)handlePinch:(UIPinchGestureRecognizer*)sender
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
if( [m_glView isXBMCAlive] )//NO GESTURES BEFORE WE ARE UP AND RUNNING
{
UITouch *touch = (UITouch *)[[touches allObjects] objectAtIndex:0];
CGPoint point = [touch locationInView:m_glView];
point.x *= screenScale;
point.y *= screenScale;
CGenericTouchActionHandler::Get().OnSingleTouchStart(point.x, point.y);
}
}
//--------------------------------------------------------------
-(void)handlePinch:(UIPinchGestureRecognizer*)sender
{
if( [m_glView isXBMCAlive] )//NO GESTURES BEFORE WE ARE UP AND RUNNING
{
Expand Down Expand Up @@ -660,23 +672,6 @@ - (IBAction)handleSwipe:(UISwipeGestureRecognizer *)sender
}
}
//--------------------------------------------------------------
- (void)postMouseMotionEvent:(CGPoint)point
{
XBMC_Event newEvent;

memset(&newEvent, 0, sizeof(newEvent));

newEvent.type = XBMC_MOUSEMOTION;
newEvent.motion.type = XBMC_MOUSEMOTION;
newEvent.motion.which = 0;
newEvent.motion.state = 0;
newEvent.motion.x = point.x;
newEvent.motion.y = point.y;
newEvent.motion.xrel = 0;
newEvent.motion.yrel = 0;
CWinEvents::MessagePush(&newEvent);
}
//--------------------------------------------------------------
- (IBAction)handleSingleFingerSingleTap:(UIGestureRecognizer *)sender
{
if( [m_glView isXBMCAlive] )//NO GESTURES BEFORE WE ARE UP AND RUNNING
Expand Down Expand Up @@ -713,7 +708,7 @@ - (IBAction)handleSingleFingerSingleLongTap:(UIGestureRecognizer *)sender
{
lastGesturePoint = point;
// mark the control
CGenericTouchActionHandler::Get().OnSingleTouchStart((float)point.x, (float)point.y);
//CGenericTouchActionHandler::Get().OnSingleTouchStart((float)point.x, (float)point.y);
}

if (sender.state == UIGestureRecognizerStateEnded)
Expand Down

0 comments on commit 590de11

Please sign in to comment.