Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,10 @@ struct android_app {
* thread, so we can't say that this is only valid within the `APP_CMD_` handler.
*/
int editorAction;
/**
* true when editorAction has been set
*/
bool pendingEditorAction;

/**
* Current state of the app's activity. May be either APP_CMD_START,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -726,9 +726,15 @@ static bool onEditorAction(GameActivity* activity, int action) {
// XXX: this is a racy design that could lose InputConnection actions if the
// application doesn't manage to look at app->editorAction before another
// action is delivered.
if (android_app->pendingEditorAction) {
LOGW("Dropping editor action %d because previous action %d not yet "
"handled",
action, android_app->editorAction);
}
android_app->editorAction = action;
// TODO: buffer these actions like other input events
//notifyInput(android_app);
android_app->pendingEditorAction = true;
notifyInput(android_app);
// TODO: buffer IME text events and editor actions like other input events

//android_app_write_cmd(android_app, APP_CMD_EDITOR_ACTION);
pthread_mutex_unlock(&android_app->mutex);
Expand Down
51 changes: 29 additions & 22 deletions android-activity/src/game_activity/ffi_aarch64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6259,6 +6259,8 @@ pub struct android_app {
pub softwareKeyboardVisible: bool,
#[doc = " Last editor action. Valid within APP_CMD_SOFTWARE_KB_VIS_CHANGED handler.\n\n Note: the upstream comment above isn't accurate.\n - `APP_CMD_SOFTWARE_KB_VIS_CHANGED` is associated with `softwareKeyboardVisible`\n changes, not `editorAction`.\n - `APP_CMD_EDITOR_ACTION` is associated with this state but unlike for\n `window` state there's no synchonization that blocks the Java main\n thread, so we can't say that this is only valid within the `APP_CMD_` handler."]
pub editorAction: ::std::os::raw::c_int,
#[doc = " true when editorAction has been set"]
pub pendingEditorAction: bool,
#[doc = " Current state of the app's activity. May be either APP_CMD_START,\n APP_CMD_RESUME, APP_CMD_PAUSE, or APP_CMD_STOP."]
pub activityState: ::std::os::raw::c_int,
#[doc = " This is non-zero when the application's GameActivity is being\n destroyed and waiting for the app thread to complete."]
Expand Down Expand Up @@ -6292,7 +6294,7 @@ fn bindgen_test_layout_android_app() {
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<android_app>(),
392usize,
400usize,
"Size of android_app"
);
assert_eq!(
Expand Down Expand Up @@ -6356,108 +6358,113 @@ fn bindgen_test_layout_android_app() {
"Offset of field: android_app::editorAction"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).activityState) as usize - ptr as usize },
unsafe { ::std::ptr::addr_of!((*ptr).pendingEditorAction) as usize - ptr as usize },
88usize,
"Offset of field: android_app::pendingEditorAction"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).activityState) as usize - ptr as usize },
92usize,
"Offset of field: android_app::activityState"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).destroyRequested) as usize - ptr as usize },
92usize,
96usize,
"Offset of field: android_app::destroyRequested"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).inputBuffers) as usize - ptr as usize },
96usize,
104usize,
"Offset of field: android_app::inputBuffers"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).currentInputBuffer) as usize - ptr as usize },
192usize,
200usize,
"Offset of field: android_app::currentInputBuffer"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).textInputState) as usize - ptr as usize },
196usize,
204usize,
"Offset of field: android_app::textInputState"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).mutex) as usize - ptr as usize },
200usize,
208usize,
"Offset of field: android_app::mutex"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).cond) as usize - ptr as usize },
240usize,
248usize,
"Offset of field: android_app::cond"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).msgread) as usize - ptr as usize },
288usize,
296usize,
"Offset of field: android_app::msgread"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).msgwrite) as usize - ptr as usize },
292usize,
300usize,
"Offset of field: android_app::msgwrite"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).thread) as usize - ptr as usize },
296usize,
304usize,
"Offset of field: android_app::thread"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).cmdPollSource) as usize - ptr as usize },
304usize,
312usize,
"Offset of field: android_app::cmdPollSource"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).running) as usize - ptr as usize },
328usize,
336usize,
"Offset of field: android_app::running"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).stateSaved) as usize - ptr as usize },
332usize,
340usize,
"Offset of field: android_app::stateSaved"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).destroyed) as usize - ptr as usize },
336usize,
344usize,
"Offset of field: android_app::destroyed"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).redrawNeeded) as usize - ptr as usize },
340usize,
348usize,
"Offset of field: android_app::redrawNeeded"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).pendingWindow) as usize - ptr as usize },
344usize,
352usize,
"Offset of field: android_app::pendingWindow"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).pendingContentRect) as usize - ptr as usize },
352usize,
360usize,
"Offset of field: android_app::pendingContentRect"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).keyEventFilter) as usize - ptr as usize },
368usize,
376usize,
"Offset of field: android_app::keyEventFilter"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).motionEventFilter) as usize - ptr as usize },
376usize,
384usize,
"Offset of field: android_app::motionEventFilter"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).inputAvailableWakeUp) as usize - ptr as usize },
384usize,
392usize,
"Offset of field: android_app::inputAvailableWakeUp"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).inputSwapPending) as usize - ptr as usize },
385usize,
393usize,
"Offset of field: android_app::inputSwapPending"
);
}
Expand Down
51 changes: 29 additions & 22 deletions android-activity/src/game_activity/ffi_arm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6724,6 +6724,8 @@ pub struct android_app {
pub softwareKeyboardVisible: bool,
#[doc = " Last editor action. Valid within APP_CMD_SOFTWARE_KB_VIS_CHANGED handler.\n\n Note: the upstream comment above isn't accurate.\n - `APP_CMD_SOFTWARE_KB_VIS_CHANGED` is associated with `softwareKeyboardVisible`\n changes, not `editorAction`.\n - `APP_CMD_EDITOR_ACTION` is associated with this state but unlike for\n `window` state there's no synchonization that blocks the Java main\n thread, so we can't say that this is only valid within the `APP_CMD_` handler."]
pub editorAction: ::std::os::raw::c_int,
#[doc = " true when editorAction has been set"]
pub pendingEditorAction: bool,
#[doc = " Current state of the app's activity. May be either APP_CMD_START,\n APP_CMD_RESUME, APP_CMD_PAUSE, or APP_CMD_STOP."]
pub activityState: ::std::os::raw::c_int,
#[doc = " This is non-zero when the application's GameActivity is being\n destroyed and waiting for the app thread to complete."]
Expand Down Expand Up @@ -6757,7 +6759,7 @@ fn bindgen_test_layout_android_app() {
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<android_app>(),
248usize,
256usize,
"Size of android_app"
);
assert_eq!(
Expand Down Expand Up @@ -6821,108 +6823,113 @@ fn bindgen_test_layout_android_app() {
"Offset of field: android_app::editorAction"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).activityState) as usize - ptr as usize },
unsafe { ::std::ptr::addr_of!((*ptr).pendingEditorAction) as usize - ptr as usize },
56usize,
"Offset of field: android_app::pendingEditorAction"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).activityState) as usize - ptr as usize },
60usize,
"Offset of field: android_app::activityState"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).destroyRequested) as usize - ptr as usize },
60usize,
64usize,
"Offset of field: android_app::destroyRequested"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).inputBuffers) as usize - ptr as usize },
64usize,
72usize,
"Offset of field: android_app::inputBuffers"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).currentInputBuffer) as usize - ptr as usize },
160usize,
168usize,
"Offset of field: android_app::currentInputBuffer"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).textInputState) as usize - ptr as usize },
164usize,
172usize,
"Offset of field: android_app::textInputState"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).mutex) as usize - ptr as usize },
168usize,
176usize,
"Offset of field: android_app::mutex"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).cond) as usize - ptr as usize },
172usize,
180usize,
"Offset of field: android_app::cond"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).msgread) as usize - ptr as usize },
176usize,
184usize,
"Offset of field: android_app::msgread"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).msgwrite) as usize - ptr as usize },
180usize,
188usize,
"Offset of field: android_app::msgwrite"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).thread) as usize - ptr as usize },
184usize,
192usize,
"Offset of field: android_app::thread"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).cmdPollSource) as usize - ptr as usize },
188usize,
196usize,
"Offset of field: android_app::cmdPollSource"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).running) as usize - ptr as usize },
200usize,
208usize,
"Offset of field: android_app::running"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).stateSaved) as usize - ptr as usize },
204usize,
212usize,
"Offset of field: android_app::stateSaved"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).destroyed) as usize - ptr as usize },
208usize,
216usize,
"Offset of field: android_app::destroyed"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).redrawNeeded) as usize - ptr as usize },
212usize,
220usize,
"Offset of field: android_app::redrawNeeded"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).pendingWindow) as usize - ptr as usize },
216usize,
224usize,
"Offset of field: android_app::pendingWindow"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).pendingContentRect) as usize - ptr as usize },
220usize,
228usize,
"Offset of field: android_app::pendingContentRect"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).keyEventFilter) as usize - ptr as usize },
236usize,
244usize,
"Offset of field: android_app::keyEventFilter"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).motionEventFilter) as usize - ptr as usize },
240usize,
248usize,
"Offset of field: android_app::motionEventFilter"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).inputAvailableWakeUp) as usize - ptr as usize },
244usize,
252usize,
"Offset of field: android_app::inputAvailableWakeUp"
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).inputSwapPending) as usize - ptr as usize },
245usize,
253usize,
"Offset of field: android_app::inputSwapPending"
);
}
Expand Down
Loading