Try to fix iOS 12 compatibility; Fixes enter key
This commit is contained in:
1 parent
8b895bc0a7
commit
c533c614bd
4 files changed
+10
-14
No files matched your search
@@ -32,7 +32,7 @@ UITextField* versionTextField;
|
||||
|
||||
// Update color mode once
|
||||
if(@available(iOS 13.0, *)) {
|
||||
[self traitCollectionDidChange:nil];
|
||||
// [self traitCollectionDidChange:nil];
|
||||
} else {
|
||||
self.view.backgroundColor = [UIColor whiteColor];
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ void loginAccountInput(UINavigationController *controller, int type, char* usern
|
||||
|
||||
// Update color mode once
|
||||
if(@available(iOS 13.0, *)) {
|
||||
[self traitCollectionDidChange:nil];
|
||||
// [self traitCollectionDidChange:nil];
|
||||
} else {
|
||||
self.view.backgroundColor = [UIColor whiteColor];
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
self.window.frame = windowScene.coordinateSpace.bounds;
|
||||
self.window.rootViewController = nav;
|
||||
[self.window makeKeyAndVisible];
|
||||
[vc traitCollectionDidChange:nil];
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
@@ -48,7 +48,6 @@ UIButton* togglableVisibleButtons[100];
|
||||
UIView *touchView;
|
||||
UITextField *inputView;
|
||||
BOOL shouldTriggerClick = NO;
|
||||
BOOL shouldTriggerEnter = NO;
|
||||
|
||||
// TODO: key modifiers impl
|
||||
|
||||
@@ -93,7 +92,6 @@ BOOL shouldTriggerEnter = NO;
|
||||
|
||||
inputView.backgroundColor = [UIColor colorWithWhite:0.0f alpha:0.0f];
|
||||
[inputView addTarget:self action:@selector(inputViewDidChange) forControlEvents:UIControlEventEditingChanged];
|
||||
[inputView addTarget:self action:@selector(inputViewDidReturn) forControlEvents:UIControlEventEditingDidEnd];
|
||||
[inputView addTarget:self action:@selector(inputViewDidClick) forControlEvents:UIControlEventTouchDown];
|
||||
|
||||
// Custom button
|
||||
@@ -214,7 +212,13 @@ BOOL shouldTriggerEnter = NO;
|
||||
int charLength = [newText length];
|
||||
//char16_t *charText = [newText UTF16String];
|
||||
for (int i = 0; i < charLength; i++) {
|
||||
Java_org_lwjgl_glfw_CallbackBridge_nativeSendCharMods(NULL, NULL, (jchar) [newText characterAtIndex:i] /* charText[i] */, /* mods */ 0);
|
||||
unichar currChar = [newText characterAtIndex:i];
|
||||
if (currChar == '\n') {
|
||||
Java_org_lwjgl_glfw_CallbackBridge_nativeSendKey(NULL, NULL, GLFW_KEY_ENTER, 0, 1, 0);
|
||||
Java_org_lwjgl_glfw_CallbackBridge_nativeSendKey(NULL, NULL, GLFW_KEY_ENTER, 0, 0, 0);
|
||||
} else {
|
||||
Java_org_lwjgl_glfw_CallbackBridge_nativeSendCharMods(NULL, NULL, (jchar) currChar /* charText[i] */, /* mods */ 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,14 +230,6 @@ BOOL shouldTriggerEnter = NO;
|
||||
// Zero the input field so user will no longer able to select text inside.
|
||||
inputView.alpha = 0.0f;
|
||||
inputView.text = @" ";
|
||||
shouldTriggerEnter = YES;
|
||||
}
|
||||
|
||||
-(void)inputViewDidReturn {
|
||||
if (shouldTriggerEnter == YES) {
|
||||
Java_org_lwjgl_glfw_CallbackBridge_nativeSendKey(NULL, NULL, GLFW_KEY_ENTER, 0, 1, 0);
|
||||
Java_org_lwjgl_glfw_CallbackBridge_nativeSendKey(NULL, NULL, GLFW_KEY_ENTER, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
int currentVisibility = 1;
|
||||
@@ -248,7 +244,6 @@ ADD_BUTTON_DEF(special_togglebtn) {
|
||||
|
||||
ADD_BUTTON_DEF(special_keyboard) {
|
||||
if (held == 0) {
|
||||
shouldTriggerEnter = NO;
|
||||
[inputView resignFirstResponder];
|
||||
inputView.alpha = 1.0f;
|
||||
inputView.text = @"";
|
||||
|
||||
Reference in new issue
Block a user