Skip to content

Commit 535994f

Browse files
authored
Merge pull request #106 from rust-mobile/rib/pr/game-activity-disable-get-unicode-char
GameActivity PATCH: Don't read unicode via getUnicodeChar
2 parents b4cf0ee + 6b33074 commit 535994f

File tree

6 files changed

+11
-54
lines changed

6 files changed

+11
-54
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
@@ -345,7 +345,7 @@ static struct {
345345
jmethodID getRepeatCount;
346346
jmethodID getKeyCode;
347347
jmethodID getScanCode;
348-
jmethodID getUnicodeChar;
348+
//jmethodID getUnicodeChar;
349349
} gKeyEventClassInfo;
350350

351351
extern "C" void GameActivityKeyEvent_fromJava(JNIEnv *env, jobject keyEvent,
@@ -379,8 +379,8 @@ extern "C" void GameActivityKeyEvent_fromJava(JNIEnv *env, jobject keyEvent,
379379
env->GetMethodID(keyEventClass, "getKeyCode", "()I");
380380
gKeyEventClassInfo.getScanCode =
381381
env->GetMethodID(keyEventClass, "getScanCode", "()I");
382-
gKeyEventClassInfo.getUnicodeChar =
383-
env->GetMethodID(keyEventClass, "getUnicodeChar", "()I");
382+
//gKeyEventClassInfo.getUnicodeChar =
383+
// env->GetMethodID(keyEventClass, "getUnicodeChar", "()I");
384384

385385
gKeyEventClassInfoInitialized = true;
386386
}
@@ -407,7 +407,8 @@ extern "C" void GameActivityKeyEvent_fromJava(JNIEnv *env, jobject keyEvent,
407407
/*keyCode=*/
408408
env->CallIntMethod(keyEvent, gKeyEventClassInfo.getKeyCode),
409409
/*scanCode=*/
410-
env->CallIntMethod(keyEvent, gKeyEventClassInfo.getScanCode),
410+
env->CallIntMethod(keyEvent, gKeyEventClassInfo.getScanCode)
411411
/*unicodeChar=*/
412-
env->CallIntMethod(keyEvent, gKeyEventClassInfo.getUnicodeChar)};
412+
//env->CallIntMethod(keyEvent, gKeyEventClassInfo.getUnicodeChar)
413+
};
413414
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ typedef struct GameActivityKeyEvent {
312312
int32_t repeatCount;
313313
int32_t keyCode;
314314
int32_t scanCode;
315-
int32_t unicodeChar;
315+
//int32_t unicodeChar;
316316
} GameActivityKeyEvent;
317317

