mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-08-02 22:29:25 +00:00
Update EventController.java
add KeyCharacterMap.UnavailableException in charMap
This commit is contained in:
parent
e2ef39fae5
commit
5aa68dd172
1 changed files with 11 additions and 1 deletions
|
@ -19,7 +19,8 @@ public class EventController {
|
||||||
private final Device device;
|
private final Device device;
|
||||||
private final DesktopConnection connection;
|
private final DesktopConnection connection;
|
||||||
|
|
||||||
private final KeyCharacterMap charMap = KeyCharacterMap.load(KeyCharacterMap.VIRTUAL_KEYBOARD);
|
// private final KeyCharacterMap charMap = KeyCharacterMap.load(KeyCharacterMap.VIRTUAL_KEYBOARD);
|
||||||
|
private KeyCharacterMap charMap;
|
||||||
|
|
||||||
private long lastMouseDown;
|
private long lastMouseDown;
|
||||||
private final MotionEvent.PointerProperties[] pointerProperties = {new MotionEvent.PointerProperties()};
|
private final MotionEvent.PointerProperties[] pointerProperties = {new MotionEvent.PointerProperties()};
|
||||||
|
@ -93,6 +94,15 @@ public class EventController {
|
||||||
private boolean injectChar(char c) {
|
private boolean injectChar(char c) {
|
||||||
String decomposed = KeyComposition.decompose(c);
|
String decomposed = KeyComposition.decompose(c);
|
||||||
char[] chars = decomposed != null ? decomposed.toCharArray() : new char[] {c};
|
char[] chars = decomposed != null ? decomposed.toCharArray() : new char[] {c};
|
||||||
|
|
||||||
|
if (charMap == null) {
|
||||||
|
try {
|
||||||
|
charMap = KeyCharacterMap.load(KeyCharacterMap.VIRTUAL_KEYBOARD);
|
||||||
|
} catch (KeyCharacterMap.UnavailableException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
KeyEvent[] events = charMap.getEvents(chars);
|
KeyEvent[] events = charMap.getEvents(chars);
|
||||||
if (events == null) {
|
if (events == null) {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue