diff options
author | Jonny Bergström | 2018-10-21 08:45:40 +0900 |
---|---|---|
committer | Thierry Crozat | 2019-02-16 17:28:16 +0000 |
commit | a9a6ce7e811a2a3fe14399a868341031b54517a0 (patch) | |
tree | ea31ce698c61c9151802a7936375e0029c440677 /backends/platform | |
parent | 4795f2b68a4fd7023c2f85a79c1b7686b9226747 (diff) | |
download | scummvm-rg350-a9a6ce7e811a2a3fe14399a868341031b54517a0.tar.gz scummvm-rg350-a9a6ce7e811a2a3fe14399a868341031b54517a0.tar.bz2 scummvm-rg350-a9a6ce7e811a2a3fe14399a868341031b54517a0.zip |
IOS: Add support for three finger swipes up/down for showing/hiding software keyboard
Diffstat (limited to 'backends/platform')
-rw-r--r-- | backends/platform/ios7/ios7_video.mm | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/backends/platform/ios7/ios7_video.mm b/backends/platform/ios7/ios7_video.mm index 679dedffc4..b00ecf64f9 100644 --- a/backends/platform/ios7/ios7_video.mm +++ b/backends/platform/ios7/ios7_video.mm @@ -349,6 +349,19 @@ uint getSizeNextPOT(uint size) { } - (void)setupGestureRecognizers { + const NSUInteger KEYBOARDSWIPETOUCHCOUNT = 3; + UISwipeGestureRecognizer *swipeUpKeyboard = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(keyboardSwipeUp:)]; + swipeUpKeyboard.direction = UISwipeGestureRecognizerDirectionUp; + swipeUpKeyboard.numberOfTouchesRequired = KEYBOARDSWIPETOUCHCOUNT; + swipeUpKeyboard.delaysTouchesBegan = NO; + swipeUpKeyboard.delaysTouchesEnded = NO; + + UISwipeGestureRecognizer *swipeDownKeyboard = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(keyboardSwipeDown:)]; + swipeDownKeyboard.direction = UISwipeGestureRecognizerDirectionDown; + swipeDownKeyboard.numberOfTouchesRequired = KEYBOARDSWIPETOUCHCOUNT; + swipeDownKeyboard.delaysTouchesBegan = NO; + swipeDownKeyboard.delaysTouchesEnded = NO; + UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(twoFingersSwipeRight:)]; swipeRight.direction = UISwipeGestureRecognizerDirectionRight; swipeRight.numberOfTouchesRequired = 2; @@ -379,12 +392,16 @@ uint getSizeNextPOT(uint size) { doubleTapTwoFingers.delaysTouchesBegan = NO; doubleTapTwoFingers.delaysTouchesEnded = NO; + [self addGestureRecognizer:swipeUpKeyboard]; + [self addGestureRecognizer:swipeDownKeyboard]; [self addGestureRecognizer:swipeRight]; [self addGestureRecognizer:swipeLeft]; [self addGestureRecognizer:swipeUp]; [self addGestureRecognizer:swipeDown]; [self addGestureRecognizer:doubleTapTwoFingers]; + [swipeUpKeyboard release]; + [swipeDownKeyboard release]; [swipeRight release]; [swipeLeft release]; [swipeUp release]; @@ -1013,6 +1030,14 @@ uint getSizeNextPOT(uint size) { _secondTouch = nil; } +- (void)keyboardSwipeUp:(UISwipeGestureRecognizer *)recognizer { + [self showKeyboard]; +} + +- (void)keyboardSwipeDown:(UISwipeGestureRecognizer *)recognizer { + [self hideKeyboard]; +} + - (void)twoFingersSwipeRight:(UISwipeGestureRecognizer *)recognizer { [self addEvent:InternalEvent(kInputSwipe, kUIViewSwipeRight, 2)]; } |