318318
/**

android-activity/src/game_activity/ffi_aarch64.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2686,15 +2686,14 @@ pub struct GameActivityKeyEvent {
26862686
pub repeatCount: i32,
26872687
pub keyCode: i32,
26882688
pub scanCode: i32,
2689-
pub unicodeChar: i32,
26902689
}
26912690
#[test]
26922691
fn bindgen_test_layout_GameActivityKeyEvent() {
26932692
const UNINIT: ::std::mem::MaybeUninit<GameActivityKeyEvent> = ::std::mem::MaybeUninit::uninit();
26942693
let ptr = UNINIT.as_ptr();
26952694
assert_eq!(
26962695
::std::mem::size_of::<GameActivityKeyEvent>(),
2697-
64usize,
2696+
56usize,
26982697
concat!("Size of: ", stringify!(GameActivityKeyEvent))
26992698
);
27002699
assert_eq!(
@@ -2812,16 +2811,6 @@ fn bindgen_test_layout_GameActivityKeyEvent() {
28122811
stringify!(scanCode)
28132812
)
28142813
);
2815-
assert_eq!(
2816-
unsafe { ::std::ptr::addr_of!((*ptr).unicodeChar) as usize - ptr as usize },
2817-
56usize,
2818-
concat!(
2819-
"Offset of field: ",
2820-
stringify!(GameActivityKeyEvent),
2821-
"::",
2822-
stringify!(unicodeChar)
2823-
)
2824-
);
28252814
}
28262815
extern "C" {
28272816
#[doc = " \\brief Convert a Java `KeyEvent` to a `GameActivityKeyEvent`.\n\n This is done automatically by the GameActivity: see `onKeyUp` and `onKeyDown`\n to set a callback to consume the received events.\n This function can be used if you re-implement events handling in your own\n activity.\n Ownership of out_event is maintained by the caller."]

android-activity/src/game_activity/ffi_arm.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2716,15 +2716,14 @@ pub struct GameActivityKeyEvent {
27162716
pub repeatCount: i32,
27172717
pub keyCode: i32,
27182718
pub scanCode: i32,
2719-
pub unicodeChar: i32,
27202719
}
27212720
#[test]
27222721
fn bindgen_test_layout_GameActivityKeyEvent() {
27232722
const UNINIT: ::std::mem::MaybeUninit<GameActivityKeyEvent> = ::std::mem::MaybeUninit::uninit();
27242723
let ptr = UNINIT.as_ptr();
27252724
assert_eq!(
27262725
::std::mem::size_of::<GameActivityKeyEvent>(),
2727-
64usize,
2726+
56usize,
27282727
concat!("Size of: ", stringify!(GameActivityKeyEvent))
27292728
);
27302729
assert_eq!(
@@ -2842,16 +2841,6 @@ fn bindgen_test_layout_GameActivityKeyEvent() {
28422841
stringify!(scanCode)
28432842
)
28442843
);
2845-
assert_eq!(
2846-
unsafe { ::std::ptr::addr_of!((*ptr).unicodeChar) as usize - ptr as usize },
2847-
56usize,
2848-
concat!(
2849-
"Offset of field: ",
2850-
stringify!(GameActivityKeyEvent),
2851-
"::",
2852-
stringify!(unicodeChar)
2853-
)
2854-
);
28552844
}
28562845
extern "C" {
28572846
#[doc = " \\brief Convert a Java `KeyEvent` to a `GameActivityKeyEvent`.\n\n This is done automatically by the GameActivity: see `onKeyUp` and `onKeyDown`\n to set a callback to consume the received events.\n This function can be used if you re-implement events handling in your own\n activity.\n Ownership of out_event is maintained by the caller."]

android-activity/src/game_activity/ffi_i686.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2637,15 +2637,14 @@ pub struct GameActivityKeyEvent {
26372637
pub repeatCount: i32,
26382638
pub keyCode: i32,
26392639
pub scanCode: i32,
2640-
pub unicodeChar: i32,
26412640
}
26422641
#[test]
26432642
fn bindgen_test_layout_GameActivityKeyEvent() {
26442643
const UNINIT: ::std::mem::MaybeUninit<GameActivityKeyEvent> = ::std::mem::MaybeUninit::uninit();
26452644
let ptr = UNINIT.as_ptr();
26462645
assert_eq!(
26472646
::std::mem::size_of::<GameActivityKeyEvent>(),
2648-
56usize,
2647+
52usize,
26492648
concat!("Size of: ", stringify!(GameActivityKeyEvent))
26502649
);
26512650
assert_eq!(
@@ -2763,16 +2762,6 @@ fn bindgen_test_layout_GameActivityKeyEvent() {
27632762
stringify!(scanCode)
27642763
)
27652764
);
2766-
assert_eq!(
2767-
unsafe { ::std::ptr::addr_of!((*ptr).unicodeChar) as usize - ptr as usize },
2768-
52usize,
2769-
concat!(
2770-
"Offset of field: ",
2771-
stringify!(GameActivityKeyEvent),
2772-
"::",
2773-
stringify!(unicodeChar)
2774-
)
2775-
);
27762765
}
27772766
extern "C" {
27782767
#[doc = " \\brief Convert a Java `KeyEvent` to a `GameActivityKeyEvent`.\n\n This is done automatically by the GameActivity: see `onKeyUp` and `onKeyDown`\n to set a callback to consume the received events.\n This function can be used if you re-implement events handling in your own\n activity.\n Ownership of out_event is maintained by the caller."]

android-activity/src/game_activity/ffi_x86_64.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2666,15 +2666,14 @@ pub struct GameActivityKeyEvent {
26662666
pub repeatCount: i32,
26672667
pub keyCode: i32,
26682668
pub scanCode: i32,
2669-
pub unicodeChar: i32,
26702669
}
26712670
#[test]
26722671
fn bindgen_test_layout_GameActivityKeyEvent() {
26732672
const UNINIT: ::std::mem::MaybeUninit<GameActivityKeyEvent> = ::std::mem::MaybeUninit::uninit();
26742673
let ptr = UNINIT.as_ptr();
26752674
assert_eq!(
26762675
::std::mem::size_of::<GameActivityKeyEvent>(),
2677-
64usize,
2676+
56usize,
26782677
concat!("Size of: ", stringify!(GameActivityKeyEvent))
26792678
);
26802679
assert_eq!(
@@ -2792,16 +2791,6 @@ fn bindgen_test_layout_GameActivityKeyEvent() {
27922791
stringify!(scanCode)
27932792
)
27942793
);
2795-
assert_eq!(
2796-
unsafe { ::std::ptr::addr_of!((*ptr).unicodeChar) as usize - ptr as usize },
2797-
56usize,
2798-
concat!(
2799-
"Offset of field: ",
2800-
stringify!(GameActivityKeyEvent),
2801-
"::",
2802-
stringify!(unicodeChar)
2803-
)
2804-
);
28052794
}
28062795
extern "C" {
28072796
#[doc = " \\brief Convert a Java `KeyEvent` to a `GameActivityKeyEvent`.\n\n This is done automatically by the GameActivity: see `onKeyUp` and `onKeyDown`\n to set a callback to consume the received events.\n This function can be used if you re-implement events handling in your own\n activity.\n Ownership of out_event is maintained by the caller."]

0 commit comments

Comments
 (0)