[Scummvm-git-logs] scummvm master -> eee970df1fa75ede7130a8d69b04cbc573512f9b
sev-
sev at scummvm.org
Wed Jul 25 10:17:44 CEST 2018
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
eee970df1f IOS: Add Keyboard and UI Fixes for Smartkeyboard on IPad Pro.
Commit: eee970df1fa75ede7130a8d69b04cbc573512f9b
https://github.com/scummvm/scummvm/commit/eee970df1fa75ede7130a8d69b04cbc573512f9b
Author: D G Turner (digitall at scummvm.org)
Date: 2018-07-25T10:17:40+02:00
Commit Message:
IOS: Add Keyboard and UI Fixes for Smartkeyboard on IPad Pro.
These have not been compiled or otherwise tested, but are cleaned up
version of code changes from forum user "dottostring" in thread:
http://forums.scummvm.org/viewtopic.php?t=14524
This should add Fake ESC key support replacing the '`' key and add full
support for the Arrow keys.
Changed paths:
backends/platform/ios7/ios7_keyboard.mm
backends/platform/ios7/ios7_video.mm
diff --git a/backends/platform/ios7/ios7_keyboard.mm b/backends/platform/ios7/ios7_keyboard.mm
index 9476b96..f6d1b59 100644
--- a/backends/platform/ios7/ios7_keyboard.mm
+++ b/backends/platform/ios7/ios7_keyboard.mm
@@ -46,6 +46,9 @@
[self setAutocorrectionType:UITextAutocorrectionTypeNo];
[self setAutocapitalizationType:UITextAutocapitalizationTypeNone];
[self setEnablesReturnKeyAutomatically:NO];
+ UITextInputAssistantItem* item = [self inputAssistantItem];
+ item.leadingBarButtonGroups = @[];
+ item.trailingBarButtonGroups = @[];
return self;
}
@@ -63,6 +66,31 @@
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 resignFirstResponder];
+ [softKeyboard handleKeyPress:273];
+}
+
+- (void) downArrow: (UIKeyCommand *) keyCommand {
+ [softKeyboard handleKeyPress:274];
+}
+
+- (void) leftArrow: (UIKeyCommand *) keyCommand {
+ [softKeyboard handleKeyPress:276];
+}
+
+- (void) rightArrow: (UIKeyCommand *) keyCommand {
+ [softKeyboard handleKeyPress:275];
+}
+
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
unichar c;
if (text.length) {
diff --git a/backends/platform/ios7/ios7_video.mm b/backends/platform/ios7/ios7_video.mm
index 85a4dc9..ee558a1 100644
--- a/backends/platform/ios7/ios7_video.mm
+++ b/backends/platform/ios7/ios7_video.mm
@@ -720,6 +720,14 @@ uint getSizeNextPOT(uint size) {
screenHeight = MAX(_renderBufferWidth, _renderBufferHeight);
}
+ if (_keyboardView == nil) {
+ _keyboardView = [[SoftKeyboard alloc] initWithFrame:CGRectZero];
+ [_keyboardView setInputDelegate:self];
+ [self addSubview:[_keyboardView inputView]];
+ [self addSubview: _keyboardView];
+ [_keyboardView showKeyboard];
+ }
+
glBindRenderbuffer(GL_RENDERBUFFER, _viewRenderbuffer); printOpenGLError();
[self clearColorBuffer];
@@ -761,8 +769,6 @@ uint getSizeNextPOT(uint size) {
yOffset = (screenHeight - rectHeight) / 2;
}
- [_keyboardView hideKeyboard];
-
//printf("Rect: %i, %i, %i, %i\n", xOffset, yOffset, rectWidth, rectHeight);
_gameScreenRect = CGRectMake(xOffset, yOffset, rectWidth, rectHeight);
overlayPortraitRatio = 1.0f;
@@ -772,15 +778,6 @@ uint getSizeNextPOT(uint size) {
//printf("Making rect (%u, %u)\n", screenWidth, height);
_gameScreenRect = CGRectMake(0, 0, screenWidth, height);
- CGRect keyFrame = CGRectMake(0.0f, 0.0f, 0.0f, 0.0f);
- if (_keyboardView == nil) {
- _keyboardView = [[SoftKeyboard alloc] initWithFrame:keyFrame];
- [_keyboardView setInputDelegate:self];
- [self addSubview:[_keyboardView inputView]];
- [self addSubview: _keyboardView];
- }
-
- [_keyboardView showKeyboard];
overlayPortraitRatio = (_videoContext.overlayHeight * ratio) / _videoContext.overlayWidth;
}
_overlayRect = CGRectMake(0, 0, screenWidth, screenHeight * overlayPortraitRatio);
@@ -981,7 +978,11 @@ uint getSizeNextPOT(uint size) {
}
- (void)handleKeyPress:(unichar)c {
- [self addEvent:InternalEvent(kInputKeyPressed, c, 0)];
+ if (c == '`') {
+ [self addEvent:InternalEvent(kInputKeyPressed, '\E', 0)];
+ } else {
+ [self addEvent:InternalEvent(kInputKeyPressed, c, 0)];
+ }
}
- (void)applicationSuspend {
More information about the Scummvm-git-logs
mailing list