Permalink
Browse files

Move keyCommands to iPhoneView (ios7_video.mm); here keyCommands is i…

…ndeed being triggered, when it was in SoftKeyboard (ios7_keyboard.mm), it was never being called.
  • Loading branch information...
Michael Zinn
Michael Zinn committed Aug 16, 2018
1 parent 78c2bb6 commit cc9a4aa435d2c8f16bbf626ec6dd98b5bab73faf
Showing with 24 additions and 24 deletions.
  1. +0 −24 backends/platform/ios7/ios7_keyboard.mm
  2. +24 −0 backends/platform/ios7/ios7_video.mm
@@ -66,30 +66,6 @@ - (id)initWithFrame:(CGRect)frame {
return self;
}

- (NSArray *)keyCommands {
UIKeyCommand *upArrow = [UIKeyCommand keyCommandWithInput: UIKeyInputUpArrow modifierFlags: 0 action: @selector(upArrow:)];
UIKeyCommand *downArrow = [UIKeyCommand keyCommandWithInput: UIKeyInputDownArrow modifierFlags: 0 action: @selector(downArrow:)];
UIKeyCommand *leftArrow = [UIKeyCommand keyCommandWithInput: UIKeyInputLeftArrow modifierFlags: 0 action: @selector(leftArrow:)];
UIKeyCommand *rightArrow = [UIKeyCommand keyCommandWithInput: UIKeyInputRightArrow modifierFlags: 0 action: @selector(rightArrow:)];
return [[NSArray alloc] initWithObjects: upArrow, downArrow, leftArrow, rightArrow, nil];
}

- (void) upArrow: (UIKeyCommand *) keyCommand {
[self handleKeyPress:273];
}

- (void) downArrow: (UIKeyCommand *) keyCommand {
[self handleKeyPress:274];
}

- (void) leftArrow: (UIKeyCommand *) keyCommand {
[self handleKeyPress:276];
}

- (void) rightArrow: (UIKeyCommand *) keyCommand {
[self handleKeyPress:275];
}

- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
unichar c;
if (text.length) {
@@ -985,6 +985,30 @@ - (void)handleKeyPress:(unichar)c {
}
}

- (NSArray *)keyCommands {
UIKeyCommand *upArrow = [UIKeyCommand keyCommandWithInput: UIKeyInputUpArrow modifierFlags: 0 action: @selector(upArrow:)];
UIKeyCommand *downArrow = [UIKeyCommand keyCommandWithInput: UIKeyInputDownArrow modifierFlags: 0 action: @selector(downArrow:)];
UIKeyCommand *leftArrow = [UIKeyCommand keyCommandWithInput: UIKeyInputLeftArrow modifierFlags: 0 action: @selector(leftArrow:)];
UIKeyCommand *rightArrow = [UIKeyCommand keyCommandWithInput: UIKeyInputRightArrow modifierFlags: 0 action: @selector(rightArrow:)];
return [[NSArray alloc] initWithObjects: upArrow, downArrow, leftArrow, rightArrow, nil];
}

- (void) upArrow: (UIKeyCommand *) keyCommand {
[_keyboardView handleKeyPress:273];
}

- (void) downArrow: (UIKeyCommand *) keyCommand {
[_keyboardView handleKeyPress:274];
}

- (void) leftArrow: (UIKeyCommand *) keyCommand {
[_keyboardView handleKeyPress:276];
}

- (void) rightArrow: (UIKeyCommand *) keyCommand {
[_keyboardView handleKeyPress:275];
}

- (void)applicationSuspend {
[self addEvent:InternalEvent(kInputApplicationSuspended, 0, 0)];
}

0 comments on commit cc9a4aa

Please sign in to comment.