added support for RustDesk
This commit is contained in:
parent
3e1c210118
commit
852eab0d64
5 changed files with 35 additions and 3 deletions
|
|
@ -70,6 +70,19 @@ public class AppHacks {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles applications that always report no text around the cursor, preventing the cursor from
|
||||||
|
* moving the usual way.
|
||||||
|
*/
|
||||||
|
public boolean onMoveCursor(boolean backward) {
|
||||||
|
if (inputType.isRustDesk() || inputType.isTermux()) {
|
||||||
|
return sendDownUpKeyEvents(backward ? KeyEvent.KEYCODE_DPAD_LEFT : KeyEvent.KEYCODE_DPAD_RIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs extra operations when the cursor moves and returns "true" if the selection was handled, "false" otherwise.
|
* Performs extra operations when the cursor moves and returns "true" if the selection was handled, "false" otherwise.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,21 @@ public class InputType extends StandardInputType {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RustDesk does not support composing text when connected to a remote computer. This detects the
|
||||||
|
* "remote input field", so that we can prevent inserting any composing text, but still perform
|
||||||
|
* the composing operation behind the scenes.
|
||||||
|
*/
|
||||||
|
public boolean isRustDesk() {
|
||||||
|
final int OPTIONS_MASK = EditorInfo.IME_ACTION_NONE | EditorInfo.IME_FLAG_NO_FULLSCREEN;
|
||||||
|
|
||||||
|
return isAppField(
|
||||||
|
"com.carriez.flutter_hbb",
|
||||||
|
EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE | EditorInfo.TYPE_TEXT_FLAG_NO_SUGGESTIONS
|
||||||
|
) && (field.imeOptions & OPTIONS_MASK) == OPTIONS_MASK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simulate the behavior of the Sonim native keyboard. In search fields with integrated lists,
|
* Simulate the behavior of the Sonim native keyboard. In search fields with integrated lists,
|
||||||
* ENTER is used to select an item from the list. But some of them have actionId = NEXT, instead of NONE,
|
* ENTER is used to select an item from the list. But some of them have actionId = NEXT, instead of NONE,
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ public abstract class HotkeyHandler extends CommandHandler {
|
||||||
|
|
||||||
|
|
||||||
public boolean onKeyMoveCursor(boolean backward) {
|
public boolean onKeyMoveCursor(boolean backward) {
|
||||||
return textField.moveCursor(backward);
|
return appHacks.onMoveCursor(backward) || textField.moveCursor(backward);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,10 @@ public abstract class TypingHandler extends KeyPadHandler {
|
||||||
|
|
||||||
|
|
||||||
protected void setInputField(InputConnection connection, EditorInfo field) {
|
protected void setInputField(InputConnection connection, EditorInfo field) {
|
||||||
|
if (textField.equals(connection, field)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
currentInputConnection = connection;
|
currentInputConnection = connection;
|
||||||
inputType = new InputType(currentInputConnection, field);
|
inputType = new InputType(currentInputConnection, field);
|
||||||
textField = new TextField(currentInputConnection, field);
|
textField = new TextField(currentInputConnection, field);
|
||||||
|
|
@ -198,7 +202,7 @@ public abstract class TypingHandler extends KeyPadHandler {
|
||||||
|
|
||||||
|
|
||||||
private void autoCorrectSpace(String currentWord, boolean isWordAcceptedManually, int nextKey) {
|
private void autoCorrectSpace(String currentWord, boolean isWordAcceptedManually, int nextKey) {
|
||||||
if (mInputMode.shouldDeletePrecedingSpace(inputType)) {
|
if (!inputType.isRustDesk() && mInputMode.shouldDeletePrecedingSpace(inputType)) {
|
||||||
textField.deletePrecedingSpace(currentWord);
|
textField.deletePrecedingSpace(currentWord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ public class TextField extends InputField {
|
||||||
super(inputConnection, inputField);
|
super(inputConnection, inputField);
|
||||||
|
|
||||||
InputType inputType = new InputType(inputConnection, inputField);
|
InputType inputType = new InputType(inputConnection, inputField);
|
||||||
isComposingSupported = !inputType.isNumeric() && !inputType.isLimited();
|
isComposingSupported = !inputType.isNumeric() && !inputType.isLimited() && !inputType.isRustDesk();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue