Skip to content

Commit

Permalink
Move keyCommands to iPhoneView (ios7_video.mm); here keyCommands is i…
Browse files Browse the repository at this point in the history
…ndeed being triggered, when it was in SoftKeyboard (ios7_keyboard.mm), it was never being called.
  • Loading branch information
Michael Zinn committed Aug 16, 2018
1 parent 78c2bb6 commit cc9a4aa
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
24 changes: 0 additions & 24 deletions backends/platform/ios7/ios7_keyboard.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
24 changes: 24 additions & 0 deletions backends/platform/ios7/ios7_video.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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)];
}
Expand Down

0 comments on commit cc9a4aa

Please sign in to comment.