From 87cac4e562e50ace9d09b0ca70c2e1447283fd21 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 16 Nov 2018 20:05:06 -0800 Subject: [PATCH] Fix host long press causing duplicate menus to show up --- Limelight/UIComputerView.m | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Limelight/UIComputerView.m b/Limelight/UIComputerView.m index 4683d31..dc1dfe4 100644 --- a/Limelight/UIComputerView.m +++ b/Limelight/UIComputerView.m @@ -80,7 +80,7 @@ static const int LABEL_DY = 20; _host = host; _callback = callback; - UILongPressGestureRecognizer* longPressRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(hostLongClicked)]; + UILongPressGestureRecognizer* longPressRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(hostLongClicked:)]; [_hostButton addGestureRecognizer:longPressRecognizer]; [_hostButton addTarget:self action:@selector(hostClicked) forControlEvents:UIControlEventPrimaryActionTriggered]; @@ -169,8 +169,10 @@ static const int LABEL_DY = 20; [self performSelector:@selector(updateLoop) withObject:self afterDelay:REFRESH_CYCLE]; } -- (void) hostLongClicked { - [_callback hostLongClicked:_host view:self]; +- (void) hostLongClicked:(UILongPressGestureRecognizer*)gesture { + if (gesture.state == UIGestureRecognizerStateBegan) { + [_callback hostLongClicked:_host view:self]; + } } - (void) hostClicked {