mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2025-07-02 15:56:21 +00:00
Add support for Unicode text input
This commit is contained in:
parent
68e6690e55
commit
e80a4fd2b1
@ -52,7 +52,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
|
|||||||
TemporarySettings* settings = [[[DataManager alloc] init] getSettings];
|
TemporarySettings* settings = [[[DataManager alloc] init] getSettings];
|
||||||
|
|
||||||
keyInputField = [[UITextField alloc] initWithFrame:CGRectZero];
|
keyInputField = [[UITextField alloc] initWithFrame:CGRectZero];
|
||||||
[keyInputField setKeyboardType:UIKeyboardTypeASCIICapable];
|
[keyInputField setKeyboardType:UIKeyboardTypeDefault];
|
||||||
[keyInputField setAutocorrectionType:UITextAutocorrectionTypeNo];
|
[keyInputField setAutocorrectionType:UITextAutocorrectionTypeNo];
|
||||||
[keyInputField setAutocapitalizationType:UITextAutocapitalizationTypeNone];
|
[keyInputField setAutocapitalizationType:UITextAutocapitalizationTypeNone];
|
||||||
[keyInputField setSpellCheckingType:UITextSpellCheckingTypeNo];
|
[keyInputField setSpellCheckingType:UITextSpellCheckingTypeNo];
|
||||||
@ -503,13 +503,24 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
|
|||||||
LiSendKeyboardEvent(0x08, KEY_ACTION_UP, 0);
|
LiSendKeyboardEvent(0x08, KEY_ACTION_UP, 0);
|
||||||
} else {
|
} else {
|
||||||
// Character 0 will be our known sentinel value
|
// Character 0 will be our known sentinel value
|
||||||
|
|
||||||
|
// Check if any characters exist which can't be represented in a basic key event
|
||||||
for (int i = 1; i < [inputText length]; i++) {
|
for (int i = 1; i < [inputText length]; i++) {
|
||||||
struct KeyEvent event = [KeyboardSupport translateKeyEvent:[inputText characterAtIndex:i] withModifierFlags:0];
|
struct KeyEvent event = [KeyboardSupport translateKeyEvent:[inputText characterAtIndex:i] withModifierFlags:0];
|
||||||
if (event.keycode == 0) {
|
if (event.keycode == 0) {
|
||||||
// If we don't know the code, don't send anything.
|
// We found an unknown key, so send the entire string as UTF-8
|
||||||
Log(LOG_W, @"Unknown key code: [%c]", [inputText characterAtIndex:i]);
|
const char* utf8String = [inputText UTF8String];
|
||||||
continue;
|
|
||||||
|
// Skip the first character which is our sentinel
|
||||||
|
LiSendUtf8TextEvent(utf8String + 1, (int)strlen(utf8String) - 1);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// We didn't find any unknown characters, so send them all as basic key events
|
||||||
|
for (int i = 1; i < [inputText length]; i++) {
|
||||||
|
struct KeyEvent event = [KeyboardSupport translateKeyEvent:[inputText characterAtIndex:i] withModifierFlags:0];
|
||||||
|
assert(event.keycode != 0);
|
||||||
[self sendLowLevelEvent:event];
|
[self sendLowLevelEvent:event];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit fa892c53344f76846b27d37cde1b904d745d42b1
|
Subproject commit a290ec032b6a068a56461bbe4b60798b68a319d5
|
Loading…
x
Reference in New Issue
Block a user