Skip to content

Commit dc2ef75

Browse files
ribjb55
authored andcommitted
GameActivity PATCH: Don't read unicode via getUnicodeChar
The `unicodeChar` in `GameActivityKeyEvent` wasn't being exposed by `android-activity` because we couldn't expose the unicode character in the same way with the native-activity backend - due to how events are received via an `InputQueue` that doesn't expose the underlying Java references for the key events. Now that we have a consistent way of supporting unicode character mapping via `KeyCharacterMap` bindings it's redundant for the `GameActivity` backend to call `getUnicodeChar` automatically for each key press.
1 parent a72c0b8 commit dc2ef75

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

android-activity/game-activity-csrc/game-activity/GameActivityEvents.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ static struct {
266266
jmethodID getRepeatCount;
267267
jmethodID getKeyCode;
268268
jmethodID getScanCode;
269-
jmethodID getUnicodeChar;
269+
// jmethodID getUnicodeChar;
270270
} gKeyEventClassInfo;
271271

272272
static void initKeyEvents(JNIEnv *env) {
@@ -297,8 +297,8 @@ static void initKeyEvents(JNIEnv *env) {
297297
env->GetMethodID(keyEventClass, "getKeyCode", "()I");
298298
gKeyEventClassInfo.getScanCode =
299299
env->GetMethodID(keyEventClass, "getScanCode", "()I");
300-
gKeyEventClassInfo.getUnicodeChar =
301-
env->GetMethodID(keyEventClass, "getUnicodeChar", "()I");
300+
//gKeyEventClassInfo.getUnicodeChar =
301+
//env->GetMethodID(keyEventClass, "getUnicodeChar", "()I");
302302
}
303303

304304
extern "C" void GameActivityKeyEvent_fromJava(JNIEnv *env, jobject keyEvent,
@@ -323,9 +323,10 @@ extern "C" void GameActivityKeyEvent_fromJava(JNIEnv *env, jobject keyEvent,
323323
/*keyCode=*/
324324
env->CallIntMethod(keyEvent, gKeyEventClassInfo.getKeyCode),
325325
/*scanCode=*/
326-
env->CallIntMethod(keyEvent, gKeyEventClassInfo.getScanCode),
326+
env->CallIntMethod(keyEvent, gKeyEventClassInfo.getScanCode)
327327
/*unicodeChar=*/
328-
env->CallIntMethod(keyEvent, gKeyEventClassInfo.getUnicodeChar)};
328+
// env->CallIntMethod(keyEvent, gKeyEventClassInfo.getUnicodeChar)
329+
};
329330
}
330331

331332
extern "C" void GameActivityEventsInit(JNIEnv *env) {

android-activity/game-activity-csrc/game-activity/GameActivityEvents.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ typedef struct GameActivityKeyEvent {
300300
int32_t repeatCount;
301301
int32_t keyCode;
302302
int32_t scanCode;
303-
int32_t unicodeChar;
303+
// int32_t unicodeChar;
304304
} GameActivityKeyEvent;
305305

306306
#ifdef __cplusplus

0 commit comments

Comments
 (0)