Permalink
Browse files

Move the arrow key capturing to TextInputHandler, which is presumably…

… what the original author intended. I am not yet convinced that this is entirely right though.
  • Loading branch information...
Michael Zinn
Michael Zinn committed Aug 19, 2018
1 parent a02b893 commit b5098a42b5a514101c809f4f0965ca4223341257
Showing with 24 additions and 24 deletions.
  1. +24 −0 backends/platform/ios7/ios7_keyboard.mm
  2. +0 −24 backends/platform/ios7/ios7_video.mm
@@ -53,6 +53,30 @@ - (id)initWithKeyboard:(SoftKeyboard *)keyboard {
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 {
[softKeyboard handleKeyPress:273];
}

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

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

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

@end


@@ -985,30 +985,6 @@ - (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 b5098a4

Please sign in to comment.