diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c4d7c133..30c81330 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,7 @@ name: ci on: push: - branches: [main] + branches: '*' pull_request: env: @@ -12,18 +12,32 @@ env: jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 strategy: fail-fast: false matrix: # See top README for MSRV policy - rust_version: [1.64.0, stable] + rust-version: [1.73.0, stable] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + + # Downgrade all dependencies to their minimum version, both to ensure our + # minimum version bounds are correct and buildable, as well as to satisfy + # our MSRV check when arbitrary dependencies bump their MSRV beyond our + # MSRV in a patch-release. + # This implies that downstream consumers can only rely on our MSRV when + # downgrading various (transitive) dependencies. + - uses: hecrj/setup-rust-action@v2 + with: + rust-version: nightly + if: ${{ matrix.rust-version != 'stable' }} + - name: Downgrade dependencies + run: cargo +nightly generate-lockfile -Zminimal-versions + if: ${{ matrix.rust-version != 'stable' }} - - uses: hecrj/setup-rust-action@v1 + - uses: hecrj/setup-rust-action@v2 with: - rust-version: ${{ matrix.rust_version }} + rust-version: ${{ matrix.rust-version }} - name: Install Rust targets run: > @@ -34,18 +48,7 @@ jobs: i686-linux-android - name: Install cargo-ndk - # We're currently sticking with cargo-ndk 2, until we bump our - # MSRV to 1.68+ - run: cargo install cargo-ndk --version "^2" - - - name: Setup Java - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: '17' - - - name: Setup Android SDK - uses: android-actions/setup-android@v2 + run: cargo +stable install cargo-ndk - name: Build game-activity working-directory: android-activity @@ -68,7 +71,7 @@ jobs: build --features native-activity - name: Build agdk-mainloop example - if: matrix.rust_version == 'stable' + if: matrix.rust-version == 'stable' working-directory: examples/agdk-mainloop run: > cargo ndk @@ -79,7 +82,7 @@ jobs: -o app/src/main/jniLibs/ -- build - name: Build na-mainloop example - if: matrix.rust_version == 'stable' + if: matrix.rust-version == 'stable' working-directory: examples/na-mainloop run: > cargo ndk @@ -93,17 +96,20 @@ jobs: run: > cargo ndk -t arm64-v8a doc --no-deps + - name: Build doctests + # All doctests are set to no_run, because they require running in the + # context of an Android app. + # Only run on stable because cross-compiling doctests is only supported + # since Rust 1.89. + if: ${{ matrix.rust-version == 'stable' }} + run: | + cargo test --doc -F native-activity --target aarch64-linux-android + cargo ndk -t arm64-v8a -- test --doc -F game-activity + format: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - components: rustfmt + - uses: actions/checkout@v4 - name: Format run: cargo fmt --all -- --check diff --git a/.gitignore b/.gitignore index eb5a316c..4fffb2f8 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -target +/target +/Cargo.lock diff --git a/Cargo.toml b/Cargo.toml index fc8008d5..5673fe47 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,5 @@ [workspace] -members = [ - "android-activity" -] +resolver = "2" +members = ["android-activity"] -exclude = [ - "examples", -] +exclude = ["examples"] diff --git a/README.md b/README.md index b2d0dc07..910fda92 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,11 @@ -# Overview +# `android-activity` + +[![ci](https://github.com/rust-mobile/android-activity/actions/workflows/ci.yml/badge.svg)](https://github.com/rust-mobile/android-activity/actions/workflows/ci.yml) +[![crates.io](https://img.shields.io/crates/v/android-activity.svg)](https://crates.io/crates/android-activity) +[![Docs](https://docs.rs/android-activity/badge.svg)](https://docs.rs/android-activity) +[![MSRV](https://img.shields.io/badge/rustc-1.68.0+-ab6000.svg)](https://blog.rust-lang.org/2023/03/09/Rust-1.68.0.html) + +## Overview `android-activity` provides a "glue" layer for building native Rust applications on Android, supporting multiple [`Activity`] base classes. @@ -22,14 +29,15 @@ applications. [ndk-glue]: https://crates.io/crates/ndk-glue [agdk]: https://developer.android.com/games/agdk -# Example +## Example Cargo.toml -``` + +```toml [dependencies] log = "0.4" -android_logger = "0.11" -android-activity = { version = "0.4", features = [ "native-activity" ] } +android_logger = "0.13" +android-activity = { version = "0.5", features = [ "native-activity" ] } [lib] crate_type = ["cdylib"] @@ -38,6 +46,7 @@ crate_type = ["cdylib"] _Note: that you will need to either specify the **"native-activity"** feature or **"game-activity"** feature to identify which `Activity` base class your application is based on_ lib.rs + ```rust use android_activity::{AndroidApp, InputStatus, MainEvent, PollEvent}; @@ -69,14 +78,14 @@ fn android_main(app: AndroidApp) { } ``` -``` +```sh rustup target add aarch64-linux-android cargo install cargo-apk cargo apk run adb logcat example:V *:S ``` -# Full Examples +## Full Examples See [this collection of examples](https://github.com/rust-mobile/rust-android-examples) (based on both `GameActivity` and `NativeActivity`). @@ -84,7 +93,7 @@ Each example is a standalone project that may also be a convenient templates for For the examples based on middleware frameworks (Winit and or Egui) they also aim to demonstrate how it's possible to write portable code that will run on Android and other systems. -# Should I use NativeActivity or GameActivity? +## Should I use NativeActivity or GameActivity? To learn more about the `NativeActivity` class that's shipped with Android see [here](https://developer.android.com/ndk/guides/concepts#naa). @@ -96,31 +105,32 @@ It's expected that the `GameActivity` backend will gain more sophisticated input Even if you start out using `NativeActivity` for the convenience, it's likely that most moderately complex applications will eventually need to define their own `Activity` subclass (either subclassing `NativeActivity` or `GameActivity`) which will require compiling at least a small amount of Java or Kotlin code. This is generally due to Android's design which directs numerous events via the `Activity` class which can only be processed by overloading some associated Activity method. -# Switching from ndk-glue to android-activity +## Switching from ndk-glue to android-activity + +### Winit-based applications -## Winit-based applications Firstly; if you have a [Winit](https://crates.io/crates/winit) based application and also have an explicit dependency on `ndk-glue` your application will need to remove its dependency on `ndk-glue` for the 0.28 release of Winit which will be based on android-activity (Since glue crates, due to their nature, can't be compatible with alternative glue crates). Winit-based applications can follow the [Android README](https://github.com/rust-windowing/winit#android) guidance for advice on how to switch over. Most Winit-based applications should aim to remove any explicit dependency on a specific glue crate (so not depend directly on `ndk-glue` or `android-activity` and instead rely on Winit to pull in the right glue crate). The main practical change will then be to add a `#[no_mangle]fn android_main(app: AndroidApp)` entry point. See the [Android README](https://github.com/rust-windowing/winit#android) for more details and also see the [Winit-based examples here](https://github.com/rust-mobile/rust-android-examples). -## Middleware crates (i.e. not applications) +### Middleware crates (i.e. not applications) If you have a crate that would be considered a middleware library (for example using JNI to support access to Bluetooth, or Android's Camera APIs) then the crate should almost certainly remove any dependence on a specific glue crate because this imposes a strict compatibility constraint that means the crate can only be used by applications that use that exact same glue crate version. Middleware libraries can instead look at using the [ndk-context](https://crates.io/crates/ndk-context) crate as a means for being able to use JNI without making any assumptions about the applications overall architecture. This way a middleware crate can work with alternative glue crates (including `ndk-glue` and `android-activity`) as well as work with embedded use cases (i.e. non-native applications that may just embed a dynamic library written in Rust to implement certain native functions). -## Other, non-Winit-based applications +### Other, non-Winit-based applications The steps to switch a simple standalone application over from `ndk-glue` to `android-activity` (still based on `NativeActivity`) should be: 1. Remove `ndk-glue` from your Cargo.toml -2. Add a dependency on `android-activity`, like `android-activity = { version="0.4", features = [ "native-activity" ] }` -3. Optionally add a dependency on `android_logger = "0.11.0"` +2. Add a dependency on `android-activity`, like `android-activity = { version="0.5", features = [ "native-activity" ] }` +3. Optionally add a dependency on `android_logger = "0.13.0"` 4. Update the `main` entry point to look like this: -``` +```rust use android_activity::AndroidApp; #[no_mangle] @@ -133,8 +143,7 @@ See this minimal [NativeActivity Mainloop](https://github.com/rust-mobile/androi There is is no `#[ndk_glue::main]` replacement considering that `android_main()` entry point needs to be passed an `AndroidApp` argument which isn't compatible with a traditional `main()` function. Having an Android specific entry point also gives a place to initialize Android logging and handle other Android specific details (such as building an event loop based on the `app` argument) - -## Design Summary / Motivation behind android-activity +### Design Summary / Motivation behind android-activity Prior to working on android-activity, the existing glue crates available for building standalone Rust applications on Android were found to have a number of technical limitations that this crate aimed to solve: @@ -142,16 +151,14 @@ Prior to working on android-activity, the existing glue crates available for bui 2. **Encapsulate IPC + synchronization between the native thread and the JVM thread**: For example with `ndk-glue` the application itself needs to avoid race conditions between the native and Java thread by following a locking convention) and it wasn't clear how this would extend to support other requests (like state saving) that also require synchronization. 3. **Avoid static global state**: Keeping in mind the possibility of supporting applications with multiple native activities there was interest in having an API that didn't rely on global statics to track top-level state. Instead of having global getters for state then `android-activity` passes an explicit `app: AndroidApp` argument to the entry point that encapsulates the state connected with a single `Activity`. - [`GameTextInput`]: https://developer.android.com/games/agdk/add-support-for-text-input [`AppCompatActivity`]: https://developer.android.com/reference/androidx/appcompat/app/AppCompatActivity - -# MSRV +## MSRV We aim to (at least) support stable releases of Rust from the last three months. Rust has a 6 week release cycle which means we will support the last three stable releases. -For example, when Rust 1.69 is released we would limit our `rust_version` to 1.67. +For example, when Rust 1.69 is released we would limit our `rust-version` to 1.67. -We will only bump the `rust_version` at the point where we either depend on a new features or a dependency has increased its MSRV, and we won't be greedy. In other words we will only set the MSRV to the lowest version that's _needed_. +We will only bump the `rust-version` at the point where we either depend on a new features or a dependency has increased its MSRV, and we won't be greedy. In other words we will only set the MSRV to the lowest version that's _needed_. -MSRV updates are not considered to be inherently semver breaking (unless a new feature is exposed in the public API) and so a `rust_version` change may happen in patch releases. +MSRV updates are not considered to be inherently semver breaking (unless a new feature is exposed in the public API) and so a `rust-version` change may happen in patch releases. diff --git a/android-activity/.gitignore b/android-activity/.gitignore deleted file mode 100644 index 29f475ac..00000000 --- a/android-activity/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -/target -Cargo.lock - - -# Added by cargo -# -# already existing elements were commented out - -#/target -#Cargo.lock diff --git a/android-activity/CHANGELOG.md b/android-activity/CHANGELOG.md index 6ddb0e12..be0c1ac0 100644 --- a/android-activity/CHANGELOG.md +++ b/android-activity/CHANGELOG.md @@ -1,33 +1,219 @@ + + # Changelog The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] -## [0.4.1] - 2022-02-16 +### Changed +- input: Replaced custom types with their `ndk` crate equivalent. + > [!NOTE] + > These types existed because the `ndk` crate didn't provide them in an extensible way. Now that they have the `#[non_exhaustive]` flag and contain a `__Unknown(T)` variant to provide lossless conversions, and not to mention use an ABI type that matches how it is being used by most functions (when the original constants were defined in a "typeless" way), the `ndk` types are used and reexported once again. + + > [!IMPORTANT] + > **Relevant breaking changes**: + > - `repr()` types for some `enum`s have changed to match the ABI type that is used by most functions that are returning or consuming this wrapper type. + > - `Source::is_xxx_class()` functions are replaced by querying `Source::class()` and comparing against variants from the returned `SourceClass` `bitflags` enum. + > - `SourceFlags::TRACKBALL` (from `Source::is_trackball_class()`) is named `SourceClass::NAVIGATION` in the `ndk`. + +- rust-version bumped to 1.73.0 ([#193](https://github.com/rust-mobile/android-activity/pull/193)) +- The `ndk` and `ndk-sys` crates are now re-exported under `android_activity::ndk` and `android_activity::ndk_sys` ([#194](https://github.com/rust-mobile/android-activity/pull/194)) +- GameActivity updated to 4.0.0 (requires the corresponding 4.0.0 `.aar` release from Google) ([#191](https://github.com/rust-mobile/android-activity/pull/191)) + +## [0.6.0] - 2024-04-26 + +### Changed +- rust-version bumped to 1.69.0 ([#156](https://github.com/rust-mobile/android-activity/pull/156)) +- Upgrade to `ndk-sys 0.6.0` and `ndk 0.9.0` ([#155](https://github.com/rust-mobile/android-activity/pull/155)) + +### Fixed +- Check for null `saved_state_in` pointer from `NativeActivity` + +## [0.5.2] - 2024-01-30 + +### Fixed +- NativeActivity: OR with `EVENT_ACTION_MASK` when extracting action from `MotionEvent` - fixing multi-touch input ([#146](https://github.com/rust-mobile/android-activity/issues/146), [#147](https://github.com/rust-mobile/android-activity/pull/147)) + +## [0.5.1] - 2023-12-20 + +### Changed +- Avoids depending on default features for `ndk` crate to avoid pulling in any `raw-window-handle` dependencies ([#142](https://github.com/rust-mobile/android-activity/pull/142)) + + **Note:** Technically, this could be observed as a breaking change in case you + were depending on the `rwh_06` feature that was enabled by default in the + `ndk` crate. This could be observed via the `NativeWindow` type (exposed via + `AndroidApp::native_window()`) no longer implementing `rwh_06::HasWindowHandle`. + + In the unlikely case that you were depending on the `ndk`'s `rwh_06` API + being enabled by default via `android-activity`'s `ndk` dependency, your crate + should explicitly enable the `rwh_06` feature for the `ndk` crate. + + As far as could be seen though, it's not expected that anything was + depending on this (e.g. anything based on Winit enables the `ndk` feature + based on an equivalent `winit` feature). + + The benefit of the change is that it can help avoid a redundant + `raw-window-handle 0.6` dependency in projects that still need to use older + (non-default) `raw-window-handle` versions. (Though note that this may be + awkward to achieve in practice since other crates that depend on the `ndk` + are still likely to use default features and also pull in + `raw-window-handles 0.6`) + +- The IO thread now gets named `stdio-to-logcat` and main thread is named `android_main` ([#145](https://github.com/rust-mobile/android-activity/pull/145)) +- Improved IO error handling in `stdio-to-logcat` IO loop. ([#133](https://github.com/rust-mobile/android-activity/pull/133)) + +## [0.5.0] - 2023-10-16 +### Added +- Added `MotionEvent::action_button()` exposing the button associated with button press/release actions ([#138](https://github.com/rust-mobile/android-activity/pull/138)) + +### Changed +- rust-version bumped to 0.68 ([#123](https://github.com/rust-mobile/android-activity/pull/123)) +- *Breaking*: updates to `ndk 0.8` and `ndk-sys 0.5` ([#128](https://github.com/rust-mobile/android-activity/pull/128)) +- The `Pointer` and `PointerIter` types from the `ndk` crate are no longer directly exposed in the public API ([#122](https://github.com/rust-mobile/android-activity/pull/122)) +- All input API enums based on Android SDK enums have been made runtime extensible via hidden `__Unknown(u32)` variants ([#131](https://github.com/rust-mobile/android-activity/pull/131)) + +## [0.5.0-beta.1] - 2023-08-15 +### Changed +- Pulled in `ndk-sys 0.5.0-beta.0` and `ndk 0.8.0-beta.0` ([#113](https://github.com/rust-mobile/android-activity/pull/113)) + +## [0.5.0-beta.0] - 2023-08-15 + +### Added +- Added `KeyEvent::meta_state()` for being able to query the state of meta keys, needed for character mapping ([#102](https://github.com/rust-mobile/android-activity/pull/102)) +- Added `KeyCharacterMap` JNI bindings to the corresponding Android SDK API ([#102](https://github.com/rust-mobile/android-activity/pull/102)) +- Added `AndroidApp::device_key_character_map()` for being able to get a `KeyCharacterMap` for a given `device_id` for unicode character mapping ([#102](https://github.com/rust-mobile/android-activity/pull/102)) + +
+ Click here for an example of how to handle unicode character mapping: + + ```rust + let mut combining_accent = None; + // Snip + + + let combined_key_char = if let Ok(map) = app.device_key_character_map(device_id) { + match map.get(key_event.key_code(), key_event.meta_state()) { + Ok(KeyMapChar::Unicode(unicode)) => { + let combined_unicode = if let Some(accent) = combining_accent { + match map.get_dead_char(accent, unicode) { + Ok(Some(key)) => { + info!("KeyEvent: Combined '{unicode}' with accent '{accent}' to give '{key}'"); + Some(key) + } + Ok(None) => None, + Err(err) => { + log::error!("KeyEvent: Failed to combine 'dead key' accent '{accent}' with '{unicode}': {err:?}"); + None + } + } + } else { + info!("KeyEvent: Pressed '{unicode}'"); + Some(unicode) + }; + combining_accent = None; + combined_unicode.map(|unicode| KeyMapChar::Unicode(unicode)) + } + Ok(KeyMapChar::CombiningAccent(accent)) => { + info!("KeyEvent: Pressed 'dead key' combining accent '{accent}'"); + combining_accent = Some(accent); + Some(KeyMapChar::CombiningAccent(accent)) + } + Ok(KeyMapChar::None) => { + info!("KeyEvent: Pressed non-unicode key"); + combining_accent = None; + None + } + Err(err) => { + log::error!("KeyEvent: Failed to get key map character: {err:?}"); + combining_accent = None; + None + } + } + } else { + None + }; + ``` + +
+- Added `TextEvent` Input Method event for supporting text editing via virtual keyboards ([#24](https://github.com/rust-mobile/android-activity/pull/24)) + +### Changed +- GameActivity updated to 2.0.2 (requires the corresponding 2.0.2 `.aar` release from Google) ([#88](https://github.com/rust-mobile/android-activity/pull/88)) +- `AndroidApp::input_events()` is replaced by `AndroidApp::input_events_iter()` ([#102](https://github.com/rust-mobile/android-activity/pull/102)) + +
+ Click here for an example of how to use `input_events_iter()`: + + ```rust + match app.input_events_iter() { + Ok(mut iter) => { + loop { + let read_input = iter.next(|event| { + let handled = match event { + InputEvent::KeyEvent(key_event) => { + // Snip + } + InputEvent::MotionEvent(motion_event) => { + // Snip + } + event => { + // Snip + } + }; + + handled + }); + + if !read_input { + break; + } + } + } + Err(err) => { + log::error!("Failed to get input events iterator: {err:?}"); + } + } + ``` + +
+ +## [0.4.3] - 2023-07-30 +### Fixed +- Fixed a deadlock in the `native-activity` backend while waiting for the native thread after getting an `onDestroy` callback from Java ([#94](https://github.com/rust-mobile/android-activity/pull/94)) +- Fixed numerous deadlocks in the `game-activity` backend with how it would wait for the native thread in various Java callbacks, after the app has returned from `android_main` ([#98](https://github.com/rust-mobile/android-activity/pull/98)) + +## [0.4.2] - 2023-06-17 +### Changed +- The `Activity.finish()` method is now called when `android_main` returns so the `Activity` will be destroyed ([#67](https://github.com/rust-mobile/android-activity/issues/67)) +- The `native-activity` backend now propagates `NativeWindow` redraw/resize and `ContentRectChanged` callbacks to main loop ([#70](https://github.com/rust-mobile/android-activity/pull/70)) +- The `game-activity` implementation of `pointer_index()` was fixed to not always return `0` ([#80](https://github.com/rust-mobile/android-activity/pull/84)) +- Added `panic` guards around application's `android_main()` and native code that could potentially unwind across a Java FFI boundary ([#68](https://github.com/rust-mobile/android-activity/pull/68)) + +## [0.4.1] - 2023-02-16 ### Added - Added `AndroidApp::vm_as_ptr()` to expose JNI `JavaVM` pointer ([#60](https://github.com/rust-mobile/android-activity/issues/60)) - Added `AndroidApp::activity_as_ptr()` to expose Android `Activity` JNI reference as pointer ([#60](https://github.com/rust-mobile/android-activity/issues/60)) ### Changed - Removed some overly-verbose logging in the `native-activity` backend ([#49](https://github.com/rust-mobile/android-activity/pull/49)) ### Removed -- Most of the examples were moved to https://github.com/rust-mobile/rust-android-examples ([#50](https://github.com/rust-mobile/android-activity/pull/50)) +- Most of the examples were moved to ([#50](https://github.com/rust-mobile/android-activity/pull/50)) -## [0.4] - 2022-11-10 +## [0.4.0] - 2022-11-10 ### Changed - *Breaking*: `input_events` callback now return whether an event was handled or not to allow for fallback handling ([#31](https://github.com/rust-mobile/android-activity/issues/31)) - The native-activity backend is now implemented in Rust only, without building on `android_native_app_glue.c` ([#35](https://github.com/rust-mobile/android-activity/pull/35)) ### Added - Added `Pointer::tool_type()` API to `GameActivity` backend for compatibility with `ndk` events API ([#38](https://github.com/rust-mobile/android-activity/pull/38)) -## [0.3] - 2022-09-15 +## [0.3.0] - 2022-09-15 ### Added - `show/hide_sot_input` API for being able to show/hide a soft keyboard (other IME still pending) - `set_window_flags()` API for setting WindowManager params ### Changed - *Breaking*: Created extensible, `#[non_exhaustive]` `InputEvent` wrapper enum instead of exposing `ndk` type directly -## [0.2] - 2022-08-25 +## [0.2.0] - 2022-08-25 ### Added - Emit an `InputAvailable` event for new input with `NativeActivity` and `GameActivity` enabling gui apps that don't render continuously @@ -44,6 +230,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Documentation fixes -## [0.1] - 2022-07-04 +## [0.1.0] - 2022-07-04 ### Added -- Initial release \ No newline at end of file +- Initial release + +[unreleased]: https://github.com/rust-mobile/android-activity/compare/v0.6.0...HEAD +[0.6.0]: https://github.com/rust-mobile/android-activity/compare/v0.5.2...v0.6.0 +[0.5.2]: https://github.com/rust-mobile/android-activity/compare/v0.5.1...v0.5.2 +[0.5.1]: https://github.com/rust-mobile/android-activity/compare/v0.5.0...v0.5.1 +[0.5.0]: https://github.com/rust-mobile/android-activity/compare/v0.4.3...v0.5.0 +[0.4.3]: https://github.com/rust-mobile/android-activity/compare/v0.4.2...v0.4.3 +[0.4.2]: https://github.com/rust-mobile/android-activity/compare/v0.4.1...v0.4.2 +[0.4.1]: https://github.com/rust-mobile/android-activity/compare/v0.4.0...v0.4.1 +[0.4.0]: https://github.com/rust-mobile/android-activity/compare/v0.3.0...v0.4.0 +[0.3.0]: https://github.com/rust-mobile/android-activity/compare/v0.2.0...v0.3.0 +[0.2.0]: https://github.com/rust-mobile/android-activity/compare/v0.1.1...v0.2.0 +[0.1.1]: https://github.com/rust-mobile/android-activity/compare/v0.1.0...v0.1.1 +[0.1.0]: https://github.com/rust-mobile/android-activity/releases/tag/v0.1.0 diff --git a/android-activity/Cargo.toml b/android-activity/Cargo.toml index 764c8e6a..276d1bdc 100644 --- a/android-activity/Cargo.toml +++ b/android-activity/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "android-activity" -version = "0.4.1" +version = "0.6.0" edition = "2021" keywords = ["android", "ndk"] readme = "../README.md" @@ -9,7 +9,17 @@ repository = "https://github.com/rust-mobile/android-activity" documentation = "https://docs.rs/android-activity" description = "Glue for building Rust applications on Android with NativeActivity or GameActivity" license = "MIT OR Apache-2.0" -rust_version = "1.64" +include = [ + "/build.rs", + "/android-games-sdk", + "/LICENSE*", + "/src", +] + +# Even though we could technically still build with 1.69, 1.73 has a fix for the +# definition of the `stat` struct on Android, and so it seems worthwhile drawing +# a line under that to ensure android-activity applications have that fix. +rust-version = "1.73.0" [features] # Note: we don't enable any backend by default since features @@ -21,20 +31,25 @@ rust_version = "1.64" default = [] game-activity = [] native-activity = [] +api-level-30 = ["ndk/api-level-30"] +api-level-33 = ["api-level-30", "ndk/api-level-33"] [dependencies] log = "0.4" jni-sys = "0.3" -ndk = "0.7" -ndk-sys = "0.4" -ndk-context = "0.1" +cesu8 = "1" +jni = "0.21" +ndk-sys = "0.6.0" +ndk = { version = "0.9.0", default-features = false } +ndk-context = "0.1.1" android-properties = "0.2" -num_enum = "0.6" -bitflags = "1.3" -libc = "0.2" +num_enum = "0.7" +bitflags = "2.0" +libc = "0.2.139" +thiserror = "1" [build-dependencies] -cc = { version = "1.0", features = ["parallel"] } +cc = { version = "1.0.42", features = ["parallel"] } [package.metadata.docs.rs] targets = [ diff --git a/android-activity/LICENSE b/android-activity/LICENSE index b4635e95..dba60f76 100644 --- a/android-activity/LICENSE +++ b/android-activity/LICENSE @@ -1,12 +1,24 @@ -The third-party glue code, under the native-activity-csrc/ and game-activity-csrc/ directories -is covered by the Apache 2.0 license only: +# License -Apache License, Version 2.0 (docs/LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0) +## GameActivity +The third-party glue code, under the game-activity-csrc/ directory is covered by +the Apache 2.0 license only: + +Apache License, Version 2.0 (LICENSE-APACHE or ) + +## SDK Documentation + +Documentation for APIs that are direct bindings of Android platform APIs are covered +by the Apache 2.0 license only: + +Apache License, Version 2.0 (LICENSE-APACHE or ) + +## android-activity All other code is dual-licensed under either -* MIT License (docs/LICENSE-MIT or http://opensource.org/licenses/MIT) -* Apache License, Version 2.0 (docs/LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0) +- MIT License (LICENSE-MIT or ) +- Apache License, Version 2.0 (LICENSE-APACHE or ) -at your option. \ No newline at end of file +at your option. diff --git a/android-activity/docs/LICENSE-APACHE b/android-activity/LICENSE-APACHE similarity index 100% rename from android-activity/docs/LICENSE-APACHE rename to android-activity/LICENSE-APACHE diff --git a/android-activity/docs/LICENSE-MIT b/android-activity/LICENSE-MIT similarity index 100% rename from android-activity/docs/LICENSE-MIT rename to android-activity/LICENSE-MIT diff --git a/android-activity/android-games-sdk/README.md b/android-activity/android-games-sdk/README.md new file mode 100644 index 00000000..290e44d5 --- /dev/null +++ b/android-activity/android-games-sdk/README.md @@ -0,0 +1,43 @@ +# android-games-sdk + +This is an imported copy of the native "prefab" source for `GameActivity` and +`GameTextInput`, from our fork of Google's +[android-games-sdk](https://github.com/rust-mobile/android-games-sdk). + +We use an external fork to track our integration patches on top of the Android +Game Development Kit (AGDK) in a way that it is easier to update to new upstream +versions. It also makes it easier to try and upstream changes when we fix bugs. + +## Updating to new agdk version checklist + +This is a basic checklist for things that need to be done when updating to a new +agdk version: + +- [ ] Create a new integration branch based on our last integrated branch and + rebase that on the latest *release* branch from Google: + + ```bash + git clone git@github.com:rust-mobile/android-games-sdk.git + cd android-games-sdk + git remote add google https://android.googlesource.com/platform/frameworks/opt/gamesdk + git fetch google + git checkout -b android-activity-5.0.0 origin/android-activity-4.0.0 + git rebase --onto google/android-games-sdk-game-activity-release + # (where is the upstream commit ID below our stack of integration patches) + ``` + +- [ ] Set the `ANDROID_GAMES_SDK` environment variable so you can build + android-activity against your external games-sdk branch while updating. +- [ ] Re-generate the `GameActivity` FFI bindings with `./generate-bindings.sh` + (this can be done with `ANDROID_GAMES_SDK` set in your environment and also + repeated after importing) +- [ ] Update [build.rs](../build.rs) with any new includes and src files +- [ ] Update the `src/game-activity` backend as needed +- [ ] Push a new `android-games-sdk` branch like `android-activity-5.0.0` that + can be referenced when importing a copy into `android-activity` +- [ ] Review and run `./import-games-sdk.sh` when ready to copy external AGDK + code into this repo +- [ ] Clearly reference the branch name and commit hash from the + `android-games-sdk` repo in the `android-activity` commit that imports new + games-sdk source. +- [ ] Update CHANGELOG.md as required diff --git a/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/include/common b/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/include/common new file mode 120000 index 00000000..9388f342 --- /dev/null +++ b/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/include/common @@ -0,0 +1 @@ +../../../../../include/common/ \ No newline at end of file diff --git a/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/include/game-activity/GameActivity.h b/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/include/game-activity/GameActivity.h new file mode 100644 index 00000000..b6ff8b44 --- /dev/null +++ b/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/include/game-activity/GameActivity.h @@ -0,0 +1,711 @@ +/* + * Copyright (C) 2021 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup GameActivity Game Activity + * The interface to use GameActivity. + * @{ + */ + +/** + * @file GameActivity.h + */ + +#ifndef ANDROID_GAME_SDK_GAME_ACTIVITY_H +#define ANDROID_GAME_SDK_GAME_ACTIVITY_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define GAMEACTIVITY_MAJOR_VERSION 4 +#define GAMEACTIVITY_MINOR_VERSION 0 +#define GAMEACTIVITY_BUGFIX_VERSION 0 +#define GAMEACTIVITY_PACKED_VERSION \ + ANDROID_GAMESDK_PACKED_VERSION(GAMEACTIVITY_MAJOR_VERSION, \ + GAMEACTIVITY_MINOR_VERSION, \ + GAMEACTIVITY_BUGFIX_VERSION) + +/** + * The type of a component for which to retrieve insets. See + * https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat.Type + */ +typedef enum GameCommonInsetsType : uint8_t { + GAMECOMMON_INSETS_TYPE_CAPTION_BAR = 0, + GAMECOMMON_INSETS_TYPE_DISPLAY_CUTOUT, + GAMECOMMON_INSETS_TYPE_IME, + GAMECOMMON_INSETS_TYPE_MANDATORY_SYSTEM_GESTURES, + GAMECOMMON_INSETS_TYPE_NAVIGATION_BARS, + GAMECOMMON_INSETS_TYPE_STATUS_BARS, + GAMECOMMON_INSETS_TYPE_SYSTEM_BARS, + GAMECOMMON_INSETS_TYPE_SYSTEM_GESTURES, + GAMECOMMON_INSETS_TYPE_TAPABLE_ELEMENT, + GAMECOMMON_INSETS_TYPE_WATERFALL, + GAMECOMMON_INSETS_TYPE_COUNT +} GameCommonInsetsType; + +/** + * {@link GameActivityCallbacks} + */ +struct GameActivityCallbacks; + +/** + * This structure defines the native side of an android.app.GameActivity. + * It is created by the framework, and handed to the application's native + * code as it is being launched. + */ +typedef struct GameActivity { + /** + * Pointer to the callback function table of the native application. + * You can set the functions here to your own callbacks. The callbacks + * pointer itself here should not be changed; it is allocated and managed + * for you by the framework. + */ + struct GameActivityCallbacks* callbacks; + + /** + * The global handle on the process's Java VM. + */ + JavaVM* vm; + + /** + * JNI context for the main thread of the app. Note that this field + * can ONLY be used from the main thread of the process; that is, the + * thread that calls into the GameActivityCallbacks. + */ + JNIEnv* env; + + /** + * The GameActivity object handle. + */ + jobject javaGameActivity; + + /** + * Path to this application's internal data directory. + */ + const char* internalDataPath; + + /** + * Path to this application's external (removable/mountable) data directory. + */ + const char* externalDataPath; + + /** + * The platform's SDK version code. + */ + int32_t sdkVersion; + + /** + * This is the native instance of the application. It is not used by + * the framework, but can be set by the application to its own instance + * state. + */ + void* instance; + + /** + * Pointer to the Asset Manager instance for the application. The + * application uses this to access binary assets bundled inside its own .apk + * file. + */ + AAssetManager* assetManager; + + /** + * Available starting with Honeycomb: path to the directory containing + * the application's OBB files (if any). If the app doesn't have any + * OBB files, this directory may not exist. + */ + const char* obbPath; +} GameActivity; + +/** + * A function the user should call from their callback with the data, its length + * and the library- supplied context. + */ +typedef void (*SaveInstanceStateRecallback)(const char* bytes, int len, + void* context); + +/** + * These are the callbacks the framework makes into a native application. + * All of these callbacks happen on the main thread of the application. + * By default, all callbacks are NULL; set to a pointer to your own function + * to have it called. + */ +typedef struct GameActivityCallbacks { + /** + * GameActivity has started. See Java documentation for Activity.onStart() + * for more information. + */ + void (*onStart)(GameActivity* activity); + + /** + * GameActivity has resumed. See Java documentation for Activity.onResume() + * for more information. + */ + void (*onResume)(GameActivity* activity); + + /** + * The framework is asking GameActivity to save its current instance state. + * See the Java documentation for Activity.onSaveInstanceState() for more + * information. The user should call the recallback with their data, its + * length and the provided context; they retain ownership of the data. Note + * that the saved state will be persisted, so it can not contain any active + * entities (pointers to memory, file descriptors, etc). + */ + void (*onSaveInstanceState)(GameActivity* activity, + SaveInstanceStateRecallback recallback, + void* context); + + /** + * GameActivity has paused. See Java documentation for Activity.onPause() + * for more information. + */ + void (*onPause)(GameActivity* activity); + + /** + * GameActivity has stopped. See Java documentation for Activity.onStop() + * for more information. + */ + void (*onStop)(GameActivity* activity); + + /** + * GameActivity is being destroyed. See Java documentation for + * Activity.onDestroy() for more information. + */ + void (*onDestroy)(GameActivity* activity); + + /** + * Focus has changed in this GameActivity's window. This is often used, + * for example, to pause a game when it loses input focus. + */ + void (*onWindowFocusChanged)(GameActivity* activity, bool hasFocus); + + /** + * The drawing window for this native activity has been created. You + * can use the given native window object to start drawing. + */ + void (*onNativeWindowCreated)(GameActivity* activity, ANativeWindow* window); + + /** + * The drawing window for this native activity has been resized. You should + * retrieve the new size from the window and ensure that your rendering in + * it now matches. + */ + void (*onNativeWindowResized)(GameActivity* activity, ANativeWindow* window, + int32_t newWidth, int32_t newHeight); + + /** + * The drawing window for this native activity needs to be redrawn. To + * avoid transient artifacts during screen changes (such resizing after + * rotation), applications should not return from this function until they + * have finished drawing their window in its current state. + */ + void (*onNativeWindowRedrawNeeded)(GameActivity* activity, + ANativeWindow* window); + + /** + * The drawing window for this native activity is going to be destroyed. + * You MUST ensure that you do not touch the window object after returning + * from this function: in the common case of drawing to the window from + * another thread, that means the implementation of this callback must + * properly synchronize with the other thread to stop its drawing before + * returning from here. + */ + void (*onNativeWindowDestroyed)(GameActivity* activity, + ANativeWindow* window); + + /** + * The current device AConfiguration has changed. The new configuration can + * be retrieved from assetManager. + */ + void (*onConfigurationChanged)(GameActivity* activity); + + /** + * The system is running low on memory. Use this callback to release + * resources you do not need, to help the system avoid killing more + * important processes. + */ + void (*onTrimMemory)(GameActivity* activity, int level); + + /** + * Callback called for every MotionEvent done on the GameActivity + * SurfaceView. Ownership of `event` is maintained by the library and it is + * only valid during the callback. + */ + bool (*onTouchEvent)(GameActivity* activity, + const GameActivityMotionEvent* event); + + /** + * Callback called for every key down event on the GameActivity SurfaceView. + * Ownership of `event` is maintained by the library and it is only valid + * during the callback. + */ + bool (*onKeyDown)(GameActivity* activity, const GameActivityKeyEvent* event); + + /** + * Callback called for every key up event on the GameActivity SurfaceView. + * Ownership of `event` is maintained by the library and it is only valid + * during the callback. + */ + bool (*onKeyUp)(GameActivity* activity, const GameActivityKeyEvent* event); + + /** + * Callback called for every soft-keyboard text input event. + * Ownership of `state` is maintained by the library and it is only valid + * during the callback. + */ + void (*onTextInputEvent)(GameActivity* activity, + const GameTextInputState* state); + + /** + * Callback called when WindowInsets of the main app window have changed. + * Call GameActivity_getWindowInsets to retrieve the insets themselves. + */ + void (*onWindowInsetsChanged)(GameActivity* activity); + + /** + * Callback called when the rectangle in the window where the content + * should be placed has changed. + */ + void (*onContentRectChanged)(GameActivity* activity, const ARect* rect); + + /** + * Callback called when the software keyboard is shown or hidden. + */ + void (*onSoftwareKeyboardVisibilityChanged)(GameActivity* activity, + bool visible); + + /** + * Callback called when the software keyboard is shown or hidden. + */ + bool (*onEditorAction)(GameActivity* activity, int action); +} GameActivityCallbacks; + +/** + * This is the function that must be in the native code to instantiate the + * application's native activity. It is called with the activity instance (see + * above); if the code is being instantiated from a previously saved instance, + * the savedState will be non-NULL and point to the saved data. You must make + * any copy of this data you need -- it will be released after you return from + * this function. + */ +typedef void GameActivity_createFunc(GameActivity* activity, void* savedState, + size_t savedStateSize); + +/** + * The name of the function that NativeInstance looks for when launching its + * native code. This is the default function that is used, you can specify + * "android.app.func_name" string meta-data in your manifest to use a different + * function. + */ +extern GameActivity_createFunc GameActivity_onCreate_C; + +/** + * Finish the given activity. Its finish() method will be called, causing it + * to be stopped and destroyed. Note that this method can be called from + * *any* thread; it will send a message to the main thread of the process + * where the Java finish call will take place. + */ +void GameActivity_finish(GameActivity* activity); + +/** + * Flags for GameActivity_setWindowFlags, + * as per the Java API at android.view.WindowManager.LayoutParams. + */ +enum GameActivitySetWindowFlags : uint32_t { + /** + * As long as this window is visible to the user, allow the lock + * screen to activate while the screen is on. This can be used + * independently, or in combination with {@link + * GAMEACTIVITY_FLAG_KEEP_SCREEN_ON} and/or {@link + * GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED} + */ + GAMEACTIVITY_FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 0x00000001, + /** Everything behind this window will be dimmed. */ + GAMEACTIVITY_FLAG_DIM_BEHIND = 0x00000002, + /** + * Blur everything behind this window. + * @deprecated Blurring is no longer supported. + */ + GAMEACTIVITY_FLAG_BLUR_BEHIND = 0x00000004, + /** + * This window won't ever get key input focus, so the + * user can not send key or other button events to it. Those will + * instead go to whatever focusable window is behind it. This flag + * will also enable {@link GAMEACTIVITY_FLAG_NOT_TOUCH_MODAL} whether or not + * that is explicitly set. + * + * Setting this flag also implies that the window will not need to + * interact with + * a soft input method, so it will be Z-ordered and positioned + * independently of any active input method (typically this means it + * gets Z-ordered on top of the input method, so it can use the full + * screen for its content and cover the input method if needed. You + * can use {@link GAMEACTIVITY_FLAG_ALT_FOCUSABLE_IM} to modify this + * behavior. + */ + GAMEACTIVITY_FLAG_NOT_FOCUSABLE = 0x00000008, + /** This window can never receive touch events. */ + GAMEACTIVITY_FLAG_NOT_TOUCHABLE = 0x00000010, + /** + * Even when this window is focusable (its + * {@link GAMEACTIVITY_FLAG_NOT_FOCUSABLE} is not set), allow any pointer + * events outside of the window to be sent to the windows behind it. + * Otherwise it will consume all pointer events itself, regardless of + * whether they are inside of the window. + */ + GAMEACTIVITY_FLAG_NOT_TOUCH_MODAL = 0x00000020, + /** + * When set, if the device is asleep when the touch + * screen is pressed, you will receive this first touch event. Usually + * the first touch event is consumed by the system since the user can + * not see what they are pressing on. + * + * @deprecated This flag has no effect. + */ + GAMEACTIVITY_FLAG_TOUCHABLE_WHEN_WAKING = 0x00000040, + /** + * As long as this window is visible to the user, keep + * the device's screen turned on and bright. + */ + GAMEACTIVITY_FLAG_KEEP_SCREEN_ON = 0x00000080, + /** + * Place the window within the entire screen, ignoring + * decorations around the border (such as the status bar). The + * window must correctly position its contents to take the screen + * decoration into account. + */ + GAMEACTIVITY_FLAG_LAYOUT_IN_SCREEN = 0x00000100, + /** Allows the window to extend outside of the screen. */ + GAMEACTIVITY_FLAG_LAYOUT_NO_LIMITS = 0x00000200, + /** + * Hide all screen decorations (such as the status + * bar) while this window is displayed. This allows the window to + * use the entire display space for itself -- the status bar will + * be hidden when an app window with this flag set is on the top + * layer. A fullscreen window will ignore a value of {@link + * GAMEACTIVITY_SOFT_INPUT_ADJUST_RESIZE}; the window will stay + * fullscreen and will not resize. + */ + GAMEACTIVITY_FLAG_FULLSCREEN = 0x00000400, + /** + * Override {@link GAMEACTIVITY_FLAG_FULLSCREEN} and force the + * screen decorations (such as the status bar) to be shown. + */ + GAMEACTIVITY_FLAG_FORCE_NOT_FULLSCREEN = 0x00000800, + /** + * Turn on dithering when compositing this window to + * the screen. + * @deprecated This flag is no longer used. + */ + GAMEACTIVITY_FLAG_DITHER = 0x00001000, + /** + * Treat the content of the window as secure, preventing + * it from appearing in screenshots or from being viewed on non-secure + * displays. + */ + GAMEACTIVITY_FLAG_SECURE = 0x00002000, + /** + * A special mode where the layout parameters are used + * to perform scaling of the surface when it is composited to the + * screen. + */ + GAMEACTIVITY_FLAG_SCALED = 0x00004000, + /** + * Intended for windows that will often be used when the user is + * holding the screen against their face, it will aggressively + * filter the event stream to prevent unintended presses in this + * situation that may not be desired for a particular window, when + * such an event stream is detected, the application will receive + * a {@link AMOTION_EVENT_ACTION_CANCEL} to indicate this so + * applications can handle this accordingly by taking no action on + * the event until the finger is released. + */ + GAMEACTIVITY_FLAG_IGNORE_CHEEK_PRESSES = 0x00008000, + /** + * A special option only for use in combination with + * {@link GAMEACTIVITY_FLAG_LAYOUT_IN_SCREEN}. When requesting layout in + * the screen your window may appear on top of or behind screen decorations + * such as the status bar. By also including this flag, the window + * manager will report the inset rectangle needed to ensure your + * content is not covered by screen decorations. + */ + GAMEACTIVITY_FLAG_LAYOUT_INSET_DECOR = 0x00010000, + /** + * Invert the state of {@link GAMEACTIVITY_FLAG_NOT_FOCUSABLE} with + * respect to how this window interacts with the current method. + * That is, if FLAG_NOT_FOCUSABLE is set and this flag is set, + * then the window will behave as if it needs to interact with the + * input method and thus be placed behind/away from it; if {@link + * GAMEACTIVITY_FLAG_NOT_FOCUSABLE} is not set and this flag is set, + * then the window will behave as if it doesn't need to interact + * with the input method and can be placed to use more space and + * cover the input method. + */ + GAMEACTIVITY_FLAG_ALT_FOCUSABLE_IM = 0x00020000, + /** + * If you have set {@link GAMEACTIVITY_FLAG_NOT_TOUCH_MODAL}, you + * can set this flag to receive a single special MotionEvent with + * the action + * {@link AMOTION_EVENT_ACTION_OUTSIDE} for + * touches that occur outside of your window. Note that you will not + * receive the full down/move/up gesture, only the location of the + * first down as an {@link AMOTION_EVENT_ACTION_OUTSIDE}. + */ + GAMEACTIVITY_FLAG_WATCH_OUTSIDE_TOUCH = 0x00040000, + /** + * Special flag to let windows be shown when the screen + * is locked. This will let application windows take precedence over + * key guard or any other lock screens. Can be used with + * {@link GAMEACTIVITY_FLAG_KEEP_SCREEN_ON} to turn screen on and display + * windows directly before showing the key guard window. Can be used with + * {@link GAMEACTIVITY_FLAG_DISMISS_KEYGUARD} to automatically fully + * dismisss non-secure keyguards. This flag only applies to the top-most + * full-screen window. + */ + GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED = 0x00080000, + /** + * Ask that the system wallpaper be shown behind + * your window. The window surface must be translucent to be able + * to actually see the wallpaper behind it; this flag just ensures + * that the wallpaper surface will be there if this window actually + * has translucent regions. + */ + GAMEACTIVITY_FLAG_SHOW_WALLPAPER = 0x00100000, + /** + * When set as a window is being added or made + * visible, once the window has been shown then the system will + * poke the power manager's user activity (as if the user had woken + * up the device) to turn the screen on. + */ + GAMEACTIVITY_FLAG_TURN_SCREEN_ON = 0x00200000, + /** + * When set the window will cause the keyguard to + * be dismissed, only if it is not a secure lock keyguard. Because such + * a keyguard is not needed for security, it will never re-appear if + * the user navigates to another window (in contrast to + * {@link GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED}, which will only temporarily + * hide both secure and non-secure keyguards but ensure they reappear + * when the user moves to another UI that doesn't hide them). + * If the keyguard is currently active and is secure (requires an + * unlock pattern) than the user will still need to confirm it before + * seeing this window, unless {@link GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED} has + * also been set. + */ + GAMEACTIVITY_FLAG_DISMISS_KEYGUARD = 0x00400000, +}; + +/** + * Change the window flags of the given activity. Calls getWindow().setFlags() + * of the given activity. + * Note that some flags must be set before the window decoration is created, + * see + * https://developer.android.com/reference/android/view/Window#setFlags(int,%20int). + * Note also that this method can be called from + * *any* thread; it will send a message to the main thread of the process + * where the Java finish call will take place. + */ +void GameActivity_setWindowFlags(GameActivity* activity, uint32_t addFlags, + uint32_t removeFlags); + +/** + * Flags for GameActivity_showSoftInput; see the Java InputMethodManager + * API for documentation. + */ +enum GameActivityShowSoftInputFlags : uint8_t { + /** + * Implicit request to show the input window, not as the result + * of a direct request by the user. + */ + GAMEACTIVITY_SHOW_SOFT_INPUT_IMPLICIT = 0x0001, + + /** + * The user has forced the input method open (such as by + * long-pressing menu) so it should not be closed until they + * explicitly do so. + */ + GAMEACTIVITY_SHOW_SOFT_INPUT_FORCED = 0x0002, +}; + +/** + * Show the IME while in the given activity. Calls + * InputMethodManager.showSoftInput() for the given activity. Note that this + * method can be called from *any* thread; it will send a message to the main + * thread of the process where the Java call will take place. + */ +void GameActivity_showSoftInput(GameActivity* activity, uint32_t flags); + +/** + * Restarts the input method. Calls InputMethodManager.restartInput(). + * Note that this method can be called from *any* thread; it will send a message + * to the main thread of the process where the Java call will take place. + */ +void GameActivity_restartInput(GameActivity* activity); + +/** + * Set the text entry state (see documentation of the GameTextInputState struct + * in the Game Text Input library reference). + * + * Ownership of the state is maintained by the caller. + */ +void GameActivity_setTextInputState(GameActivity* activity, + const GameTextInputState* state); + +/** + * Get the last-received text entry state (see documentation of the + * GameTextInputState struct in the Game Text Input library reference). + * + */ +void GameActivity_getTextInputState(GameActivity* activity, + GameTextInputGetStateCallback callback, + void* context); + +/** + * Get a pointer to the GameTextInput library instance. + */ +GameTextInput* GameActivity_getTextInput(const GameActivity* activity); + +/** + * Flags for GameActivity_hideSoftInput; see the Java InputMethodManager + * API for documentation. + */ +enum GameActivityHideSoftInputFlags : uint16_t { + /** + * The soft input window should only be hidden if it was not + * explicitly shown by the user. + */ + GAMEACTIVITY_HIDE_SOFT_INPUT_IMPLICIT_ONLY = 0x0001, + /** + * The soft input window should normally be hidden, unless it was + * originally shown with {@link GAMEACTIVITY_SHOW_SOFT_INPUT_FORCED}. + */ + GAMEACTIVITY_HIDE_SOFT_INPUT_NOT_ALWAYS = 0x0002, +}; + +/** + * Hide the IME while in the given activity. Calls + * InputMethodManager.hideSoftInput() for the given activity. Note that this + * method can be called from *any* thread; it will send a message to the main + * thread of the process where the Java finish call will take place. + */ +void GameActivity_hideSoftInput(GameActivity* activity, uint32_t flags); + +/** + * Get the current window insets of the particular component. See + * https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat.Type + * for more details. + * You can use these insets to influence what you show on the screen. + */ +void GameActivity_getWindowInsets(GameActivity* activity, + GameCommonInsetsType type, ARect* insets); + +/** + * Tells whether the software keyboard is visible or not. + */ +bool GameActivity_isSoftwareKeyboardVisible(GameActivity* activity); + +/** + * Set options on how the IME behaves when it is requested for text input. + * See + * https://developer.android.com/reference/android/view/inputmethod/EditorInfo + * for the meaning of inputType, actionId and imeOptions. + * + * Note: currently only TYPE_NULL AND TYPE_CLASS_NUMBER are supported. + */ +void GameActivity_setImeEditorInfo(GameActivity* activity, + enum GameTextInputType inputType, + enum GameTextInputActionType actionId, + enum GameTextInputImeOptions imeOptions); + +/** + * These are getters for Configuration class members. They may be called from + * any thread. + */ +int GameActivity_getOrientation(GameActivity* activity); +int GameActivity_getColorMode(GameActivity* activity); +int GameActivity_getDensityDpi(GameActivity* activity); +float GameActivity_getFontScale(GameActivity* activity); +int GameActivity_getFontWeightAdjustment(GameActivity* activity); +int GameActivity_getHardKeyboardHidden(GameActivity* activity); +int GameActivity_getKeyboard(GameActivity* activity); +int GameActivity_getKeyboardHidden(GameActivity* activity); +int GameActivity_getLocalesCount(GameActivity* activity); +int GameActivity_getMcc(GameActivity* activity); +int GameActivity_getMnc(GameActivity* activity); +int GameActivity_getNavigation(GameActivity* activity); +int GameActivity_getNavigationHidden(GameActivity* activity); +int GameActivity_getOrientation(GameActivity* activity); +int GameActivity_getScreenHeightDp(GameActivity* activity); +int GameActivity_getScreenLayout(GameActivity* activity); +int GameActivity_getScreenWidthDp(GameActivity* activity); +int GameActivity_getSmallestScreenWidthDp(GameActivity* activity); +int GameActivity_getTouchscreen(GameActivity* activity); +int GameActivity_getUIMode(GameActivity* activity); + +/** + * The functions below return Java locale information. + * + * In simple cases there will be just one locale, but it's possible tha + * there are more than one locale objects. Users are encouraged to write code + * that handles all locales and not just the first one. + * + * The functions in the block below return string values in the provided buffer. + * Return value is zero if there were no errors, otherwise it's non-zero. + * If the return value is zero, `dst` will contain a null-terminated string: + * strlen(dst) <= dst_size - 1. + * If the return value is non-zero, the content of dst is undefined. + * + * Parameters: + * + * dst, dst_size: define a receiver buffer. Locale string can be something + * short like "EN/EN", but it may be longer. You should be safe with a buffer + * size of 256 bytes. + * + * If the buffer is too small, ENOBUFS is returned. Try allocating a larger + * buffer in this case. + * + * localeIdx must be between 0 and the value of GameActivity_getLocalesCount(). + * If localeIdx is out of range, EINVAL is returned. + * + * Refer to Java documentation of locales for more information. + */ +int GameActivity_getLocaleLanguage(char* dst, size_t dst_size, + GameActivity* activity, size_t localeIdx); +int GameActivity_getLocaleScript(char* dst, size_t dst_size, + GameActivity* activity, size_t localeIdx); +int GameActivity_getLocaleCountry(char* dst, size_t dst_size, + GameActivity* activity, size_t localeIdx); +int GameActivity_getLocaleVariant(char* dst, size_t dst_size, + GameActivity* activity, size_t localeIdx); + +#ifdef __cplusplus +} +#endif + +/** @} */ + +#endif // ANDROID_GAME_SDK_GAME_ACTIVITY_H diff --git a/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/include/game-activity/GameActivityEvents.h b/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/include/game-activity/GameActivityEvents.h new file mode 100644 index 00000000..2a7982af --- /dev/null +++ b/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/include/game-activity/GameActivityEvents.h @@ -0,0 +1,312 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup GameActivity Game Activity Events + * The interface to use Game Activity Events. + * @{ + */ + +/** + * @file GameActivityEvents.h + */ +#ifndef ANDROID_GAME_SDK_GAME_ACTIVITY_EVENTS_H +#define ANDROID_GAME_SDK_GAME_ACTIVITY_EVENTS_H + +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * The maximum number of axes supported in an Android MotionEvent. + * See https://developer.android.com/ndk/reference/group/input. + */ +#define GAME_ACTIVITY_POINTER_INFO_AXIS_COUNT 48 + +/** + * \brief Describe information about a pointer, found in a + * GameActivityMotionEvent. + * + * You can read values directly from this structure, or use helper functions + * (`GameActivityPointerAxes_getX`, `GameActivityPointerAxes_getY` and + * `GameActivityPointerAxes_getAxisValue`). + * + * The X axis and Y axis are enabled by default but any other axis that you want + * to read **must** be enabled first, using + * `GameActivityPointerAxes_enableAxis`. + * + * \see GameActivityMotionEvent + */ +typedef struct GameActivityPointerAxes { + int32_t id; + int32_t toolType; + float axisValues[GAME_ACTIVITY_POINTER_INFO_AXIS_COUNT]; + float rawX; + float rawY; +} GameActivityPointerAxes; + +/** \brief Get the toolType of the pointer. */ +inline int32_t GameActivityPointerAxes_getToolType( + const GameActivityPointerAxes* pointerInfo) { + return pointerInfo->toolType; +} + +/** \brief Get the current X coordinate of the pointer. */ +inline float GameActivityPointerAxes_getX( + const GameActivityPointerAxes* pointerInfo) { + return pointerInfo->axisValues[AMOTION_EVENT_AXIS_X]; +} + +/** \brief Get the current Y coordinate of the pointer. */ +inline float GameActivityPointerAxes_getY( + const GameActivityPointerAxes* pointerInfo) { + return pointerInfo->axisValues[AMOTION_EVENT_AXIS_Y]; +} + +/** + * \brief Enable the specified axis, so that its value is reported in the + * GameActivityPointerAxes structures stored in a motion event. + * + * You must enable any axis that you want to read, apart from + * `AMOTION_EVENT_AXIS_X` and `AMOTION_EVENT_AXIS_Y` that are enabled by + * default. + * + * If the axis index is out of range, nothing is done. + */ +void GameActivityPointerAxes_enableAxis(int32_t axis); + +/** + * \brief Disable the specified axis. Its value won't be reported in the + * GameActivityPointerAxes structures stored in a motion event anymore. + * + * Apart from X and Y, any axis that you want to read **must** be enabled first, + * using `GameActivityPointerAxes_enableAxis`. + * + * If the axis index is out of range, nothing is done. + */ +void GameActivityPointerAxes_disableAxis(int32_t axis); + +/** + * \brief Get the value of the requested axis. + * + * Apart from X and Y, any axis that you want to read **must** be enabled first, + * using `GameActivityPointerAxes_enableAxis`. + * + * Find the valid enums for the axis (`AMOTION_EVENT_AXIS_X`, + * `AMOTION_EVENT_AXIS_Y`, `AMOTION_EVENT_AXIS_PRESSURE`...) + * in https://developer.android.com/ndk/reference/group/input. + * + * @param pointerInfo The structure containing information about the pointer, + * obtained from GameActivityMotionEvent. + * @param axis The axis to get the value from + * @return The value of the axis, or 0 if the axis is invalid or was not + * enabled. + */ +float GameActivityPointerAxes_getAxisValue( + const GameActivityPointerAxes* pointerInfo, int32_t axis); + +inline float GameActivityPointerAxes_getPressure( + const GameActivityPointerAxes* pointerInfo) { + return GameActivityPointerAxes_getAxisValue(pointerInfo, + AMOTION_EVENT_AXIS_PRESSURE); +} + +inline float GameActivityPointerAxes_getSize( + const GameActivityPointerAxes* pointerInfo) { + return GameActivityPointerAxes_getAxisValue(pointerInfo, + AMOTION_EVENT_AXIS_SIZE); +} + +inline float GameActivityPointerAxes_getTouchMajor( + const GameActivityPointerAxes* pointerInfo) { + return GameActivityPointerAxes_getAxisValue(pointerInfo, + AMOTION_EVENT_AXIS_TOUCH_MAJOR); +} + +inline float GameActivityPointerAxes_getTouchMinor( + const GameActivityPointerAxes* pointerInfo) { + return GameActivityPointerAxes_getAxisValue(pointerInfo, + AMOTION_EVENT_AXIS_TOUCH_MINOR); +} + +inline float GameActivityPointerAxes_getToolMajor( + const GameActivityPointerAxes* pointerInfo) { + return GameActivityPointerAxes_getAxisValue(pointerInfo, + AMOTION_EVENT_AXIS_TOOL_MAJOR); +} + +inline float GameActivityPointerAxes_getToolMinor( + const GameActivityPointerAxes* pointerInfo) { + return GameActivityPointerAxes_getAxisValue(pointerInfo, + AMOTION_EVENT_AXIS_TOOL_MINOR); +} + +inline float GameActivityPointerAxes_getOrientation( + const GameActivityPointerAxes* pointerInfo) { + return GameActivityPointerAxes_getAxisValue(pointerInfo, + AMOTION_EVENT_AXIS_ORIENTATION); +} + +/** + * The maximum number of pointers returned inside a motion event. + */ +#if (defined GAMEACTIVITY_MAX_NUM_POINTERS_IN_MOTION_EVENT_OVERRIDE) +#define GAMEACTIVITY_MAX_NUM_POINTERS_IN_MOTION_EVENT \ + GAMEACTIVITY_MAX_NUM_POINTERS_IN_MOTION_EVENT_OVERRIDE +#else +#define GAMEACTIVITY_MAX_NUM_POINTERS_IN_MOTION_EVENT 8 +#endif + +/** + * \brief Describe a motion event that happened on the GameActivity SurfaceView. + * + * This is 1:1 mapping to the information contained in a Java `MotionEvent` + * (see https://developer.android.com/reference/android/view/MotionEvent). + */ +typedef struct GameActivityMotionEvent { + int32_t deviceId; + int32_t source; + int32_t action; + + int64_t eventTime; + int64_t downTime; + + int32_t flags; + int32_t metaState; + + int32_t actionButton; + int32_t buttonState; + int32_t classification; + int32_t edgeFlags; + + uint32_t pointerCount; + GameActivityPointerAxes + pointers[GAMEACTIVITY_MAX_NUM_POINTERS_IN_MOTION_EVENT]; + + int historySize; + int64_t* historicalEventTimesMillis; + int64_t* historicalEventTimesNanos; + float* historicalAxisValues; + + float precisionX; + float precisionY; +} GameActivityMotionEvent; + +float GameActivityMotionEvent_getHistoricalAxisValue( + const GameActivityMotionEvent* event, int axis, int pointerIndex, + int historyPos); + +inline int GameActivityMotionEvent_getHistorySize( + const GameActivityMotionEvent* event) { + return event->historySize; +} + +inline float GameActivityMotionEvent_getHistoricalX( + const GameActivityMotionEvent* event, int pointerIndex, int historyPos) { + return GameActivityMotionEvent_getHistoricalAxisValue( + event, AMOTION_EVENT_AXIS_X, pointerIndex, historyPos); +} + +inline float GameActivityMotionEvent_getHistoricalY( + const GameActivityMotionEvent* event, int pointerIndex, int historyPos) { + return GameActivityMotionEvent_getHistoricalAxisValue( + event, AMOTION_EVENT_AXIS_Y, pointerIndex, historyPos); +} + +inline float GameActivityMotionEvent_getHistoricalPressure( + const GameActivityMotionEvent* event, int pointerIndex, int historyPos) { + return GameActivityMotionEvent_getHistoricalAxisValue( + event, AMOTION_EVENT_AXIS_PRESSURE, pointerIndex, historyPos); +} + +inline float GameActivityMotionEvent_getHistoricalSize( + const GameActivityMotionEvent* event, int pointerIndex, int historyPos) { + return GameActivityMotionEvent_getHistoricalAxisValue( + event, AMOTION_EVENT_AXIS_SIZE, pointerIndex, historyPos); +} + +inline float GameActivityMotionEvent_getHistoricalTouchMajor( + const GameActivityMotionEvent* event, int pointerIndex, int historyPos) { + return GameActivityMotionEvent_getHistoricalAxisValue( + event, AMOTION_EVENT_AXIS_TOUCH_MAJOR, pointerIndex, historyPos); +} + +inline float GameActivityMotionEvent_getHistoricalTouchMinor( + const GameActivityMotionEvent* event, int pointerIndex, int historyPos) { + return GameActivityMotionEvent_getHistoricalAxisValue( + event, AMOTION_EVENT_AXIS_TOUCH_MINOR, pointerIndex, historyPos); +} + +inline float GameActivityMotionEvent_getHistoricalToolMajor( + const GameActivityMotionEvent* event, int pointerIndex, int historyPos) { + return GameActivityMotionEvent_getHistoricalAxisValue( + event, AMOTION_EVENT_AXIS_TOOL_MAJOR, pointerIndex, historyPos); +} + +inline float GameActivityMotionEvent_getHistoricalToolMinor( + const GameActivityMotionEvent* event, int pointerIndex, int historyPos) { + return GameActivityMotionEvent_getHistoricalAxisValue( + event, AMOTION_EVENT_AXIS_TOOL_MINOR, pointerIndex, historyPos); +} + +inline float GameActivityMotionEvent_getHistoricalOrientation( + const GameActivityMotionEvent* event, int pointerIndex, int historyPos) { + return GameActivityMotionEvent_getHistoricalAxisValue( + event, AMOTION_EVENT_AXIS_ORIENTATION, pointerIndex, historyPos); +} + +/** \brief Handle the freeing of the GameActivityMotionEvent struct. */ +void GameActivityMotionEvent_destroy(GameActivityMotionEvent* c_event); + +/** + * \brief Describe a key event that happened on the GameActivity SurfaceView. + * + * This is 1:1 mapping to the information contained in a Java `KeyEvent` + * (see https://developer.android.com/reference/android/view/KeyEvent). + * The only exception is the event times, which are reported as + * nanoseconds in this struct. + */ +typedef struct GameActivityKeyEvent { + int32_t deviceId; + int32_t source; + int32_t action; + + int64_t eventTime; + int64_t downTime; + + int32_t flags; + int32_t metaState; + + int32_t modifiers; + int32_t repeatCount; + int32_t keyCode; + int32_t scanCode; + // int32_t unicodeChar; +} GameActivityKeyEvent; + +#ifdef __cplusplus +} +#endif + +/** @} */ + +#endif // ANDROID_GAME_SDK_GAME_ACTIVITY_EVENTS_H diff --git a/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/include/game-activity/GameActivityLog.h b/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/include/game-activity/GameActivityLog.h new file mode 100644 index 00000000..311b3c4d --- /dev/null +++ b/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/include/game-activity/GameActivityLog.h @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef ANDROID_GAME_SDK_GAME_ACTIVITY_LOG_H_ +#define ANDROID_GAME_SDK_GAME_ACTIVITY_LOG_H_ + +#define LOG_TAG "GameActivity" +#include + +#define ALOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__); +#define ALOGW(...) __android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__); +#define ALOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__); +#ifdef NDEBUG +#define ALOGV(...) +#else +#define ALOGV(...) \ + __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__); +#endif + +/* Returns 2nd arg. Used to substitute default value if caller's vararg list + * is empty. + */ +#define __android_second(first, second, ...) second + +/* If passed multiple args, returns ',' followed by all but 1st arg, otherwise + * returns nothing. + */ +#define __android_rest(first, ...) , ##__VA_ARGS__ + +#define android_printAssert(cond, tag, fmt...) \ + __android_log_assert(cond, tag, \ + __android_second(0, ##fmt, NULL) __android_rest(fmt)) + +#define CONDITION(cond) (__builtin_expect((cond) != 0, 0)) + +#ifndef LOG_ALWAYS_FATAL_IF +#define LOG_ALWAYS_FATAL_IF(cond, ...) \ + ((CONDITION(cond)) \ + ? ((void)android_printAssert(#cond, LOG_TAG, ##__VA_ARGS__)) \ + : (void)0) +#endif + +#ifndef LOG_ALWAYS_FATAL +#define LOG_ALWAYS_FATAL(...) \ + (((void)android_printAssert(NULL, LOG_TAG, ##__VA_ARGS__))) +#endif + +/* + * Simplified macro to send a warning system log message using current LOG_TAG. + */ +#ifndef SLOGW +#define SLOGW(...) \ + ((void)__android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__)) +#endif + +#ifndef SLOGW_IF +#define SLOGW_IF(cond, ...) \ + ((__predict_false(cond)) \ + ? ((void)__android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__)) \ + : (void)0) +#endif + +/* + * Versions of LOG_ALWAYS_FATAL_IF and LOG_ALWAYS_FATAL that + * are stripped out of release builds. + */ +#if LOG_NDEBUG + +#ifndef LOG_FATAL_IF +#define LOG_FATAL_IF(cond, ...) ((void)0) +#endif +#ifndef LOG_FATAL +#define LOG_FATAL(...) ((void)0) +#endif + +#else + +#ifndef LOG_FATAL_IF +#define LOG_FATAL_IF(cond, ...) LOG_ALWAYS_FATAL_IF(cond, ##__VA_ARGS__) +#endif +#ifndef LOG_FATAL +#define LOG_FATAL(...) LOG_ALWAYS_FATAL(__VA_ARGS__) +#endif + +#endif + +/* + * Assertion that generates a log message when the assertion fails. + * Stripped out of release builds. Uses the current LOG_TAG. + */ +#ifndef ALOG_ASSERT +#define ALOG_ASSERT(cond, ...) LOG_FATAL_IF(!(cond), ##__VA_ARGS__) +#endif + +#define LOG_TRACE(...) + +#endif // ANDROID_GAME_SDK_GAME_ACTIVITY_LOG_H_ diff --git a/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/include/game-activity/native_app_glue/android_native_app_glue.h b/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/include/game-activity/native_app_glue/android_native_app_glue.h new file mode 100644 index 00000000..7b4f35b8 --- /dev/null +++ b/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/include/game-activity/native_app_glue/android_native_app_glue.h @@ -0,0 +1,557 @@ +/* + * Copyright (C) 2021 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +/** + * @addtogroup android_native_app_glue Native App Glue library + * The glue library to interface your game loop with GameActivity. + * @{ + */ + +#include +#include +#include +#include +#include +#include + +#include "game-activity/GameActivity.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * The GameActivity interface provided by + * is based on a set of application-provided callbacks that will be called + * by the Activity's main thread when certain events occur. + * + * This means that each one of this callbacks _should_ _not_ block, or they + * risk having the system force-close the application. This programming + * model is direct, lightweight, but constraining. + * + * The 'android_native_app_glue' static library is used to provide a different + * execution model where the application can implement its own main event + * loop in a different thread instead. Here's how it works: + * + * 1/ The application must provide a function named "android_main()" that + * will be called when the activity is created, in a new thread that is + * distinct from the activity's main thread. + * + * 2/ android_main() receives a pointer to a valid "android_app" structure + * that contains references to other important objects, e.g. the + * GameActivity obejct instance the application is running in. + * + * 3/ the "android_app" object holds an ALooper instance that already + * listens to activity lifecycle events (e.g. "pause", "resume"). + * See APP_CMD_XXX declarations below. + * + * This corresponds to an ALooper identifier returned by + * ALooper_pollOnce with value LOOPER_ID_MAIN. + * + * Your application can use the same ALooper to listen to additional + * file-descriptors. They can either be callback based, or with return + * identifiers starting with LOOPER_ID_USER. + * + * 4/ Whenever you receive a LOOPER_ID_MAIN event, + * the returned data will point to an android_poll_source structure. You + * can call the process() function on it, and fill in android_app->onAppCmd + * to be called for your own processing of the event. + * + * Alternatively, you can call the low-level functions to read and process + * the data directly... look at the process_cmd() and process_input() + * implementations in the glue to see how to do this. + * + * See the sample named "native-activity" that comes with the NDK with a + * full usage example. Also look at the documentation of GameActivity. + */ + +struct android_app; + +/** + * Data associated with an ALooper fd that will be returned as the "outData" + * when that source has data ready. + */ +struct android_poll_source { + /** + * The identifier of this source. May be LOOPER_ID_MAIN or + * LOOPER_ID_INPUT. + */ + int32_t id; + + /** The android_app this ident is associated with. */ + struct android_app* app; + + /** + * Function to call to perform the standard processing of data from + * this source. + */ + void (*process)(struct android_app* app, struct android_poll_source* source); +}; + +struct android_input_buffer { + /** + * Pointer to a read-only array of GameActivityMotionEvent. + * Only the first motionEventsCount events are valid. + */ + GameActivityMotionEvent* motionEvents; + + /** + * The number of valid motion events in `motionEvents`. + */ + uint64_t motionEventsCount; + + /** + * The size of the `motionEvents` buffer. + */ + uint64_t motionEventsBufferSize; + + /** + * Pointer to a read-only array of GameActivityKeyEvent. + * Only the first keyEventsCount events are valid. + */ + GameActivityKeyEvent* keyEvents; + + /** + * The number of valid "Key" events in `keyEvents`. + */ + uint64_t keyEventsCount; + + /** + * The size of the `keyEvents` buffer. + */ + uint64_t keyEventsBufferSize; +}; + +/** + * Function pointer declaration for the filtering of key events. + * A function with this signature should be passed to + * android_app_set_key_event_filter and return false for any events that should + * not be handled by android_native_app_glue. These events will be handled by + * the system instead. + */ +typedef bool (*android_key_event_filter)(const GameActivityKeyEvent*); + +/** + * Function pointer definition for the filtering of motion events. + * A function with this signature should be passed to + * android_app_set_motion_event_filter and return false for any events that + * should not be handled by android_native_app_glue. These events will be + * handled by the system instead. + */ +typedef bool (*android_motion_event_filter)(const GameActivityMotionEvent*); + +/** + * This is the interface for the standard glue code of a threaded + * application. In this model, the application's code is running + * in its own thread separate from the main thread of the process. + * It is not required that this thread be associated with the Java + * VM, although it will need to be in order to make JNI calls any + * Java objects. + */ +struct android_app { + /** + * An optional pointer to application-defined state. + */ + void* userData; + + /** + * A required callback for processing main app commands (`APP_CMD_*`). + * This is called each frame if there are app commands that need processing. + */ + void (*onAppCmd)(struct android_app* app, int32_t cmd); + + /** The GameActivity object instance that this app is running in. */ + GameActivity* activity; + + /** The current configuration the app is running in. */ + AConfiguration* config; + + /** + * The last activity saved state, as provided at creation time. + * It is NULL if there was no state. You can use this as you need; the + * memory will remain around until you call android_app_exec_cmd() for + * APP_CMD_RESUME, at which point it will be freed and savedState set to + * NULL. These variables should only be changed when processing a + * APP_CMD_SAVE_STATE, at which point they will be initialized to NULL and + * you can malloc your state and place the information here. In that case + * the memory will be freed for you later. + */ + void* savedState; + + /** + * The size of the activity saved state. It is 0 if `savedState` is NULL. + */ + size_t savedStateSize; + + /** The ALooper associated with the app's thread. */ + ALooper* looper; + + /** When non-NULL, this is the window surface that the app can draw in. */ + ANativeWindow* window; + + /** + * Current content rectangle of the window; this is the area where the + * window's content should be placed to be seen by the user. + */ + ARect contentRect; + + /** + * Whether the software keyboard is visible or not. + */ + bool softwareKeyboardVisible; + + /** + * Last editor action. Valid within APP_CMD_SOFTWARE_KB_VIS_CHANGED handler. + * + * Note: the upstream comment above isn't accurate. + * - `APP_CMD_SOFTWARE_KB_VIS_CHANGED` is associated with `softwareKeyboardVisible` + * changes, not `editorAction`. + * - `APP_CMD_EDITOR_ACTION` is associated with this state but unlike for + * `window` state there's no synchonization that blocks the Java main + * thread, so we can't say that this is only valid within the `APP_CMD_` handler. + */ + int editorAction; + + /** + * Current state of the app's activity. May be either APP_CMD_START, + * APP_CMD_RESUME, APP_CMD_PAUSE, or APP_CMD_STOP. + */ + int activityState; + + /** + * This is non-zero when the application's GameActivity is being + * destroyed and waiting for the app thread to complete. + */ + int destroyRequested; + +#define NATIVE_APP_GLUE_MAX_INPUT_BUFFERS 2 + + /** + * This is used for buffering input from GameActivity. Once ready, the + * application thread switches the buffers and processes what was + * accumulated. + */ + struct android_input_buffer inputBuffers[NATIVE_APP_GLUE_MAX_INPUT_BUFFERS]; + + int currentInputBuffer; + + /** + * 0 if no text input event is outstanding, 1 if it is. + * Use `GameActivity_getTextInputState` to get information + * about the text entered by the user. + */ + int textInputState; + + // Below are "private" implementation of the glue code. + /** @cond INTERNAL */ + + pthread_mutex_t mutex; + pthread_cond_t cond; + + int msgread; + int msgwrite; + + pthread_t thread; + + struct android_poll_source cmdPollSource; + + int running; + int stateSaved; + int destroyed; + int redrawNeeded; + ANativeWindow* pendingWindow; + ARect pendingContentRect; + + android_key_event_filter keyEventFilter; + android_motion_event_filter motionEventFilter; + + // When new input is received we set both of these flags and use the looper to + // wake up the application mainloop. + // + // To avoid spamming the mainloop with wake ups from lots of input though we + // don't sent a wake up if the inputSwapPending flag is already set. (i.e. + // we already expect input to be processed in a finite amount of time due to + // our previous wake up) + // + // When a wake up is received then we will check this flag (clearing it + // at the same time). If it was set then an InputAvailable event is sent to + // the application - which should lead to all input being processed within + // a finite amount of time. + // + // The next time android_app_swap_input_buffers is called, both flags will be + // cleared. + // + // NB: both of these should only be read with the app mutex held + bool inputAvailableWakeUp; + bool inputSwapPending; + + /** @endcond */ +}; + +/** + * Looper ID of commands coming from the app's main thread, an AInputQueue or + * user-defined sources. + */ +enum NativeAppGlueLooperId : int8_t { + /** + * Looper data ID of commands coming from the app's main thread, which + * is returned as an identifier from ALooper_pollOnce(). The data for this + * identifier is a pointer to an android_poll_source structure. + * These can be retrieved and processed with android_app_read_cmd() + * and android_app_exec_cmd(). + */ + LOOPER_ID_MAIN = 1, + + /** + * Unused. Reserved for future use when usage of AInputQueue will be + * supported. + */ + LOOPER_ID_INPUT = 2, + + /** + * Start of user-defined ALooper identifiers. + */ + LOOPER_ID_USER = 3, +}; + +/** + * Commands passed from the application's main Java thread to the game's thread. + * + * Values from 0 to 127 are reserved for this library; values from -128 to -1 + * can be used for custom user's events. + */ +enum NativeAppGlueAppCmd : int8_t { + /** + * Unused. Reserved for future use when usage of AInputQueue will be + * supported. + */ + UNUSED_APP_CMD_INPUT_CHANGED, + + /** + * Command from main thread: a new ANativeWindow is ready for use. Upon + * receiving this command, android_app->window will contain the new window + * surface. + */ + APP_CMD_INIT_WINDOW, + + /** + * Command from main thread: the existing ANativeWindow needs to be + * terminated. Upon receiving this command, android_app->window still + * contains the existing window; after calling android_app_exec_cmd + * it will be set to NULL. + */ + APP_CMD_TERM_WINDOW, + + /** + * Command from main thread: the current ANativeWindow has been resized. + * Please redraw with its new size. + */ + APP_CMD_WINDOW_RESIZED, + + /** + * Command from main thread: the system needs that the current ANativeWindow + * be redrawn. You should redraw the window before handing this to + * android_app_exec_cmd() in order to avoid transient drawing glitches. + */ + APP_CMD_WINDOW_REDRAW_NEEDED, + + /** + * Command from main thread: the content area of the window has changed, + * such as from the soft input window being shown or hidden. You can + * find the new content rect in android_app::contentRect. + */ + APP_CMD_CONTENT_RECT_CHANGED, + + /** + * Command from main thread: the software keyboard was shown or hidden. + */ + APP_CMD_SOFTWARE_KB_VIS_CHANGED, + + /** + * Command from main thread: the app's activity window has gained + * input focus. + */ + APP_CMD_GAINED_FOCUS, + + /** + * Command from main thread: the app's activity window has lost + * input focus. + */ + APP_CMD_LOST_FOCUS, + + /** + * Command from main thread: the current device configuration has changed. + */ + APP_CMD_CONFIG_CHANGED, + + /** + * Command from main thread: the system is running low on memory. + * Try to reduce your memory use. + */ + APP_CMD_LOW_MEMORY, + + /** + * Command from main thread: the app's activity has been started. + */ + APP_CMD_START, + + /** + * Command from main thread: the app's activity has been resumed. + */ + APP_CMD_RESUME, + + /** + * Command from main thread: the app should generate a new saved state + * for itself, to restore from later if needed. If you have saved state, + * allocate it with malloc and place it in android_app.savedState with + * the size in android_app.savedStateSize. The will be freed for you + * later. + */ + APP_CMD_SAVE_STATE, + + /** + * Command from main thread: the app's activity has been paused. + */ + APP_CMD_PAUSE, + + /** + * Command from main thread: the app's activity has been stopped. + */ + APP_CMD_STOP, + + /** + * Command from main thread: the app's activity is being destroyed, + * and waiting for the app thread to clean up and exit before proceeding. + */ + APP_CMD_DESTROY, + + /** + * Command from main thread: the app's insets have changed. + */ + APP_CMD_WINDOW_INSETS_CHANGED, + + /** + * Command from main thread: an editor action has been triggered. + */ + //APP_CMD_EDITOR_ACTION, + + /** + * Command from main thread: a keyboard event has been received. + */ + //APP_CMD_KEY_EVENT, + + /** + * Command from main thread: a touch event has been received. + */ + //APP_CMD_TOUCH_EVENT, + +}; + +/** + * Call when ALooper_pollAll() returns LOOPER_ID_MAIN, reading the next + * app command message. + */ +int8_t android_app_read_cmd(struct android_app* android_app); + +/** + * Call with the command returned by android_app_read_cmd() to do the + * initial pre-processing of the given command. You can perform your own + * actions for the command after calling this function. + */ +void android_app_pre_exec_cmd(struct android_app* android_app, int8_t cmd); + +/** + * Call with the command returned by android_app_read_cmd() to do the + * final post-processing of the given command. You must have done your own + * actions for the command before calling this function. + */ +void android_app_post_exec_cmd(struct android_app* android_app, int8_t cmd); + +/** + * Call this before processing input events to get the events buffer. + * The function returns NULL if there are no events to process. + */ +struct android_input_buffer* android_app_swap_input_buffers( + struct android_app* android_app); + +/** + * Clear the array of motion events that were waiting to be handled, and release + * each of them. + * + * This method should be called after you have processed the motion events in + * your game loop. You should handle events at each iteration of your game loop. + */ +void android_app_clear_motion_events(struct android_input_buffer* inputBuffer); + +/** + * Clear the array of key events that were waiting to be handled, and release + * each of them. + * + * This method should be called after you have processed the key up events in + * your game loop. You should handle events at each iteration of your game loop. + */ +void android_app_clear_key_events(struct android_input_buffer* inputBuffer); + +/** + * This is a springboard into the Rust glue layer that wraps calling the + * main entry for the app itself. + */ +extern void _rust_glue_entry(struct android_app* app); + +/** + * Set the filter to use when processing key events. + * Any events for which the filter returns false will be ignored by + * android_native_app_glue. If filter is set to NULL, no filtering is done. + * + * The default key filter will filter out volume and camera button presses. + */ +void android_app_set_key_event_filter(struct android_app* app, + android_key_event_filter filter); + +/** + * Set the filter to use when processing touch and motion events. + * Any events for which the filter returns false will be ignored by + * android_native_app_glue. If filter is set to NULL, no filtering is done. + * + * Note that the default motion event filter will only allow touchscreen events + * through, in order to mimic NativeActivity's behaviour, so for controller + * events to be passed to the app, set the filter to NULL. + */ +void android_app_set_motion_event_filter(struct android_app* app, + android_motion_event_filter filter); + +/** + * You can send your custom events using the function below. + * + * Make sure your custom codes do not overlap with this library's ones. + * + * Values from 0 to 127 are reserved for this library; values from -128 to -1 + * can be used for custom user's events. + */ +void android_app_write_cmd(struct android_app* android_app, int8_t cmd); + +/** + * Determines if a looper wake up was due to new input becoming available + */ +bool android_app_input_available_wake_up(struct android_app* app); + +#ifdef __cplusplus +} +#endif + +/** @} */ diff --git a/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/include/game-text-input/gametextinput.h b/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/include/game-text-input/gametextinput.h new file mode 120000 index 00000000..84e93379 --- /dev/null +++ b/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/include/game-text-input/gametextinput.h @@ -0,0 +1 @@ +../../../../../../game-text-input/prefab-src/modules/game-text-input/include/game-text-input/gametextinput.h \ No newline at end of file diff --git a/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/module.json b/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/module.json new file mode 100644 index 00000000..0268e839 --- /dev/null +++ b/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/module.json @@ -0,0 +1,8 @@ +{ + "export_libraries": [], + "library_name": null, + "android": { + "export_libraries": ["-landroid", "-llog"], + "library_name": null + } +} diff --git a/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/src/common/system_utils.cpp b/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/src/common/system_utils.cpp new file mode 120000 index 00000000..713dcbbd --- /dev/null +++ b/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/src/common/system_utils.cpp @@ -0,0 +1 @@ +../../../../../../src/common/system_utils.cpp \ No newline at end of file diff --git a/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/src/game-activity/GameActivity.cpp b/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/src/game-activity/GameActivity.cpp new file mode 100644 index 00000000..a178793c --- /dev/null +++ b/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/src/game-activity/GameActivity.cpp @@ -0,0 +1,1399 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "GameActivityEvents_internal.h" + +namespace { + +struct OwnedGameTextInputState { + OwnedGameTextInputState &operator=(const GameTextInputState &rhs) { + inner = rhs; + owned_string = std::string(rhs.text_UTF8, rhs.text_length); + inner.text_UTF8 = owned_string.data(); + return *this; + } + GameTextInputState inner; + std::string owned_string; +}; + +} // anonymous namespace + +#ifndef NELEM +#define NELEM(x) ((int)(sizeof(x) / sizeof((x)[0]))) +#endif + +/* + * JNI methods of the GameActivity Java class. + */ +static struct { + jmethodID finish; + jmethodID setWindowFlags; + jmethodID getWindowInsets; + jmethodID getWaterfallInsets; + jmethodID setImeEditorInfoFields; +} gGameActivityClassInfo; + +/* + * JNI methods of the android.os.LocaleList class. + */ +static struct { + jmethodID size; + jmethodID get; +} gLocaleListClassInfo; + +/* + * JNI methods of the java.util.Locale class. + */ +static struct { + jmethodID getLanguage; + jmethodID getScript; + jmethodID getCountry; + jmethodID getVariant; +} gLocaleClassInfo; + +/* + * JNI fields of the androidx.core.graphics.Insets Java class. + */ +static struct { + jfieldID left; + jfieldID right; + jfieldID top; + jfieldID bottom; +} gInsetsClassInfo; + +/* + * JNI fields of the Configuration Java class. + */ +static struct ConfigurationClassInfo { + jfieldID colorMode; + jfieldID densityDpi; + jfieldID fontScale; + jfieldID fontWeightAdjustment; + jfieldID hardKeyboardHidden; + jfieldID keyboard; + jfieldID keyboardHidden; + jfieldID mcc; + jfieldID mnc; + jfieldID navigation; + jfieldID navigationHidden; + jfieldID orientation; + jfieldID screenHeightDp; + jfieldID screenLayout; + jfieldID screenWidthDp; + jfieldID smallestScreenWidthDp; + jfieldID touchscreen; + jfieldID uiMode; + + jmethodID getLocales; +} gConfigurationClassInfo; + +/* + * JNI methods of the WindowInsetsCompat.Type Java class. + */ +static struct { + jmethodID methods[GAMECOMMON_INSETS_TYPE_COUNT]; + jclass clazz; +} gWindowInsetsCompatTypeClassInfo; + +/* + * Contains a command to be executed by the GameActivity + * on the application main thread. + */ +struct ActivityWork { + int32_t cmd; + int64_t arg1; + int64_t arg2; + int64_t arg3; +}; + +/* + * The type of commands that can be passed to the GameActivity and that + * are executed on the application main thread. + */ +enum { + CMD_FINISH = 1, + CMD_SET_WINDOW_FORMAT, + CMD_SET_WINDOW_FLAGS, + CMD_SHOW_SOFT_INPUT, + CMD_HIDE_SOFT_INPUT, + CMD_SET_SOFT_INPUT_STATE, + CMD_SET_IME_EDITOR_INFO, + CMD_RESTART_INPUT +}; + +/* + * A class for locale information, matching Android Java Locale class. + */ +struct Locale { + std::string language; + std::string script; + std::string country; + std::string variant; +}; + +/* + * Last known Configuration values. They may be accessed from the different + * thread, this is why they are made atomic. + */ +static struct Configuration { + int colorMode; + int densityDpi; + float fontScale; + int fontWeightAdjustment; + int hardKeyboardHidden; + int keyboard; + int keyboardHidden; + int mcc; + int mnc; + int navigation; + int navigationHidden; + int orientation; + int screenHeightDp; + int screenLayout; + int screenWidthDp; + int smallestScreenWidthDp; + int touchscreen; + int uiMode; + std::vector locales; +} gConfiguration; + +static std::mutex gConfigMutex; + +/* + * Write a command to be executed by the GameActivity on the application main + * thread. + */ +static void write_work(int fd, int32_t cmd, int64_t arg1 = 0, int64_t arg2 = 0, + int64_t arg3 = 0) { + ActivityWork work; + work.cmd = cmd; + work.arg1 = arg1; + work.arg2 = arg2; + work.arg3 = arg3; + + LOG_TRACE("write_work: cmd=%d", cmd); +restart: + int res = write(fd, &work, sizeof(work)); + if (res < 0 && errno == EINTR) { + goto restart; + } + + if (res == sizeof(work)) return; + + if (res < 0) { + ALOGW("Failed writing to work fd: %s", strerror(errno)); + } else { + ALOGW("Truncated writing to work fd: %d", res); + } +} + +/* + * Read commands to be executed by the GameActivity on the application main + * thread. + */ +static bool read_work(int fd, ActivityWork *outWork) { + int res = read(fd, outWork, sizeof(ActivityWork)); + // no need to worry about EINTR, poll loop will just come back again. + if (res == sizeof(ActivityWork)) return true; + + if (res < 0) { + ALOGW("Failed reading work fd: %s", strerror(errno)); + } else { + ALOGW("Truncated reading work fd: %d", res); + } + return false; +} + +/* + * Native state for interacting with the GameActivity class. + */ +struct NativeCode : public GameActivity { + NativeCode() { + memset((GameActivity *)this, 0, sizeof(GameActivity)); + memset(&callbacks, 0, sizeof(callbacks)); + memset(&insetsState, 0, sizeof(insetsState)); + nativeWindow = NULL; + mainWorkRead = mainWorkWrite = -1; + gameTextInput = NULL; + softwareKeyboardVisible = false; + sdkVersion = gamesdk::GetSystemPropAsInt("ro.build.version.sdk"); + ALOGD("SDK version: %d", sdkVersion); + } + + ~NativeCode() { + if (callbacks.onDestroy != NULL) { + callbacks.onDestroy(this); + } + if (env != NULL) { + if (javaGameActivity != NULL) { + env->DeleteGlobalRef(javaGameActivity); + } + if (javaAssetManager != NULL) { + env->DeleteGlobalRef(javaAssetManager); + } + } + GameTextInput_destroy(gameTextInput); + if (looper != NULL && mainWorkRead >= 0) { + ALooper_removeFd(looper, mainWorkRead); + } + ALooper_release(looper); + looper = NULL; + + setSurface(NULL); + if (mainWorkRead >= 0) close(mainWorkRead); + if (mainWorkWrite >= 0) close(mainWorkWrite); + } + + void setSurface(jobject _surface) { + if (nativeWindow != NULL) { + ANativeWindow_release(nativeWindow); + } + if (_surface != NULL) { + nativeWindow = ANativeWindow_fromSurface(env, _surface); + } else { + nativeWindow = NULL; + } + } + + GameActivityCallbacks callbacks; + + std::string internalDataPathObj; + std::string externalDataPathObj; + std::string obbPathObj; + + ANativeWindow *nativeWindow; + int32_t lastWindowWidth; + int32_t lastWindowHeight; + + // These are used to wake up the main thread to process work. + int mainWorkRead; + int mainWorkWrite; + ALooper *looper; + + // Need to hold on to a reference here in case the upper layers destroy our + // AssetManager. + jobject javaAssetManager; + + GameTextInput *gameTextInput; + // Set by users in GameActivity_setTextInputState, then passed to + // GameTextInput. + OwnedGameTextInputState gameTextInputState; + std::mutex gameTextInputStateMutex; + + ARect insetsState[GAMECOMMON_INSETS_TYPE_COUNT]; + bool softwareKeyboardVisible; +}; + +static void readConfigurationValues(NativeCode *code, jobject javaConfig); + +extern "C" void GameActivity_finish(GameActivity *activity) { + NativeCode *code = static_cast(activity); + write_work(code->mainWorkWrite, CMD_FINISH, 0); +} + +extern "C" void GameActivity_setWindowFlags(GameActivity *activity, + uint32_t values, uint32_t mask) { + NativeCode *code = static_cast(activity); + write_work(code->mainWorkWrite, CMD_SET_WINDOW_FLAGS, values, mask); +} + +extern "C" void GameActivity_showSoftInput(GameActivity *activity, + uint32_t flags) { + NativeCode *code = static_cast(activity); + write_work(code->mainWorkWrite, CMD_SHOW_SOFT_INPUT, flags); +} + +extern "C" void GameActivity_restartInput(GameActivity *activity) { + NativeCode *code = static_cast(activity); + write_work(code->mainWorkWrite, CMD_RESTART_INPUT); +} + +extern "C" void GameActivity_setTextInputState( + GameActivity *activity, const GameTextInputState *state) { + NativeCode *code = static_cast(activity); + std::lock_guard lock(code->gameTextInputStateMutex); + code->gameTextInputState = *state; + write_work(code->mainWorkWrite, CMD_SET_SOFT_INPUT_STATE); +} + +extern "C" void GameActivity_getTextInputState( + GameActivity *activity, GameTextInputGetStateCallback callback, + void *context) { + NativeCode *code = static_cast(activity); + return GameTextInput_getState(code->gameTextInput, callback, context); +} + +extern "C" void GameActivity_hideSoftInput(GameActivity *activity, + uint32_t flags) { + NativeCode *code = static_cast(activity); + write_work(code->mainWorkWrite, CMD_HIDE_SOFT_INPUT, flags); +} + +extern "C" void GameActivity_getWindowInsets(GameActivity *activity, + GameCommonInsetsType type, + ARect *insets) { + if (type < 0 || type >= GAMECOMMON_INSETS_TYPE_COUNT) return; + NativeCode *code = static_cast(activity); + *insets = code->insetsState[type]; +} + +extern "C" bool GameActivity_isSoftwareKeyboardVisible(GameActivity *activity) { + NativeCode *code = static_cast(activity); + return code->softwareKeyboardVisible; +} + +extern "C" GameTextInput *GameActivity_getTextInput( + const GameActivity *activity) { + const NativeCode *code = static_cast(activity); + return code->gameTextInput; +} + +/* + * Log the JNI exception, if any. + */ +static void checkAndClearException(JNIEnv *env, const char *methodName) { + if (env->ExceptionCheck()) { + ALOGE("Exception while running %s", methodName); + env->ExceptionDescribe(); + env->ExceptionClear(); + } +} + +/* + * Callback for handling native events on the application's main thread. + */ +static int mainWorkCallback(int fd, int events, void *data) { + ALOGD("************** mainWorkCallback *********"); + NativeCode *code = (NativeCode *)data; + if ((events & POLLIN) == 0) { + return 1; + } + + ActivityWork work; + if (!read_work(code->mainWorkRead, &work)) { + return 1; + } + LOG_TRACE("mainWorkCallback: cmd=%d", work.cmd); + switch (work.cmd) { + case CMD_FINISH: { + code->env->CallVoidMethod(code->javaGameActivity, + gGameActivityClassInfo.finish); + checkAndClearException(code->env, "finish"); + } break; + case CMD_SET_WINDOW_FLAGS: { + code->env->CallVoidMethod( + code->javaGameActivity, gGameActivityClassInfo.setWindowFlags, + static_cast(work.arg1), static_cast(work.arg2)); + checkAndClearException(code->env, "setWindowFlags"); + } break; + case CMD_SHOW_SOFT_INPUT: { + GameTextInput_showIme(code->gameTextInput, work.arg1); + } break; + case CMD_SET_SOFT_INPUT_STATE: { + std::lock_guard lock(code->gameTextInputStateMutex); + GameTextInput_setState(code->gameTextInput, + &code->gameTextInputState.inner); + checkAndClearException(code->env, "setTextInputState"); + } break; + case CMD_HIDE_SOFT_INPUT: { + GameTextInput_hideIme(code->gameTextInput, work.arg1); + } break; + case CMD_SET_IME_EDITOR_INFO: { + code->env->CallVoidMethod( + code->javaGameActivity, gGameActivityClassInfo.setImeEditorInfoFields, + static_cast(work.arg1), static_cast(work.arg2), + static_cast(work.arg3)); + checkAndClearException(code->env, "setImeEditorInfo"); + } break; + case CMD_RESTART_INPUT: { + GameTextInput_restartInput(code->gameTextInput); + } break; + default: + ALOGW("Unknown work command: %d", work.cmd); + break; + } + + return 1; +} + +// ------------------------------------------------------------------------ +static thread_local std::string g_error_msg; + +static jlong initializeNativeCode_native( + JNIEnv *env, jobject javaGameActivity, jstring internalDataDir, + jstring obbDir, jstring externalDataDir, jobject jAssetMgr, + jbyteArray savedState, jobject javaConfig) { + LOG_TRACE("initializeNativeCode_native"); + NativeCode *code = NULL; + + code = new NativeCode(); + + code->looper = ALooper_forThread(); + if (code->looper == nullptr) { + g_error_msg = "Unable to retrieve native ALooper"; + ALOGW("%s", g_error_msg.c_str()); + delete code; + return 0; + } + ALooper_acquire(code->looper); + + int msgpipe[2]; + if (pipe(msgpipe)) { + g_error_msg = "could not create pipe: "; + g_error_msg += strerror(errno); + + ALOGW("%s", g_error_msg.c_str()); + delete code; + return 0; + } + code->mainWorkRead = msgpipe[0]; + code->mainWorkWrite = msgpipe[1]; + int result = fcntl(code->mainWorkRead, F_SETFL, O_NONBLOCK); + SLOGW_IF(result != 0, + "Could not make main work read pipe " + "non-blocking: %s", + strerror(errno)); + result = fcntl(code->mainWorkWrite, F_SETFL, O_NONBLOCK); + SLOGW_IF(result != 0, + "Could not make main work write pipe " + "non-blocking: %s", + strerror(errno)); + ALooper_addFd(code->looper, code->mainWorkRead, 0, ALOOPER_EVENT_INPUT, + mainWorkCallback, code); + + code->GameActivity::callbacks = &code->callbacks; + if (env->GetJavaVM(&code->vm) < 0) { + ALOGW("GameActivity GetJavaVM failed"); + delete code; + return 0; + } + code->env = env; + code->javaGameActivity = env->NewGlobalRef(javaGameActivity); + + const char *dirStr = + internalDataDir ? env->GetStringUTFChars(internalDataDir, NULL) : ""; + code->internalDataPathObj = dirStr; + code->internalDataPath = code->internalDataPathObj.c_str(); + if (internalDataDir) env->ReleaseStringUTFChars(internalDataDir, dirStr); + + dirStr = externalDataDir ? env->GetStringUTFChars(externalDataDir, NULL) : ""; + code->externalDataPathObj = dirStr; + code->externalDataPath = code->externalDataPathObj.c_str(); + if (externalDataDir) env->ReleaseStringUTFChars(externalDataDir, dirStr); + + code->javaAssetManager = env->NewGlobalRef(jAssetMgr); + code->assetManager = AAssetManager_fromJava(env, jAssetMgr); + + dirStr = obbDir ? env->GetStringUTFChars(obbDir, NULL) : ""; + code->obbPathObj = dirStr; + code->obbPath = code->obbPathObj.c_str(); + if (obbDir) env->ReleaseStringUTFChars(obbDir, dirStr); + + jbyte *rawSavedState = NULL; + jsize rawSavedSize = 0; + if (savedState != NULL) { + rawSavedState = env->GetByteArrayElements(savedState, NULL); + rawSavedSize = env->GetArrayLength(savedState); + } + + // read configuration for the first time + readConfigurationValues(code, javaConfig); + + GameActivity_onCreate_C(code, rawSavedState, rawSavedSize); + + code->gameTextInput = GameTextInput_init(env, 0); + GameTextInput_setEventCallback(code->gameTextInput, + reinterpret_cast( + code->callbacks.onTextInputEvent), + code); + + if (rawSavedState != NULL) { + env->ReleaseByteArrayElements(savedState, rawSavedState, 0); + } + + return reinterpret_cast(code); +} + +static jstring getDlError_native(JNIEnv *env, jobject javaGameActivity) { + jstring result = env->NewStringUTF(g_error_msg.c_str()); + g_error_msg.clear(); + return result; +} + +static void terminateNativeCode_native(JNIEnv *env, jobject javaGameActivity, + jlong handle) { + LOG_TRACE("terminateNativeCode_native"); + if (handle != 0) { + NativeCode *code = (NativeCode *)handle; + delete code; + } +} + +static void onStart_native(JNIEnv *env, jobject javaGameActivity, + jlong handle) { + ALOGV("onStart_native"); + if (handle != 0) { + NativeCode *code = (NativeCode *)handle; + if (code->callbacks.onStart != NULL) { + code->callbacks.onStart(code); + } + } +} + +static void onResume_native(JNIEnv *env, jobject javaGameActivity, + jlong handle) { + LOG_TRACE("onResume_native"); + if (handle != 0) { + NativeCode *code = (NativeCode *)handle; + if (code->callbacks.onResume != NULL) { + code->callbacks.onResume(code); + } + } +} + +struct SaveInstanceLocals { + JNIEnv *env; + jbyteArray array; +}; + +static jbyteArray onSaveInstanceState_native(JNIEnv *env, + jobject javaGameActivity, + jlong handle) { + LOG_TRACE("onSaveInstanceState_native"); + + SaveInstanceLocals locals{ + env, NULL}; // Passed through the user's state prep function. + + if (handle != 0) { + NativeCode *code = (NativeCode *)handle; + if (code->callbacks.onSaveInstanceState != NULL) { + code->callbacks.onSaveInstanceState( + code, + [](const char *bytes, int len, void *context) { + auto locals = static_cast(context); + if (len > 0) { + locals->array = locals->env->NewByteArray(len); + if (locals->array != NULL) { + locals->env->SetByteArrayRegion(locals->array, 0, len, + (const jbyte *)bytes); + } + } + }, + &locals); + } + } + return locals.array; +} + +static void onPause_native(JNIEnv *env, jobject javaGameActivity, + jlong handle) { + LOG_TRACE("onPause_native"); + if (handle != 0) { + NativeCode *code = (NativeCode *)handle; + if (code->callbacks.onPause != NULL) { + code->callbacks.onPause(code); + } + } +} + +static void onStop_native(JNIEnv *env, jobject javaGameActivity, jlong handle) { + LOG_TRACE("onStop_native"); + if (handle != 0) { + NativeCode *code = (NativeCode *)handle; + if (code->callbacks.onStop != NULL) { + code->callbacks.onStop(code); + } + } +} + +static std::string getStringField(JNIEnv *env, jobject obj, jmethodID method) { + jstring str = (jstring)env->CallObjectMethod(obj, method); + const char *chars = env->GetStringUTFChars(str, NULL); + std::string res(chars); + env->ReleaseStringUTFChars(str, chars); + checkAndClearException(env, "getStringField"); + return res; +} + +static void readConfigurationValues(NativeCode *code, jobject javaConfig) { + const std::lock_guard lock(gConfigMutex); + + if (gConfigurationClassInfo.colorMode != NULL) { + gConfiguration.colorMode = + code->env->GetIntField(javaConfig, gConfigurationClassInfo.colorMode); + } + + gConfiguration.densityDpi = + code->env->GetIntField(javaConfig, gConfigurationClassInfo.densityDpi); + gConfiguration.fontScale = + code->env->GetFloatField(javaConfig, gConfigurationClassInfo.fontScale); + + if (gConfigurationClassInfo.fontWeightAdjustment != NULL) { + gConfiguration.fontWeightAdjustment = code->env->GetIntField( + javaConfig, gConfigurationClassInfo.fontWeightAdjustment); + } + + gConfiguration.hardKeyboardHidden = code->env->GetIntField( + javaConfig, gConfigurationClassInfo.hardKeyboardHidden); + gConfiguration.keyboard = + code->env->GetIntField(javaConfig, gConfigurationClassInfo.keyboard); + gConfiguration.keyboardHidden = code->env->GetIntField( + javaConfig, gConfigurationClassInfo.keyboardHidden); + gConfiguration.mcc = + code->env->GetIntField(javaConfig, gConfigurationClassInfo.mcc); + gConfiguration.mnc = + code->env->GetIntField(javaConfig, gConfigurationClassInfo.mnc); + gConfiguration.navigation = + code->env->GetIntField(javaConfig, gConfigurationClassInfo.navigation); + gConfiguration.navigationHidden = code->env->GetIntField( + javaConfig, gConfigurationClassInfo.navigationHidden); + gConfiguration.orientation = + code->env->GetIntField(javaConfig, gConfigurationClassInfo.orientation); + gConfiguration.screenHeightDp = code->env->GetIntField( + javaConfig, gConfigurationClassInfo.screenHeightDp); + gConfiguration.screenLayout = + code->env->GetIntField(javaConfig, gConfigurationClassInfo.screenLayout); + gConfiguration.screenWidthDp = + code->env->GetIntField(javaConfig, gConfigurationClassInfo.screenWidthDp); + gConfiguration.smallestScreenWidthDp = code->env->GetIntField( + javaConfig, gConfigurationClassInfo.smallestScreenWidthDp); + gConfiguration.touchscreen = + code->env->GetIntField(javaConfig, gConfigurationClassInfo.touchscreen); + gConfiguration.uiMode = + code->env->GetIntField(javaConfig, gConfigurationClassInfo.uiMode); + + checkAndClearException(code->env, "Configuration.get"); + + jobject locales = code->env->CallObjectMethod( + javaConfig, gConfigurationClassInfo.getLocales); + checkAndClearException(code->env, "getLocales"); + + int localesCount = + code->env->CallIntMethod(locales, gLocaleListClassInfo.size); + checkAndClearException(code->env, "size"); + gConfiguration.locales.resize(localesCount); + + // extract the data for every locale + for (int i = 0; i < localesCount; ++i) { + Locale &locale = gConfiguration.locales[i]; + + // get locale object from the array + jobject jniLocale = + code->env->CallObjectMethod(locales, gLocaleListClassInfo.get, i); + checkAndClearException(code->env, "GetObjectArrayElement"); + + // get data strings for this locale + locale.language = + getStringField(code->env, jniLocale, gLocaleClassInfo.getLanguage); + locale.script = + getStringField(code->env, jniLocale, gLocaleClassInfo.getScript); + locale.country = + getStringField(code->env, jniLocale, gLocaleClassInfo.getCountry); + locale.variant = + getStringField(code->env, jniLocale, gLocaleClassInfo.getVariant); + } +} + +static void onConfigurationChanged_native(JNIEnv *env, jobject javaGameActivity, + jlong handle, jobject javaNewConfig) { + LOG_TRACE("onConfigurationChanged_native"); + if (handle != 0) { + NativeCode *code = (NativeCode *)handle; + readConfigurationValues(code, javaNewConfig); + + if (code->callbacks.onConfigurationChanged != NULL) { + code->callbacks.onConfigurationChanged(code); + } + } +} + +static void onTrimMemory_native(JNIEnv *env, jobject javaGameActivity, + jlong handle, jint level) { + LOG_TRACE("onTrimMemory_native"); + if (handle != 0) { + NativeCode *code = (NativeCode *)handle; + if (code->callbacks.onTrimMemory != NULL) { + code->callbacks.onTrimMemory(code, level); + } + } +} + +static void onWindowFocusChanged_native(JNIEnv *env, jobject javaGameActivity, + jlong handle, jboolean focused) { + LOG_TRACE("onWindowFocusChanged_native"); + if (handle != 0) { + NativeCode *code = (NativeCode *)handle; + if (code->callbacks.onWindowFocusChanged != NULL) { + code->callbacks.onWindowFocusChanged(code, focused ? 1 : 0); + } + } +} + +static void onSurfaceCreated_native(JNIEnv *env, jobject javaGameActivity, + jlong handle, jobject surface) { + ALOGV("onSurfaceCreated_native"); + LOG_TRACE("onSurfaceCreated_native"); + if (handle != 0) { + NativeCode *code = (NativeCode *)handle; + code->setSurface(surface); + + if (code->nativeWindow != NULL && + code->callbacks.onNativeWindowCreated != NULL) { + code->callbacks.onNativeWindowCreated(code, code->nativeWindow); + } + } +} + +static void onSurfaceChanged_native(JNIEnv *env, jobject javaGameActivity, + jlong handle, jobject surface, jint format, + jint width, jint height) { + LOG_TRACE("onSurfaceChanged_native"); + if (handle != 0) { + NativeCode *code = (NativeCode *)handle; + ANativeWindow *oldNativeWindow = code->nativeWindow; + // Fix for window being destroyed behind the scenes on older Android + // versions. + if (oldNativeWindow != NULL) { + ANativeWindow_acquire(oldNativeWindow); + } + code->setSurface(surface); + if (oldNativeWindow != code->nativeWindow) { + if (oldNativeWindow != NULL && + code->callbacks.onNativeWindowDestroyed != NULL) { + code->callbacks.onNativeWindowDestroyed(code, oldNativeWindow); + } + if (code->nativeWindow != NULL) { + if (code->callbacks.onNativeWindowCreated != NULL) { + code->callbacks.onNativeWindowCreated(code, code->nativeWindow); + } + + code->lastWindowWidth = ANativeWindow_getWidth(code->nativeWindow); + code->lastWindowHeight = ANativeWindow_getHeight(code->nativeWindow); + } + } else { + // Maybe it was resized? + int32_t newWidth = ANativeWindow_getWidth(code->nativeWindow); + int32_t newHeight = ANativeWindow_getHeight(code->nativeWindow); + + if (newWidth != code->lastWindowWidth || + newHeight != code->lastWindowHeight) { + code->lastWindowWidth = newWidth; + code->lastWindowHeight = newHeight; + + if (code->callbacks.onNativeWindowResized != NULL) { + code->callbacks.onNativeWindowResized(code, code->nativeWindow, + newWidth, newHeight); + } + } + } + // Release the window we acquired earlier. + if (oldNativeWindow != NULL) { + ANativeWindow_release(oldNativeWindow); + } + } +} + +static void onSurfaceRedrawNeeded_native(JNIEnv *env, jobject javaGameActivity, + jlong handle) { + LOG_TRACE("onSurfaceRedrawNeeded_native"); + if (handle != 0) { + NativeCode *code = (NativeCode *)handle; + if (code->nativeWindow != NULL && + code->callbacks.onNativeWindowRedrawNeeded != NULL) { + code->callbacks.onNativeWindowRedrawNeeded(code, code->nativeWindow); + } + } +} + +static void onSurfaceDestroyed_native(JNIEnv *env, jobject javaGameActivity, + jlong handle) { + LOG_TRACE("onSurfaceDestroyed_native"); + if (handle != 0) { + NativeCode *code = (NativeCode *)handle; + if (code->nativeWindow != NULL && + code->callbacks.onNativeWindowDestroyed != NULL) { + code->callbacks.onNativeWindowDestroyed(code, code->nativeWindow); + } + code->setSurface(NULL); + } +} + +extern "C" void GameActivity_setImeEditorInfo( + GameActivity *activity, GameTextInputType inputType, + GameTextInputActionType actionId, GameTextInputImeOptions imeOptions) { + NativeCode *code = static_cast(activity); + write_work(code->mainWorkWrite, CMD_SET_IME_EDITOR_INFO, inputType, actionId, + imeOptions); +} + +extern "C" int GameActivity_getColorMode(GameActivity *) { + const std::lock_guard lock(gConfigMutex); + return gConfiguration.colorMode; +} + +extern "C" int GameActivity_getDensityDpi(GameActivity *) { + const std::lock_guard lock(gConfigMutex); + return gConfiguration.densityDpi; +} + +extern "C" float GameActivity_getFontScale(GameActivity *) { + const std::lock_guard lock(gConfigMutex); + return gConfiguration.fontScale; +} + +extern "C" int GameActivity_getFontWeightAdjustment(GameActivity *) { + const std::lock_guard lock(gConfigMutex); + return gConfiguration.fontWeightAdjustment; +} + +extern "C" int GameActivity_getHardKeyboardHidden(GameActivity *) { + const std::lock_guard lock(gConfigMutex); + return gConfiguration.hardKeyboardHidden; +} + +extern "C" int GameActivity_getKeyboard(GameActivity *) { + const std::lock_guard lock(gConfigMutex); + return gConfiguration.keyboard; +} + +extern "C" int GameActivity_getKeyboardHidden(GameActivity *) { + const std::lock_guard lock(gConfigMutex); + return gConfiguration.keyboardHidden; +} + +extern "C" int GameActivity_getLocalesCount(GameActivity *activity) { + const std::lock_guard lock(gConfigMutex); + return gConfiguration.locales.size(); +} + +extern "C" int GameActivity_getMcc(GameActivity *) { + const std::lock_guard lock(gConfigMutex); + return gConfiguration.mcc; +} + +extern "C" int GameActivity_getMnc(GameActivity *) { + const std::lock_guard lock(gConfigMutex); + return gConfiguration.mnc; +} + +extern "C" int GameActivity_getNavigation(GameActivity *) { + const std::lock_guard lock(gConfigMutex); + return gConfiguration.navigation; +} + +extern "C" int GameActivity_getNavigationHidden(GameActivity *) { + const std::lock_guard lock(gConfigMutex); + return gConfiguration.navigationHidden; +} + +extern "C" int GameActivity_getOrientation(GameActivity *) { + const std::lock_guard lock(gConfigMutex); + return gConfiguration.orientation; +} + +extern "C" int GameActivity_getScreenHeightDp(GameActivity *) { + const std::lock_guard lock(gConfigMutex); + return gConfiguration.screenHeightDp; +} + +extern "C" int GameActivity_getScreenLayout(GameActivity *) { + const std::lock_guard lock(gConfigMutex); + return gConfiguration.screenLayout; +} + +extern "C" int GameActivity_getScreenWidthDp(GameActivity *) { + const std::lock_guard lock(gConfigMutex); + return gConfiguration.screenWidthDp; +} + +extern "C" int GameActivity_getSmallestScreenWidthDp(GameActivity *) { + const std::lock_guard lock(gConfigMutex); + return gConfiguration.smallestScreenWidthDp; +} + +extern "C" int GameActivity_getTouchscreen(GameActivity *) { + const std::lock_guard lock(gConfigMutex); + return gConfiguration.touchscreen; +} + +extern "C" int GameActivity_getUIMode(GameActivity *) { + const std::lock_guard lock(gConfigMutex); + return gConfiguration.uiMode; +} + +static int copyStringIfFits(char *dst, size_t dst_size, const std::string &s) { + if (dst_size <= s.size()) { + return ENOBUFS; + } + + strcpy(dst, s.c_str()); + return 0; +} + +extern "C" int GameActivity_getLocaleLanguage(char *dst, size_t dst_size, + GameActivity *activity, + size_t localeIdx) { + const std::lock_guard lock(gConfigMutex); + + if (localeIdx >= gConfiguration.locales.size()) { + return EINVAL; + } + + return copyStringIfFits(dst, dst_size, + gConfiguration.locales[localeIdx].language); +} + +extern "C" int GameActivity_getLocaleScript(char *dst, size_t dst_size, + GameActivity *activity, + size_t localeIdx) { + const std::lock_guard lock(gConfigMutex); + + if (localeIdx >= gConfiguration.locales.size()) { + return EINVAL; + } + + return copyStringIfFits(dst, dst_size, + gConfiguration.locales[localeIdx].script); +} + +extern "C" int GameActivity_getLocaleCountry(char *dst, size_t dst_size, + GameActivity *activity, + size_t localeIdx) { + const std::lock_guard lock(gConfigMutex); + + if (localeIdx >= gConfiguration.locales.size()) { + return EINVAL; + } + + return copyStringIfFits(dst, dst_size, + gConfiguration.locales[localeIdx].country); +} + +extern "C" int GameActivity_getLocaleVariant(char *dst, size_t dst_size, + GameActivity *activity, + size_t localeIdx) { + const std::lock_guard lock(gConfigMutex); + + if (localeIdx >= gConfiguration.locales.size()) { + return EINVAL; + } + + return copyStringIfFits(dst, dst_size, + gConfiguration.locales[localeIdx].variant); +} + +static bool onTouchEvent_native(JNIEnv *env, jobject javaGameActivity, + jlong handle, jobject motionEvent, + int pointerCount, int historySize, int deviceId, + int source, int action, int64_t eventTime, + int64_t downTime, int flags, int metaState, + int actionButton, int buttonState, + int classification, int edgeFlags, + float precisionX, float precisionY) { + if (handle == 0) return false; + NativeCode *code = (NativeCode *)handle; + if (code->callbacks.onTouchEvent == nullptr) return false; + + static GameActivityMotionEvent c_event; + + c_event.deviceId = deviceId; + c_event.source = source; + c_event.action = action; + + c_event.eventTime = eventTime; + c_event.downTime = downTime; + + c_event.flags = flags; + c_event.metaState = metaState; + + c_event.actionButton = actionButton; + c_event.buttonState = buttonState; + c_event.classification = classification; + c_event.edgeFlags = edgeFlags; + + c_event.precisionX = precisionX; + c_event.precisionY = precisionY; + + GameActivityMotionEvent_fromJava(env, motionEvent, &c_event, pointerCount, + historySize); + return code->callbacks.onTouchEvent(code, &c_event); +} + +static bool onKeyUp_native(JNIEnv *env, jobject javaGameActivity, jlong handle, + jobject keyEvent) { + if (handle == 0) return false; + NativeCode *code = (NativeCode *)handle; + if (code->callbacks.onKeyUp == nullptr) return false; + + static GameActivityKeyEvent c_event; + GameActivityKeyEvent_fromJava(env, keyEvent, &c_event); + return code->callbacks.onKeyUp(code, &c_event); +} + +static bool onKeyDown_native(JNIEnv *env, jobject javaGameActivity, + jlong handle, jobject keyEvent) { + if (handle == 0) return false; + NativeCode *code = (NativeCode *)handle; + if (code->callbacks.onKeyDown == nullptr) return false; + + static GameActivityKeyEvent c_event; + GameActivityKeyEvent_fromJava(env, keyEvent, &c_event); + return code->callbacks.onKeyDown(code, &c_event); +} + +static void onTextInput_native(JNIEnv *env, jobject activity, jlong handle, + jobject textInputEvent) { + if (handle == 0) return; + NativeCode *code = (NativeCode *)handle; + GameTextInput_processEvent(code->gameTextInput, textInputEvent); +} + +static void onWindowInsetsChanged_native(JNIEnv *env, jobject activity, + jlong handle) { + if (handle == 0) return; + NativeCode *code = (NativeCode *)handle; + if (code->callbacks.onWindowInsetsChanged == nullptr) return; + for (int type = 0; type < GAMECOMMON_INSETS_TYPE_COUNT; ++type) { + jobject jinsets; + // Note that waterfall insets are handled differently on the Java side. + if (type == GAMECOMMON_INSETS_TYPE_WATERFALL) { + jinsets = env->CallObjectMethod( + code->javaGameActivity, gGameActivityClassInfo.getWaterfallInsets); + } else { + jint jtype = env->CallStaticIntMethod( + gWindowInsetsCompatTypeClassInfo.clazz, + gWindowInsetsCompatTypeClassInfo.methods[type]); + jinsets = + env->CallObjectMethod(code->javaGameActivity, + gGameActivityClassInfo.getWindowInsets, jtype); + } + ARect &insets = code->insetsState[type]; + if (jinsets == nullptr) { + insets.left = 0; + insets.right = 0; + insets.top = 0; + insets.bottom = 0; + } else { + insets.left = env->GetIntField(jinsets, gInsetsClassInfo.left); + insets.right = env->GetIntField(jinsets, gInsetsClassInfo.right); + insets.top = env->GetIntField(jinsets, gInsetsClassInfo.top); + insets.bottom = env->GetIntField(jinsets, gInsetsClassInfo.bottom); + } + } + GameTextInput_processImeInsets( + code->gameTextInput, &code->insetsState[GAMECOMMON_INSETS_TYPE_IME]); + code->callbacks.onWindowInsetsChanged(code); +} + +static void setInputConnection_native(JNIEnv *env, jobject activity, + jlong handle, jobject inputConnection) { + NativeCode *code = (NativeCode *)handle; + GameTextInput_setInputConnection(code->gameTextInput, inputConnection); +} + +static void onContentRectChangedNative_native(JNIEnv *env, jobject activity, + jlong handle, jint x, jint y, + jint w, jint h) { + if (handle != 0) { + NativeCode *code = (NativeCode *)handle; + + if (code->callbacks.onContentRectChanged != nullptr) { + ARect rect; + rect.left = x; + rect.top = y; + rect.right = x + w; + rect.bottom = y + h; + code->callbacks.onContentRectChanged(code, &rect); + } + } +} + +static void onSoftwareKeyboardVisibilityChangedNative_native(JNIEnv *env, + jobject activity, + jlong handle, + bool visible) { + if (handle != 0) { + NativeCode *code = (NativeCode *)handle; + code->softwareKeyboardVisible = visible; + + if (code->callbacks.onSoftwareKeyboardVisibilityChanged != nullptr) { + code->callbacks.onSoftwareKeyboardVisibilityChanged(code, visible); + } + } +} + +static void onEditorActionNative_native(JNIEnv *env, jobject activity, + jlong handle, int action) { + if (handle != 0) { + NativeCode *code = (NativeCode *)handle; + + if (code->callbacks.onEditorAction != nullptr) { + code->callbacks.onEditorAction(code, action); + } + } +} + +static const JNINativeMethod g_methods[] = { + {"initializeNativeCode", + "(Ljava/lang/String;Ljava/lang/String;" + "Ljava/lang/String;Landroid/content/res/AssetManager;" + "[BLandroid/content/res/Configuration;)J", + (void *)initializeNativeCode_native}, + {"getDlError", "()Ljava/lang/String;", (void *)getDlError_native}, + {"terminateNativeCode", "(J)V", (void *)terminateNativeCode_native}, + {"onStartNative", "(J)V", (void *)onStart_native}, + {"onResumeNative", "(J)V", (void *)onResume_native}, + {"onSaveInstanceStateNative", "(J)[B", (void *)onSaveInstanceState_native}, + {"onPauseNative", "(J)V", (void *)onPause_native}, + {"onStopNative", "(J)V", (void *)onStop_native}, + {"onConfigurationChangedNative", "(JLandroid/content/res/Configuration;)V", + (void *)onConfigurationChanged_native}, + {"onTrimMemoryNative", "(JI)V", (void *)onTrimMemory_native}, + {"onWindowFocusChangedNative", "(JZ)V", + (void *)onWindowFocusChanged_native}, + {"onSurfaceCreatedNative", "(JLandroid/view/Surface;)V", + (void *)onSurfaceCreated_native}, + {"onSurfaceChangedNative", "(JLandroid/view/Surface;III)V", + (void *)onSurfaceChanged_native}, + {"onSurfaceRedrawNeededNative", "(JLandroid/view/Surface;)V", + (void *)onSurfaceRedrawNeeded_native}, + {"onSurfaceDestroyedNative", "(J)V", (void *)onSurfaceDestroyed_native}, + {"onTouchEventNative", "(JLandroid/view/MotionEvent;IIIIIJJIIIIIIFF)Z", + (void *)onTouchEvent_native}, + {"onKeyDownNative", "(JLandroid/view/KeyEvent;)Z", + (void *)onKeyDown_native}, + {"onKeyUpNative", "(JLandroid/view/KeyEvent;)Z", (void *)onKeyUp_native}, + {"onTextInputEventNative", + "(JLcom/google/androidgamesdk/gametextinput/State;)V", + (void *)onTextInput_native}, + {"onWindowInsetsChangedNative", "(J)V", + (void *)onWindowInsetsChanged_native}, + {"setInputConnectionNative", + "(JLcom/google/androidgamesdk/gametextinput/InputConnection;)V", + (void *)setInputConnection_native}, + {"onContentRectChangedNative", "(JIIII)V", + (void *)onContentRectChangedNative_native}, + {"onSoftwareKeyboardVisibilityChangedNative", "(JZ)V", + (void *)onSoftwareKeyboardVisibilityChangedNative_native}, + {"onEditorActionNative", "(JI)V", (void *)onEditorActionNative_native}, +}; + +static const char *const kGameActivityPathName = + "com/google/androidgamesdk/GameActivity"; + +static const char *const kInsetsPathName = "androidx/core/graphics/Insets"; +static const char *const kConfigurationPathName = + "android/content/res/Configuration"; +static const char *const kWindowInsetsCompatTypePathName = + "androidx/core/view/WindowInsetsCompat$Type"; +static const char *const kLocaleListPathName = "android/os/LocaleList"; +static const char *const kLocalePathName = "java/util/Locale"; + +#define FIND_CLASS(var, className) \ + var = env->FindClass(className); \ + LOG_FATAL_IF(!var, "Unable to find class %s", className); + +#define GET_METHOD_ID(var, clazz, methodName, fieldDescriptor) \ + var = env->GetMethodID(clazz, methodName, fieldDescriptor); \ + LOG_FATAL_IF(!var, "Unable to find method %s", methodName); + +#define GET_STATIC_METHOD_ID(var, clazz, methodName, fieldDescriptor) \ + var = env->GetStaticMethodID(clazz, methodName, fieldDescriptor); \ + LOG_FATAL_IF(!var, "Unable to find static method %s", methodName); + +#define GET_FIELD_ID(var, clazz, fieldName, fieldDescriptor) \ + var = env->GetFieldID(clazz, fieldName, fieldDescriptor); \ + LOG_FATAL_IF(!var, "Unable to find field %s", fieldName); + +static int jniRegisterNativeMethods(JNIEnv *env, const char *className, + const JNINativeMethod *methods, + int numMethods) { + ALOGV("Registering %s's %d native methods...", className, numMethods); + jclass clazz = env->FindClass(className); + LOG_FATAL_IF(clazz == nullptr, + "Native registration unable to find class '%s'; aborting...", + className); + int result = env->RegisterNatives(clazz, methods, numMethods); + env->DeleteLocalRef(clazz); + if (result == 0) { + return 0; + } + + // Failure to register natives is fatal. Try to report the corresponding + // exception, otherwise abort with generic failure message. + jthrowable thrown = env->ExceptionOccurred(); + if (thrown != NULL) { + env->ExceptionDescribe(); + env->DeleteLocalRef(thrown); + } + LOG_FATAL("RegisterNatives failed for '%s'; aborting...", className); +} + +extern "C" int GameActivity_register(JNIEnv *env) { + ALOGD("GameActivity_register"); + jclass activity_class; + FIND_CLASS(activity_class, kGameActivityPathName); + GET_METHOD_ID(gGameActivityClassInfo.finish, activity_class, "finish", "()V"); + GET_METHOD_ID(gGameActivityClassInfo.setWindowFlags, activity_class, + "setWindowFlags", "(II)V"); + GET_METHOD_ID(gGameActivityClassInfo.getWindowInsets, activity_class, + "getWindowInsets", "(I)Landroidx/core/graphics/Insets;"); + GET_METHOD_ID(gGameActivityClassInfo.getWaterfallInsets, activity_class, + "getWaterfallInsets", "()Landroidx/core/graphics/Insets;"); + GET_METHOD_ID(gGameActivityClassInfo.setImeEditorInfoFields, activity_class, + "setImeEditorInfoFields", "(III)V"); + + jclass insets_class; + FIND_CLASS(insets_class, kInsetsPathName); + GET_FIELD_ID(gInsetsClassInfo.left, insets_class, "left", "I"); + GET_FIELD_ID(gInsetsClassInfo.right, insets_class, "right", "I"); + GET_FIELD_ID(gInsetsClassInfo.top, insets_class, "top", "I"); + GET_FIELD_ID(gInsetsClassInfo.bottom, insets_class, "bottom", "I"); + + jclass configuration_class; + FIND_CLASS(configuration_class, kConfigurationPathName); + + if (android_get_device_api_level() >= 26) { + GET_FIELD_ID(gConfigurationClassInfo.colorMode, configuration_class, + "colorMode", "I"); + } + + GET_FIELD_ID(gConfigurationClassInfo.densityDpi, configuration_class, + "densityDpi", "I"); + GET_FIELD_ID(gConfigurationClassInfo.fontScale, configuration_class, + "fontScale", "F"); + + if (android_get_device_api_level() >= 31) { + GET_FIELD_ID(gConfigurationClassInfo.fontWeightAdjustment, + configuration_class, "fontWeightAdjustment", "I"); + } + + GET_FIELD_ID(gConfigurationClassInfo.hardKeyboardHidden, configuration_class, + "hardKeyboardHidden", "I"); + GET_FIELD_ID(gConfigurationClassInfo.keyboard, configuration_class, + "keyboard", "I"); + GET_FIELD_ID(gConfigurationClassInfo.keyboardHidden, configuration_class, + "keyboardHidden", "I"); + GET_FIELD_ID(gConfigurationClassInfo.mcc, configuration_class, "mcc", "I"); + GET_FIELD_ID(gConfigurationClassInfo.mnc, configuration_class, "mnc", "I"); + GET_FIELD_ID(gConfigurationClassInfo.navigation, configuration_class, + "navigation", "I"); + GET_FIELD_ID(gConfigurationClassInfo.navigationHidden, configuration_class, + "navigationHidden", "I"); + GET_FIELD_ID(gConfigurationClassInfo.orientation, configuration_class, + "orientation", "I"); + GET_FIELD_ID(gConfigurationClassInfo.screenHeightDp, configuration_class, + "screenHeightDp", "I"); + GET_FIELD_ID(gConfigurationClassInfo.screenLayout, configuration_class, + "screenLayout", "I"); + GET_FIELD_ID(gConfigurationClassInfo.screenWidthDp, configuration_class, + "screenWidthDp", "I"); + GET_FIELD_ID(gConfigurationClassInfo.smallestScreenWidthDp, + configuration_class, "smallestScreenWidthDp", "I"); + GET_FIELD_ID(gConfigurationClassInfo.touchscreen, configuration_class, + "touchscreen", "I"); + GET_FIELD_ID(gConfigurationClassInfo.uiMode, configuration_class, "uiMode", + "I"); + + GET_METHOD_ID(gConfigurationClassInfo.getLocales, configuration_class, + "getLocales", "()Landroid/os/LocaleList;"); + + jclass localeListClass; + FIND_CLASS(localeListClass, kLocaleListPathName); + GET_METHOD_ID(gLocaleListClassInfo.size, localeListClass, "size", "()I"); + GET_METHOD_ID(gLocaleListClassInfo.get, localeListClass, "get", + "(I)Ljava/util/Locale;"); + + jclass localeClass; + FIND_CLASS(localeClass, kLocalePathName); + GET_METHOD_ID(gLocaleClassInfo.getLanguage, localeClass, "getLanguage", + "()Ljava/lang/String;"); + GET_METHOD_ID(gLocaleClassInfo.getScript, localeClass, "getScript", + "()Ljava/lang/String;"); + GET_METHOD_ID(gLocaleClassInfo.getCountry, localeClass, "getCountry", + "()Ljava/lang/String;"); + GET_METHOD_ID(gLocaleClassInfo.getVariant, localeClass, "getVariant", + "()Ljava/lang/String;"); + + jclass windowInsetsCompatType_class; + FIND_CLASS(windowInsetsCompatType_class, kWindowInsetsCompatTypePathName); + gWindowInsetsCompatTypeClassInfo.clazz = + (jclass)env->NewGlobalRef(windowInsetsCompatType_class); + // These names must match, in order, the GameCommonInsetsType enum fields + // Note that waterfall is handled differently by the insets API, so we + // exclude it here. + const char *methodNames[GAMECOMMON_INSETS_TYPE_WATERFALL] = { + "captionBar", + "displayCutout", + "ime", + "mandatorySystemGestures", + "navigationBars", + "statusBars", + "systemBars", + "systemGestures", + "tappableElement"}; + for (int i = 0; i < GAMECOMMON_INSETS_TYPE_WATERFALL; ++i) { + GET_STATIC_METHOD_ID(gWindowInsetsCompatTypeClassInfo.methods[i], + windowInsetsCompatType_class, methodNames[i], "()I"); + } + + GameActivityEventsInit(env); + + return jniRegisterNativeMethods(env, kGameActivityPathName, g_methods, + NELEM(g_methods)); +} + +// XXX: This symbol is renamed with a _C suffix and then re-exported from +// Rust because Rust/Cargo don't give us a way to directly export symbols +// from C/C++ code: https://github.com/rust-lang/rfcs/issues/2771 +// +extern "C" JNIEXPORT jlong JNICALL +Java_com_google_androidgamesdk_GameActivity_initializeNativeCode_C( + JNIEnv *env, jobject javaGameActivity, jstring internalDataDir, + jstring obbDir, jstring externalDataDir, jobject jAssetMgr, + jbyteArray savedState, jobject javaConfig) { + GameActivity_register(env); + jlong nativeCode = initializeNativeCode_native( + env, javaGameActivity, internalDataDir, obbDir, externalDataDir, + jAssetMgr, savedState, javaConfig); + return nativeCode; +} diff --git a/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/src/game-activity/GameActivityEvents.cpp b/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/src/game-activity/GameActivityEvents.cpp new file mode 100644 index 00000000..5e238c6c --- /dev/null +++ b/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/src/game-activity/GameActivityEvents.cpp @@ -0,0 +1,335 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include + +#include + +#include "GameActivityEvents_internal.h" +#include "system_utils.h" + +static bool enabledAxes[GAME_ACTIVITY_POINTER_INFO_AXIS_COUNT] = { + /* AMOTION_EVENT_AXIS_X */ true, + /* AMOTION_EVENT_AXIS_Y */ true, + // Disable all other axes by default (they can be enabled using + // `GameActivityPointerAxes_enableAxis`). + false}; + +extern "C" void GameActivityPointerAxes_enableAxis(int32_t axis) { + if (axis < 0 || axis >= GAME_ACTIVITY_POINTER_INFO_AXIS_COUNT) { + return; + } + + enabledAxes[axis] = true; +} + +float GameActivityPointerAxes_getAxisValue( + const GameActivityPointerAxes *pointerInfo, int32_t axis) { + if (axis < 0 || axis >= GAME_ACTIVITY_POINTER_INFO_AXIS_COUNT) { + return 0; + } + + if (!enabledAxes[axis]) { + ALOGW("Axis %d must be enabled before it can be accessed.", axis); + return 0; + } + + return pointerInfo->axisValues[axis]; +} + +extern "C" void GameActivityPointerAxes_disableAxis(int32_t axis) { + if (axis < 0 || axis >= GAME_ACTIVITY_POINTER_INFO_AXIS_COUNT) { + return; + } + + enabledAxes[axis] = false; +} + +float GameActivityMotionEvent_getHistoricalAxisValue( + const GameActivityMotionEvent *event, int axis, int pointerIndex, + int historyPos) { + if (axis < 0 || axis >= GAME_ACTIVITY_POINTER_INFO_AXIS_COUNT) { + ALOGE("Invalid axis %d", axis); + return -1; + } + if (pointerIndex < 0 || pointerIndex >= event->pointerCount) { + ALOGE("Invalid pointer index %d", pointerIndex); + return -1; + } + if (historyPos < 0 || historyPos >= event->historySize) { + ALOGE("Invalid history index %d", historyPos); + return -1; + } + if (!enabledAxes[axis]) { + ALOGW("Axis %d must be enabled before it can be accessed.", axis); + return 0; + } + + int pointerOffset = pointerIndex * GAME_ACTIVITY_POINTER_INFO_AXIS_COUNT; + int historyValuesOffset = + historyPos * event->pointerCount * GAME_ACTIVITY_POINTER_INFO_AXIS_COUNT; + return event + ->historicalAxisValues[historyValuesOffset + pointerOffset + axis]; +} + +static struct { + jmethodID getDeviceId; + jmethodID getSource; + jmethodID getAction; + + jmethodID getEventTime; + jmethodID getDownTime; + + jmethodID getFlags; + jmethodID getMetaState; + + jmethodID getActionButton; + jmethodID getButtonState; + jmethodID getClassification; + jmethodID getEdgeFlags; + + jmethodID getHistorySize; + jmethodID getHistoricalEventTime; + + jmethodID getPointerCount; + jmethodID getPointerId; + + jmethodID getToolType; + + jmethodID getRawX; + jmethodID getRawY; + jmethodID getXPrecision; + jmethodID getYPrecision; + jmethodID getAxisValue; + + jmethodID getHistoricalAxisValue; +} gMotionEventClassInfo; + +extern "C" void GameActivityMotionEvent_destroy( + GameActivityMotionEvent *c_event) { + delete c_event->historicalAxisValues; + delete c_event->historicalEventTimesMillis; + delete c_event->historicalEventTimesNanos; +} + +static void initMotionEvents(JNIEnv *env) { + int sdkVersion = gamesdk::GetSystemPropAsInt("ro.build.version.sdk"); + gMotionEventClassInfo = {0}; + jclass motionEventClass = env->FindClass("android/view/MotionEvent"); + gMotionEventClassInfo.getDeviceId = + env->GetMethodID(motionEventClass, "getDeviceId", "()I"); + gMotionEventClassInfo.getSource = + env->GetMethodID(motionEventClass, "getSource", "()I"); + gMotionEventClassInfo.getAction = + env->GetMethodID(motionEventClass, "getAction", "()I"); + gMotionEventClassInfo.getEventTime = + env->GetMethodID(motionEventClass, "getEventTime", "()J"); + gMotionEventClassInfo.getDownTime = + env->GetMethodID(motionEventClass, "getDownTime", "()J"); + gMotionEventClassInfo.getFlags = + env->GetMethodID(motionEventClass, "getFlags", "()I"); + gMotionEventClassInfo.getMetaState = + env->GetMethodID(motionEventClass, "getMetaState", "()I"); + if (sdkVersion >= 23) { + gMotionEventClassInfo.getActionButton = + env->GetMethodID(motionEventClass, "getActionButton", "()I"); + } + if (sdkVersion >= 14) { + gMotionEventClassInfo.getButtonState = + env->GetMethodID(motionEventClass, "getButtonState", "()I"); + } + if (sdkVersion >= 29) { + gMotionEventClassInfo.getClassification = + env->GetMethodID(motionEventClass, "getClassification", "()I"); + } + gMotionEventClassInfo.getEdgeFlags = + env->GetMethodID(motionEventClass, "getEdgeFlags", "()I"); + + gMotionEventClassInfo.getHistorySize = + env->GetMethodID(motionEventClass, "getHistorySize", "()I"); + gMotionEventClassInfo.getHistoricalEventTime = + env->GetMethodID(motionEventClass, "getHistoricalEventTime", "(I)J"); + + gMotionEventClassInfo.getPointerCount = + env->GetMethodID(motionEventClass, "getPointerCount", "()I"); + gMotionEventClassInfo.getPointerId = + env->GetMethodID(motionEventClass, "getPointerId", "(I)I"); + gMotionEventClassInfo.getToolType = + env->GetMethodID(motionEventClass, "getToolType", "(I)I"); + if (sdkVersion >= 29) { + gMotionEventClassInfo.getRawX = + env->GetMethodID(motionEventClass, "getRawX", "(I)F"); + gMotionEventClassInfo.getRawY = + env->GetMethodID(motionEventClass, "getRawY", "(I)F"); + } + gMotionEventClassInfo.getXPrecision = + env->GetMethodID(motionEventClass, "getXPrecision", "()F"); + gMotionEventClassInfo.getYPrecision = + env->GetMethodID(motionEventClass, "getYPrecision", "()F"); + gMotionEventClassInfo.getAxisValue = + env->GetMethodID(motionEventClass, "getAxisValue", "(II)F"); + + gMotionEventClassInfo.getHistoricalAxisValue = + env->GetMethodID(motionEventClass, "getHistoricalAxisValue", "(III)F"); +} + +extern "C" void GameActivityMotionEvent_fromJava( + JNIEnv *env, jobject motionEvent, GameActivityMotionEvent *out_event, + int pointerCount, int historySize) { + pointerCount = + std::min(pointerCount, GAMEACTIVITY_MAX_NUM_POINTERS_IN_MOTION_EVENT); + out_event->pointerCount = pointerCount; + for (int i = 0; i < pointerCount; ++i) { + out_event->pointers[i] = { + /*id=*/env->CallIntMethod(motionEvent, + gMotionEventClassInfo.getPointerId, i), + /*toolType=*/ + env->CallIntMethod(motionEvent, gMotionEventClassInfo.getToolType, i), + /*axisValues=*/{0}, + /*rawX=*/gMotionEventClassInfo.getRawX + ? env->CallFloatMethod(motionEvent, gMotionEventClassInfo.getRawX, + i) + : 0, + /*rawY=*/gMotionEventClassInfo.getRawY + ? env->CallFloatMethod(motionEvent, gMotionEventClassInfo.getRawY, + i) + : 0, + }; + + for (int axisIndex = 0; axisIndex < GAME_ACTIVITY_POINTER_INFO_AXIS_COUNT; + ++axisIndex) { + if (enabledAxes[axisIndex]) { + out_event->pointers[i].axisValues[axisIndex] = env->CallFloatMethod( + motionEvent, gMotionEventClassInfo.getAxisValue, axisIndex, i); + } + } + } + + out_event->historySize = historySize; + out_event->historicalAxisValues = + new float[historySize * pointerCount * + GAME_ACTIVITY_POINTER_INFO_AXIS_COUNT]; + out_event->historicalEventTimesMillis = new int64_t[historySize]; + out_event->historicalEventTimesNanos = new int64_t[historySize]; + + for (int historyIndex = 0; historyIndex < historySize; historyIndex++) { + out_event->historicalEventTimesMillis[historyIndex] = env->CallLongMethod( + motionEvent, gMotionEventClassInfo.getHistoricalEventTime, + historyIndex); + out_event->historicalEventTimesNanos[historyIndex] = + out_event->historicalEventTimesMillis[historyIndex] * 1000000; + for (int i = 0; i < pointerCount; ++i) { + int pointerOffset = i * GAME_ACTIVITY_POINTER_INFO_AXIS_COUNT; + int historyAxisOffset = + historyIndex * pointerCount * GAME_ACTIVITY_POINTER_INFO_AXIS_COUNT; + float *axisValues = + &out_event->historicalAxisValues[historyAxisOffset + pointerOffset]; + for (int axisIndex = 0; axisIndex < GAME_ACTIVITY_POINTER_INFO_AXIS_COUNT; + ++axisIndex) { + if (enabledAxes[axisIndex]) { + axisValues[axisIndex] = env->CallFloatMethod( + motionEvent, gMotionEventClassInfo.getHistoricalAxisValue, + axisIndex, i, historyIndex); + } + } + } + } +} + +static struct { + jmethodID getDeviceId; + jmethodID getSource; + jmethodID getAction; + + jmethodID getEventTime; + jmethodID getDownTime; + + jmethodID getFlags; + jmethodID getMetaState; + + jmethodID getModifiers; + jmethodID getRepeatCount; + jmethodID getKeyCode; + jmethodID getScanCode; + // jmethodID getUnicodeChar; +} gKeyEventClassInfo; + +static void initKeyEvents(JNIEnv *env) { + int sdkVersion = gamesdk::GetSystemPropAsInt("ro.build.version.sdk"); + gKeyEventClassInfo = {0}; + jclass keyEventClass = env->FindClass("android/view/KeyEvent"); + gKeyEventClassInfo.getDeviceId = + env->GetMethodID(keyEventClass, "getDeviceId", "()I"); + gKeyEventClassInfo.getSource = + env->GetMethodID(keyEventClass, "getSource", "()I"); + gKeyEventClassInfo.getAction = + env->GetMethodID(keyEventClass, "getAction", "()I"); + gKeyEventClassInfo.getEventTime = + env->GetMethodID(keyEventClass, "getEventTime", "()J"); + gKeyEventClassInfo.getDownTime = + env->GetMethodID(keyEventClass, "getDownTime", "()J"); + gKeyEventClassInfo.getFlags = + env->GetMethodID(keyEventClass, "getFlags", "()I"); + gKeyEventClassInfo.getMetaState = + env->GetMethodID(keyEventClass, "getMetaState", "()I"); + if (sdkVersion >= 13) { + gKeyEventClassInfo.getModifiers = + env->GetMethodID(keyEventClass, "getModifiers", "()I"); + } + gKeyEventClassInfo.getRepeatCount = + env->GetMethodID(keyEventClass, "getRepeatCount", "()I"); + gKeyEventClassInfo.getKeyCode = + env->GetMethodID(keyEventClass, "getKeyCode", "()I"); + gKeyEventClassInfo.getScanCode = + env->GetMethodID(keyEventClass, "getScanCode", "()I"); + //gKeyEventClassInfo.getUnicodeChar = + //env->GetMethodID(keyEventClass, "getUnicodeChar", "()I"); +} + +extern "C" void GameActivityKeyEvent_fromJava(JNIEnv *env, jobject keyEvent, + GameActivityKeyEvent *out_event) { + *out_event = { + /*deviceId=*/env->CallIntMethod(keyEvent, gKeyEventClassInfo.getDeviceId), + /*source=*/env->CallIntMethod(keyEvent, gKeyEventClassInfo.getSource), + /*action=*/env->CallIntMethod(keyEvent, gKeyEventClassInfo.getAction), + // TODO: introduce a millisecondsToNanoseconds helper: + /*eventTime=*/ + env->CallLongMethod(keyEvent, gKeyEventClassInfo.getEventTime) * 1000000, + /*downTime=*/ + env->CallLongMethod(keyEvent, gKeyEventClassInfo.getDownTime) * 1000000, + /*flags=*/env->CallIntMethod(keyEvent, gKeyEventClassInfo.getFlags), + /*metaState=*/ + env->CallIntMethod(keyEvent, gKeyEventClassInfo.getMetaState), + /*modifiers=*/gKeyEventClassInfo.getModifiers + ? env->CallIntMethod(keyEvent, gKeyEventClassInfo.getModifiers) + : 0, + /*repeatCount=*/ + env->CallIntMethod(keyEvent, gKeyEventClassInfo.getRepeatCount), + /*keyCode=*/ + env->CallIntMethod(keyEvent, gKeyEventClassInfo.getKeyCode), + /*scanCode=*/ + env->CallIntMethod(keyEvent, gKeyEventClassInfo.getScanCode) + /*unicodeChar=*/ + // env->CallIntMethod(keyEvent, gKeyEventClassInfo.getUnicodeChar) + }; +} + +extern "C" void GameActivityEventsInit(JNIEnv *env) { + initMotionEvents(env); + initKeyEvents(env); +} diff --git a/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/src/game-activity/GameActivityEvents_internal.h b/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/src/game-activity/GameActivityEvents_internal.h new file mode 100644 index 00000000..202be8b1 --- /dev/null +++ b/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/src/game-activity/GameActivityEvents_internal.h @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup GameActivity Game Activity Events Internal + * These functions are internal details of Game Activity Events. + * Please do not rely on anything in this file as this can be changed + * without notice. + * @{ + */ + +/** + * @file GameActivityEvents_internal.h + */ +#ifndef ANDROID_GAME_SDK_GAME_ACTIVITY_EVENTS_INTERNAL_H +#define ANDROID_GAME_SDK_GAME_ACTIVITY_EVENTS_INTERNAL_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** \brief Performs necessary initialization steps for GameActivityEvents. + * + * User must call this function before calling any other functions of this unit. + * If you use GameActivity it will call this function for you. + */ +void GameActivityEventsInit(JNIEnv* env); + +/** + * \brief Convert a Java `MotionEvent` to a `GameActivityMotionEvent`. + * + * This is done automatically by the GameActivity: see `onTouchEvent` to set + * a callback to consume the received events. + * This function can be used if you re-implement events handling in your own + * activity. + * Ownership of out_event is maintained by the caller. + * Note that we pass as much information from Java Activity as possible + * to avoid extra JNI calls. + */ +void GameActivityMotionEvent_fromJava(JNIEnv* env, jobject motionEvent, + GameActivityMotionEvent* out_event, + int pointerCount, int historySize); + +/** + * \brief Convert a Java `KeyEvent` to a `GameActivityKeyEvent`. + * + * This is done automatically by the GameActivity: see `onKeyUp` and `onKeyDown` + * to set a callback to consume the received events. + * This function can be used if you re-implement events handling in your own + * activity. + * Ownership of out_event is maintained by the caller. + */ +void GameActivityKeyEvent_fromJava(JNIEnv* env, jobject motionEvent, + GameActivityKeyEvent* out_event); + +#ifdef __cplusplus +} +#endif + +/** @} */ + +#endif // ANDROID_GAME_SDK_GAME_ACTIVITY_EVENTS_INTERNAL_H diff --git a/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/src/game-activity/native_app_glue/android_native_app_glue.c b/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/src/game-activity/native_app_glue/android_native_app_glue.c new file mode 100644 index 00000000..3aeae123 --- /dev/null +++ b/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/src/game-activity/native_app_glue/android_native_app_glue.c @@ -0,0 +1,771 @@ +/* + * Copyright (C) 2021 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "game-activity/native_app_glue/android_native_app_glue.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#define NATIVE_APP_GLUE_MOTION_EVENTS_DEFAULT_BUF_SIZE 16 +#define NATIVE_APP_GLUE_KEY_EVENTS_DEFAULT_BUF_SIZE 4 + +#define LOGI(...) \ + ((void)__android_log_print(ANDROID_LOG_INFO, "threaded_app", __VA_ARGS__)) +#define LOGE(...) \ + ((void)__android_log_print(ANDROID_LOG_ERROR, "threaded_app", __VA_ARGS__)) +#define LOGW(...) \ + ((void)__android_log_print(ANDROID_LOG_WARN, "threaded_app", __VA_ARGS__)) +#define LOGW_ONCE(...) \ + do { \ + static bool alogw_once##__FILE__##__LINE__##__ = true; \ + if (alogw_once##__FILE__##__LINE__##__) { \ + alogw_once##__FILE__##__LINE__##__ = false; \ + LOGW(__VA_ARGS__); \ + } \ + } while (0) + +/* For debug builds, always enable the debug traces in this library */ +#ifndef NDEBUG +#define LOGV(...) \ + ((void)__android_log_print(ANDROID_LOG_VERBOSE, "threaded_app", __VA_ARGS__)) +#else +#define LOGV(...) ((void)0) +#endif + +static void free_saved_state(struct android_app* android_app) { + pthread_mutex_lock(&android_app->mutex); + if (android_app->savedState != NULL) { + free(android_app->savedState); + android_app->savedState = NULL; + android_app->savedStateSize = 0; + } + pthread_mutex_unlock(&android_app->mutex); +} + +int8_t android_app_read_cmd(struct android_app* android_app) { + int8_t cmd; + if (read(android_app->msgread, &cmd, sizeof(cmd)) != sizeof(cmd)) { + LOGE("No data on command pipe!"); + return -1; + } + if (cmd == APP_CMD_SAVE_STATE) free_saved_state(android_app); + return cmd; +} + +static void print_cur_config(struct android_app* android_app) { + char lang[2], country[2]; + AConfiguration_getLanguage(android_app->config, lang); + AConfiguration_getCountry(android_app->config, country); + + LOGV( + "Config: mcc=%d mnc=%d lang=%c%c cnt=%c%c orien=%d touch=%d dens=%d " + "keys=%d nav=%d keysHid=%d navHid=%d sdk=%d size=%d long=%d " + "modetype=%d modenight=%d", + AConfiguration_getMcc(android_app->config), + AConfiguration_getMnc(android_app->config), lang[0], lang[1], country[0], + country[1], AConfiguration_getOrientation(android_app->config), + AConfiguration_getTouchscreen(android_app->config), + AConfiguration_getDensity(android_app->config), + AConfiguration_getKeyboard(android_app->config), + AConfiguration_getNavigation(android_app->config), + AConfiguration_getKeysHidden(android_app->config), + AConfiguration_getNavHidden(android_app->config), + AConfiguration_getSdkVersion(android_app->config), + AConfiguration_getScreenSize(android_app->config), + AConfiguration_getScreenLong(android_app->config), + AConfiguration_getUiModeType(android_app->config), + AConfiguration_getUiModeNight(android_app->config)); +} + +void android_app_pre_exec_cmd(struct android_app* android_app, int8_t cmd) { + switch (cmd) { + case UNUSED_APP_CMD_INPUT_CHANGED: + LOGV("UNUSED_APP_CMD_INPUT_CHANGED"); + // Do nothing. This can be used in the future to handle AInputQueue + // natively, like done in NativeActivity. + break; + + case APP_CMD_INIT_WINDOW: + LOGV("APP_CMD_INIT_WINDOW"); + pthread_mutex_lock(&android_app->mutex); + android_app->window = android_app->pendingWindow; + pthread_cond_broadcast(&android_app->cond); + pthread_mutex_unlock(&android_app->mutex); + break; + + case APP_CMD_TERM_WINDOW: + LOGV("APP_CMD_TERM_WINDOW"); + pthread_cond_broadcast(&android_app->cond); + break; + + case APP_CMD_RESUME: + case APP_CMD_START: + case APP_CMD_PAUSE: + case APP_CMD_STOP: + LOGV("activityState=%d", cmd); + pthread_mutex_lock(&android_app->mutex); + android_app->activityState = cmd; + pthread_cond_broadcast(&android_app->cond); + pthread_mutex_unlock(&android_app->mutex); + break; + + case APP_CMD_CONFIG_CHANGED: + LOGV("APP_CMD_CONFIG_CHANGED"); + AConfiguration_fromAssetManager(android_app->config, + android_app->activity->assetManager); + print_cur_config(android_app); + break; + + case APP_CMD_DESTROY: + LOGV("APP_CMD_DESTROY"); + android_app->destroyRequested = 1; + break; + } +} + +void android_app_post_exec_cmd(struct android_app* android_app, int8_t cmd) { + switch (cmd) { + case APP_CMD_TERM_WINDOW: + LOGV("APP_CMD_TERM_WINDOW"); + pthread_mutex_lock(&android_app->mutex); + android_app->window = NULL; + pthread_cond_broadcast(&android_app->cond); + pthread_mutex_unlock(&android_app->mutex); + break; + + case APP_CMD_SAVE_STATE: + LOGV("APP_CMD_SAVE_STATE"); + pthread_mutex_lock(&android_app->mutex); + android_app->stateSaved = 1; + pthread_cond_broadcast(&android_app->cond); + pthread_mutex_unlock(&android_app->mutex); + break; + + case APP_CMD_RESUME: + free_saved_state(android_app); + break; + } +} + +void app_dummy() {} + +static void android_app_destroy(struct android_app* android_app) { + LOGV("android_app_destroy!"); + free_saved_state(android_app); + pthread_mutex_lock(&android_app->mutex); + + AConfiguration_delete(android_app->config); + android_app->destroyed = 1; + pthread_cond_broadcast(&android_app->cond); + pthread_mutex_unlock(&android_app->mutex); + // Can't touch android_app object after this. +} + +static void process_cmd(struct android_app* app, + struct android_poll_source* source) { + int8_t cmd = android_app_read_cmd(app); + android_app_pre_exec_cmd(app, cmd); + if (app->onAppCmd != NULL) app->onAppCmd(app, cmd); + android_app_post_exec_cmd(app, cmd); +} + +// This is run on a separate thread (i.e: not the main thread). +static void* android_app_entry(void* param) { + struct android_app* android_app = (struct android_app*)param; + int input_buf_idx = 0; + + LOGV("android_app_entry called"); + android_app->config = AConfiguration_new(); + LOGV("android_app = %p", android_app); + LOGV("config = %p", android_app->config); + LOGV("activity = %p", android_app->activity); + LOGV("assetmanager = %p", android_app->activity->assetManager); + AConfiguration_fromAssetManager(android_app->config, + android_app->activity->assetManager); + + print_cur_config(android_app); + + /* initialize event buffers */ + for (input_buf_idx = 0; input_buf_idx < NATIVE_APP_GLUE_MAX_INPUT_BUFFERS; + input_buf_idx++) { + struct android_input_buffer* buf = + &android_app->inputBuffers[input_buf_idx]; + + buf->motionEventsBufferSize = + NATIVE_APP_GLUE_MOTION_EVENTS_DEFAULT_BUF_SIZE; + buf->motionEvents = (GameActivityMotionEvent*)malloc( + sizeof(GameActivityMotionEvent) * buf->motionEventsBufferSize); + + buf->keyEventsBufferSize = NATIVE_APP_GLUE_KEY_EVENTS_DEFAULT_BUF_SIZE; + buf->keyEvents = (GameActivityKeyEvent*)malloc( + sizeof(GameActivityKeyEvent) * buf->keyEventsBufferSize); + } + + android_app->cmdPollSource.id = LOOPER_ID_MAIN; + android_app->cmdPollSource.app = android_app; + android_app->cmdPollSource.process = process_cmd; + + ALooper* looper = ALooper_prepare(ALOOPER_PREPARE_ALLOW_NON_CALLBACKS); + ALooper_addFd(looper, android_app->msgread, LOOPER_ID_MAIN, + ALOOPER_EVENT_INPUT, NULL, &android_app->cmdPollSource); + android_app->looper = looper; + + pthread_mutex_lock(&android_app->mutex); + android_app->running = 1; + pthread_cond_broadcast(&android_app->cond); + pthread_mutex_unlock(&android_app->mutex); + + _rust_glue_entry(android_app); + + android_app_destroy(android_app); + return NULL; +} + +// Codes from https://developer.android.com/reference/android/view/KeyEvent +#define KEY_EVENT_KEYCODE_VOLUME_DOWN 25 +#define KEY_EVENT_KEYCODE_VOLUME_MUTE 164 +#define KEY_EVENT_KEYCODE_VOLUME_UP 24 +#define KEY_EVENT_KEYCODE_CAMERA 27 +#define KEY_EVENT_KEYCODE_ZOOM_IN 168 +#define KEY_EVENT_KEYCODE_ZOOM_OUT 169 + +// Double-buffer the key event filter to avoid race condition. +static bool default_key_filter(const GameActivityKeyEvent* event) { + // Ignore camera, volume, etc. buttons + return !(event->keyCode == KEY_EVENT_KEYCODE_VOLUME_DOWN || + event->keyCode == KEY_EVENT_KEYCODE_VOLUME_MUTE || + event->keyCode == KEY_EVENT_KEYCODE_VOLUME_UP || + event->keyCode == KEY_EVENT_KEYCODE_CAMERA || + event->keyCode == KEY_EVENT_KEYCODE_ZOOM_IN || + event->keyCode == KEY_EVENT_KEYCODE_ZOOM_OUT); +} + +// See +// https://developer.android.com/reference/android/view/InputDevice#SOURCE_TOUCHSCREEN +#define SOURCE_TOUCHSCREEN 0x00001002 + +static bool default_motion_filter(const GameActivityMotionEvent* event) { + // Ignore any non-touch events. + return (event->source & SOURCE_TOUCHSCREEN) != 0; +} + +// -------------------------------------------------------------------- +// Native activity interaction (called from main thread) +// -------------------------------------------------------------------- + +static struct android_app* android_app_create(GameActivity* activity, + void* savedState, + size_t savedStateSize) { + // struct android_app* android_app = calloc(1, sizeof(struct android_app)); + struct android_app* android_app = + (struct android_app*)malloc(sizeof(struct android_app)); + memset(android_app, 0, sizeof(struct android_app)); + android_app->activity = activity; + + pthread_mutex_init(&android_app->mutex, NULL); + pthread_cond_init(&android_app->cond, NULL); + + if (savedState != NULL) { + android_app->savedState = malloc(savedStateSize); + android_app->savedStateSize = savedStateSize; + memcpy(android_app->savedState, savedState, savedStateSize); + } + + int msgpipe[2]; + if (pipe(msgpipe)) { + LOGE("could not create pipe: %s", strerror(errno)); + return NULL; + } + android_app->msgread = msgpipe[0]; + android_app->msgwrite = msgpipe[1]; + + android_app->keyEventFilter = default_key_filter; + android_app->motionEventFilter = default_motion_filter; + + LOGV("Launching android_app_entry in a thread"); + pthread_attr_t attr; + pthread_attr_init(&attr); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_create(&android_app->thread, &attr, android_app_entry, android_app); + + // Wait for thread to start. + pthread_mutex_lock(&android_app->mutex); + while (!android_app->running) { + pthread_cond_wait(&android_app->cond, &android_app->mutex); + } + pthread_mutex_unlock(&android_app->mutex); + + return android_app; +} + +void android_app_write_cmd(struct android_app* android_app, int8_t cmd) { + if (write(android_app->msgwrite, &cmd, sizeof(cmd)) != sizeof(cmd)) { + LOGE("Failure writing android_app cmd: %s", strerror(errno)); + } +} + +static void android_app_set_window(struct android_app* android_app, + ANativeWindow* window) { + LOGV("android_app_set_window called"); + pthread_mutex_lock(&android_app->mutex); + + // NB: we have to consider that the native thread could have already + // (gracefully) exit (setting android_app->destroyed) and so we need + // to be careful to avoid a deadlock waiting for a thread that's + // already exit. + if (android_app->destroyed) { + pthread_mutex_unlock(&android_app->mutex); + return; + } + if (android_app->pendingWindow != NULL) { + android_app_write_cmd(android_app, APP_CMD_TERM_WINDOW); + } + android_app->pendingWindow = window; + if (window != NULL) { + android_app_write_cmd(android_app, APP_CMD_INIT_WINDOW); + } + while (android_app->window != android_app->pendingWindow) { + pthread_cond_wait(&android_app->cond, &android_app->mutex); + } + pthread_mutex_unlock(&android_app->mutex); +} + +static void android_app_set_activity_state(struct android_app* android_app, + int8_t cmd) { + pthread_mutex_lock(&android_app->mutex); + + // NB: we have to consider that the native thread could have already + // (gracefully) exit (setting android_app->destroyed) and so we need + // to be careful to avoid a deadlock waiting for a thread that's + // already exit. + if (!android_app->destroyed) { + android_app_write_cmd(android_app, cmd); + while (android_app->activityState != cmd) { + pthread_cond_wait(&android_app->cond, &android_app->mutex); + } + } + pthread_mutex_unlock(&android_app->mutex); +} + +static void android_app_free(struct android_app* android_app) { + int input_buf_idx = 0; + + pthread_mutex_lock(&android_app->mutex); + + // It's possible that onDestroy is called after we have already 'destroyed' + // the app (via `android_app_destroy` due to `android_main` returning. + // + // In this case `->destroyed` will already be set (so we won't deadlock in + // the loop below) but we still need to close the messaging fds and finish + // freeing the android_app + + android_app_write_cmd(android_app, APP_CMD_DESTROY); + while (!android_app->destroyed) { + pthread_cond_wait(&android_app->cond, &android_app->mutex); + } + pthread_mutex_unlock(&android_app->mutex); + + for (input_buf_idx = 0; input_buf_idx < NATIVE_APP_GLUE_MAX_INPUT_BUFFERS; + input_buf_idx++) { + struct android_input_buffer* buf = + &android_app->inputBuffers[input_buf_idx]; + + android_app_clear_motion_events(buf); + free(buf->motionEvents); + free(buf->keyEvents); + } + + close(android_app->msgread); + close(android_app->msgwrite); + pthread_cond_destroy(&android_app->cond); + pthread_mutex_destroy(&android_app->mutex); + free(android_app); +} + +static inline struct android_app* ToApp(GameActivity* activity) { + return (struct android_app*)activity->instance; +} + +static void onDestroy(GameActivity* activity) { + LOGV("Destroy: %p", activity); + android_app_free(ToApp(activity)); +} + +static void onStart(GameActivity* activity) { + LOGV("Start: %p", activity); + android_app_set_activity_state(ToApp(activity), APP_CMD_START); +} + +static void onResume(GameActivity* activity) { + LOGV("Resume: %p", activity); + android_app_set_activity_state(ToApp(activity), APP_CMD_RESUME); +} + +static void onSaveInstanceState(GameActivity* activity, + SaveInstanceStateRecallback recallback, + void* context) { + LOGV("SaveInstanceState: %p", activity); + + struct android_app* android_app = ToApp(activity); + pthread_mutex_lock(&android_app->mutex); + + // NB: we have to consider that the native thread could have already + // (gracefully) exit (setting android_app->destroyed) and so we need + // to be careful to avoid a deadlock waiting for a thread that's + // already exit. + if (android_app->destroyed) { + pthread_mutex_unlock(&android_app->mutex); + return; + } + + android_app->stateSaved = 0; + android_app_write_cmd(android_app, APP_CMD_SAVE_STATE); + while (!android_app->stateSaved) { + pthread_cond_wait(&android_app->cond, &android_app->mutex); + } + + if (android_app->savedState != NULL) { + // Tell the Java side about our state. + recallback((const char*)android_app->savedState, + android_app->savedStateSize, context); + // Now we can free it. + free(android_app->savedState); + android_app->savedState = NULL; + android_app->savedStateSize = 0; + } + + pthread_mutex_unlock(&android_app->mutex); +} + +static void onPause(GameActivity* activity) { + LOGV("Pause: %p", activity); + android_app_set_activity_state(ToApp(activity), APP_CMD_PAUSE); +} + +static void onStop(GameActivity* activity) { + LOGV("Stop: %p", activity); + android_app_set_activity_state(ToApp(activity), APP_CMD_STOP); +} + +static void onConfigurationChanged(GameActivity* activity) { + LOGV("ConfigurationChanged: %p", activity); + android_app_write_cmd(ToApp(activity), APP_CMD_CONFIG_CHANGED); +} + +static void onTrimMemory(GameActivity* activity, int level) { + LOGV("TrimMemory: %p %d", activity, level); + android_app_write_cmd(ToApp(activity), APP_CMD_LOW_MEMORY); +} + +static void onWindowFocusChanged(GameActivity* activity, bool focused) { + LOGV("WindowFocusChanged: %p -- %d", activity, focused); + android_app_write_cmd(ToApp(activity), + focused ? APP_CMD_GAINED_FOCUS : APP_CMD_LOST_FOCUS); +} + +static void onNativeWindowCreated(GameActivity* activity, + ANativeWindow* window) { + LOGV("NativeWindowCreated: %p -- %p", activity, window); + android_app_set_window(ToApp(activity), window); +} + +static void onNativeWindowDestroyed(GameActivity* activity, + ANativeWindow* window) { + LOGV("NativeWindowDestroyed: %p -- %p", activity, window); + android_app_set_window(ToApp(activity), NULL); +} + +static void onNativeWindowRedrawNeeded(GameActivity* activity, + ANativeWindow* window) { + LOGV("NativeWindowRedrawNeeded: %p -- %p", activity, window); + android_app_write_cmd(ToApp(activity), APP_CMD_WINDOW_REDRAW_NEEDED); +} + +static void onNativeWindowResized(GameActivity* activity, ANativeWindow* window, + int32_t width, int32_t height) { + LOGV("NativeWindowResized: %p -- %p ( %d x %d )", activity, window, width, + height); + android_app_write_cmd(ToApp(activity), APP_CMD_WINDOW_RESIZED); +} + +void android_app_set_motion_event_filter(struct android_app* app, + android_motion_event_filter filter) { + pthread_mutex_lock(&app->mutex); + app->motionEventFilter = filter; + pthread_mutex_unlock(&app->mutex); +} + +bool android_app_input_available_wake_up(struct android_app* app) { + pthread_mutex_lock(&app->mutex); + bool available = app->inputAvailableWakeUp; + app->inputAvailableWakeUp = false; + pthread_mutex_unlock(&app->mutex); + return available; +} + +// NB: should be called with the android_app->mutex held already +static void notifyInput(struct android_app* android_app) { + // Don't spam the mainloop with wake ups if we've already sent one + if (android_app->inputSwapPending) { + return; + } + + if (android_app->looper != NULL) { + // for the app thread to know why it received the wake() up + android_app->inputAvailableWakeUp = true; + android_app->inputSwapPending = true; + ALooper_wake(android_app->looper); + } +} + +static bool onTouchEvent(GameActivity* activity, + const GameActivityMotionEvent* event) { + struct android_app* android_app = ToApp(activity); + pthread_mutex_lock(&android_app->mutex); + + // NB: we have to consider that the native thread could have already + // (gracefully) exit (setting android_app->destroyed) and so we need + // to be careful to avoid a deadlock waiting for a thread that's + // already exit. + if (android_app->destroyed) { + pthread_mutex_unlock(&android_app->mutex); + return false; + } + + if (android_app->motionEventFilter != NULL && + !android_app->motionEventFilter(event)) { + pthread_mutex_unlock(&android_app->mutex); + return false; + } + + struct android_input_buffer* inputBuffer = + &android_app->inputBuffers[android_app->currentInputBuffer]; + + // Add to the list of active motion events + if (inputBuffer->motionEventsCount >= inputBuffer->motionEventsBufferSize) { + inputBuffer->motionEventsBufferSize *= 2; + inputBuffer->motionEvents = (GameActivityMotionEvent*)realloc( + inputBuffer->motionEvents, + sizeof(GameActivityMotionEvent) * inputBuffer->motionEventsBufferSize); + + if (inputBuffer->motionEvents == NULL) { + LOGE("onTouchEvent: out of memory"); + abort(); + } + } + + int new_ix = inputBuffer->motionEventsCount; + memcpy(&inputBuffer->motionEvents[new_ix], event, + sizeof(GameActivityMotionEvent)); + ++inputBuffer->motionEventsCount; + notifyInput(android_app); + + //android_app_write_cmd(android_app, APP_CMD_TOUCH_EVENT); + pthread_mutex_unlock(&android_app->mutex); + return true; +} + +struct android_input_buffer* android_app_swap_input_buffers( + struct android_app* android_app) { + pthread_mutex_lock(&android_app->mutex); + + struct android_input_buffer* inputBuffer = + &android_app->inputBuffers[android_app->currentInputBuffer]; + + if (inputBuffer->motionEventsCount == 0 && inputBuffer->keyEventsCount == 0) { + inputBuffer = NULL; + } else { + android_app->currentInputBuffer = (android_app->currentInputBuffer + 1) % + NATIVE_APP_GLUE_MAX_INPUT_BUFFERS; + } + + android_app->inputSwapPending = false; + android_app->inputAvailableWakeUp = false; + + pthread_mutex_unlock(&android_app->mutex); + + return inputBuffer; +} + +void android_app_clear_motion_events(struct android_input_buffer* inputBuffer) { + // We do not need to lock here if the inputBuffer has already been swapped + // as is handled by the game loop thread + while (inputBuffer->motionEventsCount > 0) { + GameActivityMotionEvent_destroy( + &inputBuffer->motionEvents[inputBuffer->motionEventsCount - 1]); + + inputBuffer->motionEventsCount--; + } + assert(inputBuffer->motionEventsCount == 0); +} + +void android_app_set_key_event_filter(struct android_app* app, + android_key_event_filter filter) { + pthread_mutex_lock(&app->mutex); + app->keyEventFilter = filter; + pthread_mutex_unlock(&app->mutex); +} + +static bool onKey(GameActivity* activity, const GameActivityKeyEvent* event) { + struct android_app* android_app = ToApp(activity); + pthread_mutex_lock(&android_app->mutex); + + // NB: we have to consider that the native thread could have already + // (gracefully) exit (setting android_app->destroyed) and so we need + // to be careful to avoid a deadlock waiting for a thread that's + // already exit. + if (android_app->destroyed) { + pthread_mutex_unlock(&android_app->mutex); + return false; + } + + if (android_app->keyEventFilter != NULL && + !android_app->keyEventFilter(event)) { + pthread_mutex_unlock(&android_app->mutex); + return false; + } + + struct android_input_buffer* inputBuffer = + &android_app->inputBuffers[android_app->currentInputBuffer]; + + // Add to the list of active key down events + if (inputBuffer->keyEventsCount >= inputBuffer->keyEventsBufferSize) { + inputBuffer->keyEventsBufferSize = inputBuffer->keyEventsBufferSize * 2; + inputBuffer->keyEvents = (GameActivityKeyEvent*)realloc( + inputBuffer->keyEvents, + sizeof(GameActivityKeyEvent) * inputBuffer->keyEventsBufferSize); + + if (inputBuffer->keyEvents == NULL) { + LOGE("onKey: out of memory"); + abort(); + } + } + + int new_ix = inputBuffer->keyEventsCount; + memcpy(&inputBuffer->keyEvents[new_ix], event, sizeof(GameActivityKeyEvent)); + ++inputBuffer->keyEventsCount; + notifyInput(android_app); + + //android_app_write_cmd(android_app, APP_CMD_KEY_EVENT); + pthread_mutex_unlock(&android_app->mutex); + return true; +} + +void android_app_clear_key_events(struct android_input_buffer* inputBuffer) { + inputBuffer->keyEventsCount = 0; +} + +static void onTextInputEvent(GameActivity* activity, + const GameTextInputState* state) { + struct android_app* android_app = ToApp(activity); + pthread_mutex_lock(&android_app->mutex); + if (!android_app->destroyed) { + android_app->textInputState = 1; + notifyInput(android_app); + } + pthread_mutex_unlock(&android_app->mutex); +} + +static void onWindowInsetsChanged(GameActivity* activity) { + LOGV("WindowInsetsChanged: %p", activity); + android_app_write_cmd(ToApp(activity), APP_CMD_WINDOW_INSETS_CHANGED); +} + +static void onContentRectChanged(GameActivity* activity, const ARect* rect) { + LOGV("ContentRectChanged: %p -- (%d %d) (%d %d)", activity, rect->left, + rect->top, rect->right, rect->bottom); + + struct android_app* android_app = ToApp(activity); + + pthread_mutex_lock(&android_app->mutex); + android_app->contentRect = *rect; + + android_app_write_cmd(android_app, APP_CMD_CONTENT_RECT_CHANGED); + pthread_mutex_unlock(&android_app->mutex); +} + +static void onSoftwareKeyboardVisibilityChanged(GameActivity* activity, + bool visible) { + LOGV("SoftwareKeyboardVisibilityChanged: %p -- %d", activity, (int)visible); + + struct android_app* android_app = ToApp(activity); + + pthread_mutex_lock(&android_app->mutex); + android_app->softwareKeyboardVisible = visible; + + android_app_write_cmd(android_app, APP_CMD_SOFTWARE_KB_VIS_CHANGED); + pthread_mutex_unlock(&android_app->mutex); +} + +static bool onEditorAction(GameActivity* activity, int action) { + LOGV("EditorAction: %p -- %d", activity, action); + + struct android_app* android_app = ToApp(activity); + + pthread_mutex_lock(&android_app->mutex); + + // 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. + android_app->editorAction = action; + // TODO: buffer these actions like other input events + //notifyInput(android_app); + + //android_app_write_cmd(android_app, APP_CMD_EDITOR_ACTION); + pthread_mutex_unlock(&android_app->mutex); + return true; +} + +// XXX: This symbol is renamed with a _C suffix and then re-exported from +// Rust because Rust/Cargo don't give us a way to directly export symbols +// from C/C++ code: https://github.com/rust-lang/rfcs/issues/2771 +// +JNIEXPORT +void GameActivity_onCreate_C(GameActivity* activity, void* savedState, + size_t savedStateSize) { + LOGV("Creating: %p", activity); + activity->callbacks->onDestroy = onDestroy; + activity->callbacks->onStart = onStart; + activity->callbacks->onResume = onResume; + activity->callbacks->onSaveInstanceState = onSaveInstanceState; + activity->callbacks->onPause = onPause; + activity->callbacks->onStop = onStop; + activity->callbacks->onTouchEvent = onTouchEvent; + activity->callbacks->onKeyDown = onKey; + activity->callbacks->onKeyUp = onKey; + activity->callbacks->onTextInputEvent = onTextInputEvent; + activity->callbacks->onConfigurationChanged = onConfigurationChanged; + activity->callbacks->onTrimMemory = onTrimMemory; + activity->callbacks->onWindowFocusChanged = onWindowFocusChanged; + activity->callbacks->onNativeWindowCreated = onNativeWindowCreated; + activity->callbacks->onNativeWindowDestroyed = onNativeWindowDestroyed; + activity->callbacks->onNativeWindowRedrawNeeded = onNativeWindowRedrawNeeded; + activity->callbacks->onNativeWindowResized = onNativeWindowResized; + activity->callbacks->onWindowInsetsChanged = onWindowInsetsChanged; + activity->callbacks->onContentRectChanged = onContentRectChanged; + activity->callbacks->onSoftwareKeyboardVisibilityChanged = + onSoftwareKeyboardVisibilityChanged; + activity->callbacks->onEditorAction = onEditorAction; + LOGV("Callbacks set: %p", activity->callbacks); + + activity->instance = android_app_create(activity, savedState, savedStateSize); +} diff --git a/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/src/game-text-input/gametextinput.cpp b/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/src/game-text-input/gametextinput.cpp new file mode 120000 index 00000000..3deaa670 --- /dev/null +++ b/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/src/game-text-input/gametextinput.cpp @@ -0,0 +1 @@ +../../../../../../game-text-input/prefab-src/modules/game-text-input/src/game-text-input/gametextinput.cpp \ No newline at end of file diff --git a/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/src/game-text-input/gametextinput.h b/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/src/game-text-input/gametextinput.h new file mode 120000 index 00000000..84e93379 --- /dev/null +++ b/android-activity/android-games-sdk/game-activity/prefab-src/modules/game-activity/src/game-text-input/gametextinput.h @@ -0,0 +1 @@ +../../../../../../game-text-input/prefab-src/modules/game-text-input/include/game-text-input/gametextinput.h \ No newline at end of file diff --git a/android-activity/android-games-sdk/game-activity/prefab-src/prefab.json b/android-activity/android-games-sdk/game-activity/prefab-src/prefab.json new file mode 100644 index 00000000..46adff6b --- /dev/null +++ b/android-activity/android-games-sdk/game-activity/prefab-src/prefab.json @@ -0,0 +1,13 @@ +{ + "name": "game-activity", + "schema_version": 1, + "dependencies": [], + "version": "0.0.1", + "cpp_files": [ + "src/common/system_utils.cpp", + "src/game-activity/GameActivity.cpp", + "src/game-activity/native_app_glue/android_native_app_glue.c", + "src/game-activity/GameActivityEvents.cpp", + "src/game-text-input/gametextinput.cpp" + ] +} diff --git a/android-activity/android-games-sdk/game-text-input/prefab-src/modules/game-text-input/include/common b/android-activity/android-games-sdk/game-text-input/prefab-src/modules/game-text-input/include/common new file mode 120000 index 00000000..9388f342 --- /dev/null +++ b/android-activity/android-games-sdk/game-text-input/prefab-src/modules/game-text-input/include/common @@ -0,0 +1 @@ +../../../../../include/common/ \ No newline at end of file diff --git a/android-activity/android-games-sdk/game-text-input/prefab-src/modules/game-text-input/include/game-text-input/gametextinput.h b/android-activity/android-games-sdk/game-text-input/prefab-src/modules/game-text-input/include/game-text-input/gametextinput.h new file mode 100644 index 00000000..28645446 --- /dev/null +++ b/android-activity/android-games-sdk/game-text-input/prefab-src/modules/game-text-input/include/game-text-input/gametextinput.h @@ -0,0 +1,929 @@ +/* + * Copyright (C) 2021 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @defgroup game_text_input Game Text Input + * The interface to use GameTextInput. + * @{ + */ + +#pragma once + +#include +#include +#include + +#include "common/gamesdk_common.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define GAMETEXTINPUT_MAJOR_VERSION 4 +#define GAMETEXTINPUT_MINOR_VERSION 0 +#define GAMETEXTINPUT_BUGFIX_VERSION 0 +#define GAMETEXTINPUT_PACKED_VERSION \ + ANDROID_GAMESDK_PACKED_VERSION(GAMETEXTINPUT_MAJOR_VERSION, \ + GAMETEXTINPUT_MINOR_VERSION, \ + GAMETEXTINPUT_BUGFIX_VERSION) + +/** + * This struct holds a span within a region of text from start (inclusive) to + * end (exclusive). An empty span or cursor position is specified with + * start==end. An undefined span is specified with start = end = SPAN_UNDEFINED. + */ +typedef struct GameTextInputSpan { + /** The start of the region (inclusive). */ + int32_t start; + /** The end of the region (exclusive). */ + int32_t end; +} GameTextInputSpan; + +/** + * Values with special meaning in a GameTextInputSpan. + */ +enum GameTextInputSpanFlag : int32_t { SPAN_UNDEFINED = -1 }; + +/** + * This struct holds the state of an editable section of text. + * The text can have a selection and a composing region defined on it. + * A composing region is used by IMEs that allow input using multiple steps to + * compose a glyph or word. Use functions GameTextInput_getState and + * GameTextInput_setState to read and modify the state that an IME is editing. + */ +typedef struct GameTextInputState { + /** + * Text owned by the state, as a modified UTF-8 string. Null-terminated. + * https://en.wikipedia.org/wiki/UTF-8#Modified_UTF-8 + */ + const char *text_UTF8; + /** + * Length in bytes of text_UTF8, *not* including the null at end. + */ + int32_t text_length; + /** + * A selection defined on the text. + */ + GameTextInputSpan selection; + /** + * A composing region defined on the text. + */ + GameTextInputSpan composingRegion; +} GameTextInputState; + +/** + * A callback called by GameTextInput_getState. + * @param context User-defined context. + * @param state State, owned by the library, that will be valid for the duration + * of the callback. + */ +typedef void (*GameTextInputGetStateCallback)( + void *context, const struct GameTextInputState *state); + +/** + * Opaque handle to the GameTextInput API. + */ +typedef struct GameTextInput GameTextInput; + +/** + * Initialize the GameTextInput library. + * If called twice without GameTextInput_destroy being called, the same pointer + * will be returned and a warning will be issued. + * @param env A JNI env valid on the calling thread. + * @param max_string_size The maximum length of a string that can be edited. If + * zero, the maximum defaults to 65536 bytes. A buffer of this size is allocated + * at initialization. + * @return A handle to the library. + */ +GameTextInput *GameTextInput_init(JNIEnv *env, uint32_t max_string_size); + +/** + * When using GameTextInput, you need to create a gametextinput.InputConnection + * on the Java side and pass it using this function to the library, unless using + * GameActivity in which case this will be done for you. See the GameActivity + * source code or GameTextInput samples for examples of usage. + * @param input A valid GameTextInput library handle. + * @param inputConnection A gametextinput.InputConnection object. + */ +void GameTextInput_setInputConnection(GameTextInput *input, + jobject inputConnection); + +/** + * Unless using GameActivity, it is required to call this function from your + * Java gametextinput.Listener.stateChanged method to convert eventState and + * trigger any event callbacks. When using GameActivity, this does not need to + * be called as event processing is handled by the Activity. + * @param input A valid GameTextInput library handle. + * @param eventState A Java gametextinput.State object. + */ +void GameTextInput_processEvent(GameTextInput *input, jobject eventState); + +/** + * Free any resources owned by the GameTextInput library. + * Any subsequent calls to the library will fail until GameTextInput_init is + * called again. + * @param input A valid GameTextInput library handle. + */ +void GameTextInput_destroy(GameTextInput *input); + +/** + * Flags to be passed to GameTextInput_showIme. + */ +enum ShowImeFlags : uint32_t { + SHOW_IME_UNDEFINED = 0, // Default value. + SHOW_IMPLICIT = + 1, // Indicates that the user has forced the input method open so it + // should not be closed until they explicitly do so. + SHOW_FORCED = 2 // Indicates that this is an implicit request to show the + // input window, not as the result of a direct request by + // the user. The window may not be shown in this case. +}; + +/** + * Show the IME. Calls InputMethodManager.showSoftInput(). + * @param input A valid GameTextInput library handle. + * @param flags Defined in ShowImeFlags above. For more information see: + * https://developer.android.com/reference/android/view/inputmethod/InputMethodManager + */ +void GameTextInput_showIme(GameTextInput *input, uint32_t flags); + +/** + * Flags to be passed to GameTextInput_hideIme. + */ +enum HideImeFlags : uint32_t { + HIDE_IME_UNDEFINED = 0, // Default value. + HIDE_IMPLICIT_ONLY = + 1, // Indicates that the soft input window should only be hidden if it + // was not explicitly shown by the user. + HIDE_NOT_ALWAYS = + 2, // Indicates that the soft input window should normally be hidden, + // unless it was originally shown with SHOW_FORCED. +}; + +/** + * Hide the IME. Calls InputMethodManager.hideSoftInputFromWindow(). + * @param input A valid GameTextInput library handle. + * @param flags Defined in HideImeFlags above. For more information see: + * https://developer.android.com/reference/android/view/inputmethod/InputMethodManager + */ +void GameTextInput_hideIme(GameTextInput *input, uint32_t flags); + +/** + * Restarts the input method. Calls InputMethodManager.restartInput(). + * @param input A valid GameTextInput library handle. + */ +void GameTextInput_restartInput(GameTextInput *input); + +/** + * Call a callback with the current GameTextInput state, which may have been + * modified by changes in the IME and calls to GameTextInput_setState. We use a + * callback rather than returning the state in order to simplify ownership of + * text_UTF8 strings. These strings are only valid during the calling of the + * callback. + * @param input A valid GameTextInput library handle. + * @param callback A function that will be called with valid state. + * @param context Context used by the callback. + */ +void GameTextInput_getState(GameTextInput *input, + GameTextInputGetStateCallback callback, + void *context); + +/** + * Set the current GameTextInput state. This state is reflected to any active + * IME. + * @param input A valid GameTextInput library handle. + * @param state The state to set. Ownership is maintained by the caller and must + * remain valid for the duration of the call. + */ +void GameTextInput_setState(GameTextInput *input, + const GameTextInputState *state); + +/** + * Type of the callback needed by GameTextInput_setEventCallback that will be + * called every time the IME state changes. + * @param context User-defined context set in GameTextInput_setEventCallback. + * @param current_state Current IME state, owned by the library and valid during + * the callback. + */ +typedef void (*GameTextInputEventCallback)( + void *context, const GameTextInputState *current_state); + +/** + * Optionally set a callback to be called whenever the IME state changes. + * Not necessary if you are using GameActivity, which handles these callbacks + * for you. + * @param input A valid GameTextInput library handle. + * @param callback Called by the library when the IME state changes. + * @param context Context passed as first argument to the callback. + * This function is deprecated. Don't perform any complex processing inside + * the callback other than copying the state variable. Using any synchronization + * primitives inside this callback may cause a deadlock. + */ +void GameTextInput_setEventCallback(GameTextInput *input, + GameTextInputEventCallback callback, + void *context); + +/** + * Type of the callback needed by GameTextInput_setImeInsetsCallback that will + * be called every time the IME window insets change. + * @param context User-defined context set in + * GameTextInput_setImeWIndowInsetsCallback. + * @param current_insets Current IME insets, owned by the library and valid + * during the callback. + */ +typedef void (*GameTextInputImeInsetsCallback)(void *context, + const ARect *current_insets); + +/** + * Optionally set a callback to be called whenever the IME insets change. + * Not necessary if you are using GameActivity, which handles these callbacks + * for you. + * @param input A valid GameTextInput library handle. + * @param callback Called by the library when the IME insets change. + * @param context Context passed as first argument to the callback. + */ +void GameTextInput_setImeInsetsCallback(GameTextInput *input, + GameTextInputImeInsetsCallback callback, + void *context); + +/** + * Get the current window insets for the IME. + * @param input A valid GameTextInput library handle. + * @param insets Filled with the current insets by this function. + */ +void GameTextInput_getImeInsets(const GameTextInput *input, ARect *insets); + +/** + * Unless using GameActivity, it is required to call this function from your + * Java gametextinput.Listener.onImeInsetsChanged method to + * trigger any event callbacks. When using GameActivity, this does not need to + * be called as insets processing is handled by the Activity. + * @param input A valid GameTextInput library handle. + * @param eventState A Java gametextinput.State object. + */ +void GameTextInput_processImeInsets(GameTextInput *input, const ARect *insets); + +/** + * Convert a GameTextInputState struct to a Java gametextinput.State object. + * Don't forget to delete the returned Java local ref when you're done. + * @param input A valid GameTextInput library handle. + * @param state Input state to convert. + * @return A Java object of class gametextinput.State. The caller is required to + * delete this local reference. + */ +jobject GameTextInputState_toJava(const GameTextInput *input, + const GameTextInputState *state); + +/** + * Convert from a Java gametextinput.State object into a C GameTextInputState + * struct. + * @param input A valid GameTextInput library handle. + * @param state A Java gametextinput.State object. + * @param callback A function called with the C struct, valid for the duration + * of the call. + * @param context Context passed to the callback. + */ +void GameTextInputState_fromJava(const GameTextInput *input, jobject state, + GameTextInputGetStateCallback callback, + void *context); + +/** + * Definitions for inputType argument of GameActivity_setImeEditorInfo() + * + *
+ * |-------|-------|-------|-------|
+ *                              1111 TYPE_MASK_CLASS
+ *                      11111111     TYPE_MASK_VARIATION
+ *          111111111111             TYPE_MASK_FLAGS
+ * |-------|-------|-------|-------|
+ *                                   TYPE_NULL
+ * |-------|-------|-------|-------|
+ *                                 1 TYPE_CLASS_TEXT
+ *                             1     TYPE_TEXT_VARIATION_URI
+ *                            1      TYPE_TEXT_VARIATION_EMAIL_ADDRESS
+ *                            11     TYPE_TEXT_VARIATION_EMAIL_SUBJECT
+ *                           1       TYPE_TEXT_VARIATION_SHORT_MESSAGE
+ *                           1 1     TYPE_TEXT_VARIATION_LONG_MESSAGE
+ *                           11      TYPE_TEXT_VARIATION_PERSON_NAME
+ *                           111     TYPE_TEXT_VARIATION_POSTAL_ADDRESS
+ *                          1        TYPE_TEXT_VARIATION_PASSWORD
+ *                          1  1     TYPE_TEXT_VARIATION_VISIBLE_PASSWORD
+ *                          1 1      TYPE_TEXT_VARIATION_WEB_EDIT_TEXT
+ *                          1 11     TYPE_TEXT_VARIATION_FILTER
+ *                          11       TYPE_TEXT_VARIATION_PHONETIC
+ *                          11 1     TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS
+ *                          111      TYPE_TEXT_VARIATION_WEB_PASSWORD
+ *                     1             TYPE_TEXT_FLAG_CAP_CHARACTERS
+ *                    1              TYPE_TEXT_FLAG_CAP_WORDS
+ *                   1               TYPE_TEXT_FLAG_CAP_SENTENCES
+ *                  1                TYPE_TEXT_FLAG_AUTO_CORRECT
+ *                 1                 TYPE_TEXT_FLAG_AUTO_COMPLETE
+ *                1                  TYPE_TEXT_FLAG_MULTI_LINE
+ *               1                   TYPE_TEXT_FLAG_IME_MULTI_LINE
+ *              1                    TYPE_TEXT_FLAG_NO_SUGGESTIONS
+ *             1 TYPE_TEXT_FLAG_ENABLE_TEXT_CONVERSION_SUGGESTIONS
+ * |-------|-------|-------|-------|
+ *                                1  TYPE_CLASS_NUMBER
+ *                             1     TYPE_NUMBER_VARIATION_PASSWORD
+ *                     1             TYPE_NUMBER_FLAG_SIGNED
+ *                    1              TYPE_NUMBER_FLAG_DECIMAL
+ * |-------|-------|-------|-------|
+ *                                11 TYPE_CLASS_PHONE
+ * |-------|-------|-------|-------|
+ *                               1   TYPE_CLASS_DATETIME
+ *                             1     TYPE_DATETIME_VARIATION_DATE
+ *                            1      TYPE_DATETIME_VARIATION_TIME
+ * |-------|-------|-------|-------|
+ */ + +enum GameTextInputType : uint32_t { + /** + * Mask of bits that determine the overall class + * of text being given. Currently supported classes are: + * {@link #TYPE_CLASS_TEXT}, {@link #TYPE_CLASS_NUMBER}, + * {@link #TYPE_CLASS_PHONE}, {@link #TYPE_CLASS_DATETIME}. + *

IME authors: If the class is not one you + * understand, assume {@link #TYPE_CLASS_TEXT} with NO variation + * or flags.

+ */ + TYPE_MASK_CLASS = 0x0000000f, + + /** + * Mask of bits that determine the variation of + * the base content class. + */ + TYPE_MASK_VARIATION = 0x00000ff0, + + /** + * Mask of bits that provide addition bit flags + * of options. + */ + TYPE_MASK_FLAGS = 0x00fff000, + + /** + * Special content type for when no explicit type has been specified. + * This should be interpreted to mean that the target input connection + * is not rich, it can not process and show things like candidate text nor + * retrieve the current text, so the input method will need to run in a + * limited "generate key events" mode, if it supports it. Note that some + * input methods may not support it, for example a voice-based input + * method will likely not be able to generate key events even if this + * flag is set. + */ + TYPE_NULL = 0x00000000, + + // ---------------------------------------------------------------------- + + /** + * Class for normal text. This class supports the following flags (only + * one of which should be set): + * {@link #TYPE_TEXT_FLAG_CAP_CHARACTERS}, + * {@link #TYPE_TEXT_FLAG_CAP_WORDS}, and. + * {@link #TYPE_TEXT_FLAG_CAP_SENTENCES}. It also supports the + * following variations: + * {@link #TYPE_TEXT_VARIATION_NORMAL}, and + * {@link #TYPE_TEXT_VARIATION_URI}. If you do not recognize the + * variation, normal should be assumed. + */ + TYPE_CLASS_TEXT = 0x00000001, + + /** + * Flag for {@link #TYPE_CLASS_TEXT}: capitalize all characters. Overrides + * {@link #TYPE_TEXT_FLAG_CAP_WORDS} and + * {@link #TYPE_TEXT_FLAG_CAP_SENTENCES}. This value is explicitly defined + * to be the same as {@link TextUtils#CAP_MODE_CHARACTERS}. Of course, + * this only affects languages where there are upper-case and lower-case + * letters. + */ + TYPE_TEXT_FLAG_CAP_CHARACTERS = 0x00001000, + + /** + * Flag for {@link #TYPE_CLASS_TEXT}: capitalize the first character of + * every word. Overrides {@link #TYPE_TEXT_FLAG_CAP_SENTENCES}. This + * value is explicitly defined + * to be the same as {@link TextUtils#CAP_MODE_WORDS}. Of course, + * this only affects languages where there are upper-case and lower-case + * letters. + */ + TYPE_TEXT_FLAG_CAP_WORDS = 0x00002000, + + /** + * Flag for {@link #TYPE_CLASS_TEXT}: capitalize the first character of + * each sentence. This value is explicitly defined + * to be the same as {@link TextUtils#CAP_MODE_SENTENCES}. For example + * in English it means to capitalize after a period and a space (note that + * other languages may have different characters for period, or not use + * spaces, or use different grammatical rules). Of course, this only affects + * languages where there are upper-case and lower-case letters. + */ + TYPE_TEXT_FLAG_CAP_SENTENCES = 0x00004000, + + /** + * Flag for {@link #TYPE_CLASS_TEXT}: the user is entering free-form + * text that should have auto-correction applied to it. Without this flag, + * the IME will not try to correct typos. You should always set this flag + * unless you really expect users to type non-words in this field, for + * example to choose a name for a character in a game. + * Contrast this with {@link #TYPE_TEXT_FLAG_AUTO_COMPLETE} and + * {@link #TYPE_TEXT_FLAG_NO_SUGGESTIONS}: + * {@code TYPE_TEXT_FLAG_AUTO_CORRECT} means that the IME will try to + * auto-correct typos as the user is typing, but does not define whether + * the IME offers an interface to show suggestions. + */ + TYPE_TEXT_FLAG_AUTO_CORRECT = 0x00008000, + + /** + * Flag for {@link #TYPE_CLASS_TEXT}: the text editor (which means + * the application) is performing auto-completion of the text being entered + * based on its own semantics, which it will present to the user as they type. + * This generally means that the input method should not be showing + * candidates itself, but can expect the editor to supply its own + * completions/candidates from + * {@link android.view.inputmethod.InputMethodSession#displayCompletions + * InputMethodSession.displayCompletions()} as a result of the editor calling + * {@link android.view.inputmethod.InputMethodManager#displayCompletions + * InputMethodManager.displayCompletions()}. + * Note the contrast with {@link #TYPE_TEXT_FLAG_AUTO_CORRECT} and + * {@link #TYPE_TEXT_FLAG_NO_SUGGESTIONS}: + * {@code TYPE_TEXT_FLAG_AUTO_COMPLETE} means the editor should show an + * interface for displaying suggestions, but instead of supplying its own + * it will rely on the Editor to pass completions/corrections. + */ + TYPE_TEXT_FLAG_AUTO_COMPLETE = 0x00010000, + + /** + * Flag for {@link #TYPE_CLASS_TEXT}: multiple lines of text can be + * entered into the field. If this flag is not set, the text field + * will be constrained to a single line. The IME may also choose not to + * display an enter key when this flag is not set, as there should be no + * need to create new lines. + */ + TYPE_TEXT_FLAG_MULTI_LINE = 0x00020000, + + /** + * Flag for {@link #TYPE_CLASS_TEXT}: the regular text view associated + * with this should not be multi-line, but when a fullscreen input method + * is providing text it should use multiple lines if it can. + */ + TYPE_TEXT_FLAG_IME_MULTI_LINE = 0x00040000, + + /** + * Flag for {@link #TYPE_CLASS_TEXT}: the input method does not need to + * display any dictionary-based candidates. This is useful for text views that + * do not contain words from the language and do not benefit from any + * dictionary-based completions or corrections. It overrides the + * {@link #TYPE_TEXT_FLAG_AUTO_CORRECT} value when set. + * Please avoid using this unless you are certain this is what you want. + * Many input methods need suggestions to work well, for example the ones + * based on gesture typing. Consider clearing + * {@link #TYPE_TEXT_FLAG_AUTO_CORRECT} instead if you just do not + * want the IME to correct typos. + * Note the contrast with {@link #TYPE_TEXT_FLAG_AUTO_CORRECT} and + * {@link #TYPE_TEXT_FLAG_AUTO_COMPLETE}: + * {@code TYPE_TEXT_FLAG_NO_SUGGESTIONS} means the IME does not need to + * show an interface to display suggestions. Most IMEs will also take this to + * mean they do not need to try to auto-correct what the user is typing. + */ + TYPE_TEXT_FLAG_NO_SUGGESTIONS = 0x00080000, + + /** + * Flag for {@link #TYPE_CLASS_TEXT}: Let the IME know the text conversion + * suggestions are required by the application. Text conversion suggestion is + * for the transliteration languages which has pronunciation characters and + * target characters. When the user is typing the pronunciation charactes, the + * IME could provide the possible target characters to the user. When this + * flag is set, the IME should insert the text conversion suggestions through + * {@link Builder#setTextConversionSuggestions(List)} and + * the {@link TextAttribute} with initialized with the text conversion + * suggestions is provided by the IME to the application. To receive the + * additional information, the application needs to implement {@link + * InputConnection#setComposingText(CharSequence, int, TextAttribute)}, + * {@link InputConnection#setComposingRegion(int, int, TextAttribute)}, and + * {@link InputConnection#commitText(CharSequence, int, TextAttribute)}. + */ + TYPE_TEXT_FLAG_ENABLE_TEXT_CONVERSION_SUGGESTIONS = 0x00100000, + + // ---------------------------------------------------------------------- + + /** + * Default variation of {@link #TYPE_CLASS_TEXT}: plain old normal text. + */ + TYPE_TEXT_VARIATION_NORMAL = 0x00000000, + + /** + * Variation of {@link #TYPE_CLASS_TEXT}: entering a URI. + */ + TYPE_TEXT_VARIATION_URI = 0x00000010, + + /** + * Variation of {@link #TYPE_CLASS_TEXT}: entering an e-mail address. + */ + TYPE_TEXT_VARIATION_EMAIL_ADDRESS = 0x00000020, + + /** + * Variation of {@link #TYPE_CLASS_TEXT}: entering the subject line of + * an e-mail. + */ + TYPE_TEXT_VARIATION_EMAIL_SUBJECT = 0x00000030, + + /** + * Variation of {@link #TYPE_CLASS_TEXT}: entering a short, possibly informal + * message such as an instant message or a text message. + */ + TYPE_TEXT_VARIATION_SHORT_MESSAGE = 0x00000040, + + /** + * Variation of {@link #TYPE_CLASS_TEXT}: entering the content of a long, + * possibly formal message such as the body of an e-mail. + */ + TYPE_TEXT_VARIATION_LONG_MESSAGE = 0x00000050, + + /** + * Variation of {@link #TYPE_CLASS_TEXT}: entering the name of a person. + */ + TYPE_TEXT_VARIATION_PERSON_NAME = 0x00000060, + + /** + * Variation of {@link #TYPE_CLASS_TEXT}: entering a postal mailing address. + */ + TYPE_TEXT_VARIATION_POSTAL_ADDRESS = 0x00000070, + + /** + * Variation of {@link #TYPE_CLASS_TEXT}: entering a password. + */ + TYPE_TEXT_VARIATION_PASSWORD = 0x00000080, + + /** + * Variation of {@link #TYPE_CLASS_TEXT}: entering a password, which should + * be visible to the user. + */ + TYPE_TEXT_VARIATION_VISIBLE_PASSWORD = 0x00000090, + + /** + * Variation of {@link #TYPE_CLASS_TEXT}: entering text inside of a web form. + */ + TYPE_TEXT_VARIATION_WEB_EDIT_TEXT = 0x000000a0, + + /** + * Variation of {@link #TYPE_CLASS_TEXT}: entering text to filter contents + * of a list etc. + */ + TYPE_TEXT_VARIATION_FILTER = 0x000000b0, + + /** + * Variation of {@link #TYPE_CLASS_TEXT}: entering text for phonetic + * pronunciation, such as a phonetic name field in contacts. This is mostly + * useful for languages where one spelling may have several phonetic + * readings, like Japanese. + */ + TYPE_TEXT_VARIATION_PHONETIC = 0x000000c0, + + /** + * Variation of {@link #TYPE_CLASS_TEXT}: entering e-mail address inside + * of a web form. This was added in + * {@link android.os.Build.VERSION_CODES#HONEYCOMB}. An IME must target + * this API version or later to see this input type; if it doesn't, a request + * for this type will be seen as {@link #TYPE_TEXT_VARIATION_EMAIL_ADDRESS} + * when passed through {@link + * android.view.inputmethod.EditorInfo#makeCompatible(int) + * EditorInfo.makeCompatible(int)}. + */ + TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS = 0x000000d0, + + /** + * Variation of {@link #TYPE_CLASS_TEXT}: entering password inside + * of a web form. This was added in + * {@link android.os.Build.VERSION_CODES#HONEYCOMB}. An IME must target + * this API version or later to see this input type; if it doesn't, a request + * for this type will be seen as {@link #TYPE_TEXT_VARIATION_PASSWORD} + * when passed through {@link + * android.view.inputmethod.EditorInfo#makeCompatible(int) + * EditorInfo.makeCompatible(int)}. + */ + TYPE_TEXT_VARIATION_WEB_PASSWORD = 0x000000e0, + + // ---------------------------------------------------------------------- + + /** + * Class for numeric text. This class supports the following flags: + * {@link #TYPE_NUMBER_FLAG_SIGNED} and + * {@link #TYPE_NUMBER_FLAG_DECIMAL}. It also supports the following + * variations: {@link #TYPE_NUMBER_VARIATION_NORMAL} and + * {@link #TYPE_NUMBER_VARIATION_PASSWORD}. + *

IME authors: If you do not recognize + * the variation, normal should be assumed.

+ */ + TYPE_CLASS_NUMBER = 0x00000002, + + /** + * Flag of {@link #TYPE_CLASS_NUMBER}: the number is signed, allowing + * a positive or negative sign at the start. + */ + TYPE_NUMBER_FLAG_SIGNED = 0x00001000, + + /** + * Flag of {@link #TYPE_CLASS_NUMBER}: the number is decimal, allowing + * a decimal point to provide fractional values. + */ + TYPE_NUMBER_FLAG_DECIMAL = 0x00002000, + + // ---------------------------------------------------------------------- + + /** + * Default variation of {@link #TYPE_CLASS_NUMBER}: plain normal + * numeric text. This was added in + * {@link android.os.Build.VERSION_CODES#HONEYCOMB}. An IME must target + * this API version or later to see this input type; if it doesn't, a request + * for this type will be dropped when passed through + * {@link android.view.inputmethod.EditorInfo#makeCompatible(int) + * EditorInfo.makeCompatible(int)}. + */ + TYPE_NUMBER_VARIATION_NORMAL = 0x00000000, + + /** + * Variation of {@link #TYPE_CLASS_NUMBER}: entering a numeric password. + * This was added in {@link android.os.Build.VERSION_CODES#HONEYCOMB}. An + * IME must target this API version or later to see this input type; if it + * doesn't, a request for this type will be dropped when passed + * through {@link android.view.inputmethod.EditorInfo#makeCompatible(int) + * EditorInfo.makeCompatible(int)}. + */ + TYPE_NUMBER_VARIATION_PASSWORD = 0x00000010, + + // ---------------------------------------------------------------------- + /** + * Class for a phone number. This class currently supports no variations + * or flags. + */ + TYPE_CLASS_PHONE = 0x00000003, + + // ---------------------------------------------------------------------- + + /** + * Class for dates and times. It supports the + * following variations: + * {@link #TYPE_DATETIME_VARIATION_NORMAL} + * {@link #TYPE_DATETIME_VARIATION_DATE}, and + * {@link #TYPE_DATETIME_VARIATION_TIME}. + */ + TYPE_CLASS_DATETIME = 0x00000004, + + /** + * Default variation of {@link #TYPE_CLASS_DATETIME}: allows entering + * both a date and time. + */ + TYPE_DATETIME_VARIATION_NORMAL = 0x00000000, + + /** + * Default variation of {@link #TYPE_CLASS_DATETIME}: allows entering + * only a date. + */ + TYPE_DATETIME_VARIATION_DATE = 0x00000010, + + /** + * Default variation of {@link #TYPE_CLASS_DATETIME}: allows entering + * only a time. + */ + TYPE_DATETIME_VARIATION_TIME = 0x00000020, +}; + +/** + * actionId and imeOptions argument of GameActivity_setImeEditorInfo(). + * + *
+ * |-------|-------|-------|-------|
+ *                              1111 IME_MASK_ACTION
+ * |-------|-------|-------|-------|
+ *                                   IME_ACTION_UNSPECIFIED
+ *                                 1 IME_ACTION_NONE
+ *                                1  IME_ACTION_GO
+ *                                11 IME_ACTION_SEARCH
+ *                               1   IME_ACTION_SEND
+ *                               1 1 IME_ACTION_NEXT
+ *                               11  IME_ACTION_DONE
+ *                               111 IME_ACTION_PREVIOUS
+ *         1                         IME_FLAG_NO_PERSONALIZED_LEARNING
+ *        1                          IME_FLAG_NO_FULLSCREEN
+ *       1                           IME_FLAG_NAVIGATE_PREVIOUS
+ *      1                            IME_FLAG_NAVIGATE_NEXT
+ *     1                             IME_FLAG_NO_EXTRACT_UI
+ *    1                              IME_FLAG_NO_ACCESSORY_ACTION
+ *   1                               IME_FLAG_NO_ENTER_ACTION
+ *  1                                IME_FLAG_FORCE_ASCII
+ * |-------|-------|-------|-------|
+ */ + +enum GameTextInputActionType : uint32_t { + /** + * Set of bits in {@link #imeOptions} that provide alternative actions + * associated with the "enter" key. This both helps the IME provide + * better feedback about what the enter key will do, and also allows it + * to provide alternative mechanisms for providing that command. + */ + IME_MASK_ACTION = 0x000000ff, + + /** + * Bits of {@link #IME_MASK_ACTION}: no specific action has been + * associated with this editor, let the editor come up with its own if + * it can. + */ + IME_ACTION_UNSPECIFIED = 0x00000000, + + /** + * Bits of {@link #IME_MASK_ACTION}: there is no available action. + */ + IME_ACTION_NONE = 0x00000001, + + /** + * Bits of {@link #IME_MASK_ACTION}: the action key performs a "go" + * operation to take the user to the target of the text they typed. + * Typically used, for example, when entering a URL. + */ + IME_ACTION_GO = 0x00000002, + + /** + * Bits of {@link #IME_MASK_ACTION}: the action key performs a "search" + * operation, taking the user to the results of searching for the text + * they have typed (in whatever context is appropriate). + */ + IME_ACTION_SEARCH = 0x00000003, + + /** + * Bits of {@link #IME_MASK_ACTION}: the action key performs a "send" + * operation, delivering the text to its target. This is typically used + * when composing a message in IM or SMS where sending is immediate. + */ + IME_ACTION_SEND = 0x00000004, + + /** + * Bits of {@link #IME_MASK_ACTION}: the action key performs a "next" + * operation, taking the user to the next field that will accept text. + */ + IME_ACTION_NEXT = 0x00000005, + + /** + * Bits of {@link #IME_MASK_ACTION}: the action key performs a "done" + * operation, typically meaning there is nothing more to input and the + * IME will be closed. + */ + IME_ACTION_DONE = 0x00000006, + + /** + * Bits of {@link #IME_MASK_ACTION}: like {@link #IME_ACTION_NEXT}, but + * for moving to the previous field. This will normally not be used to + * specify an action (since it precludes {@link #IME_ACTION_NEXT}), but + * can be returned to the app if it sets {@link #IME_FLAG_NAVIGATE_PREVIOUS}. + */ + IME_ACTION_PREVIOUS = 0x00000007, +}; + +enum GameTextInputImeOptions : uint32_t { + /** + * Flag of {@link #imeOptions}: used to request that the IME should not update + * any personalized data such as typing history and personalized language + * model based on what the user typed on this text editing object. Typical + * use cases are:
  • When the application is in a special mode, where + * user's activities are expected to be not recorded in the application's + * history. Some web browsers and chat applications may have this kind of + * modes.
  • When storing typing history does not make much sense. + * Specifying this flag in typing games may help to avoid typing history from + * being filled up with words that the user is less likely to type in their + * daily life. Another example is that when the application already knows + * that the expected input is not a valid word (e.g. a promotion code that is + * not a valid word in any natural language).
  • + *
+ * + *

Applications need to be aware that the flag is not a guarantee, and some + * IMEs may not respect it.

+ */ + IME_FLAG_NO_PERSONALIZED_LEARNING = 0x1000000, + + /** + * Flag of {@link #imeOptions}: used to request that the IME never go + * into fullscreen mode. + * By default, IMEs may go into full screen mode when they think + * it's appropriate, for example on small screens in landscape + * orientation where displaying a software keyboard may occlude + * such a large portion of the screen that the remaining part is + * too small to meaningfully display the application UI. + * If this flag is set, compliant IMEs will never go into full screen mode, + * and always leave some space to display the application UI. + * Applications need to be aware that the flag is not a guarantee, and + * some IMEs may ignore it. + */ + IME_FLAG_NO_FULLSCREEN = 0x2000000, + + /** + * Flag of {@link #imeOptions}: like {@link #IME_FLAG_NAVIGATE_NEXT}, but + * specifies there is something interesting that a backward navigation + * can focus on. If the user selects the IME's facility to backward + * navigate, this will show up in the application as an {@link + * #IME_ACTION_PREVIOUS} at {@link InputConnection#performEditorAction(int) + * InputConnection.performEditorAction(int)}. + */ + IME_FLAG_NAVIGATE_PREVIOUS = 0x4000000, + + /** + * Flag of {@link #imeOptions}: used to specify that there is something + * interesting that a forward navigation can focus on. This is like using + * {@link #IME_ACTION_NEXT}, except allows the IME to be multiline (with + * an enter key) as well as provide forward navigation. Note that some + * IMEs may not be able to do this, especially when running on a small + * screen where there is little space. In that case it does not need to + * present a UI for this option. Like {@link #IME_ACTION_NEXT}, if the + * user selects the IME's facility to forward navigate, this will show up + * in the application at {@link InputConnection#performEditorAction(int) + * InputConnection.performEditorAction(int)}. + */ + IME_FLAG_NAVIGATE_NEXT = 0x8000000, + + /** + * Flag of {@link #imeOptions}: used to specify that the IME does not need + * to show its extracted text UI. For input methods that may be fullscreen, + * often when in landscape mode, this allows them to be smaller and let part + * of the application be shown behind, through transparent UI parts in the + * fullscreen IME. The part of the UI visible to the user may not be + * responsive to touch because the IME will receive touch events, which may + * confuse the user; use {@link #IME_FLAG_NO_FULLSCREEN} instead for a better + * experience. Using this flag is discouraged and it may become deprecated in + * the future. Its meaning is unclear in some situations and it may not work + * appropriately on older versions of the platform. + */ + IME_FLAG_NO_EXTRACT_UI = 0x10000000, + + /** + * Flag of {@link #imeOptions}: used in conjunction with one of the actions + * masked by {@link #IME_MASK_ACTION}, this indicates that the action + * should not be available as an accessory button on the right of the + * extracted text when the input method is full-screen. Note that by setting + * this flag, there can be cases where the action is simply never available to + * the user. Setting this generally means that you think that in fullscreen + * mode, where there is little space to show the text, it's not worth taking + * some screen real estate to display the action and it should be used instead + * to show more text. + */ + IME_FLAG_NO_ACCESSORY_ACTION = 0x20000000, + + /** + * Flag of {@link #imeOptions}: used in conjunction with one of the actions + * masked by {@link #IME_MASK_ACTION}. If this flag is not set, IMEs will + * normally replace the "enter" key with the action supplied. This flag + * indicates that the action should not be available in-line as a replacement + * for the "enter" key. Typically this is because the action has such a + * significant impact or is not recoverable enough that accidentally hitting + * it should be avoided, such as sending a message. Note that + * {@link android.widget.TextView} will automatically set this flag for you + * on multi-line text views. + */ + IME_FLAG_NO_ENTER_ACTION = 0x40000000, + + /** + * Flag of {@link #imeOptions}: used to request an IME that is capable of + * inputting ASCII characters. The intention of this flag is to ensure that + * the user can type Roman alphabet characters in a {@link + * android.widget.TextView}. It is typically used for an account ID or + * password input. A lot of the time, IMEs are already able to input ASCII + * even without being told so (such IMEs already respect this flag in a + * sense), but there are cases when this is not the default. For instance, + * users of languages using a different script like Arabic, Greek, Hebrew or + * Russian typically have a keyboard that can't input ASCII characters by + * default. Applications need to be aware that the flag is not a guarantee, + * and some IMEs may not respect it. However, it is strongly recommended for + * IME authors to respect this flag especially when their IME could end up + * with a state where only languages using non-ASCII are enabled. + */ + IME_FLAG_FORCE_ASCII = 0x80000000, + + /** + * Flag of {@link #internalImeOptions}: flag is set when app window containing + * this + * {@link EditorInfo} is using {@link Configuration#ORIENTATION_PORTRAIT} + * mode. + * @hide + */ + IME_INTERNAL_FLAG_APP_WINDOW_PORTRAIT = 0x00000001, + + /** + * Generic unspecified type for {@link #imeOptions}. + */ + IME_NULL = 0x00000000, +}; + +#ifdef __cplusplus +} +#endif + +/** @} */ diff --git a/android-activity/android-games-sdk/game-text-input/prefab-src/modules/game-text-input/module.json b/android-activity/android-games-sdk/game-text-input/prefab-src/modules/game-text-input/module.json new file mode 100644 index 00000000..1a64fccd --- /dev/null +++ b/android-activity/android-games-sdk/game-text-input/prefab-src/modules/game-text-input/module.json @@ -0,0 +1,8 @@ +{ + "export_libraries": [], + "library_name": null, + "android": { + "export_libraries": null, + "library_name": null + } +} diff --git a/android-activity/android-games-sdk/game-text-input/prefab-src/modules/game-text-input/src/game-text-input/gametextinput.cpp b/android-activity/android-games-sdk/game-text-input/prefab-src/modules/game-text-input/src/game-text-input/gametextinput.cpp new file mode 100644 index 00000000..70a59389 --- /dev/null +++ b/android-activity/android-games-sdk/game-text-input/prefab-src/modules/game-text-input/src/game-text-input/gametextinput.cpp @@ -0,0 +1,386 @@ +/* + * Copyright (C) 2021 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "game-text-input/gametextinput.h" + +#include +#include +#include +#include + +#include +#include +#include +#include + +#define LOG_TAG "GameTextInput" + +static constexpr int32_t DEFAULT_MAX_STRING_SIZE = 1 << 16; + +// Cache of field ids in the Java GameTextInputState class +struct StateClassInfo { + jfieldID text; + jfieldID selectionStart; + jfieldID selectionEnd; + jfieldID composingRegionStart; + jfieldID composingRegionEnd; +}; + +// Main GameTextInput object. +struct GameTextInput { + public: + GameTextInput(JNIEnv *env, uint32_t max_string_size); + ~GameTextInput(); + void setState(const GameTextInputState &state); + GameTextInputState getState() const { + std::lock_guard lock(currentStateMutex_); + return currentState_; + } + void setInputConnection(jobject inputConnection); + void processEvent(jobject textInputEvent); + void showIme(uint32_t flags); + void hideIme(uint32_t flags); + void restartInput(); + void setEventCallback(GameTextInputEventCallback callback, void *context); + jobject stateToJava(const GameTextInputState &state) const; + void stateFromJava(jobject textInputEvent, + GameTextInputGetStateCallback callback, + void *context) const; + void setImeInsetsCallback(GameTextInputImeInsetsCallback callback, + void *context); + void processImeInsets(const ARect *insets); + const ARect &getImeInsets() const { return currentInsets_; } + + private: + // Copy string and set other fields + void setStateInner(const GameTextInputState &state); + static void processCallback(void *context, const GameTextInputState *state); + JNIEnv *env_ = nullptr; + // Cached at initialization from + // com/google/androidgamesdk/gametextinput/State. + jclass stateJavaClass_ = nullptr; + // The latest text input update. + GameTextInputState currentState_ = {}; + // A mutex to protect currentState_. + mutable std::mutex currentStateMutex_; + // An instance of gametextinput.InputConnection. + jclass inputConnectionClass_ = nullptr; + jobject inputConnection_ = nullptr; + jmethodID inputConnectionSetStateMethod_; + jmethodID setSoftKeyboardActiveMethod_; + jmethodID restartInputMethod_; + void (*eventCallback_)(void *context, + const struct GameTextInputState *state) = nullptr; + void *eventCallbackContext_ = nullptr; + void (*insetsCallback_)(void *context, const struct ARect *insets) = nullptr; + ARect currentInsets_ = {}; + void *insetsCallbackContext_ = nullptr; + StateClassInfo stateClassInfo_ = {}; + // Constant-sized buffer used to store state text. + std::vector stateStringBuffer_; +}; + +std::unique_ptr s_gameTextInput; + +extern "C" { + +/////////////////////////////////////////////////////////// +/// GameTextInputState C Functions +/////////////////////////////////////////////////////////// + +// Convert to a Java structure. +jobject currentState_toJava(const GameTextInput *gameTextInput, + const GameTextInputState *state) { + if (state == nullptr) return NULL; + return gameTextInput->stateToJava(*state); +} + +// Convert from Java structure. +void currentState_fromJava(const GameTextInput *gameTextInput, + jobject textInputEvent, + GameTextInputGetStateCallback callback, + void *context) { + gameTextInput->stateFromJava(textInputEvent, callback, context); +} + +/////////////////////////////////////////////////////////// +/// GameTextInput C Functions +/////////////////////////////////////////////////////////// + +struct GameTextInput *GameTextInput_init(JNIEnv *env, + uint32_t max_string_size) { + if (s_gameTextInput.get() != nullptr) { + __android_log_print(ANDROID_LOG_WARN, LOG_TAG, + "Warning: called GameTextInput_init twice without " + "calling GameTextInput_destroy"); + return s_gameTextInput.get(); + } + // Don't use make_unique, for C++11 compatibility + s_gameTextInput = + std::unique_ptr(new GameTextInput(env, max_string_size)); + return s_gameTextInput.get(); +} + +void GameTextInput_destroy(GameTextInput *input) { + if (input == nullptr || s_gameTextInput.get() == nullptr) return; + s_gameTextInput.reset(); +} + +void GameTextInput_setState(GameTextInput *input, + const GameTextInputState *state) { + if (state == nullptr) return; + input->setState(*state); +} + +void GameTextInput_getState(GameTextInput *input, + GameTextInputGetStateCallback callback, + void *context) { + GameTextInputState state = input->getState(); + callback(context, &state); +} + +void GameTextInput_setInputConnection(GameTextInput *input, + jobject inputConnection) { + input->setInputConnection(inputConnection); +} + +void GameTextInput_processEvent(GameTextInput *input, jobject textInputEvent) { + input->processEvent(textInputEvent); +} + +void GameTextInput_processImeInsets(GameTextInput *input, const ARect *insets) { + input->processImeInsets(insets); +} + +void GameTextInput_showIme(struct GameTextInput *input, uint32_t flags) { + input->showIme(flags); +} + +void GameTextInput_hideIme(struct GameTextInput *input, uint32_t flags) { + input->hideIme(flags); +} + +void GameTextInput_restartInput(struct GameTextInput *input) { + input->restartInput(); +} + +void GameTextInput_setEventCallback(struct GameTextInput *input, + GameTextInputEventCallback callback, + void *context) { + input->setEventCallback(callback, context); +} + +void GameTextInput_setImeInsetsCallback(struct GameTextInput *input, + GameTextInputImeInsetsCallback callback, + void *context) { + input->setImeInsetsCallback(callback, context); +} + +void GameTextInput_getImeInsets(const GameTextInput *input, ARect *insets) { + *insets = input->getImeInsets(); +} + +} // extern "C" + +/////////////////////////////////////////////////////////// +/// GameTextInput C++ class Implementation +/////////////////////////////////////////////////////////// + +GameTextInput::GameTextInput(JNIEnv *env, uint32_t max_string_size) + : env_(env), + stateStringBuffer_(max_string_size == 0 ? DEFAULT_MAX_STRING_SIZE + : max_string_size) { + stateJavaClass_ = (jclass)env_->NewGlobalRef( + env_->FindClass("com/google/androidgamesdk/gametextinput/State")); + inputConnectionClass_ = (jclass)env_->NewGlobalRef(env_->FindClass( + "com/google/androidgamesdk/gametextinput/InputConnection")); + inputConnectionSetStateMethod_ = + env_->GetMethodID(inputConnectionClass_, "setState", + "(Lcom/google/androidgamesdk/gametextinput/State;)V"); + setSoftKeyboardActiveMethod_ = env_->GetMethodID( + inputConnectionClass_, "setSoftKeyboardActive", "(ZI)V"); + restartInputMethod_ = + env_->GetMethodID(inputConnectionClass_, "restartInput", "()V"); + + stateClassInfo_.text = + env_->GetFieldID(stateJavaClass_, "text", "Ljava/lang/String;"); + stateClassInfo_.selectionStart = + env_->GetFieldID(stateJavaClass_, "selectionStart", "I"); + stateClassInfo_.selectionEnd = + env_->GetFieldID(stateJavaClass_, "selectionEnd", "I"); + stateClassInfo_.composingRegionStart = + env_->GetFieldID(stateJavaClass_, "composingRegionStart", "I"); + stateClassInfo_.composingRegionEnd = + env_->GetFieldID(stateJavaClass_, "composingRegionEnd", "I"); +} + +GameTextInput::~GameTextInput() { + if (stateJavaClass_ != NULL) { + env_->DeleteGlobalRef(stateJavaClass_); + stateJavaClass_ = NULL; + } + if (inputConnectionClass_ != NULL) { + env_->DeleteGlobalRef(inputConnectionClass_); + inputConnectionClass_ = NULL; + } + if (inputConnection_ != NULL) { + env_->DeleteGlobalRef(inputConnection_); + inputConnection_ = NULL; + } +} + +void GameTextInput::setState(const GameTextInputState &state) { + if (inputConnection_ == nullptr) return; + jobject jstate = stateToJava(state); + env_->CallVoidMethod(inputConnection_, inputConnectionSetStateMethod_, + jstate); + env_->DeleteLocalRef(jstate); + setStateInner(state); +} + +void GameTextInput::setStateInner(const GameTextInputState &state) { + std::lock_guard lock(currentStateMutex_); + + // Check if we're setting using our own string (other parts may be + // different) + if (state.text_UTF8 == currentState_.text_UTF8) { + currentState_ = state; + return; + } + // Otherwise, copy across the string. + auto bytes_needed = + std::min(static_cast(state.text_length + 1), + static_cast(stateStringBuffer_.size())); + currentState_.text_UTF8 = stateStringBuffer_.data(); + std::copy(state.text_UTF8, state.text_UTF8 + bytes_needed - 1, + stateStringBuffer_.data()); + currentState_.text_length = state.text_length; + currentState_.selection = state.selection; + currentState_.composingRegion = state.composingRegion; + stateStringBuffer_[bytes_needed - 1] = 0; +} + +void GameTextInput::setInputConnection(jobject inputConnection) { + if (inputConnection_ != NULL) { + env_->DeleteGlobalRef(inputConnection_); + } + inputConnection_ = env_->NewGlobalRef(inputConnection); +} + +/*static*/ void GameTextInput::processCallback( + void *context, const GameTextInputState *state) { + auto thiz = static_cast(context); + if (state != nullptr) thiz->setStateInner(*state); +} + +void GameTextInput::processEvent(jobject textInputEvent) { + stateFromJava(textInputEvent, processCallback, this); + if (eventCallback_) { + std::lock_guard lock(currentStateMutex_); + eventCallback_(eventCallbackContext_, ¤tState_); + } +} + +void GameTextInput::showIme(uint32_t flags) { + if (inputConnection_ == nullptr) return; + env_->CallVoidMethod(inputConnection_, setSoftKeyboardActiveMethod_, true, + static_cast(flags)); +} + +void GameTextInput::setEventCallback(GameTextInputEventCallback callback, + void *context) { + eventCallback_ = callback; + eventCallbackContext_ = context; +} + +void GameTextInput::setImeInsetsCallback( + GameTextInputImeInsetsCallback callback, void *context) { + insetsCallback_ = callback; + insetsCallbackContext_ = context; +} + +void GameTextInput::processImeInsets(const ARect *insets) { + currentInsets_ = *insets; + if (insetsCallback_) { + insetsCallback_(insetsCallbackContext_, ¤tInsets_); + } +} + +void GameTextInput::hideIme(uint32_t flags) { + if (inputConnection_ == nullptr) return; + env_->CallVoidMethod(inputConnection_, setSoftKeyboardActiveMethod_, false, + static_cast(flags)); +} + +void GameTextInput::restartInput() { + if (inputConnection_ == nullptr) return; + env_->CallVoidMethod(inputConnection_, restartInputMethod_); +} + +jobject GameTextInput::stateToJava(const GameTextInputState &state) const { + static jmethodID constructor = nullptr; + if (constructor == nullptr) { + constructor = env_->GetMethodID(stateJavaClass_, "", + "(Ljava/lang/String;IIII)V"); + if (constructor == nullptr) { + __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, + "Can't find gametextinput.State constructor"); + return nullptr; + } + } + const char *text = state.text_UTF8; + if (text == nullptr) { + static char empty_string[] = ""; + text = empty_string; + } + // Note that this expects 'modified' UTF-8 which is not the same as UTF-8 + // https://en.wikipedia.org/wiki/UTF-8#Modified_UTF-8 + jstring jtext = env_->NewStringUTF(text); + jobject jobj = + env_->NewObject(stateJavaClass_, constructor, jtext, + state.selection.start, state.selection.end, + state.composingRegion.start, state.composingRegion.end); + env_->DeleteLocalRef(jtext); + return jobj; +} + +void GameTextInput::stateFromJava(jobject textInputEvent, + GameTextInputGetStateCallback callback, + void *context) const { + jstring text = + (jstring)env_->GetObjectField(textInputEvent, stateClassInfo_.text); + // Note this is 'modified' UTF-8, not true UTF-8. It has no NULLs in it, + // except at the end. It's actually not specified whether the value returned + // by GetStringUTFChars includes a null at the end, but it *seems to* on + // Android. + const char *text_chars = env_->GetStringUTFChars(text, NULL); + int text_len = env_->GetStringUTFLength( + text); // Length in bytes, *not* including the null. + int selectionStart = + env_->GetIntField(textInputEvent, stateClassInfo_.selectionStart); + int selectionEnd = + env_->GetIntField(textInputEvent, stateClassInfo_.selectionEnd); + int composingRegionStart = + env_->GetIntField(textInputEvent, stateClassInfo_.composingRegionStart); + int composingRegionEnd = + env_->GetIntField(textInputEvent, stateClassInfo_.composingRegionEnd); + GameTextInputState state{text_chars, + text_len, + {selectionStart, selectionEnd}, + {composingRegionStart, composingRegionEnd}}; + callback(context, &state); + env_->ReleaseStringUTFChars(text, text_chars); + env_->DeleteLocalRef(text); +} diff --git a/android-activity/android-games-sdk/game-text-input/prefab-src/prefab.json b/android-activity/android-games-sdk/game-text-input/prefab-src/prefab.json new file mode 100644 index 00000000..5b3ea1ec --- /dev/null +++ b/android-activity/android-games-sdk/game-text-input/prefab-src/prefab.json @@ -0,0 +1,9 @@ +{ + "name": "game-text-input", + "schema_version": 1, + "dependencies": [], + "version": "0.0.1", + "cpp_files": [ + "src/game-text-input/gametextinput.cpp" + ] +} diff --git a/android-activity/android-games-sdk/import-games-sdk.sh b/android-activity/android-games-sdk/import-games-sdk.sh new file mode 100755 index 00000000..83bdf9f3 --- /dev/null +++ b/android-activity/android-games-sdk/import-games-sdk.sh @@ -0,0 +1,45 @@ +#!/bin/bash +set -xe + +# Copies the native, prefab-src for GameActivity + GameTextInput from the +# upstream, android-games-sdk, including our android-activity integration +# changes. +# +# This code is maintained out-of-tree, based on a fork of Google's AGDK repo, so +# it's more practical to try and upstream changes we make, or to rebase on new +# versions. + +if [ $# -ne 1 ]; then + echo "Usage: $0 " + exit 1 +fi + +SOURCE_DIR="$1" +TOP_DIR=$(git rev-parse --show-toplevel) +DEST_DIR="$TOP_DIR/android-activity/android-games-sdk" + +if [ ! -d "$SOURCE_DIR" ]; then + echo "Error: Source directory '$SOURCE_DIR' does not exist." + exit 1 +fi + +if [ ! -d "$DEST_DIR" ]; then + echo "Error: expected find destination directory $DEST_DIR" + exit 1 +fi + +rm -fr "$DEST_DIR/game-activity" +rm -fr "$DEST_DIR/game-text-input" +rm -fr "$DEST_DIR/src/common" +rm -fr "$DEST_DIR/include/common" + +mkdir -p "$DEST_DIR/game-activity" +mkdir -p "$DEST_DIR/game-text-input" +mkdir -p "$DEST_DIR/include/common" +mkdir -p "$DEST_DIR/src/common" + +cp -av "$SOURCE_DIR/game-activity/prefab-src" "$DEST_DIR/game-activity" +cp -av "$SOURCE_DIR/game-text-input/prefab-src" "$DEST_DIR/game-text-input" +cp -av "$SOURCE_DIR/include/common/gamesdk_common.h" "$DEST_DIR/include/common" +cp -av "$SOURCE_DIR/src/common/system_utils.h" "$DEST_DIR/src/common" +cp -av "$SOURCE_DIR/src/common/system_utils.cpp" "$DEST_DIR/src/common" \ No newline at end of file diff --git a/android-activity/android-games-sdk/include/common/gamesdk_common.h b/android-activity/android-games-sdk/include/common/gamesdk_common.h new file mode 100644 index 00000000..25ce8139 --- /dev/null +++ b/android-activity/android-games-sdk/include/common/gamesdk_common.h @@ -0,0 +1,42 @@ +/* + * Copyright 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * This is the main interface to the Android Performance Tuner library, also + * known as Tuning Fork. + * + * It is part of the Android Games SDK and produces best results when integrated + * with the Swappy Frame Pacing Library. + * + * See the documentation at + * https://developer.android.com/games/sdk/performance-tuner/custom-engine for + * more information on using this library in a native Android game. + * + */ + +#pragma once + +// There are separate versions for each GameSDK component that use this format: +#define ANDROID_GAMESDK_PACKED_VERSION(MAJOR, MINOR, BUGFIX) \ + ((MAJOR << 16) | (MINOR << 8) | (BUGFIX)) +// Accessors +#define ANDROID_GAMESDK_MAJOR_VERSION(PACKED) ((PACKED) >> 16) +#define ANDROID_GAMESDK_MINOR_VERSION(PACKED) (((PACKED) >> 8) & 0xff) +#define ANDROID_GAMESDK_BUGFIX_VERSION(PACKED) ((PACKED) & 0xff) + +#define AGDK_STRINGIFY(NUMBER) #NUMBER +#define AGDK_STRING_VERSION(MAJOR, MINOR, BUGFIX) \ + AGDK_STRINGIFY(MAJOR) "." AGDK_STRINGIFY(MINOR) "." AGDK_STRINGIFY(BUGFIX) diff --git a/android-activity/android-games-sdk/src/common/system_utils.cpp b/android-activity/android-games-sdk/src/common/system_utils.cpp new file mode 100644 index 00000000..efc5b743 --- /dev/null +++ b/android-activity/android-games-sdk/src/common/system_utils.cpp @@ -0,0 +1,72 @@ +/* + * Copyright 2021 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "system_utils.h" + +#include +#include +#include + +namespace gamesdk { + +#if __ANDROID_API__ >= 26 +std::string getSystemPropViaCallback(const char* key, + const char* default_value = "") { + const prop_info* prop = __system_property_find(key); + if (prop == nullptr) { + return default_value; + } + std::string return_value; + auto thunk = [](void* cookie, const char* /*name*/, const char* value, + uint32_t /*serial*/) { + if (value != nullptr) { + std::string* r = static_cast(cookie); + *r = value; + } + }; + __system_property_read_callback(prop, thunk, &return_value); + return return_value; +} +#else +std::string getSystemPropViaGet(const char* key, + const char* default_value = "") { + char buffer[PROP_VALUE_MAX + 1] = ""; // +1 for terminator + int bufferLen = __system_property_get(key, buffer); + if (bufferLen > 0) + return buffer; + else + return ""; +} +#endif + +std::string GetSystemProp(const char* key, const char* default_value) { +#if __ANDROID_API__ >= 26 + return getSystemPropViaCallback(key, default_value); +#else + return getSystemPropViaGet(key, default_value); +#endif +} + +int GetSystemPropAsInt(const char* key, int default_value) { + std::string prop = GetSystemProp(key); + return prop == "" ? default_value : strtoll(prop.c_str(), nullptr, 10); +} + +bool GetSystemPropAsBool(const char* key, bool default_value) { + return GetSystemPropAsInt(key, default_value) != 0; +} + +} // namespace gamesdk \ No newline at end of file diff --git a/android-activity/android-games-sdk/src/common/system_utils.h b/android-activity/android-games-sdk/src/common/system_utils.h new file mode 100644 index 00000000..488374bc --- /dev/null +++ b/android-activity/android-games-sdk/src/common/system_utils.h @@ -0,0 +1,32 @@ +/* + * Copyright 2021 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "string" + +namespace gamesdk { + +// Get the value of the given system property +std::string GetSystemProp(const char* key, const char* default_value = ""); + +// Get the value of the given system property as an integer +int GetSystemPropAsInt(const char* key, int default_value = 0); + +// Get the value of the given system property as a bool +bool GetSystemPropAsBool(const char* key, bool default_value = false); + +} // namespace gamesdk \ No newline at end of file diff --git a/android-activity/build.rs b/android-activity/build.rs index 6b08f62e..94e44b52 100644 --- a/android-activity/build.rs +++ b/android-activity/build.rs @@ -1,23 +1,87 @@ -#![allow(dead_code)] - fn build_glue_for_game_activity() { + let android_games_sdk = + std::env::var("ANDROID_GAMES_SDK").unwrap_or_else(|_err| "android-games-sdk".to_string()); + + let activity_path = |src_inc, name| { + format!("{android_games_sdk}/game-activity/prefab-src/modules/game-activity/{src_inc}/game-activity/{name}") + }; + let textinput_path = |src_inc, name| { + format!("{android_games_sdk}/game-text-input/prefab-src/modules/game-text-input/{src_inc}/game-text-input/{name}") + }; + + for f in ["GameActivity.cpp", "GameActivityEvents.cpp"] { + println!("cargo:rerun-if-changed={}", activity_path("src", f)); + } + + for f in [ + "GameActivity.h", + "GameActivityEvents.h", + "GameActivityLog.h", + "GameActivityEvents_internal.h", + ] { + println!("cargo:rerun-if-changed={}", activity_path("include", f)); + } + cc::Build::new() .cpp(true) - .include("game-activity-csrc") - .file("game-activity-csrc/game-activity/GameActivity.cpp") + .include("android-games-sdk/src/common") + .file("android-games-sdk/src/common/system_utils.cpp") + .extra_warnings(false) + .cpp_link_stdlib("c++_static") + .compile("libgame_common.a"); + + println!("cargo:rerun-if-changed=android-games-sdk/src/common/system_utils.cpp"); + println!("cargo:rerun-if-changed=android-games-sdk/src/common/system_utils.h"); + + cc::Build::new() + .cpp(true) + .include("android-games-sdk/src/common") + .include("android-games-sdk/include") + .include("android-games-sdk/game-activity/prefab-src/modules/game-activity/include") + .include("android-games-sdk/game-text-input/prefab-src/modules/game-text-input/include") + .file(activity_path("src", "GameActivity.cpp")) + .file(activity_path("src", "GameActivityEvents.cpp")) .extra_warnings(false) .cpp_link_stdlib("c++_static") .compile("libgame_activity.a"); + + println!( + "cargo:rerun-if-changed={}", + textinput_path("include", "gametextinput.h") + ); + println!( + "cargo:rerun-if-changed={}", + textinput_path("src", "gametextinput.cpp") + ); + cc::Build::new() .cpp(true) - .include("game-activity-csrc") - .file("game-activity-csrc/game-text-input/gametextinput.cpp") + .include("android-games-sdk/src/common") + .include("android-games-sdk/include") + .include("android-games-sdk/game-text-input/prefab-src/modules/game-text-input/include") + .file(textinput_path("src", "gametextinput.cpp")) .cpp_link_stdlib("c++_static") .compile("libgame_text_input.a"); + + println!( + "cargo:rerun-if-changed={}", + activity_path("src", "native_app_glue/android_native_app_glue.c") + ); + println!( + "cargo:rerun-if-changed={}", + activity_path("include", "native_app_glue/android_native_app_glue.h") + ); + cc::Build::new() - .include("game-activity-csrc") - .include("game-activity-csrc/game-activity/native_app_glue") - .file("game-activity-csrc/game-activity/native_app_glue/android_native_app_glue.c") + .include("android-games-sdk/src/common") + .include("android-games-sdk/include") + .include("android-games-sdk/game-activity/prefab-src/modules/game-activity/include") + .include("android-games-sdk/game-text-input/prefab-src/modules/game-text-input/include") + .include(activity_path("include", "")) + .file(activity_path( + "src", + "native_app_glue/android_native_app_glue.c", + )) .extra_warnings(false) .cpp_link_stdlib("c++_static") .compile("libnative_app_glue.a"); @@ -28,6 +92,21 @@ fn build_glue_for_game_activity() { } fn main() { - #[cfg(feature = "game-activity")] - build_glue_for_game_activity(); + // Enable Cargo's change-detection to avoid re-running build script if + // irrelvant parts changed. Using build.rs here is just a dummy used to + // disable the default "rerun on every change" behaviour Cargo has. + println!("cargo:rerun-if-changed=build.rs"); + + if cfg!(feature = "game-activity") { + build_glue_for_game_activity(); + } + + // Whether this is used directly in or as a dependency on docs.rs. + // + // `cfg(docsrs)` cannot be used, since it's only set for the crate being + // built, and not for any dependent crates. + println!("cargo:rustc-check-cfg=cfg(used_on_docsrs)"); + if std::env::var("DOCS_RS").is_ok() { + println!("cargo:rustc-cfg=used_on_docsrs"); + } } diff --git a/android-activity/game-activity-csrc/game-activity/GameActivity.cpp b/android-activity/game-activity-csrc/game-activity/GameActivity.cpp deleted file mode 100644 index a139696f..00000000 --- a/android-activity/game-activity-csrc/game-activity/GameActivity.cpp +++ /dev/null @@ -1,1398 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#define LOG_TAG "GameActivity" - -#include "GameActivity.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -// TODO(b/187147166): these functions were extracted from the Game SDK -// (gamesdk/src/common/system_utils.h). system_utils.h/cpp should be used -// instead. -namespace { - -#if __ANDROID_API__ >= 26 -std::string getSystemPropViaCallback(const char *key, - const char *default_value = "") { - const prop_info *prop = __system_property_find(key); - if (prop == nullptr) { - return default_value; - } - std::string return_value; - auto thunk = [](void *cookie, const char * /*name*/, const char *value, - uint32_t /*serial*/) { - if (value != nullptr) { - std::string *r = static_cast(cookie); - *r = value; - } - }; - __system_property_read_callback(prop, thunk, &return_value); - return return_value; -} -#else -std::string getSystemPropViaGet(const char *key, - const char *default_value = "") { - char buffer[PROP_VALUE_MAX + 1] = ""; // +1 for terminator - int bufferLen = __system_property_get(key, buffer); - if (bufferLen > 0) - return buffer; - else - return ""; -} -#endif - -std::string GetSystemProp(const char *key, const char *default_value = "") { -#if __ANDROID_API__ >= 26 - return getSystemPropViaCallback(key, default_value); -#else - return getSystemPropViaGet(key, default_value); -#endif -} - -int GetSystemPropAsInt(const char *key, int default_value = 0) { - std::string prop = GetSystemProp(key); - return prop == "" ? default_value : strtoll(prop.c_str(), nullptr, 10); -} - -struct OwnedGameTextInputState { - OwnedGameTextInputState &operator=(const GameTextInputState &rhs) { - inner = rhs; - owned_string = std::string(rhs.text_UTF8, rhs.text_length); - inner.text_UTF8 = owned_string.data(); - return *this; - } - GameTextInputState inner; - std::string owned_string; -}; - -} // anonymous namespace - -#define ALOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__); -#define ALOGW(...) __android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__); -#define ALOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__); -#ifdef NDEBUG -#define ALOGV(...) -#else -#define ALOGV(...) \ - __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__); -#endif - -/* Returns 2nd arg. Used to substitute default value if caller's vararg list - * is empty. - */ -#define __android_second(first, second, ...) second - -/* If passed multiple args, returns ',' followed by all but 1st arg, otherwise - * returns nothing. - */ -#define __android_rest(first, ...) , ##__VA_ARGS__ - -#define android_printAssert(cond, tag, fmt...) \ - __android_log_assert(cond, tag, \ - __android_second(0, ##fmt, NULL) __android_rest(fmt)) - -#define CONDITION(cond) (__builtin_expect((cond) != 0, 0)) - -#ifndef LOG_ALWAYS_FATAL_IF -#define LOG_ALWAYS_FATAL_IF(cond, ...) \ - ((CONDITION(cond)) \ - ? ((void)android_printAssert(#cond, LOG_TAG, ##__VA_ARGS__)) \ - : (void)0) -#endif - -#ifndef LOG_ALWAYS_FATAL -#define LOG_ALWAYS_FATAL(...) \ - (((void)android_printAssert(NULL, LOG_TAG, ##__VA_ARGS__))) -#endif - -/* - * Simplified macro to send a warning system log message using current LOG_TAG. - */ -#ifndef SLOGW -#define SLOGW(...) \ - ((void)__android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__)) -#endif - -#ifndef SLOGW_IF -#define SLOGW_IF(cond, ...) \ - ((__predict_false(cond)) \ - ? ((void)__android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__)) \ - : (void)0) -#endif - -/* - * Versions of LOG_ALWAYS_FATAL_IF and LOG_ALWAYS_FATAL that - * are stripped out of release builds. - */ -#if LOG_NDEBUG - -#ifndef LOG_FATAL_IF -#define LOG_FATAL_IF(cond, ...) ((void)0) -#endif -#ifndef LOG_FATAL -#define LOG_FATAL(...) ((void)0) -#endif - -#else - -#ifndef LOG_FATAL_IF -#define LOG_FATAL_IF(cond, ...) LOG_ALWAYS_FATAL_IF(cond, ##__VA_ARGS__) -#endif -#ifndef LOG_FATAL -#define LOG_FATAL(...) LOG_ALWAYS_FATAL(__VA_ARGS__) -#endif - -#endif - -/* - * Assertion that generates a log message when the assertion fails. - * Stripped out of release builds. Uses the current LOG_TAG. - */ -#ifndef ALOG_ASSERT -#define ALOG_ASSERT(cond, ...) LOG_FATAL_IF(!(cond), ##__VA_ARGS__) -#endif - -#define LOG_TRACE(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__) - -#ifndef NELEM -#define NELEM(x) ((int)(sizeof(x) / sizeof((x)[0]))) -#endif - -/* - * JNI methods of the GameActivity Java class. - */ -static struct { - jmethodID finish; - jmethodID setWindowFlags; - jmethodID getWindowInsets; - jmethodID getWaterfallInsets; - jmethodID setImeEditorInfoFields; -} gGameActivityClassInfo; - -/* - * JNI fields of the androidx.core.graphics.Insets Java class. - */ -static struct { - jfieldID left; - jfieldID right; - jfieldID top; - jfieldID bottom; -} gInsetsClassInfo; - -/* - * JNI methods of the WindowInsetsCompat.Type Java class. - */ -static struct { - jmethodID methods[GAMECOMMON_INSETS_TYPE_COUNT]; - jclass clazz; -} gWindowInsetsCompatTypeClassInfo; - -/* - * Contains a command to be executed by the GameActivity - * on the application main thread. - */ -struct ActivityWork { - int32_t cmd; - int64_t arg1; - int64_t arg2; -}; - -/* - * The type of commands that can be passed to the GameActivity and that - * are executed on the application main thread. - */ -enum { - CMD_FINISH = 1, - CMD_SET_WINDOW_FORMAT, - CMD_SET_WINDOW_FLAGS, - CMD_SHOW_SOFT_INPUT, - CMD_HIDE_SOFT_INPUT, - CMD_SET_SOFT_INPUT_STATE -}; - -/* - * Write a command to be executed by the GameActivity on the application main - * thread. - */ -static void write_work(int fd, int32_t cmd, int64_t arg1 = 0, - int64_t arg2 = 0) { - ActivityWork work; - work.cmd = cmd; - work.arg1 = arg1; - work.arg2 = arg2; - - LOG_TRACE("write_work: cmd=%d", cmd); -restart: - int res = write(fd, &work, sizeof(work)); - if (res < 0 && errno == EINTR) { - goto restart; - } - - if (res == sizeof(work)) return; - - if (res < 0) { - ALOGW("Failed writing to work fd: %s", strerror(errno)); - } else { - ALOGW("Truncated writing to work fd: %d", res); - } -} - -/* - * Read commands to be executed by the GameActivity on the application main - * thread. - */ -static bool read_work(int fd, ActivityWork *outWork) { - int res = read(fd, outWork, sizeof(ActivityWork)); - // no need to worry about EINTR, poll loop will just come back again. - if (res == sizeof(ActivityWork)) return true; - - if (res < 0) { - ALOGW("Failed reading work fd: %s", strerror(errno)); - } else { - ALOGW("Truncated reading work fd: %d", res); - } - return false; -} - -/* - * Native state for interacting with the GameActivity class. - */ -struct NativeCode : public GameActivity { - NativeCode(void *_dlhandle, GameActivity_createFunc *_createFunc) { - memset((GameActivity *)this, 0, sizeof(GameActivity)); - memset(&callbacks, 0, sizeof(callbacks)); - memset(&insetsState, 0, sizeof(insetsState)); - dlhandle = _dlhandle; - createActivityFunc = _createFunc; - nativeWindow = NULL; - mainWorkRead = mainWorkWrite = -1; - gameTextInput = NULL; - } - - ~NativeCode() { - if (callbacks.onDestroy != NULL) { - callbacks.onDestroy(this); - } - if (env != NULL) { - if (javaGameActivity != NULL) { - env->DeleteGlobalRef(javaGameActivity); - } - if (javaAssetManager != NULL) { - env->DeleteGlobalRef(javaAssetManager); - } - } - GameTextInput_destroy(gameTextInput); - if (looper != NULL && mainWorkRead >= 0) { - ALooper_removeFd(looper, mainWorkRead); - } - ALooper_release(looper); - looper = NULL; - - setSurface(NULL); - if (mainWorkRead >= 0) close(mainWorkRead); - if (mainWorkWrite >= 0) close(mainWorkWrite); - if (dlhandle != NULL) { - // for now don't unload... we probably should clean this - // up and only keep one open dlhandle per proc, since there - // is really no benefit to unloading the code. - // dlclose(dlhandle); - } - } - - void setSurface(jobject _surface) { - if (nativeWindow != NULL) { - ANativeWindow_release(nativeWindow); - } - if (_surface != NULL) { - nativeWindow = ANativeWindow_fromSurface(env, _surface); - } else { - nativeWindow = NULL; - } - } - - GameActivityCallbacks callbacks; - - void *dlhandle; - GameActivity_createFunc *createActivityFunc; - - std::string internalDataPathObj; - std::string externalDataPathObj; - std::string obbPathObj; - - ANativeWindow *nativeWindow; - int32_t lastWindowWidth; - int32_t lastWindowHeight; - - // These are used to wake up the main thread to process work. - int mainWorkRead; - int mainWorkWrite; - ALooper *looper; - - // Need to hold on to a reference here in case the upper layers destroy our - // AssetManager. - jobject javaAssetManager; - - GameTextInput *gameTextInput; - // Set by users in GameActivity_setTextInputState, then passed to - // GameTextInput. - OwnedGameTextInputState gameTextInputState; - std::mutex gameTextInputStateMutex; - - ARect insetsState[GAMECOMMON_INSETS_TYPE_COUNT]; -}; - -extern "C" void GameActivity_finish(GameActivity *activity) { - NativeCode *code = static_cast(activity); - write_work(code->mainWorkWrite, CMD_FINISH, 0); -} - -extern "C" void GameActivity_setWindowFlags(GameActivity *activity, - uint32_t values, uint32_t mask) { - NativeCode *code = static_cast(activity); - write_work(code->mainWorkWrite, CMD_SET_WINDOW_FLAGS, values, mask); -} - -extern "C" void GameActivity_showSoftInput(GameActivity *activity, - uint32_t flags) { - NativeCode *code = static_cast(activity); - write_work(code->mainWorkWrite, CMD_SHOW_SOFT_INPUT, flags); -} - -extern "C" void GameActivity_setTextInputState( - GameActivity *activity, const GameTextInputState *state) { - NativeCode *code = static_cast(activity); - std::lock_guard lock(code->gameTextInputStateMutex); - code->gameTextInputState = *state; - write_work(code->mainWorkWrite, CMD_SET_SOFT_INPUT_STATE); -} - -extern "C" void GameActivity_getTextInputState( - GameActivity *activity, GameTextInputGetStateCallback callback, - void *context) { - NativeCode *code = static_cast(activity); - return GameTextInput_getState(code->gameTextInput, callback, context); -} - -extern "C" void GameActivity_hideSoftInput(GameActivity *activity, - uint32_t flags) { - NativeCode *code = static_cast(activity); - write_work(code->mainWorkWrite, CMD_HIDE_SOFT_INPUT, flags); -} - -extern "C" void GameActivity_getWindowInsets(GameActivity *activity, - GameCommonInsetsType type, - ARect *insets) { - if (type < 0 || type >= GAMECOMMON_INSETS_TYPE_COUNT) return; - NativeCode *code = static_cast(activity); - *insets = code->insetsState[type]; -} - -extern "C" GameTextInput *GameActivity_getTextInput( - const GameActivity *activity) { - const NativeCode *code = static_cast(activity); - return code->gameTextInput; -} - -/* - * Log the JNI exception, if any. - */ -static void checkAndClearException(JNIEnv *env, const char *methodName) { - if (env->ExceptionCheck()) { - ALOGE("Exception while running %s", methodName); - env->ExceptionDescribe(); - env->ExceptionClear(); - } -} - -/* - * Callback for handling native events on the application's main thread. - */ -static int mainWorkCallback(int fd, int events, void *data) { - ALOGD("************** mainWorkCallback *********"); - NativeCode *code = (NativeCode *)data; - if ((events & POLLIN) == 0) { - return 1; - } - - ActivityWork work; - if (!read_work(code->mainWorkRead, &work)) { - return 1; - } - LOG_TRACE("mainWorkCallback: cmd=%d", work.cmd); - switch (work.cmd) { - case CMD_FINISH: { - code->env->CallVoidMethod(code->javaGameActivity, - gGameActivityClassInfo.finish); - checkAndClearException(code->env, "finish"); - } break; - case CMD_SET_WINDOW_FLAGS: { - code->env->CallVoidMethod(code->javaGameActivity, - gGameActivityClassInfo.setWindowFlags, - work.arg1, work.arg2); - checkAndClearException(code->env, "setWindowFlags"); - } break; - case CMD_SHOW_SOFT_INPUT: { - GameTextInput_showIme(code->gameTextInput, work.arg1); - } break; - case CMD_SET_SOFT_INPUT_STATE: { - std::lock_guard lock(code->gameTextInputStateMutex); - GameTextInput_setState(code->gameTextInput, - &code->gameTextInputState.inner); - checkAndClearException(code->env, "setTextInputState"); - } break; - case CMD_HIDE_SOFT_INPUT: { - GameTextInput_hideIme(code->gameTextInput, work.arg1); - } break; - default: - ALOGW("Unknown work command: %d", work.cmd); - break; - } - - return 1; -} - -// ------------------------------------------------------------------------ - -static thread_local std::string g_error_msg; - -static jlong loadNativeCode_native(JNIEnv *env, jobject javaGameActivity, - jstring path, jstring funcName, - jstring internalDataDir, jstring obbDir, - jstring externalDataDir, jobject jAssetMgr, - jbyteArray savedState) { - LOG_TRACE("loadNativeCode_native"); - const char *pathStr = env->GetStringUTFChars(path, NULL); - NativeCode *code = NULL; - - void *handle = dlopen(pathStr, RTLD_LAZY); - - env->ReleaseStringUTFChars(path, pathStr); - - if (handle == nullptr) { - g_error_msg = dlerror(); - ALOGE("GameActivity dlopen(\"%s\") failed: %s", pathStr, - g_error_msg.c_str()); - return 0; - } - - const char *funcStr = env->GetStringUTFChars(funcName, NULL); - code = new NativeCode(handle, - (GameActivity_createFunc *)dlsym(handle, funcStr)); - env->ReleaseStringUTFChars(funcName, funcStr); - - if (code->createActivityFunc == nullptr) { - g_error_msg = dlerror(); - ALOGW("GameActivity_onCreate not found: %s", g_error_msg.c_str()); - delete code; - return 0; - } - - code->looper = ALooper_forThread(); - if (code->looper == nullptr) { - g_error_msg = "Unable to retrieve native ALooper"; - ALOGW("%s", g_error_msg.c_str()); - delete code; - return 0; - } - ALooper_acquire(code->looper); - - int msgpipe[2]; - if (pipe(msgpipe)) { - g_error_msg = "could not create pipe: "; - g_error_msg += strerror(errno); - - ALOGW("%s", g_error_msg.c_str()); - delete code; - return 0; - } - code->mainWorkRead = msgpipe[0]; - code->mainWorkWrite = msgpipe[1]; - int result = fcntl(code->mainWorkRead, F_SETFL, O_NONBLOCK); - SLOGW_IF(result != 0, - "Could not make main work read pipe " - "non-blocking: %s", - strerror(errno)); - result = fcntl(code->mainWorkWrite, F_SETFL, O_NONBLOCK); - SLOGW_IF(result != 0, - "Could not make main work write pipe " - "non-blocking: %s", - strerror(errno)); - ALooper_addFd(code->looper, code->mainWorkRead, 0, ALOOPER_EVENT_INPUT, - mainWorkCallback, code); - - code->GameActivity::callbacks = &code->callbacks; - if (env->GetJavaVM(&code->vm) < 0) { - ALOGW("GameActivity GetJavaVM failed"); - delete code; - return 0; - } - code->env = env; - code->javaGameActivity = env->NewGlobalRef(javaGameActivity); - - const char *dirStr = - internalDataDir ? env->GetStringUTFChars(internalDataDir, NULL) : ""; - code->internalDataPathObj = dirStr; - code->internalDataPath = code->internalDataPathObj.c_str(); - if (internalDataDir) env->ReleaseStringUTFChars(internalDataDir, dirStr); - - dirStr = - externalDataDir ? env->GetStringUTFChars(externalDataDir, NULL) : ""; - code->externalDataPathObj = dirStr; - code->externalDataPath = code->externalDataPathObj.c_str(); - if (externalDataDir) env->ReleaseStringUTFChars(externalDataDir, dirStr); - - code->javaAssetManager = env->NewGlobalRef(jAssetMgr); - code->assetManager = AAssetManager_fromJava(env, jAssetMgr); - - dirStr = obbDir ? env->GetStringUTFChars(obbDir, NULL) : ""; - code->obbPathObj = dirStr; - code->obbPath = code->obbPathObj.c_str(); - if (obbDir) env->ReleaseStringUTFChars(obbDir, dirStr); - - jbyte *rawSavedState = NULL; - jsize rawSavedSize = 0; - if (savedState != NULL) { - rawSavedState = env->GetByteArrayElements(savedState, NULL); - rawSavedSize = env->GetArrayLength(savedState); - } - code->createActivityFunc(code, rawSavedState, rawSavedSize); - - code->gameTextInput = GameTextInput_init(env, 0); - GameTextInput_setEventCallback(code->gameTextInput, - reinterpret_cast( - code->callbacks.onTextInputEvent), - code); - - if (rawSavedState != NULL) { - env->ReleaseByteArrayElements(savedState, rawSavedState, 0); - } - - return reinterpret_cast(code); -} - -static jstring getDlError_native(JNIEnv *env, jobject javaGameActivity) { - jstring result = env->NewStringUTF(g_error_msg.c_str()); - g_error_msg.clear(); - return result; -} - -static void unloadNativeCode_native(JNIEnv *env, jobject javaGameActivity, - jlong handle) { - LOG_TRACE("unloadNativeCode_native"); - if (handle != 0) { - NativeCode *code = (NativeCode *)handle; - delete code; - } -} - -static void onStart_native(JNIEnv *env, jobject javaGameActivity, - jlong handle) { - ALOGV("onStart_native"); - if (handle != 0) { - NativeCode *code = (NativeCode *)handle; - if (code->callbacks.onStart != NULL) { - code->callbacks.onStart(code); - } - } -} - -static void onResume_native(JNIEnv *env, jobject javaGameActivity, - jlong handle) { - LOG_TRACE("onResume_native"); - if (handle != 0) { - NativeCode *code = (NativeCode *)handle; - if (code->callbacks.onResume != NULL) { - code->callbacks.onResume(code); - } - } -} - -struct SaveInstanceLocals { - JNIEnv *env; - jbyteArray array; -}; - -static jbyteArray onSaveInstanceState_native(JNIEnv *env, - jobject javaGameActivity, - jlong handle) { - LOG_TRACE("onSaveInstanceState_native"); - - SaveInstanceLocals locals{ - env, NULL}; // Passed through the user's state prep function. - - if (handle != 0) { - NativeCode *code = (NativeCode *)handle; - if (code->callbacks.onSaveInstanceState != NULL) { - code->callbacks.onSaveInstanceState( - code, - [](const char *bytes, int len, void *context) { - auto locals = static_cast(context); - if (len > 0) { - locals->array = locals->env->NewByteArray(len); - if (locals->array != NULL) { - locals->env->SetByteArrayRegion( - locals->array, 0, len, (const jbyte *)bytes); - } - } - }, - &locals); - } - } - return locals.array; -} - -static void onPause_native(JNIEnv *env, jobject javaGameActivity, - jlong handle) { - LOG_TRACE("onPause_native"); - if (handle != 0) { - NativeCode *code = (NativeCode *)handle; - if (code->callbacks.onPause != NULL) { - code->callbacks.onPause(code); - } - } -} - -static void onStop_native(JNIEnv *env, jobject javaGameActivity, jlong handle) { - LOG_TRACE("onStop_native"); - if (handle != 0) { - NativeCode *code = (NativeCode *)handle; - if (code->callbacks.onStop != NULL) { - code->callbacks.onStop(code); - } - } -} - -static void onConfigurationChanged_native(JNIEnv *env, jobject javaGameActivity, - jlong handle) { - LOG_TRACE("onConfigurationChanged_native"); - if (handle != 0) { - NativeCode *code = (NativeCode *)handle; - if (code->callbacks.onConfigurationChanged != NULL) { - code->callbacks.onConfigurationChanged(code); - } - } -} - -static void onTrimMemory_native(JNIEnv *env, jobject javaGameActivity, - jlong handle, jint level) { - LOG_TRACE("onTrimMemory_native"); - if (handle != 0) { - NativeCode *code = (NativeCode *)handle; - if (code->callbacks.onTrimMemory != NULL) { - code->callbacks.onTrimMemory(code, level); - } - } -} - -static void onWindowFocusChanged_native(JNIEnv *env, jobject javaGameActivity, - jlong handle, jboolean focused) { - LOG_TRACE("onWindowFocusChanged_native"); - if (handle != 0) { - NativeCode *code = (NativeCode *)handle; - if (code->callbacks.onWindowFocusChanged != NULL) { - code->callbacks.onWindowFocusChanged(code, focused ? 1 : 0); - } - } -} - -static void onSurfaceCreated_native(JNIEnv *env, jobject javaGameActivity, - jlong handle, jobject surface) { - ALOGV("onSurfaceCreated_native"); - LOG_TRACE("onSurfaceCreated_native"); - if (handle != 0) { - NativeCode *code = (NativeCode *)handle; - code->setSurface(surface); - - if (code->nativeWindow != NULL && - code->callbacks.onNativeWindowCreated != NULL) { - code->callbacks.onNativeWindowCreated(code, code->nativeWindow); - } - } -} - -static void onSurfaceChanged_native(JNIEnv *env, jobject javaGameActivity, - jlong handle, jobject surface, jint format, - jint width, jint height) { - LOG_TRACE("onSurfaceChanged_native"); - if (handle != 0) { - NativeCode *code = (NativeCode *)handle; - ANativeWindow *oldNativeWindow = code->nativeWindow; - // Fix for window being destroyed behind the scenes on older Android - // versions. - if (oldNativeWindow != NULL) { - ANativeWindow_acquire(oldNativeWindow); - } - code->setSurface(surface); - if (oldNativeWindow != code->nativeWindow) { - if (oldNativeWindow != NULL && - code->callbacks.onNativeWindowDestroyed != NULL) { - code->callbacks.onNativeWindowDestroyed(code, oldNativeWindow); - } - if (code->nativeWindow != NULL) { - if (code->callbacks.onNativeWindowCreated != NULL) { - code->callbacks.onNativeWindowCreated(code, - code->nativeWindow); - } - - code->lastWindowWidth = - ANativeWindow_getWidth(code->nativeWindow); - code->lastWindowHeight = - ANativeWindow_getHeight(code->nativeWindow); - } - } else { - // Maybe it was resized? - int32_t newWidth = ANativeWindow_getWidth(code->nativeWindow); - int32_t newHeight = ANativeWindow_getHeight(code->nativeWindow); - if (newWidth != code->lastWindowWidth || - newHeight != code->lastWindowHeight) { - if (code->callbacks.onNativeWindowResized != NULL) { - code->callbacks.onNativeWindowResized( - code, code->nativeWindow, newWidth, newHeight); - } - } - } - // Release the window we acquired earlier. - if (oldNativeWindow != NULL) { - ANativeWindow_release(oldNativeWindow); - } - } -} - -static void onSurfaceRedrawNeeded_native(JNIEnv *env, jobject javaGameActivity, - jlong handle) { - LOG_TRACE("onSurfaceRedrawNeeded_native"); - if (handle != 0) { - NativeCode *code = (NativeCode *)handle; - if (code->nativeWindow != NULL && - code->callbacks.onNativeWindowRedrawNeeded != NULL) { - code->callbacks.onNativeWindowRedrawNeeded(code, - code->nativeWindow); - } - } -} - -static void onSurfaceDestroyed_native(JNIEnv *env, jobject javaGameActivity, - jlong handle) { - LOG_TRACE("onSurfaceDestroyed_native"); - if (handle != 0) { - NativeCode *code = (NativeCode *)handle; - if (code->nativeWindow != NULL && - code->callbacks.onNativeWindowDestroyed != NULL) { - code->callbacks.onNativeWindowDestroyed(code, code->nativeWindow); - } - code->setSurface(NULL); - } -} - -static bool enabledAxes[GAME_ACTIVITY_POINTER_INFO_AXIS_COUNT] = { - /* AMOTION_EVENT_AXIS_X */ true, - /* AMOTION_EVENT_AXIS_Y */ true, - // Disable all other axes by default (they can be enabled using - // `GameActivityPointerAxes_enableAxis`). - false}; - -extern "C" void GameActivityPointerAxes_enableAxis(int32_t axis) { - if (axis < 0 || axis >= GAME_ACTIVITY_POINTER_INFO_AXIS_COUNT) { - return; - } - - enabledAxes[axis] = true; -} - -extern "C" void GameActivityPointerAxes_disableAxis(int32_t axis) { - if (axis < 0 || axis >= GAME_ACTIVITY_POINTER_INFO_AXIS_COUNT) { - return; - } - - enabledAxes[axis] = false; -} - -static bool enabledHistoricalAxes[GAME_ACTIVITY_POINTER_INFO_AXIS_COUNT] = { - // Disable all axes by default (they can be enabled using - // `GameActivityPointerAxes_enableHistoricalAxis`). - false}; - -extern "C" void GameActivityHistoricalPointerAxes_enableAxis(int32_t axis) { - if (axis < 0 || axis >= GAME_ACTIVITY_POINTER_INFO_AXIS_COUNT) { - return; - } - - enabledHistoricalAxes[axis] = true; -} - -extern "C" void GameActivityHistoricalPointerAxes_disableAxis(int32_t axis) { - if (axis < 0 || axis >= GAME_ACTIVITY_POINTER_INFO_AXIS_COUNT) { - return; - } - - enabledHistoricalAxes[axis] = false; -} - -extern "C" void GameActivity_setImeEditorInfo(GameActivity *activity, - int inputType, int actionId, - int imeOptions) { - JNIEnv *env; - if (activity->vm->AttachCurrentThread(&env, NULL) == JNI_OK) { - env->CallVoidMethod(activity->javaGameActivity, - gGameActivityClassInfo.setImeEditorInfoFields, - inputType, actionId, imeOptions); - } -} - -static struct { - jmethodID getDeviceId; - jmethodID getSource; - jmethodID getAction; - - jmethodID getEventTime; - jmethodID getDownTime; - - jmethodID getFlags; - jmethodID getMetaState; - - jmethodID getActionButton; - jmethodID getButtonState; - jmethodID getClassification; - jmethodID getEdgeFlags; - - jmethodID getPointerCount; - jmethodID getPointerId; - jmethodID getToolType; - jmethodID getRawX; - jmethodID getRawY; - jmethodID getXPrecision; - jmethodID getYPrecision; - jmethodID getAxisValue; - - jmethodID getHistorySize; - jmethodID getHistoricalEventTime; - jmethodID getHistoricalAxisValue; -} gMotionEventClassInfo; - -extern "C" int GameActivityMotionEvent_fromJava( - JNIEnv *env, jobject motionEvent, GameActivityMotionEvent *out_event, - GameActivityHistoricalPointerAxes *out_historical) { - static bool gMotionEventClassInfoInitialized = false; - if (!gMotionEventClassInfoInitialized) { - int sdkVersion = GetSystemPropAsInt("ro.build.version.sdk"); - gMotionEventClassInfo = {0}; - jclass motionEventClass = env->FindClass("android/view/MotionEvent"); - gMotionEventClassInfo.getDeviceId = - env->GetMethodID(motionEventClass, "getDeviceId", "()I"); - gMotionEventClassInfo.getSource = - env->GetMethodID(motionEventClass, "getSource", "()I"); - gMotionEventClassInfo.getAction = - env->GetMethodID(motionEventClass, "getAction", "()I"); - gMotionEventClassInfo.getEventTime = - env->GetMethodID(motionEventClass, "getEventTime", "()J"); - gMotionEventClassInfo.getDownTime = - env->GetMethodID(motionEventClass, "getDownTime", "()J"); - gMotionEventClassInfo.getFlags = - env->GetMethodID(motionEventClass, "getFlags", "()I"); - gMotionEventClassInfo.getMetaState = - env->GetMethodID(motionEventClass, "getMetaState", "()I"); - if (sdkVersion >= 23) { - gMotionEventClassInfo.getActionButton = - env->GetMethodID(motionEventClass, "getActionButton", "()I"); - } - if (sdkVersion >= 14) { - gMotionEventClassInfo.getButtonState = - env->GetMethodID(motionEventClass, "getButtonState", "()I"); - } - if (sdkVersion >= 29) { - gMotionEventClassInfo.getClassification = - env->GetMethodID(motionEventClass, "getClassification", "()I"); - } - gMotionEventClassInfo.getEdgeFlags = - env->GetMethodID(motionEventClass, "getEdgeFlags", "()I"); - gMotionEventClassInfo.getPointerCount = - env->GetMethodID(motionEventClass, "getPointerCount", "()I"); - gMotionEventClassInfo.getPointerId = - env->GetMethodID(motionEventClass, "getPointerId", "(I)I"); - gMotionEventClassInfo.getToolType = - env->GetMethodID(motionEventClass, "getToolType", "(I)I"); - if (sdkVersion >= 29) { - gMotionEventClassInfo.getRawX = - env->GetMethodID(motionEventClass, "getRawX", "(I)F"); - gMotionEventClassInfo.getRawY = - env->GetMethodID(motionEventClass, "getRawY", "(I)F"); - } - gMotionEventClassInfo.getXPrecision = - env->GetMethodID(motionEventClass, "getXPrecision", "()F"); - gMotionEventClassInfo.getYPrecision = - env->GetMethodID(motionEventClass, "getYPrecision", "()F"); - gMotionEventClassInfo.getAxisValue = - env->GetMethodID(motionEventClass, "getAxisValue", "(II)F"); - - gMotionEventClassInfo.getHistorySize = - env->GetMethodID(motionEventClass, "getHistorySize", "()I"); - gMotionEventClassInfo.getHistoricalEventTime = - env->GetMethodID(motionEventClass, "getHistoricalEventTime", "(I)J"); - gMotionEventClassInfo.getHistoricalAxisValue = - env->GetMethodID(motionEventClass, "getHistoricalAxisValue", "(III)F"); - - gMotionEventClassInfoInitialized = true; - } - - int historySize = - env->CallIntMethod(motionEvent, gMotionEventClassInfo.getHistorySize); - historySize = - std::min(historySize, GAMEACTIVITY_MAX_NUM_HISTORICAL_IN_MOTION_EVENT); - - int localEnabledHistoricalAxis[GAME_ACTIVITY_POINTER_INFO_AXIS_COUNT]; - int enabledHistoricalAxisCount = 0; - - for (int axisIndex = 0; - axisIndex < GAME_ACTIVITY_POINTER_INFO_AXIS_COUNT; - ++axisIndex) { - if (enabledHistoricalAxes[axisIndex]) { - localEnabledHistoricalAxis[enabledHistoricalAxisCount++] = axisIndex; - } - } - out_event->historicalCount = enabledHistoricalAxisCount == 0 ? 0 : historySize; - out_event->historicalStart = 0; // Free for caller to use - - // The historical event times aren't unique per-pointer but for simplicity - // we output a per-pointer event time, copied from here... - int64_t historicalEventTimes[GAMEACTIVITY_MAX_NUM_HISTORICAL_IN_MOTION_EVENT]; - for (int histIndex = 0; histIndex < historySize; ++histIndex) { - historicalEventTimes[histIndex] = - env->CallLongMethod(motionEvent, - gMotionEventClassInfo.getHistoricalEventTime, histIndex) * - 1000000; - } - - int pointerCount = - env->CallIntMethod(motionEvent, gMotionEventClassInfo.getPointerCount); - pointerCount = - std::min(pointerCount, GAMEACTIVITY_MAX_NUM_POINTERS_IN_MOTION_EVENT); - out_event->pointerCount = pointerCount; - for (int i = 0; i < pointerCount; ++i) { - out_event->pointers[i] = { - /*id=*/env->CallIntMethod(motionEvent, - gMotionEventClassInfo.getPointerId, i), - /*toolType=*/env->CallIntMethod(motionEvent, - gMotionEventClassInfo.getToolType, i), - /*axisValues=*/{0}, - /*rawX=*/gMotionEventClassInfo.getRawX - ? env->CallFloatMethod(motionEvent, - gMotionEventClassInfo.getRawX, i) - : 0, - /*rawY=*/gMotionEventClassInfo.getRawY - ? env->CallFloatMethod(motionEvent, - gMotionEventClassInfo.getRawY, i) - : 0, - }; - - for (int axisIndex = 0; - axisIndex < GAME_ACTIVITY_POINTER_INFO_AXIS_COUNT; ++axisIndex) { - if (enabledAxes[axisIndex]) { - out_event->pointers[i].axisValues[axisIndex] = - env->CallFloatMethod(motionEvent, - gMotionEventClassInfo.getAxisValue, - axisIndex, i); - } - } - - if (enabledHistoricalAxisCount > 0) { - for (int histIndex = 0; histIndex < historySize; ++histIndex) { - int pointerHistIndex = historySize * i; - out_historical[pointerHistIndex].eventTime = historicalEventTimes[histIndex]; - for (int c = 0; c < enabledHistoricalAxisCount; ++c) { - int axisIndex = localEnabledHistoricalAxis[c]; - out_historical[pointerHistIndex].axisValues[axisIndex] = - env->CallFloatMethod(motionEvent, - gMotionEventClassInfo.getHistoricalAxisValue, - axisIndex, i, histIndex); - } - } - } - } - - out_event->deviceId = - env->CallIntMethod(motionEvent, gMotionEventClassInfo.getDeviceId); - out_event->source = - env->CallIntMethod(motionEvent, gMotionEventClassInfo.getSource); - out_event->action = - env->CallIntMethod(motionEvent, gMotionEventClassInfo.getAction); - out_event->eventTime = - env->CallLongMethod(motionEvent, gMotionEventClassInfo.getEventTime) * - 1000000; - out_event->downTime = - env->CallLongMethod(motionEvent, gMotionEventClassInfo.getDownTime) * - 1000000; - out_event->flags = - env->CallIntMethod(motionEvent, gMotionEventClassInfo.getFlags); - out_event->metaState = - env->CallIntMethod(motionEvent, gMotionEventClassInfo.getMetaState); - out_event->actionButton = - gMotionEventClassInfo.getActionButton - ? env->CallIntMethod(motionEvent, - gMotionEventClassInfo.getActionButton) - : 0; - out_event->buttonState = - gMotionEventClassInfo.getButtonState - ? env->CallIntMethod(motionEvent, - gMotionEventClassInfo.getButtonState) - : 0; - out_event->classification = - gMotionEventClassInfo.getClassification - ? env->CallIntMethod(motionEvent, - gMotionEventClassInfo.getClassification) - : 0; - out_event->edgeFlags = - env->CallIntMethod(motionEvent, gMotionEventClassInfo.getEdgeFlags); - out_event->precisionX = - env->CallFloatMethod(motionEvent, gMotionEventClassInfo.getXPrecision); - out_event->precisionY = - env->CallFloatMethod(motionEvent, gMotionEventClassInfo.getYPrecision); - - return out_event->pointerCount * out_event->historicalCount; -} - -static struct { - jmethodID getDeviceId; - jmethodID getSource; - jmethodID getAction; - - jmethodID getEventTime; - jmethodID getDownTime; - - jmethodID getFlags; - jmethodID getMetaState; - - jmethodID getModifiers; - jmethodID getRepeatCount; - jmethodID getKeyCode; - jmethodID getScanCode; -} gKeyEventClassInfo; - -extern "C" void GameActivityKeyEvent_fromJava(JNIEnv *env, jobject keyEvent, - GameActivityKeyEvent *out_event) { - static bool gKeyEventClassInfoInitialized = false; - if (!gKeyEventClassInfoInitialized) { - int sdkVersion = GetSystemPropAsInt("ro.build.version.sdk"); - gKeyEventClassInfo = {0}; - jclass keyEventClass = env->FindClass("android/view/KeyEvent"); - gKeyEventClassInfo.getDeviceId = - env->GetMethodID(keyEventClass, "getDeviceId", "()I"); - gKeyEventClassInfo.getSource = - env->GetMethodID(keyEventClass, "getSource", "()I"); - gKeyEventClassInfo.getAction = - env->GetMethodID(keyEventClass, "getAction", "()I"); - gKeyEventClassInfo.getEventTime = - env->GetMethodID(keyEventClass, "getEventTime", "()J"); - gKeyEventClassInfo.getDownTime = - env->GetMethodID(keyEventClass, "getDownTime", "()J"); - gKeyEventClassInfo.getFlags = - env->GetMethodID(keyEventClass, "getFlags", "()I"); - gKeyEventClassInfo.getMetaState = - env->GetMethodID(keyEventClass, "getMetaState", "()I"); - if (sdkVersion >= 13) { - gKeyEventClassInfo.getModifiers = - env->GetMethodID(keyEventClass, "getModifiers", "()I"); - } - gKeyEventClassInfo.getRepeatCount = - env->GetMethodID(keyEventClass, "getRepeatCount", "()I"); - gKeyEventClassInfo.getKeyCode = - env->GetMethodID(keyEventClass, "getKeyCode", "()I"); - gKeyEventClassInfo.getScanCode = - env->GetMethodID(keyEventClass, "getScanCode", "()I"); - - gKeyEventClassInfoInitialized = true; - } - - *out_event = { - /*deviceId=*/env->CallIntMethod(keyEvent, - gKeyEventClassInfo.getDeviceId), - /*source=*/env->CallIntMethod(keyEvent, gKeyEventClassInfo.getSource), - /*action=*/env->CallIntMethod(keyEvent, gKeyEventClassInfo.getAction), - // TODO: introduce a millisecondsToNanoseconds helper: - /*eventTime=*/ - env->CallLongMethod(keyEvent, gKeyEventClassInfo.getEventTime) * - 1000000, - /*downTime=*/ - env->CallLongMethod(keyEvent, gKeyEventClassInfo.getDownTime) * 1000000, - /*flags=*/env->CallIntMethod(keyEvent, gKeyEventClassInfo.getFlags), - /*metaState=*/ - env->CallIntMethod(keyEvent, gKeyEventClassInfo.getMetaState), - /*modifiers=*/gKeyEventClassInfo.getModifiers - ? env->CallIntMethod(keyEvent, gKeyEventClassInfo.getModifiers) - : 0, - /*repeatCount=*/ - env->CallIntMethod(keyEvent, gKeyEventClassInfo.getRepeatCount), - /*keyCode=*/ - env->CallIntMethod(keyEvent, gKeyEventClassInfo.getKeyCode), - /*scanCode=*/ - env->CallIntMethod(keyEvent, gKeyEventClassInfo.getScanCode)}; -} - -static bool onTouchEvent_native(JNIEnv *env, jobject javaGameActivity, - jlong handle, jobject motionEvent) { - if (handle == 0) return false; - NativeCode *code = (NativeCode *)handle; - if (code->callbacks.onTouchEvent == nullptr) return false; - - static GameActivityMotionEvent c_event; - // Note the actual data is written contiguously as numPointers x historySize - // entries. - static GameActivityHistoricalPointerAxes historical[GAMEACTIVITY_MAX_NUM_POINTERS_IN_MOTION_EVENT * GAMEACTIVITY_MAX_NUM_HISTORICAL_IN_MOTION_EVENT]; - int historicalLen = GameActivityMotionEvent_fromJava(env, motionEvent, &c_event, historical); - return code->callbacks.onTouchEvent(code, &c_event, historical, historicalLen); -} - -static bool onKeyUp_native(JNIEnv *env, jobject javaGameActivity, jlong handle, - jobject keyEvent) { - if (handle == 0) return false; - NativeCode *code = (NativeCode *)handle; - if (code->callbacks.onKeyUp == nullptr) return false; - - static GameActivityKeyEvent c_event; - GameActivityKeyEvent_fromJava(env, keyEvent, &c_event); - return code->callbacks.onKeyUp(code, &c_event); -} - -static bool onKeyDown_native(JNIEnv *env, jobject javaGameActivity, - jlong handle, jobject keyEvent) { - if (handle == 0) return false; - NativeCode *code = (NativeCode *)handle; - if (code->callbacks.onKeyDown == nullptr) return false; - - static GameActivityKeyEvent c_event; - GameActivityKeyEvent_fromJava(env, keyEvent, &c_event); - return code->callbacks.onKeyDown(code, &c_event); -} - -static void onTextInput_native(JNIEnv *env, jobject activity, jlong handle, - jobject textInputEvent) { - if (handle == 0) return; - NativeCode *code = (NativeCode *)handle; - GameTextInput_processEvent(code->gameTextInput, textInputEvent); -} - -static void onWindowInsetsChanged_native(JNIEnv *env, jobject activity, - jlong handle) { - if (handle == 0) return; - NativeCode *code = (NativeCode *)handle; - if (code->callbacks.onWindowInsetsChanged == nullptr) return; - for (int type = 0; type < GAMECOMMON_INSETS_TYPE_COUNT; ++type) { - jobject jinsets; - // Note that waterfall insets are handled differently on the Java side. - if (type == GAMECOMMON_INSETS_TYPE_WATERFALL) { - jinsets = env->CallObjectMethod( - code->javaGameActivity, - gGameActivityClassInfo.getWaterfallInsets); - } else { - jint jtype = env->CallStaticIntMethod( - gWindowInsetsCompatTypeClassInfo.clazz, - gWindowInsetsCompatTypeClassInfo.methods[type]); - jinsets = env->CallObjectMethod( - code->javaGameActivity, gGameActivityClassInfo.getWindowInsets, - jtype); - } - ARect &insets = code->insetsState[type]; - if (jinsets == nullptr) { - insets.left = 0; - insets.right = 0; - insets.top = 0; - insets.bottom = 0; - } else { - insets.left = env->GetIntField(jinsets, gInsetsClassInfo.left); - insets.right = env->GetIntField(jinsets, gInsetsClassInfo.right); - insets.top = env->GetIntField(jinsets, gInsetsClassInfo.top); - insets.bottom = env->GetIntField(jinsets, gInsetsClassInfo.bottom); - } - } - GameTextInput_processImeInsets( - code->gameTextInput, &code->insetsState[GAMECOMMON_INSETS_TYPE_IME]); - code->callbacks.onWindowInsetsChanged(code); -} - -static void setInputConnection_native(JNIEnv *env, jobject activity, - jlong handle, jobject inputConnection) { - NativeCode *code = (NativeCode *)handle; - GameTextInput_setInputConnection(code->gameTextInput, inputConnection); -} - -static const JNINativeMethod g_methods[] = { - {"loadNativeCode", - "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/" - "String;Ljava/lang/String;Landroid/content/res/AssetManager;[B)J", - (void *)loadNativeCode_native}, - {"getDlError", "()Ljava/lang/String;", (void *)getDlError_native}, - {"unloadNativeCode", "(J)V", (void *)unloadNativeCode_native}, - {"onStartNative", "(J)V", (void *)onStart_native}, - {"onResumeNative", "(J)V", (void *)onResume_native}, - {"onSaveInstanceStateNative", "(J)[B", (void *)onSaveInstanceState_native}, - {"onPauseNative", "(J)V", (void *)onPause_native}, - {"onStopNative", "(J)V", (void *)onStop_native}, - {"onConfigurationChangedNative", "(J)V", - (void *)onConfigurationChanged_native}, - {"onTrimMemoryNative", "(JI)V", (void *)onTrimMemory_native}, - {"onWindowFocusChangedNative", "(JZ)V", - (void *)onWindowFocusChanged_native}, - {"onSurfaceCreatedNative", "(JLandroid/view/Surface;)V", - (void *)onSurfaceCreated_native}, - {"onSurfaceChangedNative", "(JLandroid/view/Surface;III)V", - (void *)onSurfaceChanged_native}, - {"onSurfaceRedrawNeededNative", "(JLandroid/view/Surface;)V", - (void *)onSurfaceRedrawNeeded_native}, - {"onSurfaceDestroyedNative", "(J)V", (void *)onSurfaceDestroyed_native}, - {"onTouchEventNative", "(JLandroid/view/MotionEvent;)Z", - (void *)onTouchEvent_native}, - {"onKeyDownNative", "(JLandroid/view/KeyEvent;)Z", - (void *)onKeyDown_native}, - {"onKeyUpNative", "(JLandroid/view/KeyEvent;)Z", (void *)onKeyUp_native}, - {"onTextInputEventNative", - "(JLcom/google/androidgamesdk/gametextinput/State;)V", - (void *)onTextInput_native}, - {"onWindowInsetsChangedNative", "(J)V", - (void *)onWindowInsetsChanged_native}, - {"setInputConnectionNative", - "(JLcom/google/androidgamesdk/gametextinput/InputConnection;)V", - (void *)setInputConnection_native}, -}; - -static const char *const kGameActivityPathName = - "com/google/androidgamesdk/GameActivity"; - -static const char *const kInsetsPathName = "androidx/core/graphics/Insets"; - -static const char *const kWindowInsetsCompatTypePathName = - "androidx/core/view/WindowInsetsCompat$Type"; - -#define FIND_CLASS(var, className) \ - var = env->FindClass(className); \ - LOG_FATAL_IF(!var, "Unable to find class %s", className); - -#define GET_METHOD_ID(var, clazz, methodName, fieldDescriptor) \ - var = env->GetMethodID(clazz, methodName, fieldDescriptor); \ - LOG_FATAL_IF(!var, "Unable to find method %s", methodName); - -#define GET_STATIC_METHOD_ID(var, clazz, methodName, fieldDescriptor) \ - var = env->GetStaticMethodID(clazz, methodName, fieldDescriptor); \ - LOG_FATAL_IF(!var, "Unable to find static method %s", methodName); - -#define GET_FIELD_ID(var, clazz, fieldName, fieldDescriptor) \ - var = env->GetFieldID(clazz, fieldName, fieldDescriptor); \ - LOG_FATAL_IF(!var, "Unable to find field %s", fieldName); - -static int jniRegisterNativeMethods(JNIEnv *env, const char *className, - const JNINativeMethod *methods, - int numMethods) { - ALOGV("Registering %s's %d native methods...", className, numMethods); - jclass clazz = env->FindClass(className); - LOG_FATAL_IF(clazz == nullptr, - "Native registration unable to find class '%s'; aborting...", - className); - int result = env->RegisterNatives(clazz, methods, numMethods); - env->DeleteLocalRef(clazz); - if (result == 0) { - return 0; - } - - // Failure to register natives is fatal. Try to report the corresponding - // exception, otherwise abort with generic failure message. - jthrowable thrown = env->ExceptionOccurred(); - if (thrown != NULL) { - env->ExceptionDescribe(); - env->DeleteLocalRef(thrown); - } - LOG_FATAL("RegisterNatives failed for '%s'; aborting...", className); -} - -extern "C" int GameActivity_register(JNIEnv *env) { - ALOGD("GameActivity_register"); - jclass activity_class; - FIND_CLASS(activity_class, kGameActivityPathName); - GET_METHOD_ID(gGameActivityClassInfo.finish, activity_class, "finish", - "()V"); - GET_METHOD_ID(gGameActivityClassInfo.setWindowFlags, activity_class, - "setWindowFlags", "(II)V"); - GET_METHOD_ID(gGameActivityClassInfo.getWindowInsets, activity_class, - "getWindowInsets", "(I)Landroidx/core/graphics/Insets;"); - GET_METHOD_ID(gGameActivityClassInfo.getWaterfallInsets, activity_class, - "getWaterfallInsets", "()Landroidx/core/graphics/Insets;"); - GET_METHOD_ID(gGameActivityClassInfo.setImeEditorInfoFields, activity_class, - "setImeEditorInfoFields", "(III)V"); - jclass insets_class; - FIND_CLASS(insets_class, kInsetsPathName); - GET_FIELD_ID(gInsetsClassInfo.left, insets_class, "left", "I"); - GET_FIELD_ID(gInsetsClassInfo.right, insets_class, "right", "I"); - GET_FIELD_ID(gInsetsClassInfo.top, insets_class, "top", "I"); - GET_FIELD_ID(gInsetsClassInfo.bottom, insets_class, "bottom", "I"); - jclass windowInsetsCompatType_class; - FIND_CLASS(windowInsetsCompatType_class, kWindowInsetsCompatTypePathName); - gWindowInsetsCompatTypeClassInfo.clazz = - (jclass)env->NewGlobalRef(windowInsetsCompatType_class); - // These names must match, in order, the GameCommonInsetsType enum fields - // Note that waterfall is handled differently by the insets API, so we - // exclude it here. - const char *methodNames[GAMECOMMON_INSETS_TYPE_WATERFALL] = { - "captionBar", - "displayCutout", - "ime", - "mandatorySystemGestures", - "navigationBars", - "statusBars", - "systemBars", - "systemGestures", - "tappableElement"}; - for (int i = 0; i < GAMECOMMON_INSETS_TYPE_WATERFALL; ++i) { - GET_STATIC_METHOD_ID(gWindowInsetsCompatTypeClassInfo.methods[i], - windowInsetsCompatType_class, methodNames[i], - "()I"); - } - return jniRegisterNativeMethods(env, kGameActivityPathName, g_methods, - NELEM(g_methods)); -} - -// XXX: This symbol is renamed with a _C suffix and then re-exported from -// Rust because Rust/Cargo don't give us a way to directly export symbols -// from C/C++ code: https://github.com/rust-lang/rfcs/issues/2771 -// -// Register this method so that GameActiviy_register does not need to be called -// manually. -extern "C" jlong Java_com_google_androidgamesdk_GameActivity_loadNativeCode_C( - JNIEnv *env, jobject javaGameActivity, jstring path, jstring funcName, - jstring internalDataDir, jstring obbDir, jstring externalDataDir, - jobject jAssetMgr, jbyteArray savedState) { - GameActivity_register(env); - jlong nativeCode = loadNativeCode_native( - env, javaGameActivity, path, funcName, internalDataDir, obbDir, - externalDataDir, jAssetMgr, savedState); - return nativeCode; -} diff --git a/android-activity/game-activity-csrc/game-activity/GameActivity.h b/android-activity/game-activity-csrc/game-activity/GameActivity.h deleted file mode 100644 index c5abfc04..00000000 --- a/android-activity/game-activity-csrc/game-activity/GameActivity.h +++ /dev/null @@ -1,820 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @addtogroup GameActivity Game Activity - * The interface to use GameActivity. - * @{ - */ - -/** - * @file GameActivity.h - */ - -#ifndef ANDROID_GAME_SDK_GAME_ACTIVITY_H -#define ANDROID_GAME_SDK_GAME_ACTIVITY_H - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "game-text-input/gametextinput.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * {@link GameActivityCallbacks} - */ -struct GameActivityCallbacks; - -/** - * This structure defines the native side of an android.app.GameActivity. - * It is created by the framework, and handed to the application's native - * code as it is being launched. - */ -typedef struct GameActivity { - /** - * Pointer to the callback function table of the native application. - * You can set the functions here to your own callbacks. The callbacks - * pointer itself here should not be changed; it is allocated and managed - * for you by the framework. - */ - struct GameActivityCallbacks* callbacks; - - /** - * The global handle on the process's Java VM. - */ - JavaVM* vm; - - /** - * JNI context for the main thread of the app. Note that this field - * can ONLY be used from the main thread of the process; that is, the - * thread that calls into the GameActivityCallbacks. - */ - JNIEnv* env; - - /** - * The GameActivity object handle. - */ - jobject javaGameActivity; - - /** - * Path to this application's internal data directory. - */ - const char* internalDataPath; - - /** - * Path to this application's external (removable/mountable) data directory. - */ - const char* externalDataPath; - - /** - * The platform's SDK version code. - */ - int32_t sdkVersion; - - /** - * This is the native instance of the application. It is not used by - * the framework, but can be set by the application to its own instance - * state. - */ - void* instance; - - /** - * Pointer to the Asset Manager instance for the application. The - * application uses this to access binary assets bundled inside its own .apk - * file. - */ - AAssetManager* assetManager; - - /** - * Available starting with Honeycomb: path to the directory containing - * the application's OBB files (if any). If the app doesn't have any - * OBB files, this directory may not exist. - */ - const char* obbPath; -} GameActivity; - -/** - * The maximum number of axes supported in an Android MotionEvent. - * See https://developer.android.com/ndk/reference/group/input. - */ -#define GAME_ACTIVITY_POINTER_INFO_AXIS_COUNT 48 - -/** - * \brief Describe information about a pointer, found in a - * GameActivityMotionEvent. - * - * You can read values directly from this structure, or use helper functions - * (`GameActivityPointerAxes_getX`, `GameActivityPointerAxes_getY` and - * `GameActivityPointerAxes_getAxisValue`). - * - * The X axis and Y axis are enabled by default but any other axis that you want - * to read **must** be enabled first, using - * `GameActivityPointerAxes_enableAxis`. - * - * \see GameActivityMotionEvent - */ -typedef struct GameActivityPointerAxes { - int32_t id; - int32_t toolType; - float axisValues[GAME_ACTIVITY_POINTER_INFO_AXIS_COUNT]; - float rawX; - float rawY; -} GameActivityPointerAxes; - -typedef struct GameActivityHistoricalPointerAxes { - int64_t eventTime; - float axisValues[GAME_ACTIVITY_POINTER_INFO_AXIS_COUNT]; -} GameActivityHistoricalPointerAxes; - -/** \brief Get the current X coordinate of the pointer. */ -inline float GameActivityPointerAxes_getX( - const GameActivityPointerAxes* pointerInfo) { - return pointerInfo->axisValues[AMOTION_EVENT_AXIS_X]; -} - -/** \brief Get the current Y coordinate of the pointer. */ -inline float GameActivityPointerAxes_getY( - const GameActivityPointerAxes* pointerInfo) { - return pointerInfo->axisValues[AMOTION_EVENT_AXIS_Y]; -} - -/** - * \brief Enable the specified axis, so that its value is reported in the - * GameActivityPointerAxes structures stored in a motion event. - * - * You must enable any axis that you want to read, apart from - * `AMOTION_EVENT_AXIS_X` and `AMOTION_EVENT_AXIS_Y` that are enabled by - * default. - * - * If the axis index is out of range, nothing is done. - */ -void GameActivityPointerAxes_enableAxis(int32_t axis); - -/** - * \brief Disable the specified axis. Its value won't be reported in the - * GameActivityPointerAxes structures stored in a motion event anymore. - * - * Apart from X and Y, any axis that you want to read **must** be enabled first, - * using `GameActivityPointerAxes_enableAxis`. - * - * If the axis index is out of range, nothing is done. - */ -void GameActivityPointerAxes_disableAxis(int32_t axis); - -/** - * \brief Enable the specified axis, so that its value is reported in the - * GameActivityHistoricalPointerAxes structures associated with a motion event. - * - * You must enable any axis that you want to read (no axes are enabled by - * default). - * - * If the axis index is out of range, nothing is done. - */ -void GameActivityHistoricalPointerAxes_enableAxis(int32_t axis); - -/** - * \brief Disable the specified axis. Its value won't be reported in the - * GameActivityHistoricalPointerAxes structures associated with motion events - * anymore. - * - * If the axis index is out of range, nothing is done. - */ -void GameActivityHistoricalPointerAxes_disableAxis(int32_t axis); - -/** - * \brief Get the value of the requested axis. - * - * Apart from X and Y, any axis that you want to read **must** be enabled first, - * using `GameActivityPointerAxes_enableAxis`. - * - * Find the valid enums for the axis (`AMOTION_EVENT_AXIS_X`, - * `AMOTION_EVENT_AXIS_Y`, `AMOTION_EVENT_AXIS_PRESSURE`...) - * in https://developer.android.com/ndk/reference/group/input. - * - * @param pointerInfo The structure containing information about the pointer, - * obtained from GameActivityMotionEvent. - * @param axis The axis to get the value from - * @return The value of the axis, or 0 if the axis is invalid or was not - * enabled. - */ -inline float GameActivityPointerAxes_getAxisValue( - GameActivityPointerAxes* pointerInfo, int32_t axis) { - if (axis < 0 || axis >= GAME_ACTIVITY_POINTER_INFO_AXIS_COUNT) { - return 0; - } - - return pointerInfo->axisValues[axis]; -} - -/** - * The maximum number of pointers returned inside a motion event. - */ -#if (defined GAMEACTIVITY_MAX_NUM_POINTERS_IN_MOTION_EVENT_OVERRIDE) -#define GAMEACTIVITY_MAX_NUM_POINTERS_IN_MOTION_EVENT \ - GAMEACTIVITY_MAX_NUM_POINTERS_IN_MOTION_EVENT_OVERRIDE -#else -#define GAMEACTIVITY_MAX_NUM_POINTERS_IN_MOTION_EVENT 8 -#endif - -/** - * The maximum number of historic samples associated with a single motion event. - */ -#if (defined GAMEACTIVITY_MAX_NUM_HISTORICAL_IN_MOTION_EVENT_OVERRIDE) -#define GAMEACTIVITY_MAX_NUM_HISTORICAL_IN_MOTION_EVENT \ - GAMEACTIVITY_MAX_NUM_HISTORICAL_IN_MOTION_EVENT_OVERRIDE -#else -#define GAMEACTIVITY_MAX_NUM_HISTORICAL_IN_MOTION_EVENT 8 -#endif - -/** - * \brief Describe a motion event that happened on the GameActivity SurfaceView. - * - * This is 1:1 mapping to the information contained in a Java `MotionEvent` - * (see https://developer.android.com/reference/android/view/MotionEvent). - */ -typedef struct GameActivityMotionEvent { - int32_t deviceId; - int32_t source; - int32_t action; - - int64_t eventTime; - int64_t downTime; - - int32_t flags; - int32_t metaState; - - int32_t actionButton; - int32_t buttonState; - int32_t classification; - int32_t edgeFlags; - - uint32_t pointerCount; - GameActivityPointerAxes - pointers[GAMEACTIVITY_MAX_NUM_POINTERS_IN_MOTION_EVENT]; - - float precisionX; - float precisionY; - - int16_t historicalStart; - - // Note the actual buffer of historical data has a length of - // pointerCount * historicalCount, since the historical axis - // data is per-pointer. - int16_t historicalCount; -} GameActivityMotionEvent; - -/** - * \brief Describe a key event that happened on the GameActivity SurfaceView. - * - * This is 1:1 mapping to the information contained in a Java `KeyEvent` - * (see https://developer.android.com/reference/android/view/KeyEvent). - */ -typedef struct GameActivityKeyEvent { - int32_t deviceId; - int32_t source; - int32_t action; - - int64_t eventTime; - int64_t downTime; - - int32_t flags; - int32_t metaState; - - int32_t modifiers; - int32_t repeatCount; - int32_t keyCode; - int32_t scanCode; -} GameActivityKeyEvent; - -/** - * A function the user should call from their callback with the data, its length - * and the library- supplied context. - */ -typedef void (*SaveInstanceStateRecallback)(const char* bytes, int len, - void* context); - -/** - * These are the callbacks the framework makes into a native application. - * All of these callbacks happen on the main thread of the application. - * By default, all callbacks are NULL; set to a pointer to your own function - * to have it called. - */ -typedef struct GameActivityCallbacks { - /** - * GameActivity has started. See Java documentation for Activity.onStart() - * for more information. - */ - void (*onStart)(GameActivity* activity); - - /** - * GameActivity has resumed. See Java documentation for Activity.onResume() - * for more information. - */ - void (*onResume)(GameActivity* activity); - - /** - * The framework is asking GameActivity to save its current instance state. - * See the Java documentation for Activity.onSaveInstanceState() for more - * information. The user should call the recallback with their data, its - * length and the provided context; they retain ownership of the data. Note - * that the saved state will be persisted, so it can not contain any active - * entities (pointers to memory, file descriptors, etc). - */ - void (*onSaveInstanceState)(GameActivity* activity, - SaveInstanceStateRecallback recallback, - void* context); - - /** - * GameActivity has paused. See Java documentation for Activity.onPause() - * for more information. - */ - void (*onPause)(GameActivity* activity); - - /** - * GameActivity has stopped. See Java documentation for Activity.onStop() - * for more information. - */ - void (*onStop)(GameActivity* activity); - - /** - * GameActivity is being destroyed. See Java documentation for - * Activity.onDestroy() for more information. - */ - void (*onDestroy)(GameActivity* activity); - - /** - * Focus has changed in this GameActivity's window. This is often used, - * for example, to pause a game when it loses input focus. - */ - void (*onWindowFocusChanged)(GameActivity* activity, bool hasFocus); - - /** - * The drawing window for this native activity has been created. You - * can use the given native window object to start drawing. - */ - void (*onNativeWindowCreated)(GameActivity* activity, - ANativeWindow* window); - - /** - * The drawing window for this native activity has been resized. You should - * retrieve the new size from the window and ensure that your rendering in - * it now matches. - */ - void (*onNativeWindowResized)(GameActivity* activity, ANativeWindow* window, - int32_t newWidth, int32_t newHeight); - - /** - * The drawing window for this native activity needs to be redrawn. To - * avoid transient artifacts during screen changes (such resizing after - * rotation), applications should not return from this function until they - * have finished drawing their window in its current state. - */ - void (*onNativeWindowRedrawNeeded)(GameActivity* activity, - ANativeWindow* window); - - /** - * The drawing window for this native activity is going to be destroyed. - * You MUST ensure that you do not touch the window object after returning - * from this function: in the common case of drawing to the window from - * another thread, that means the implementation of this callback must - * properly synchronize with the other thread to stop its drawing before - * returning from here. - */ - void (*onNativeWindowDestroyed)(GameActivity* activity, - ANativeWindow* window); - - /** - * The current device AConfiguration has changed. The new configuration can - * be retrieved from assetManager. - */ - void (*onConfigurationChanged)(GameActivity* activity); - - /** - * The system is running low on memory. Use this callback to release - * resources you do not need, to help the system avoid killing more - * important processes. - */ - void (*onTrimMemory)(GameActivity* activity, int level); - - /** - * Callback called for every MotionEvent done on the GameActivity - * SurfaceView. Ownership of `event` is maintained by the library and it is - * only valid during the callback. - */ - bool (*onTouchEvent)(GameActivity* activity, - const GameActivityMotionEvent* event, - const GameActivityHistoricalPointerAxes* historical, - int historicalLen); - - /** - * Callback called for every key down event on the GameActivity SurfaceView. - * Ownership of `event` is maintained by the library and it is only valid - * during the callback. - */ - bool (*onKeyDown)(GameActivity* activity, - const GameActivityKeyEvent* event); - - /** - * Callback called for every key up event on the GameActivity SurfaceView. - * Ownership of `event` is maintained by the library and it is only valid - * during the callback. - */ - bool (*onKeyUp)(GameActivity* activity, const GameActivityKeyEvent* event); - - /** - * Callback called for every soft-keyboard text input event. - * Ownership of `state` is maintained by the library and it is only valid - * during the callback. - */ - void (*onTextInputEvent)(GameActivity* activity, - const GameTextInputState* state); - - /** - * Callback called when WindowInsets of the main app window have changed. - * Call GameActivity_getWindowInsets to retrieve the insets themselves. - */ - void (*onWindowInsetsChanged)(GameActivity* activity); -} GameActivityCallbacks; - -/** - * \brief Convert a Java `MotionEvent` to a `GameActivityMotionEvent`. - * - * This is done automatically by the GameActivity: see `onTouchEvent` to set - * a callback to consume the received events. - * This function can be used if you re-implement events handling in your own - * activity. On return, the out_event->historicalStart will be zero, and should - * be updated to index into whatever buffer out_historical is copied. - * On return the length of out_historical is - * (out_event->pointerCount x out_event->historicalCount) and is in a - * pointer-major order (i.e. all axis for a pointer are contiguous) - * Ownership of out_event is maintained by the caller. - */ -int GameActivityMotionEvent_fromJava(JNIEnv* env, jobject motionEvent, - GameActivityMotionEvent* out_event, - GameActivityHistoricalPointerAxes *out_historical); - -/** - * \brief Convert a Java `KeyEvent` to a `GameActivityKeyEvent`. - * - * This is done automatically by the GameActivity: see `onKeyUp` and `onKeyDown` - * to set a callback to consume the received events. - * This function can be used if you re-implement events handling in your own - * activity. - * Ownership of out_event is maintained by the caller. - */ -void GameActivityKeyEvent_fromJava(JNIEnv* env, jobject motionEvent, - GameActivityKeyEvent* out_event); - -/** - * This is the function that must be in the native code to instantiate the - * application's native activity. It is called with the activity instance (see - * above); if the code is being instantiated from a previously saved instance, - * the savedState will be non-NULL and point to the saved data. You must make - * any copy of this data you need -- it will be released after you return from - * this function. - */ -typedef void GameActivity_createFunc(GameActivity* activity, void* savedState, - size_t savedStateSize); - -/** - * The name of the function that NativeInstance looks for when launching its - * native code. This is the default function that is used, you can specify - * "android.app.func_name" string meta-data in your manifest to use a different - * function. - */ -extern GameActivity_createFunc GameActivity_onCreate; - -/** - * Finish the given activity. Its finish() method will be called, causing it - * to be stopped and destroyed. Note that this method can be called from - * *any* thread; it will send a message to the main thread of the process - * where the Java finish call will take place. - */ -void GameActivity_finish(GameActivity* activity); - -/** - * Flags for GameActivity_setWindowFlags, - * as per the Java API at android.view.WindowManager.LayoutParams. - */ -enum GameActivitySetWindowFlags { - /** - * As long as this window is visible to the user, allow the lock - * screen to activate while the screen is on. This can be used - * independently, or in combination with {@link - * GAMEACTIVITY_FLAG_KEEP_SCREEN_ON} and/or {@link - * GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED} - */ - GAMEACTIVITY_FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 0x00000001, - /** Everything behind this window will be dimmed. */ - GAMEACTIVITY_FLAG_DIM_BEHIND = 0x00000002, - /** - * Blur everything behind this window. - * @deprecated Blurring is no longer supported. - */ - GAMEACTIVITY_FLAG_BLUR_BEHIND = 0x00000004, - /** - * This window won't ever get key input focus, so the - * user can not send key or other button events to it. Those will - * instead go to whatever focusable window is behind it. This flag - * will also enable {@link GAMEACTIVITY_FLAG_NOT_TOUCH_MODAL} whether or not - * that is explicitly set. - * - * Setting this flag also implies that the window will not need to - * interact with - * a soft input method, so it will be Z-ordered and positioned - * independently of any active input method (typically this means it - * gets Z-ordered on top of the input method, so it can use the full - * screen for its content and cover the input method if needed. You - * can use {@link GAMEACTIVITY_FLAG_ALT_FOCUSABLE_IM} to modify this - * behavior. - */ - GAMEACTIVITY_FLAG_NOT_FOCUSABLE = 0x00000008, - /** This window can never receive touch events. */ - GAMEACTIVITY_FLAG_NOT_TOUCHABLE = 0x00000010, - /** - * Even when this window is focusable (its - * {@link GAMEACTIVITY_FLAG_NOT_FOCUSABLE} is not set), allow any pointer - * events outside of the window to be sent to the windows behind it. - * Otherwise it will consume all pointer events itself, regardless of - * whether they are inside of the window. - */ - GAMEACTIVITY_FLAG_NOT_TOUCH_MODAL = 0x00000020, - /** - * When set, if the device is asleep when the touch - * screen is pressed, you will receive this first touch event. Usually - * the first touch event is consumed by the system since the user can - * not see what they are pressing on. - * - * @deprecated This flag has no effect. - */ - GAMEACTIVITY_FLAG_TOUCHABLE_WHEN_WAKING = 0x00000040, - /** - * As long as this window is visible to the user, keep - * the device's screen turned on and bright. - */ - GAMEACTIVITY_FLAG_KEEP_SCREEN_ON = 0x00000080, - /** - * Place the window within the entire screen, ignoring - * decorations around the border (such as the status bar). The - * window must correctly position its contents to take the screen - * decoration into account. - */ - GAMEACTIVITY_FLAG_LAYOUT_IN_SCREEN = 0x00000100, - /** Allows the window to extend outside of the screen. */ - GAMEACTIVITY_FLAG_LAYOUT_NO_LIMITS = 0x00000200, - /** - * Hide all screen decorations (such as the status - * bar) while this window is displayed. This allows the window to - * use the entire display space for itself -- the status bar will - * be hidden when an app window with this flag set is on the top - * layer. A fullscreen window will ignore a value of {@link - * GAMEACTIVITY_SOFT_INPUT_ADJUST_RESIZE}; the window will stay - * fullscreen and will not resize. - */ - GAMEACTIVITY_FLAG_FULLSCREEN = 0x00000400, - /** - * Override {@link GAMEACTIVITY_FLAG_FULLSCREEN} and force the - * screen decorations (such as the status bar) to be shown. - */ - GAMEACTIVITY_FLAG_FORCE_NOT_FULLSCREEN = 0x00000800, - /** - * Turn on dithering when compositing this window to - * the screen. - * @deprecated This flag is no longer used. - */ - GAMEACTIVITY_FLAG_DITHER = 0x00001000, - /** - * Treat the content of the window as secure, preventing - * it from appearing in screenshots or from being viewed on non-secure - * displays. - */ - GAMEACTIVITY_FLAG_SECURE = 0x00002000, - /** - * A special mode where the layout parameters are used - * to perform scaling of the surface when it is composited to the - * screen. - */ - GAMEACTIVITY_FLAG_SCALED = 0x00004000, - /** - * Intended for windows that will often be used when the user is - * holding the screen against their face, it will aggressively - * filter the event stream to prevent unintended presses in this - * situation that may not be desired for a particular window, when - * such an event stream is detected, the application will receive - * a {@link AMOTION_EVENT_ACTION_CANCEL} to indicate this so - * applications can handle this accordingly by taking no action on - * the event until the finger is released. - */ - GAMEACTIVITY_FLAG_IGNORE_CHEEK_PRESSES = 0x00008000, - /** - * A special option only for use in combination with - * {@link GAMEACTIVITY_FLAG_LAYOUT_IN_SCREEN}. When requesting layout in - * the screen your window may appear on top of or behind screen decorations - * such as the status bar. By also including this flag, the window - * manager will report the inset rectangle needed to ensure your - * content is not covered by screen decorations. - */ - GAMEACTIVITY_FLAG_LAYOUT_INSET_DECOR = 0x00010000, - /** - * Invert the state of {@link GAMEACTIVITY_FLAG_NOT_FOCUSABLE} with - * respect to how this window interacts with the current method. - * That is, if FLAG_NOT_FOCUSABLE is set and this flag is set, - * then the window will behave as if it needs to interact with the - * input method and thus be placed behind/away from it; if {@link - * GAMEACTIVITY_FLAG_NOT_FOCUSABLE} is not set and this flag is set, - * then the window will behave as if it doesn't need to interact - * with the input method and can be placed to use more space and - * cover the input method. - */ - GAMEACTIVITY_FLAG_ALT_FOCUSABLE_IM = 0x00020000, - /** - * If you have set {@link GAMEACTIVITY_FLAG_NOT_TOUCH_MODAL}, you - * can set this flag to receive a single special MotionEvent with - * the action - * {@link AMOTION_EVENT_ACTION_OUTSIDE} for - * touches that occur outside of your window. Note that you will not - * receive the full down/move/up gesture, only the location of the - * first down as an {@link AMOTION_EVENT_ACTION_OUTSIDE}. - */ - GAMEACTIVITY_FLAG_WATCH_OUTSIDE_TOUCH = 0x00040000, - /** - * Special flag to let windows be shown when the screen - * is locked. This will let application windows take precedence over - * key guard or any other lock screens. Can be used with - * {@link GAMEACTIVITY_FLAG_KEEP_SCREEN_ON} to turn screen on and display - * windows directly before showing the key guard window. Can be used with - * {@link GAMEACTIVITY_FLAG_DISMISS_KEYGUARD} to automatically fully - * dismisss non-secure keyguards. This flag only applies to the top-most - * full-screen window. - */ - GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED = 0x00080000, - /** - * Ask that the system wallpaper be shown behind - * your window. The window surface must be translucent to be able - * to actually see the wallpaper behind it; this flag just ensures - * that the wallpaper surface will be there if this window actually - * has translucent regions. - */ - GAMEACTIVITY_FLAG_SHOW_WALLPAPER = 0x00100000, - /** - * When set as a window is being added or made - * visible, once the window has been shown then the system will - * poke the power manager's user activity (as if the user had woken - * up the device) to turn the screen on. - */ - GAMEACTIVITY_FLAG_TURN_SCREEN_ON = 0x00200000, - /** - * When set the window will cause the keyguard to - * be dismissed, only if it is not a secure lock keyguard. Because such - * a keyguard is not needed for security, it will never re-appear if - * the user navigates to another window (in contrast to - * {@link GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED}, which will only temporarily - * hide both secure and non-secure keyguards but ensure they reappear - * when the user moves to another UI that doesn't hide them). - * If the keyguard is currently active and is secure (requires an - * unlock pattern) than the user will still need to confirm it before - * seeing this window, unless {@link GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED} has - * also been set. - */ - GAMEACTIVITY_FLAG_DISMISS_KEYGUARD = 0x00400000, -}; - -/** - * Change the window flags of the given activity. Calls getWindow().setFlags() - * of the given activity. - * Note that some flags must be set before the window decoration is created, - * see - * https://developer.android.com/reference/android/view/Window#setFlags(int,%20int). - * Note also that this method can be called from - * *any* thread; it will send a message to the main thread of the process - * where the Java finish call will take place. - */ -void GameActivity_setWindowFlags(GameActivity* activity, uint32_t addFlags, - uint32_t removeFlags); - -/** - * Flags for GameActivity_showSoftInput; see the Java InputMethodManager - * API for documentation. - */ -enum GameActivityShowSoftInputFlags { - /** - * Implicit request to show the input window, not as the result - * of a direct request by the user. - */ - GAMEACTIVITY_SHOW_SOFT_INPUT_IMPLICIT = 0x0001, - - /** - * The user has forced the input method open (such as by - * long-pressing menu) so it should not be closed until they - * explicitly do so. - */ - GAMEACTIVITY_SHOW_SOFT_INPUT_FORCED = 0x0002, -}; - -/** - * Show the IME while in the given activity. Calls - * InputMethodManager.showSoftInput() for the given activity. Note that this - * method can be called from *any* thread; it will send a message to the main - * thread of the process where the Java call will take place. - */ -void GameActivity_showSoftInput(GameActivity* activity, uint32_t flags); - -/** - * Set the text entry state (see documentation of the GameTextInputState struct - * in the Game Text Input library reference). - * - * Ownership of the state is maintained by the caller. - */ -void GameActivity_setTextInputState(GameActivity* activity, - const GameTextInputState* state); - -/** - * Get the last-received text entry state (see documentation of the - * GameTextInputState struct in the Game Text Input library reference). - * - */ -void GameActivity_getTextInputState(GameActivity* activity, - GameTextInputGetStateCallback callback, - void* context); - -/** - * Get a pointer to the GameTextInput library instance. - */ -GameTextInput* GameActivity_getTextInput(const GameActivity* activity); - -/** - * Flags for GameActivity_hideSoftInput; see the Java InputMethodManager - * API for documentation. - */ -enum GameActivityHideSoftInputFlags { - /** - * The soft input window should only be hidden if it was not - * explicitly shown by the user. - */ - GAMEACTIVITY_HIDE_SOFT_INPUT_IMPLICIT_ONLY = 0x0001, - /** - * The soft input window should normally be hidden, unless it was - * originally shown with {@link GAMEACTIVITY_SHOW_SOFT_INPUT_FORCED}. - */ - GAMEACTIVITY_HIDE_SOFT_INPUT_NOT_ALWAYS = 0x0002, -}; - -/** - * Hide the IME while in the given activity. Calls - * InputMethodManager.hideSoftInput() for the given activity. Note that this - * method can be called from *any* thread; it will send a message to the main - * thread of the process where the Java finish call will take place. - */ -void GameActivity_hideSoftInput(GameActivity* activity, uint32_t flags); - -/** - * Get the current window insets of the particular component. See - * https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat.Type - * for more details. - * You can use these insets to influence what you show on the screen. - */ -void GameActivity_getWindowInsets(GameActivity* activity, - GameCommonInsetsType type, ARect* insets); - -/** - * Set options on how the IME behaves when it is requested for text input. - * See - * https://developer.android.com/reference/android/view/inputmethod/EditorInfo - * for the meaning of inputType, actionId and imeOptions. - * - * Note that this function will attach the current thread to the JVM if it is - * not already attached, so the caller must detach the thread from the JVM - * before the thread is destroyed using DetachCurrentThread. - */ -void GameActivity_setImeEditorInfo(GameActivity* activity, int inputType, - int actionId, int imeOptions); - -#ifdef __cplusplus -} -#endif - -/** @} */ - -#endif // ANDROID_GAME_SDK_GAME_ACTIVITY_H diff --git a/android-activity/game-activity-csrc/game-activity/native_app_glue/android_native_app_glue.c b/android-activity/game-activity-csrc/game-activity/native_app_glue/android_native_app_glue.c deleted file mode 100644 index 5fd3eb86..00000000 --- a/android-activity/game-activity-csrc/game-activity/native_app_glue/android_native_app_glue.c +++ /dev/null @@ -1,639 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "android_native_app_glue.h" - -#include -#include -#include -#include -#include -#include -#include - -#define LOGI(...) \ - ((void)__android_log_print(ANDROID_LOG_INFO, "threaded_app", __VA_ARGS__)) -#define LOGE(...) \ - ((void)__android_log_print(ANDROID_LOG_ERROR, "threaded_app", __VA_ARGS__)) -#define LOGW(...) \ - ((void)__android_log_print(ANDROID_LOG_WARN, "threaded_app", __VA_ARGS__)) -#define LOGW_ONCE(...) \ - do { \ - static bool alogw_once##__FILE__##__LINE__##__ = true; \ - if (alogw_once##__FILE__##__LINE__##__) { \ - alogw_once##__FILE__##__LINE__##__ = false; \ - LOGW(__VA_ARGS__); \ - } \ - } while (0) - -/* For debug builds, always enable the debug traces in this library */ -#ifndef NDEBUG -#define LOGV(...) \ - ((void)__android_log_print(ANDROID_LOG_VERBOSE, "threaded_app", \ - __VA_ARGS__)) -#else -#define LOGV(...) ((void)0) -#endif - -static void free_saved_state(struct android_app* android_app) { - pthread_mutex_lock(&android_app->mutex); - if (android_app->savedState != NULL) { - free(android_app->savedState); - android_app->savedState = NULL; - android_app->savedStateSize = 0; - } - pthread_mutex_unlock(&android_app->mutex); -} - -int8_t android_app_read_cmd(struct android_app* android_app) { - int8_t cmd; - if (read(android_app->msgread, &cmd, sizeof(cmd)) != sizeof(cmd)) { - LOGE("No data on command pipe!"); - return -1; - } - if (cmd == APP_CMD_SAVE_STATE) free_saved_state(android_app); - return cmd; -} - -static void print_cur_config(struct android_app* android_app) { - char lang[2], country[2]; - AConfiguration_getLanguage(android_app->config, lang); - AConfiguration_getCountry(android_app->config, country); - - LOGV( - "Config: mcc=%d mnc=%d lang=%c%c cnt=%c%c orien=%d touch=%d dens=%d " - "keys=%d nav=%d keysHid=%d navHid=%d sdk=%d size=%d long=%d " - "modetype=%d modenight=%d", - AConfiguration_getMcc(android_app->config), - AConfiguration_getMnc(android_app->config), lang[0], lang[1], - country[0], country[1], - AConfiguration_getOrientation(android_app->config), - AConfiguration_getTouchscreen(android_app->config), - AConfiguration_getDensity(android_app->config), - AConfiguration_getKeyboard(android_app->config), - AConfiguration_getNavigation(android_app->config), - AConfiguration_getKeysHidden(android_app->config), - AConfiguration_getNavHidden(android_app->config), - AConfiguration_getSdkVersion(android_app->config), - AConfiguration_getScreenSize(android_app->config), - AConfiguration_getScreenLong(android_app->config), - AConfiguration_getUiModeType(android_app->config), - AConfiguration_getUiModeNight(android_app->config)); -} - -void android_app_pre_exec_cmd(struct android_app* android_app, int8_t cmd) { - switch (cmd) { - case UNUSED_APP_CMD_INPUT_CHANGED: - LOGV("UNUSED_APP_CMD_INPUT_CHANGED"); - // Do nothing. This can be used in the future to handle AInputQueue - // natively, like done in NativeActivity. - break; - - case APP_CMD_INIT_WINDOW: - LOGV("APP_CMD_INIT_WINDOW"); - pthread_mutex_lock(&android_app->mutex); - android_app->window = android_app->pendingWindow; - pthread_cond_broadcast(&android_app->cond); - pthread_mutex_unlock(&android_app->mutex); - break; - - case APP_CMD_TERM_WINDOW: - LOGV("APP_CMD_TERM_WINDOW"); - pthread_cond_broadcast(&android_app->cond); - break; - - case APP_CMD_RESUME: - case APP_CMD_START: - case APP_CMD_PAUSE: - case APP_CMD_STOP: - LOGV("activityState=%d", cmd); - pthread_mutex_lock(&android_app->mutex); - android_app->activityState = cmd; - pthread_cond_broadcast(&android_app->cond); - pthread_mutex_unlock(&android_app->mutex); - break; - - case APP_CMD_CONFIG_CHANGED: - LOGV("APP_CMD_CONFIG_CHANGED"); - AConfiguration_fromAssetManager( - android_app->config, android_app->activity->assetManager); - print_cur_config(android_app); - break; - - case APP_CMD_DESTROY: - LOGV("APP_CMD_DESTROY"); - android_app->destroyRequested = 1; - break; - } -} - -void android_app_post_exec_cmd(struct android_app* android_app, int8_t cmd) { - switch (cmd) { - case APP_CMD_TERM_WINDOW: - LOGV("APP_CMD_TERM_WINDOW"); - pthread_mutex_lock(&android_app->mutex); - android_app->window = NULL; - pthread_cond_broadcast(&android_app->cond); - pthread_mutex_unlock(&android_app->mutex); - break; - - case APP_CMD_SAVE_STATE: - LOGV("APP_CMD_SAVE_STATE"); - pthread_mutex_lock(&android_app->mutex); - android_app->stateSaved = 1; - pthread_cond_broadcast(&android_app->cond); - pthread_mutex_unlock(&android_app->mutex); - break; - - case APP_CMD_RESUME: - free_saved_state(android_app); - break; - } -} - -void app_dummy() {} - -static void android_app_destroy(struct android_app* android_app) { - LOGV("android_app_destroy!"); - free_saved_state(android_app); - pthread_mutex_lock(&android_app->mutex); - - AConfiguration_delete(android_app->config); - android_app->destroyed = 1; - pthread_cond_broadcast(&android_app->cond); - pthread_mutex_unlock(&android_app->mutex); - // Can't touch android_app object after this. -} - -static void process_cmd(struct android_app* app, - struct android_poll_source* source) { - int8_t cmd = android_app_read_cmd(app); - android_app_pre_exec_cmd(app, cmd); - if (app->onAppCmd != NULL) app->onAppCmd(app, cmd); - android_app_post_exec_cmd(app, cmd); -} - -// This is run on a separate thread (i.e: not the main thread). -static void* android_app_entry(void* param) { - struct android_app* android_app = (struct android_app*)param; - - LOGV("android_app_entry called"); - android_app->config = AConfiguration_new(); - LOGV("android_app = %p", android_app); - LOGV("config = %p", android_app->config); - LOGV("activity = %p", android_app->activity); - LOGV("assetmanager = %p", android_app->activity->assetManager); - AConfiguration_fromAssetManager(android_app->config, - android_app->activity->assetManager); - - print_cur_config(android_app); - - android_app->cmdPollSource.id = LOOPER_ID_MAIN; - android_app->cmdPollSource.app = android_app; - android_app->cmdPollSource.process = process_cmd; - - ALooper* looper = ALooper_prepare(ALOOPER_PREPARE_ALLOW_NON_CALLBACKS); - ALooper_addFd(looper, android_app->msgread, LOOPER_ID_MAIN, - ALOOPER_EVENT_INPUT, NULL, &android_app->cmdPollSource); - android_app->looper = looper; - - pthread_mutex_lock(&android_app->mutex); - android_app->running = 1; - pthread_cond_broadcast(&android_app->cond); - pthread_mutex_unlock(&android_app->mutex); - - _rust_glue_entry(android_app); - - android_app_destroy(android_app); - return NULL; -} - -// Codes from https://developer.android.com/reference/android/view/KeyEvent -#define KEY_EVENT_KEYCODE_VOLUME_DOWN 25 -#define KEY_EVENT_KEYCODE_VOLUME_MUTE 164 -#define KEY_EVENT_KEYCODE_VOLUME_UP 24 -#define KEY_EVENT_KEYCODE_CAMERA 27 -#define KEY_EVENT_KEYCODE_ZOOM_IN 168 -#define KEY_EVENT_KEYCODE_ZOOM_OUT 169 - -// Double-buffer the key event filter to avoid race condition. -static bool default_key_filter(const GameActivityKeyEvent* event) { - // Ignore camera, volume, etc. buttons - return !(event->keyCode == KEY_EVENT_KEYCODE_VOLUME_DOWN || - event->keyCode == KEY_EVENT_KEYCODE_VOLUME_MUTE || - event->keyCode == KEY_EVENT_KEYCODE_VOLUME_UP || - event->keyCode == KEY_EVENT_KEYCODE_CAMERA || - event->keyCode == KEY_EVENT_KEYCODE_ZOOM_IN || - event->keyCode == KEY_EVENT_KEYCODE_ZOOM_OUT); -} - -// See -// https://developer.android.com/reference/android/view/InputDevice#SOURCE_TOUCHSCREEN -#define SOURCE_TOUCHSCREEN 0x00001002 - -static bool default_motion_filter(const GameActivityMotionEvent* event) { - // Ignore any non-touch events. - return event->source == SOURCE_TOUCHSCREEN; -} - -// -------------------------------------------------------------------- -// Native activity interaction (called from main thread) -// -------------------------------------------------------------------- - -static struct android_app* android_app_create(GameActivity* activity, - void* savedState, - size_t savedStateSize) { - // struct android_app* android_app = calloc(1, sizeof(struct android_app)); - struct android_app* android_app = - (struct android_app*)malloc(sizeof(struct android_app)); - memset(android_app, 0, sizeof(struct android_app)); - android_app->activity = activity; - - pthread_mutex_init(&android_app->mutex, NULL); - pthread_cond_init(&android_app->cond, NULL); - - if (savedState != NULL) { - android_app->savedState = malloc(savedStateSize); - android_app->savedStateSize = savedStateSize; - memcpy(android_app->savedState, savedState, savedStateSize); - } - - int msgpipe[2]; - if (pipe(msgpipe)) { - LOGE("could not create pipe: %s", strerror(errno)); - return NULL; - } - android_app->msgread = msgpipe[0]; - android_app->msgwrite = msgpipe[1]; - - android_app->keyEventFilter = default_key_filter; - android_app->motionEventFilter = default_motion_filter; - - LOGV("Launching android_app_entry in a thread"); - pthread_attr_t attr; - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - pthread_create(&android_app->thread, &attr, android_app_entry, android_app); - - // Wait for thread to start. - pthread_mutex_lock(&android_app->mutex); - while (!android_app->running) { - pthread_cond_wait(&android_app->cond, &android_app->mutex); - } - pthread_mutex_unlock(&android_app->mutex); - - return android_app; -} - -static void android_app_write_cmd(struct android_app* android_app, int8_t cmd) { - if (write(android_app->msgwrite, &cmd, sizeof(cmd)) != sizeof(cmd)) { - LOGE("Failure writing android_app cmd: %s", strerror(errno)); - } -} - -static void android_app_set_window(struct android_app* android_app, - ANativeWindow* window) { - LOGV("android_app_set_window called"); - pthread_mutex_lock(&android_app->mutex); - if (android_app->pendingWindow != NULL) { - android_app_write_cmd(android_app, APP_CMD_TERM_WINDOW); - } - android_app->pendingWindow = window; - if (window != NULL) { - android_app_write_cmd(android_app, APP_CMD_INIT_WINDOW); - } - while (android_app->window != android_app->pendingWindow) { - pthread_cond_wait(&android_app->cond, &android_app->mutex); - } - pthread_mutex_unlock(&android_app->mutex); -} - -static void android_app_set_activity_state(struct android_app* android_app, - int8_t cmd) { - pthread_mutex_lock(&android_app->mutex); - android_app_write_cmd(android_app, cmd); - while (android_app->activityState != cmd) { - pthread_cond_wait(&android_app->cond, &android_app->mutex); - } - pthread_mutex_unlock(&android_app->mutex); -} - -static void android_app_free(struct android_app* android_app) { - pthread_mutex_lock(&android_app->mutex); - android_app_write_cmd(android_app, APP_CMD_DESTROY); - while (!android_app->destroyed) { - pthread_cond_wait(&android_app->cond, &android_app->mutex); - } - pthread_mutex_unlock(&android_app->mutex); - - close(android_app->msgread); - close(android_app->msgwrite); - pthread_cond_destroy(&android_app->cond); - pthread_mutex_destroy(&android_app->mutex); - free(android_app); -} - -static inline struct android_app* ToApp(GameActivity* activity) { - return (struct android_app*)activity->instance; -} - -static void onDestroy(GameActivity* activity) { - LOGV("Destroy: %p", activity); - android_app_free(ToApp(activity)); -} - -static void onStart(GameActivity* activity) { - LOGV("Start: %p", activity); - android_app_set_activity_state(ToApp(activity), APP_CMD_START); -} - -static void onResume(GameActivity* activity) { - LOGV("Resume: %p", activity); - android_app_set_activity_state(ToApp(activity), APP_CMD_RESUME); -} - -static void onSaveInstanceState(GameActivity* activity, - SaveInstanceStateRecallback recallback, - void* context) { - LOGV("SaveInstanceState: %p", activity); - - struct android_app* android_app = ToApp(activity); - pthread_mutex_lock(&android_app->mutex); - android_app->stateSaved = 0; - android_app_write_cmd(android_app, APP_CMD_SAVE_STATE); - while (!android_app->stateSaved) { - pthread_cond_wait(&android_app->cond, &android_app->mutex); - } - - if (android_app->savedState != NULL) { - // Tell the Java side about our state. - recallback((const char*)android_app->savedState, - android_app->savedStateSize, context); - // Now we can free it. - free(android_app->savedState); - android_app->savedState = NULL; - android_app->savedStateSize = 0; - } - - pthread_mutex_unlock(&android_app->mutex); -} - -static void onPause(GameActivity* activity) { - LOGV("Pause: %p", activity); - android_app_set_activity_state(ToApp(activity), APP_CMD_PAUSE); -} - -static void onStop(GameActivity* activity) { - LOGV("Stop: %p", activity); - android_app_set_activity_state(ToApp(activity), APP_CMD_STOP); -} - -static void onConfigurationChanged(GameActivity* activity) { - LOGV("ConfigurationChanged: %p", activity); - android_app_write_cmd(ToApp(activity), APP_CMD_CONFIG_CHANGED); -} - -static void onTrimMemory(GameActivity* activity, int level) { - LOGV("TrimMemory: %p %d", activity, level); - android_app_write_cmd(ToApp(activity), APP_CMD_LOW_MEMORY); -} - -static void onWindowFocusChanged(GameActivity* activity, bool focused) { - LOGV("WindowFocusChanged: %p -- %d", activity, focused); - android_app_write_cmd(ToApp(activity), - focused ? APP_CMD_GAINED_FOCUS : APP_CMD_LOST_FOCUS); -} - -static void onNativeWindowCreated(GameActivity* activity, - ANativeWindow* window) { - LOGV("NativeWindowCreated: %p -- %p", activity, window); - android_app_set_window(ToApp(activity), window); -} - -static void onNativeWindowDestroyed(GameActivity* activity, - ANativeWindow* window) { - LOGV("NativeWindowDestroyed: %p -- %p", activity, window); - android_app_set_window(ToApp(activity), NULL); -} - -static void onNativeWindowRedrawNeeded(GameActivity* activity, - ANativeWindow* window) { - LOGV("NativeWindowRedrawNeeded: %p -- %p", activity, window); - android_app_write_cmd(ToApp(activity), APP_CMD_WINDOW_REDRAW_NEEDED); -} - -static void onNativeWindowResized(GameActivity* activity, ANativeWindow* window, - int32_t width, int32_t height) { - LOGV("NativeWindowResized: %p -- %p ( %d x %d )", activity, window, width, - height); - android_app_write_cmd(ToApp(activity), APP_CMD_WINDOW_RESIZED); -} - -void android_app_set_motion_event_filter(struct android_app* app, - android_motion_event_filter filter) { - pthread_mutex_lock(&app->mutex); - app->motionEventFilter = filter; - pthread_mutex_unlock(&app->mutex); -} - -bool android_app_input_available_wake_up(struct android_app* app) { - pthread_mutex_lock(&app->mutex); - // TODO: use atomic ops for this - bool available = app->inputAvailableWakeUp; - app->inputAvailableWakeUp = false; - pthread_mutex_unlock(&app->mutex); - return available; -} - -// NB: should be called with the android_app->mutex held already -static void notifyInput(struct android_app* android_app) { - // Don't spam the mainloop with wake ups if we've already sent one - if (android_app->inputSwapPending) { - return; - } - - if (android_app->looper != NULL) { - LOGV("Input Notify: %p", android_app); - // for the app thread to know why it received the wake() up - android_app->inputAvailableWakeUp = true; - android_app->inputSwapPending = true; - ALooper_wake(android_app->looper); - } -} - -static bool onTouchEvent(GameActivity* activity, - const GameActivityMotionEvent* event, - const GameActivityHistoricalPointerAxes* historical, - int historicalLen) { - struct android_app* android_app = ToApp(activity); - pthread_mutex_lock(&android_app->mutex); - - if (android_app->motionEventFilter != NULL && - !android_app->motionEventFilter(event)) { - pthread_mutex_unlock(&android_app->mutex); - return false; - } - - struct android_input_buffer* inputBuffer = - &android_app->inputBuffers[android_app->currentInputBuffer]; - - // Add to the list of active motion events - if (inputBuffer->motionEventsCount < - NATIVE_APP_GLUE_MAX_NUM_MOTION_EVENTS) { - int new_ix = inputBuffer->motionEventsCount; - memcpy(&inputBuffer->motionEvents[new_ix], event, - sizeof(GameActivityMotionEvent)); - ++inputBuffer->motionEventsCount; - - if (inputBuffer->historicalSamplesCount + historicalLen <= - NATIVE_APP_GLUE_MAX_HISTORICAL_POINTER_SAMPLES) { - - int start_ix = inputBuffer->historicalSamplesCount; - memcpy(&inputBuffer->historicalAxisSamples[start_ix], historical, - sizeof(historical[0]) * historicalLen); - inputBuffer->historicalSamplesCount += event->historicalCount; - - inputBuffer->motionEvents[new_ix].historicalStart = start_ix; - inputBuffer->motionEvents[new_ix].historicalCount = historicalLen; - } else { - inputBuffer->motionEvents[new_ix].historicalCount = 0; - } - - notifyInput(android_app); - } else { - LOGW_ONCE("Motion event will be dropped because the number of unconsumed motion" - " events exceeded NATIVE_APP_GLUE_MAX_NUM_MOTION_EVENTS (%d). Consider setting" - " NATIVE_APP_GLUE_MAX_NUM_MOTION_EVENTS_OVERRIDE to a larger value", - NATIVE_APP_GLUE_MAX_NUM_MOTION_EVENTS); - } - - pthread_mutex_unlock(&android_app->mutex); - return true; -} - -struct android_input_buffer* android_app_swap_input_buffers( - struct android_app* android_app) { - pthread_mutex_lock(&android_app->mutex); - - struct android_input_buffer* inputBuffer = - &android_app->inputBuffers[android_app->currentInputBuffer]; - - if (inputBuffer->motionEventsCount == 0 && - inputBuffer->keyEventsCount == 0) { - inputBuffer = NULL; - } else { - android_app->currentInputBuffer = - (android_app->currentInputBuffer + 1) % - NATIVE_APP_GLUE_MAX_INPUT_BUFFERS; - } - - android_app->inputSwapPending = false; - android_app->inputAvailableWakeUp = false; - - pthread_mutex_unlock(&android_app->mutex); - - return inputBuffer; -} - -void android_app_clear_motion_events(struct android_input_buffer* inputBuffer) { - inputBuffer->motionEventsCount = 0; -} - -void android_app_set_key_event_filter(struct android_app* app, - android_key_event_filter filter) { - pthread_mutex_lock(&app->mutex); - app->keyEventFilter = filter; - pthread_mutex_unlock(&app->mutex); -} - -static bool onKey(GameActivity* activity, const GameActivityKeyEvent* event) { - struct android_app* android_app = ToApp(activity); - pthread_mutex_lock(&android_app->mutex); - - if (android_app->keyEventFilter != NULL && - !android_app->keyEventFilter(event)) { - pthread_mutex_unlock(&android_app->mutex); - return false; - } - - struct android_input_buffer* inputBuffer = - &android_app->inputBuffers[android_app->currentInputBuffer]; - - // Add to the list of active key down events - if (inputBuffer->keyEventsCount < NATIVE_APP_GLUE_MAX_NUM_KEY_EVENTS) { - int new_ix = inputBuffer->keyEventsCount; - memcpy(&inputBuffer->keyEvents[new_ix], event, - sizeof(GameActivityKeyEvent)); - ++inputBuffer->keyEventsCount; - - notifyInput(android_app); - } else { - LOGW_ONCE("Key event will be dropped because the number of unconsumed key events exceeded" - " NATIVE_APP_GLUE_MAX_NUM_KEY_EVENTS (%d). Consider setting" - " NATIVE_APP_GLUE_MAX_NUM_KEY_EVENTS_OVERRIDE to a larger value", - NATIVE_APP_GLUE_MAX_NUM_KEY_EVENTS); - } - - pthread_mutex_unlock(&android_app->mutex); - return true; -} - -void android_app_clear_key_events(struct android_input_buffer* inputBuffer) { - inputBuffer->keyEventsCount = 0; -} - -static void onTextInputEvent(GameActivity* activity, - const GameTextInputState* state) { - struct android_app* android_app = ToApp(activity); - pthread_mutex_lock(&android_app->mutex); - - android_app->textInputState = 1; - pthread_mutex_unlock(&android_app->mutex); -} - -static void onWindowInsetsChanged(GameActivity* activity) { - LOGV("WindowInsetsChanged: %p", activity); - android_app_write_cmd(ToApp(activity), APP_CMD_WINDOW_INSETS_CHANGED); -} - -JNIEXPORT -void GameActivity_onCreate_C(GameActivity* activity, void* savedState, - size_t savedStateSize) { - LOGV("Creating: %p", activity); - activity->callbacks->onDestroy = onDestroy; - activity->callbacks->onStart = onStart; - activity->callbacks->onResume = onResume; - activity->callbacks->onSaveInstanceState = onSaveInstanceState; - activity->callbacks->onPause = onPause; - activity->callbacks->onStop = onStop; - activity->callbacks->onTouchEvent = onTouchEvent; - activity->callbacks->onKeyDown = onKey; - activity->callbacks->onKeyUp = onKey; - activity->callbacks->onTextInputEvent = onTextInputEvent; - activity->callbacks->onConfigurationChanged = onConfigurationChanged; - activity->callbacks->onTrimMemory = onTrimMemory; - activity->callbacks->onWindowFocusChanged = onWindowFocusChanged; - activity->callbacks->onNativeWindowCreated = onNativeWindowCreated; - activity->callbacks->onNativeWindowDestroyed = onNativeWindowDestroyed; - activity->callbacks->onNativeWindowRedrawNeeded = - onNativeWindowRedrawNeeded; - activity->callbacks->onNativeWindowResized = onNativeWindowResized; - activity->callbacks->onWindowInsetsChanged = onWindowInsetsChanged; - LOGV("Callbacks set: %p", activity->callbacks); - - activity->instance = - android_app_create(activity, savedState, savedStateSize); -} diff --git a/android-activity/game-activity-csrc/game-activity/native_app_glue/android_native_app_glue.h b/android-activity/game-activity-csrc/game-activity/native_app_glue/android_native_app_glue.h deleted file mode 100644 index 96968e38..00000000 --- a/android-activity/game-activity-csrc/game-activity/native_app_glue/android_native_app_glue.h +++ /dev/null @@ -1,541 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -/** - * @addtogroup android_native_app_glue Native App Glue library - * The glue library to interface your game loop with GameActivity. - * @{ - */ - -#include -#include -#include -#include -#include - -#include "game-activity/GameActivity.h" - -#if (defined NATIVE_APP_GLUE_MAX_NUM_MOTION_EVENTS_OVERRIDE) -#define NATIVE_APP_GLUE_MAX_NUM_MOTION_EVENTS \ - NATIVE_APP_GLUE_MAX_NUM_MOTION_EVENTS_OVERRIDE -#else -#define NATIVE_APP_GLUE_MAX_NUM_MOTION_EVENTS 16 -#endif - -#if (defined NATIVE_APP_GLUE_MAX_HISTORICAL_POINTER_SAMPLES_OVERRIDE) -#define NATIVE_APP_GLUE_MAX_HISTORICAL_POINTER_SAMPLES \ - NATIVE_APP_GLUE_MAX_HISTORICAL_POINTER_SAMPLES_OVERRIDE -#else -#define NATIVE_APP_GLUE_MAX_HISTORICAL_POINTER_SAMPLES 64 -#endif - -#if (defined NATIVE_APP_GLUE_MAX_NUM_KEY_EVENTS_OVERRIDE) -#define NATIVE_APP_GLUE_MAX_NUM_KEY_EVENTS \ - NATIVE_APP_GLUE_MAX_NUM_KEY_EVENTS_OVERRIDE -#else -#define NATIVE_APP_GLUE_MAX_NUM_KEY_EVENTS 4 -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * The GameActivity interface provided by - * is based on a set of application-provided callbacks that will be called - * by the Activity's main thread when certain events occur. - * - * This means that each one of this callbacks _should_ _not_ block, or they - * risk having the system force-close the application. This programming - * model is direct, lightweight, but constraining. - * - * The 'android_native_app_glue' static library is used to provide a different - * execution model where the application can implement its own main event - * loop in a different thread instead. Here's how it works: - * - * 1/ The application must provide a function named "android_main()" that - * will be called when the activity is created, in a new thread that is - * distinct from the activity's main thread. - * - * 2/ android_main() receives a pointer to a valid "android_app" structure - * that contains references to other important objects, e.g. the - * GameActivity obejct instance the application is running in. - * - * 3/ the "android_app" object holds an ALooper instance that already - * listens to activity lifecycle events (e.g. "pause", "resume"). - * See APP_CMD_XXX declarations below. - * - * This corresponds to an ALooper identifier returned by - * ALooper_pollOnce with value LOOPER_ID_MAIN. - * - * Your application can use the same ALooper to listen to additional - * file-descriptors. They can either be callback based, or with return - * identifiers starting with LOOPER_ID_USER. - * - * 4/ Whenever you receive a LOOPER_ID_MAIN event, - * the returned data will point to an android_poll_source structure. You - * can call the process() function on it, and fill in android_app->onAppCmd - * to be called for your own processing of the event. - * - * Alternatively, you can call the low-level functions to read and process - * the data directly... look at the process_cmd() and process_input() - * implementations in the glue to see how to do this. - * - * See the sample named "native-activity" that comes with the NDK with a - * full usage example. Also look at the documentation of GameActivity. - */ - -struct android_app; - -/** - * Data associated with an ALooper fd that will be returned as the "outData" - * when that source has data ready. - */ -struct android_poll_source { - /** - * The identifier of this source. May be LOOPER_ID_MAIN or - * LOOPER_ID_INPUT. - */ - int32_t id; - - /** The android_app this ident is associated with. */ - struct android_app* app; - - /** - * Function to call to perform the standard processing of data from - * this source. - */ - void (*process)(struct android_app* app, - struct android_poll_source* source); -}; - -struct android_input_buffer { - /** - * Pointer to a read-only array of pointers to GameActivityMotionEvent. - * Only the first motionEventsCount events are valid. - */ - GameActivityMotionEvent motionEvents[NATIVE_APP_GLUE_MAX_NUM_MOTION_EVENTS]; - - /** - * The number of valid motion events in `motionEvents`. - */ - uint64_t motionEventsCount; - - /** - * Pointer to a read-only array of pointers to GameActivityHistoricalPointerAxes. - * - * Only the first historicalSamplesCount samples are valid. - * Refer to event->historicalStart, event->pointerCount and event->historicalCount - * to access the specific samples that relate to an event. - * - * Each slice of samples for one event has a length of - * (event->pointerCount and event->historicalCount) and is in pointer-major - * order so the historic samples for each pointer are contiguous. - * E.g. you would access historic sample index 3 for pointer 2 of an event with: - * - * historicalAxisSamples[event->historicalStart + (event->historicalCount * 2) + 3]; - */ - GameActivityHistoricalPointerAxes historicalAxisSamples[NATIVE_APP_GLUE_MAX_HISTORICAL_POINTER_SAMPLES]; - - /** - * The number of valid historical samples in `historicalAxisSamples`. - */ - uint64_t historicalSamplesCount; - - /** - * Pointer to a read-only array of pointers to GameActivityKeyEvent. - * Only the first keyEventsCount events are valid. - */ - GameActivityKeyEvent keyEvents[NATIVE_APP_GLUE_MAX_NUM_KEY_EVENTS]; - - /** - * The number of valid "Key" events in `keyEvents`. - */ - uint64_t keyEventsCount; -}; - -/** - * Function pointer declaration for the filtering of key events. - * A function with this signature should be passed to - * android_app_set_key_event_filter and return false for any events that should - * not be handled by android_native_app_glue. These events will be handled by - * the system instead. - */ -typedef bool (*android_key_event_filter)(const GameActivityKeyEvent*); - -/** - * Function pointer definition for the filtering of motion events. - * A function with this signature should be passed to - * android_app_set_motion_event_filter and return false for any events that - * should not be handled by android_native_app_glue. These events will be - * handled by the system instead. - */ -typedef bool (*android_motion_event_filter)(const GameActivityMotionEvent*); - -/** - * This is the interface for the standard glue code of a threaded - * application. In this model, the application's code is running - * in its own thread separate from the main thread of the process. - * It is not required that this thread be associated with the Java - * VM, although it will need to be in order to make JNI calls any - * Java objects. - */ -struct android_app { - /** - * An optional pointer to application-defined state. - */ - void* userData; - - /** - * A required callback for processing main app commands (`APP_CMD_*`). - * This is called each frame if there are app commands that need processing. - */ - void (*onAppCmd)(struct android_app* app, int32_t cmd); - - /** The GameActivity object instance that this app is running in. */ - GameActivity* activity; - - /** The current configuration the app is running in. */ - AConfiguration* config; - - /** - * The last activity saved state, as provided at creation time. - * It is NULL if there was no state. You can use this as you need; the - * memory will remain around until you call android_app_exec_cmd() for - * APP_CMD_RESUME, at which point it will be freed and savedState set to - * NULL. These variables should only be changed when processing a - * APP_CMD_SAVE_STATE, at which point they will be initialized to NULL and - * you can malloc your state and place the information here. In that case - * the memory will be freed for you later. - */ - void* savedState; - - /** - * The size of the activity saved state. It is 0 if `savedState` is NULL. - */ - size_t savedStateSize; - - /** The ALooper associated with the app's thread. */ - ALooper* looper; - - /** When non-NULL, this is the window surface that the app can draw in. */ - ANativeWindow* window; - - /** - * Current content rectangle of the window; this is the area where the - * window's content should be placed to be seen by the user. - */ - ARect contentRect; - - /** - * Current state of the app's activity. May be either APP_CMD_START, - * APP_CMD_RESUME, APP_CMD_PAUSE, or APP_CMD_STOP. - */ - int activityState; - - /** - * This is non-zero when the application's GameActivity is being - * destroyed and waiting for the app thread to complete. - */ - int destroyRequested; - -#define NATIVE_APP_GLUE_MAX_INPUT_BUFFERS 2 - - /** - * This is used for buffering input from GameActivity. Once ready, the - * application thread switches the buffers and processes what was - * accumulated. - */ - struct android_input_buffer inputBuffers[NATIVE_APP_GLUE_MAX_INPUT_BUFFERS]; - - int currentInputBuffer; - - /** - * 0 if no text input event is outstanding, 1 if it is. - * Use `GameActivity_getTextInputState` to get information - * about the text entered by the user. - */ - int textInputState; - - // Below are "private" implementation of the glue code. - /** @cond INTERNAL */ - - pthread_mutex_t mutex; - pthread_cond_t cond; - - int msgread; - int msgwrite; - - pthread_t thread; - - struct android_poll_source cmdPollSource; - - int running; - int stateSaved; - int destroyed; - int redrawNeeded; - ANativeWindow* pendingWindow; - ARect pendingContentRect; - - android_key_event_filter keyEventFilter; - android_motion_event_filter motionEventFilter; - - // When new input is received we set both of these flags and use the looper to - // wake up the application mainloop. - // - // To avoid spamming the mainloop with wake ups from lots of input though we - // don't sent a wake up if the inputSwapPending flag is already set. (i.e. - // we already expect input to be processed in a finite amount of time due to - // our previous wake up) - // - // When a wake up is received then we will check this flag (clearing it - // at the same time). If it was set then an InputAvailable event is sent to - // the application - which should lead to all input being processed within - // a finite amount of time. - // - // The next time android_app_swap_input_buffers is called, both flags will be - // cleared. - // - // NB: both of these should only be read with the app mutex held - bool inputAvailableWakeUp; - bool inputSwapPending; - - /** @endcond */ -}; - -/** - * Looper ID of commands coming from the app's main thread, an AInputQueue or - * user-defined sources. - */ -enum NativeAppGlueLooperId { - /** - * Looper data ID of commands coming from the app's main thread, which - * is returned as an identifier from ALooper_pollOnce(). The data for this - * identifier is a pointer to an android_poll_source structure. - * These can be retrieved and processed with android_app_read_cmd() - * and android_app_exec_cmd(). - */ - LOOPER_ID_MAIN = 1, - - /** - * Unused. Reserved for future use when usage of AInputQueue will be - * supported. - */ - LOOPER_ID_INPUT = 2, - - /** - * Start of user-defined ALooper identifiers. - */ - LOOPER_ID_USER = 3, -}; - -/** - * Commands passed from the application's main Java thread to the game's thread. - */ -enum NativeAppGlueAppCmd { - /** - * Unused. Reserved for future use when usage of AInputQueue will be - * supported. - */ - UNUSED_APP_CMD_INPUT_CHANGED, - - /** - * Command from main thread: a new ANativeWindow is ready for use. Upon - * receiving this command, android_app->window will contain the new window - * surface. - */ - APP_CMD_INIT_WINDOW, - - /** - * Command from main thread: the existing ANativeWindow needs to be - * terminated. Upon receiving this command, android_app->window still - * contains the existing window; after calling android_app_exec_cmd - * it will be set to NULL. - */ - APP_CMD_TERM_WINDOW, - - /** - * Command from main thread: the current ANativeWindow has been resized. - * Please redraw with its new size. - */ - APP_CMD_WINDOW_RESIZED, - - /** - * Command from main thread: the system needs that the current ANativeWindow - * be redrawn. You should redraw the window before handing this to - * android_app_exec_cmd() in order to avoid transient drawing glitches. - */ - APP_CMD_WINDOW_REDRAW_NEEDED, - - /** - * Command from main thread: the content area of the window has changed, - * such as from the soft input window being shown or hidden. You can - * find the new content rect in android_app::contentRect. - */ - APP_CMD_CONTENT_RECT_CHANGED, - - /** - * Command from main thread: the app's activity window has gained - * input focus. - */ - APP_CMD_GAINED_FOCUS, - - /** - * Command from main thread: the app's activity window has lost - * input focus. - */ - APP_CMD_LOST_FOCUS, - - /** - * Command from main thread: the current device configuration has changed. - */ - APP_CMD_CONFIG_CHANGED, - - /** - * Command from main thread: the system is running low on memory. - * Try to reduce your memory use. - */ - APP_CMD_LOW_MEMORY, - - /** - * Command from main thread: the app's activity has been started. - */ - APP_CMD_START, - - /** - * Command from main thread: the app's activity has been resumed. - */ - APP_CMD_RESUME, - - /** - * Command from main thread: the app should generate a new saved state - * for itself, to restore from later if needed. If you have saved state, - * allocate it with malloc and place it in android_app.savedState with - * the size in android_app.savedStateSize. The will be freed for you - * later. - */ - APP_CMD_SAVE_STATE, - - /** - * Command from main thread: the app's activity has been paused. - */ - APP_CMD_PAUSE, - - /** - * Command from main thread: the app's activity has been stopped. - */ - APP_CMD_STOP, - - /** - * Command from main thread: the app's activity is being destroyed, - * and waiting for the app thread to clean up and exit before proceeding. - */ - APP_CMD_DESTROY, - - /** - * Command from main thread: the app's insets have changed. - */ - APP_CMD_WINDOW_INSETS_CHANGED, - -}; - -/** - * Call when ALooper_pollAll() returns LOOPER_ID_MAIN, reading the next - * app command message. - */ -int8_t android_app_read_cmd(struct android_app* android_app); - -/** - * Call with the command returned by android_app_read_cmd() to do the - * initial pre-processing of the given command. You can perform your own - * actions for the command after calling this function. - */ -void android_app_pre_exec_cmd(struct android_app* android_app, int8_t cmd); - -/** - * Call with the command returned by android_app_read_cmd() to do the - * final post-processing of the given command. You must have done your own - * actions for the command before calling this function. - */ -void android_app_post_exec_cmd(struct android_app* android_app, int8_t cmd); - -/** - * Call this before processing input events to get the events buffer. - * The function returns NULL if there are no events to process. - */ -struct android_input_buffer* android_app_swap_input_buffers( - struct android_app* android_app); - -/** - * Clear the array of motion events that were waiting to be handled, and release - * each of them. - * - * This method should be called after you have processed the motion events in - * your game loop. You should handle events at each iteration of your game loop. - */ -void android_app_clear_motion_events(struct android_input_buffer* inputBuffer); - -/** - * Clear the array of key events that were waiting to be handled, and release - * each of them. - * - * This method should be called after you have processed the key up events in - * your game loop. You should handle events at each iteration of your game loop. - */ -void android_app_clear_key_events(struct android_input_buffer* inputBuffer); - -/** - * This is a springboard into the Rust glue layer that wraps calling the - * main entry for the app itself. - */ -extern void _rust_glue_entry(struct android_app* app); - -/** - * Set the filter to use when processing key events. - * Any events for which the filter returns false will be ignored by - * android_native_app_glue. If filter is set to NULL, no filtering is done. - * - * The default key filter will filter out volume and camera button presses. - */ -void android_app_set_key_event_filter(struct android_app* app, - android_key_event_filter filter); - -/** - * Set the filter to use when processing touch and motion events. - * Any events for which the filter returns false will be ignored by - * android_native_app_glue. If filter is set to NULL, no filtering is done. - * - * Note that the default motion event filter will only allow touchscreen events - * through, in order to mimic NativeActivity's behaviour, so for controller - * events to be passed to the app, set the filter to NULL. - */ -void android_app_set_motion_event_filter(struct android_app* app, - android_motion_event_filter filter); - -/** - * Determines if a looper wake up was due to new input becoming available - */ -bool android_app_input_available_wake_up(struct android_app* app); - -void GameActivity_onCreate_C(GameActivity* activity, void* savedState, - size_t savedStateSize); -#ifdef __cplusplus -} -#endif - -/** @} */ diff --git a/android-activity/game-activity-csrc/game-text-input/gamecommon.h b/android-activity/game-activity-csrc/game-text-input/gamecommon.h deleted file mode 100644 index 38bffff2..00000000 --- a/android-activity/game-activity-csrc/game-text-input/gamecommon.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @defgroup game_common Game Common - * Common structures and functions used within AGDK - * @{ - */ - -#pragma once - -/** - * The type of a component for which to retrieve insets. See - * https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat.Type - */ -typedef enum GameCommonInsetsType { - GAMECOMMON_INSETS_TYPE_CAPTION_BAR = 0, - GAMECOMMON_INSETS_TYPE_DISPLAY_CUTOUT, - GAMECOMMON_INSETS_TYPE_IME, - GAMECOMMON_INSETS_TYPE_MANDATORY_SYSTEM_GESTURES, - GAMECOMMON_INSETS_TYPE_NAVIGATION_BARS, - GAMECOMMON_INSETS_TYPE_STATUS_BARS, - GAMECOMMON_INSETS_TYPE_SYSTEM_BARS, - GAMECOMMON_INSETS_TYPE_SYSTEM_GESTURES, - GAMECOMMON_INSETS_TYPE_TAPABLE_ELEMENT, - GAMECOMMON_INSETS_TYPE_WATERFALL, - GAMECOMMON_INSETS_TYPE_COUNT -} GameCommonInsetsType; diff --git a/android-activity/game-activity-csrc/game-text-input/gametextinput.cpp b/android-activity/game-activity-csrc/game-text-input/gametextinput.cpp deleted file mode 100644 index 6a399439..00000000 --- a/android-activity/game-activity-csrc/game-text-input/gametextinput.cpp +++ /dev/null @@ -1,364 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "game-text-input/gametextinput.h" - -#include -#include -#include -#include - -#include -#include -#include - -#define LOG_TAG "GameTextInput" - -static constexpr int32_t DEFAULT_MAX_STRING_SIZE = 1 << 16; - -// Cache of field ids in the Java GameTextInputState class -struct StateClassInfo { - jfieldID text; - jfieldID selectionStart; - jfieldID selectionEnd; - jfieldID composingRegionStart; - jfieldID composingRegionEnd; -}; - -// Main GameTextInput object. -struct GameTextInput { - public: - GameTextInput(JNIEnv *env, uint32_t max_string_size); - ~GameTextInput(); - void setState(const GameTextInputState &state); - const GameTextInputState &getState() const { return currentState_; } - void setInputConnection(jobject inputConnection); - void processEvent(jobject textInputEvent); - void showIme(uint32_t flags); - void hideIme(uint32_t flags); - void setEventCallback(GameTextInputEventCallback callback, void *context); - jobject stateToJava(const GameTextInputState &state) const; - void stateFromJava(jobject textInputEvent, - GameTextInputGetStateCallback callback, - void *context) const; - void setImeInsetsCallback(GameTextInputImeInsetsCallback callback, - void *context); - void processImeInsets(const ARect *insets); - const ARect &getImeInsets() const { return currentInsets_; } - - private: - // Copy string and set other fields - void setStateInner(const GameTextInputState &state); - static void processCallback(void *context, const GameTextInputState *state); - JNIEnv *env_ = nullptr; - // Cached at initialization from - // com/google/androidgamesdk/gametextinput/State. - jclass stateJavaClass_ = nullptr; - // The latest text input update. - GameTextInputState currentState_ = {}; - // An instance of gametextinput.InputConnection. - jclass inputConnectionClass_ = nullptr; - jobject inputConnection_ = nullptr; - jmethodID inputConnectionSetStateMethod_; - jmethodID setSoftKeyboardActiveMethod_; - void (*eventCallback_)(void *context, - const struct GameTextInputState *state) = nullptr; - void *eventCallbackContext_ = nullptr; - void (*insetsCallback_)(void *context, - const struct ARect *insets) = nullptr; - ARect currentInsets_ = {}; - void *insetsCallbackContext_ = nullptr; - StateClassInfo stateClassInfo_ = {}; - // Constant-sized buffer used to store state text. - std::vector stateStringBuffer_; -}; - -std::unique_ptr s_gameTextInput; - -extern "C" { - -/////////////////////////////////////////////////////////// -/// GameTextInputState C Functions -/////////////////////////////////////////////////////////// - -// Convert to a Java structure. -jobject currentState_toJava(const GameTextInput *gameTextInput, - const GameTextInputState *state) { - if (state == nullptr) return NULL; - return gameTextInput->stateToJava(*state); -} - -// Convert from Java structure. -void currentState_fromJava(const GameTextInput *gameTextInput, - jobject textInputEvent, - GameTextInputGetStateCallback callback, - void *context) { - gameTextInput->stateFromJava(textInputEvent, callback, context); -} - -/////////////////////////////////////////////////////////// -/// GameTextInput C Functions -/////////////////////////////////////////////////////////// - -struct GameTextInput *GameTextInput_init(JNIEnv *env, - uint32_t max_string_size) { - if (s_gameTextInput.get() != nullptr) { - __android_log_print(ANDROID_LOG_WARN, LOG_TAG, - "Warning: called GameTextInput_init twice without " - "calling GameTextInput_destroy"); - return s_gameTextInput.get(); - } - // Don't use make_unique, for C++11 compatibility - s_gameTextInput = - std::unique_ptr(new GameTextInput(env, max_string_size)); - return s_gameTextInput.get(); -} - -void GameTextInput_destroy(GameTextInput *input) { - if (input == nullptr || s_gameTextInput.get() == nullptr) return; - s_gameTextInput.reset(); -} - -void GameTextInput_setState(GameTextInput *input, - const GameTextInputState *state) { - if (state == nullptr) return; - input->setState(*state); -} - -void GameTextInput_getState(GameTextInput *input, - GameTextInputGetStateCallback callback, - void *context) { - callback(context, &input->getState()); -} - -void GameTextInput_setInputConnection(GameTextInput *input, - jobject inputConnection) { - input->setInputConnection(inputConnection); -} - -void GameTextInput_processEvent(GameTextInput *input, jobject textInputEvent) { - input->processEvent(textInputEvent); -} - -void GameTextInput_processImeInsets(GameTextInput *input, const ARect *insets) { - input->processImeInsets(insets); -} - -void GameTextInput_showIme(struct GameTextInput *input, uint32_t flags) { - input->showIme(flags); -} - -void GameTextInput_hideIme(struct GameTextInput *input, uint32_t flags) { - input->hideIme(flags); -} - -void GameTextInput_setEventCallback(struct GameTextInput *input, - GameTextInputEventCallback callback, - void *context) { - input->setEventCallback(callback, context); -} - -void GameTextInput_setImeInsetsCallback(struct GameTextInput *input, - GameTextInputImeInsetsCallback callback, - void *context) { - input->setImeInsetsCallback(callback, context); -} - -void GameTextInput_getImeInsets(const GameTextInput *input, ARect *insets) { - *insets = input->getImeInsets(); -} - -} // extern "C" - -/////////////////////////////////////////////////////////// -/// GameTextInput C++ class Implementation -/////////////////////////////////////////////////////////// - -GameTextInput::GameTextInput(JNIEnv *env, uint32_t max_string_size) - : env_(env), - stateStringBuffer_(max_string_size == 0 ? DEFAULT_MAX_STRING_SIZE - : max_string_size) { - stateJavaClass_ = (jclass)env_->NewGlobalRef( - env_->FindClass("com/google/androidgamesdk/gametextinput/State")); - inputConnectionClass_ = (jclass)env_->NewGlobalRef(env_->FindClass( - "com/google/androidgamesdk/gametextinput/InputConnection")); - inputConnectionSetStateMethod_ = - env_->GetMethodID(inputConnectionClass_, "setState", - "(Lcom/google/androidgamesdk/gametextinput/State;)V"); - setSoftKeyboardActiveMethod_ = env_->GetMethodID( - inputConnectionClass_, "setSoftKeyboardActive", "(ZI)V"); - - stateClassInfo_.text = - env_->GetFieldID(stateJavaClass_, "text", "Ljava/lang/String;"); - stateClassInfo_.selectionStart = - env_->GetFieldID(stateJavaClass_, "selectionStart", "I"); - stateClassInfo_.selectionEnd = - env_->GetFieldID(stateJavaClass_, "selectionEnd", "I"); - stateClassInfo_.composingRegionStart = - env_->GetFieldID(stateJavaClass_, "composingRegionStart", "I"); - stateClassInfo_.composingRegionEnd = - env_->GetFieldID(stateJavaClass_, "composingRegionEnd", "I"); -} - -GameTextInput::~GameTextInput() { - if (stateJavaClass_ != NULL) { - env_->DeleteGlobalRef(stateJavaClass_); - stateJavaClass_ = NULL; - } - if (inputConnectionClass_ != NULL) { - env_->DeleteGlobalRef(inputConnectionClass_); - inputConnectionClass_ = NULL; - } - if (inputConnection_ != NULL) { - env_->DeleteGlobalRef(inputConnection_); - inputConnection_ = NULL; - } -} - -void GameTextInput::setState(const GameTextInputState &state) { - if (inputConnection_ == nullptr) return; - jobject jstate = stateToJava(state); - env_->CallVoidMethod(inputConnection_, inputConnectionSetStateMethod_, - jstate); - env_->DeleteLocalRef(jstate); - setStateInner(state); -} - -void GameTextInput::setStateInner(const GameTextInputState &state) { - // Check if we're setting using our own string (other parts may be - // different) - if (state.text_UTF8 == currentState_.text_UTF8) { - currentState_ = state; - return; - } - // Otherwise, copy across the string. - auto bytes_needed = - std::min(static_cast(state.text_length + 1), - static_cast(stateStringBuffer_.size())); - currentState_.text_UTF8 = stateStringBuffer_.data(); - std::copy(state.text_UTF8, state.text_UTF8 + bytes_needed - 1, - stateStringBuffer_.data()); - currentState_.text_length = state.text_length; - currentState_.selection = state.selection; - currentState_.composingRegion = state.composingRegion; - stateStringBuffer_[bytes_needed - 1] = 0; -} - -void GameTextInput::setInputConnection(jobject inputConnection) { - if (inputConnection_ != NULL) { - env_->DeleteGlobalRef(inputConnection_); - } - inputConnection_ = env_->NewGlobalRef(inputConnection); -} - -/*static*/ void GameTextInput::processCallback( - void *context, const GameTextInputState *state) { - auto thiz = static_cast(context); - if (state != nullptr) thiz->setStateInner(*state); -} - -void GameTextInput::processEvent(jobject textInputEvent) { - stateFromJava(textInputEvent, processCallback, this); - if (eventCallback_) { - eventCallback_(eventCallbackContext_, ¤tState_); - } -} - -void GameTextInput::showIme(uint32_t flags) { - if (inputConnection_ == nullptr) return; - env_->CallVoidMethod(inputConnection_, setSoftKeyboardActiveMethod_, true, - flags); -} - -void GameTextInput::setEventCallback(GameTextInputEventCallback callback, - void *context) { - eventCallback_ = callback; - eventCallbackContext_ = context; -} - -void GameTextInput::setImeInsetsCallback( - GameTextInputImeInsetsCallback callback, void *context) { - insetsCallback_ = callback; - insetsCallbackContext_ = context; -} - -void GameTextInput::processImeInsets(const ARect *insets) { - currentInsets_ = *insets; - if (insetsCallback_) { - insetsCallback_(insetsCallbackContext_, ¤tInsets_); - } -} - -void GameTextInput::hideIme(uint32_t flags) { - if (inputConnection_ == nullptr) return; - env_->CallVoidMethod(inputConnection_, setSoftKeyboardActiveMethod_, false, - flags); -} - -jobject GameTextInput::stateToJava(const GameTextInputState &state) const { - static jmethodID constructor = nullptr; - if (constructor == nullptr) { - constructor = env_->GetMethodID(stateJavaClass_, "", - "(Ljava/lang/String;IIII)V"); - if (constructor == nullptr) { - __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, - "Can't find gametextinput.State constructor"); - return nullptr; - } - } - const char *text = state.text_UTF8; - if (text == nullptr) { - static char empty_string[] = ""; - text = empty_string; - } - // Note that this expects 'modified' UTF-8 which is not the same as UTF-8 - // https://en.wikipedia.org/wiki/UTF-8#Modified_UTF-8 - jstring jtext = env_->NewStringUTF(text); - jobject jobj = - env_->NewObject(stateJavaClass_, constructor, jtext, - state.selection.start, state.selection.end, - state.composingRegion.start, state.composingRegion.end); - env_->DeleteLocalRef(jtext); - return jobj; -} - -void GameTextInput::stateFromJava(jobject textInputEvent, - GameTextInputGetStateCallback callback, - void *context) const { - jstring text = - (jstring)env_->GetObjectField(textInputEvent, stateClassInfo_.text); - // Note this is 'modified' UTF-8, not true UTF-8. It has no NULLs in it, - // except at the end. It's actually not specified whether the value returned - // by GetStringUTFChars includes a null at the end, but it *seems to* on - // Android. - const char *text_chars = env_->GetStringUTFChars(text, NULL); - int text_len = env_->GetStringUTFLength( - text); // Length in bytes, *not* including the null. - int selectionStart = - env_->GetIntField(textInputEvent, stateClassInfo_.selectionStart); - int selectionEnd = - env_->GetIntField(textInputEvent, stateClassInfo_.selectionEnd); - int composingRegionStart = - env_->GetIntField(textInputEvent, stateClassInfo_.composingRegionStart); - int composingRegionEnd = - env_->GetIntField(textInputEvent, stateClassInfo_.composingRegionEnd); - GameTextInputState state{text_chars, - text_len, - {selectionStart, selectionEnd}, - {composingRegionStart, composingRegionEnd}}; - callback(context, &state); - env_->ReleaseStringUTFChars(text, text_chars); - env_->DeleteLocalRef(text); -} diff --git a/android-activity/game-activity-csrc/game-text-input/gametextinput.h b/android-activity/game-activity-csrc/game-text-input/gametextinput.h deleted file mode 100644 index a85265ee..00000000 --- a/android-activity/game-activity-csrc/game-text-input/gametextinput.h +++ /dev/null @@ -1,290 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @defgroup game_text_input Game Text Input - * The interface to use GameTextInput. - * @{ - */ - -#pragma once - -#include -#include -#include - -#include "gamecommon.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * This struct holds a span within a region of text from start (inclusive) to - * end (exclusive). An empty span or cursor position is specified with - * start==end. An undefined span is specified with start = end = SPAN_UNDEFINED. - */ -typedef struct GameTextInputSpan { - /** The start of the region (inclusive). */ - int32_t start; - /** The end of the region (exclusive). */ - int32_t end; -} GameTextInputSpan; - -/** - * Values with special meaning in a GameTextInputSpan. - */ -enum GameTextInputSpanFlag { SPAN_UNDEFINED = -1 }; - -/** - * This struct holds the state of an editable section of text. - * The text can have a selection and a composing region defined on it. - * A composing region is used by IMEs that allow input using multiple steps to - * compose a glyph or word. Use functions GameTextInput_getState and - * GameTextInput_setState to read and modify the state that an IME is editing. - */ -typedef struct GameTextInputState { - /** - * Text owned by the state, as a modified UTF-8 string. Null-terminated. - * https://en.wikipedia.org/wiki/UTF-8#Modified_UTF-8 - */ - const char *text_UTF8; - /** - * Length in bytes of text_UTF8, *not* including the null at end. - */ - int32_t text_length; - /** - * A selection defined on the text. - */ - GameTextInputSpan selection; - /** - * A composing region defined on the text. - */ - GameTextInputSpan composingRegion; -} GameTextInputState; - -/** - * A callback called by GameTextInput_getState. - * @param context User-defined context. - * @param state State, owned by the library, that will be valid for the duration - * of the callback. - */ -typedef void (*GameTextInputGetStateCallback)( - void *context, const struct GameTextInputState *state); - -/** - * Opaque handle to the GameTextInput API. - */ -typedef struct GameTextInput GameTextInput; - -/** - * Initialize the GameTextInput library. - * If called twice without GameTextInput_destroy being called, the same pointer - * will be returned and a warning will be issued. - * @param env A JNI env valid on the calling thread. - * @param max_string_size The maximum length of a string that can be edited. If - * zero, the maximum defaults to 65536 bytes. A buffer of this size is allocated - * at initialization. - * @return A handle to the library. - */ -GameTextInput *GameTextInput_init(JNIEnv *env, uint32_t max_string_size); - -/** - * When using GameTextInput, you need to create a gametextinput.InputConnection - * on the Java side and pass it using this function to the library, unless using - * GameActivity in which case this will be done for you. See the GameActivity - * source code or GameTextInput samples for examples of usage. - * @param input A valid GameTextInput library handle. - * @param inputConnection A gametextinput.InputConnection object. - */ -void GameTextInput_setInputConnection(GameTextInput *input, - jobject inputConnection); - -/** - * Unless using GameActivity, it is required to call this function from your - * Java gametextinput.Listener.stateChanged method to convert eventState and - * trigger any event callbacks. When using GameActivity, this does not need to - * be called as event processing is handled by the Activity. - * @param input A valid GameTextInput library handle. - * @param eventState A Java gametextinput.State object. - */ -void GameTextInput_processEvent(GameTextInput *input, jobject eventState); - -/** - * Free any resources owned by the GameTextInput library. - * Any subsequent calls to the library will fail until GameTextInput_init is - * called again. - * @param input A valid GameTextInput library handle. - */ -void GameTextInput_destroy(GameTextInput *input); - -/** - * Flags to be passed to GameTextInput_showIme. - */ -enum ShowImeFlags { - SHOW_IME_UNDEFINED = 0, // Default value. - SHOW_IMPLICIT = - 1, // Indicates that the user has forced the input method open so it - // should not be closed until they explicitly do so. - SHOW_FORCED = 2 // Indicates that this is an implicit request to show the - // input window, not as the result of a direct request by - // the user. The window may not be shown in this case. -}; - -/** - * Show the IME. Calls InputMethodManager.showSoftInput(). - * @param input A valid GameTextInput library handle. - * @param flags Defined in ShowImeFlags above. For more information see: - * https://developer.android.com/reference/android/view/inputmethod/InputMethodManager - */ -void GameTextInput_showIme(GameTextInput *input, uint32_t flags); - -/** - * Flags to be passed to GameTextInput_hideIme. - */ -enum HideImeFlags { - HIDE_IME_UNDEFINED = 0, // Default value. - HIDE_IMPLICIT_ONLY = - 1, // Indicates that the soft input window should only be hidden if it - // was not explicitly shown by the user. - HIDE_NOT_ALWAYS = - 2, // Indicates that the soft input window should normally be hidden, - // unless it was originally shown with SHOW_FORCED. -}; - -/** - * Show the IME. Calls InputMethodManager.hideSoftInputFromWindow(). - * @param input A valid GameTextInput library handle. - * @param flags Defined in HideImeFlags above. For more information see: - * https://developer.android.com/reference/android/view/inputmethod/InputMethodManager - */ -void GameTextInput_hideIme(GameTextInput *input, uint32_t flags); - -/** - * Call a callback with the current GameTextInput state, which may have been - * modified by changes in the IME and calls to GameTextInput_setState. We use a - * callback rather than returning the state in order to simplify ownership of - * text_UTF8 strings. These strings are only valid during the calling of the - * callback. - * @param input A valid GameTextInput library handle. - * @param callback A function that will be called with valid state. - * @param context Context used by the callback. - */ -void GameTextInput_getState(GameTextInput *input, - GameTextInputGetStateCallback callback, - void *context); - -/** - * Set the current GameTextInput state. This state is reflected to any active - * IME. - * @param input A valid GameTextInput library handle. - * @param state The state to set. Ownership is maintained by the caller and must - * remain valid for the duration of the call. - */ -void GameTextInput_setState(GameTextInput *input, - const GameTextInputState *state); - -/** - * Type of the callback needed by GameTextInput_setEventCallback that will be - * called every time the IME state changes. - * @param context User-defined context set in GameTextInput_setEventCallback. - * @param current_state Current IME state, owned by the library and valid during - * the callback. - */ -typedef void (*GameTextInputEventCallback)( - void *context, const GameTextInputState *current_state); - -/** - * Optionally set a callback to be called whenever the IME state changes. - * Not necessary if you are using GameActivity, which handles these callbacks - * for you. - * @param input A valid GameTextInput library handle. - * @param callback Called by the library when the IME state changes. - * @param context Context passed as first argument to the callback. - */ -void GameTextInput_setEventCallback(GameTextInput *input, - GameTextInputEventCallback callback, - void *context); - -/** - * Type of the callback needed by GameTextInput_setImeInsetsCallback that will - * be called every time the IME window insets change. - * @param context User-defined context set in - * GameTextInput_setImeWIndowInsetsCallback. - * @param current_insets Current IME insets, owned by the library and valid - * during the callback. - */ -typedef void (*GameTextInputImeInsetsCallback)(void *context, - const ARect *current_insets); - -/** - * Optionally set a callback to be called whenever the IME insets change. - * Not necessary if you are using GameActivity, which handles these callbacks - * for you. - * @param input A valid GameTextInput library handle. - * @param callback Called by the library when the IME insets change. - * @param context Context passed as first argument to the callback. - */ -void GameTextInput_setImeInsetsCallback(GameTextInput *input, - GameTextInputImeInsetsCallback callback, - void *context); - -/** - * Get the current window insets for the IME. - * @param input A valid GameTextInput library handle. - * @param insets Filled with the current insets by this function. - */ -void GameTextInput_getImeInsets(const GameTextInput *input, ARect *insets); - -/** - * Unless using GameActivity, it is required to call this function from your - * Java gametextinput.Listener.onImeInsetsChanged method to - * trigger any event callbacks. When using GameActivity, this does not need to - * be called as insets processing is handled by the Activity. - * @param input A valid GameTextInput library handle. - * @param eventState A Java gametextinput.State object. - */ -void GameTextInput_processImeInsets(GameTextInput *input, const ARect *insets); - -/** - * Convert a GameTextInputState struct to a Java gametextinput.State object. - * Don't forget to delete the returned Java local ref when you're done. - * @param input A valid GameTextInput library handle. - * @param state Input state to convert. - * @return A Java object of class gametextinput.State. The caller is required to - * delete this local reference. - */ -jobject GameTextInputState_toJava(const GameTextInput *input, - const GameTextInputState *state); - -/** - * Convert from a Java gametextinput.State object into a C GameTextInputState - * struct. - * @param input A valid GameTextInput library handle. - * @param state A Java gametextinput.State object. - * @param callback A function called with the C struct, valid for the duration - * of the call. - * @param context Context passed to the callback. - */ -void GameTextInputState_fromJava(const GameTextInput *input, jobject state, - GameTextInputGetStateCallback callback, - void *context); - -#ifdef __cplusplus -} -#endif - -/** @} */ diff --git a/android-activity/generate-bindings.sh b/android-activity/generate-bindings.sh old mode 100644 new mode 100755 index 530eeaea..8c1a4e97 --- a/android-activity/generate-bindings.sh +++ b/android-activity/generate-bindings.sh @@ -1,5 +1,8 @@ #!/bin/sh +# First install bindgen-cli via `cargo install bindgen-cli` + +SDK_DIR="${ANDROID_GAMES_SDK:-android-games-sdk}" if test -z "${ANDROID_NDK_ROOT}"; then export ANDROID_NDK_ROOT=${ANDROID_NDK_HOME} fi @@ -12,6 +15,7 @@ while read ARCH && read TARGET ; do # --module-raw-line 'use ' bindgen game-activity-ffi.h -o src/game_activity/ffi_$ARCH.rs \ + --rust-target '1.73.0' \ --blocklist-item 'JNI\w+' \ --blocklist-item 'C?_?JNIEnv' \ --blocklist-item '_?JavaVM' \ @@ -34,7 +38,9 @@ while read ARCH && read TARGET ; do --blocklist-function 'GameActivity_onCreate_C' \ --newtype-enum '\w+_(result|status)_t' \ -- \ - -Igame-activity-csrc \ + "-I$SDK_DIR/game-activity/prefab-src/modules/game-activity/include" \ + "-I$SDK_DIR/game-text-input/prefab-src/modules/game-text-input/include" \ + "-I$SDK_DIR/include" \ --sysroot="$SYSROOT" --target=$TARGET done << EOF diff --git a/android-activity/src/config.rs b/android-activity/src/config.rs index 7d818ecf..ab1bf1e6 100644 --- a/android-activity/src/config.rs +++ b/android-activity/src/config.rs @@ -6,13 +6,14 @@ use ndk::configuration::{ ScreenSize, Touchscreen, UiModeNight, UiModeType, }; -/// A (cheaply clonable) reference to this application's [`ndk::configuration::Configuration`] +/// A runtime-replacable reference to [`ndk::configuration::Configuration`]. /// -/// This provides a thread-safe way to access the latest configuration state for -/// an application without deeply copying the large [`ndk::configuration::Configuration`] struct. +/// # Warning /// -/// If the application is notified of configuration changes then those changes -/// will become visible via pre-existing configuration references. +/// The value held by this reference **will change** with every [`super::MainEvent::ConfigChanged`] +/// event that is raised. You should **not** [`Clone`] this type to compare it against a +/// "new" [`super::AndroidApp::config()`] when that event is raised, since both point to the same +/// internal [`ndk::configuration::Configuration`] and will be identical. #[derive(Clone)] pub struct ConfigurationRef { config: Arc>, @@ -28,8 +29,6 @@ impl PartialEq for ConfigurationRef { } } impl Eq for ConfigurationRef {} -unsafe impl Send for ConfigurationRef {} -unsafe impl Sync for ConfigurationRef {} impl fmt::Debug for ConfigurationRef { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { diff --git a/android-activity/src/error.rs b/android-activity/src/error.rs new file mode 100644 index 00000000..7193f5a1 --- /dev/null +++ b/android-activity/src/error.rs @@ -0,0 +1,58 @@ +use thiserror::Error; + +#[derive(Error, Debug)] +pub enum AppError { + #[error("Operation only supported from the android_main() thread: {0}")] + NonMainThread(String), + + #[error("Java VM or JNI error, including Java exceptions")] + JavaError(String), + + #[error("Input unavailable")] + InputUnavailable, +} + +pub type Result = std::result::Result; + +// XXX: we don't want to expose jni-rs in the public API +// so we have an internal error type that we can generally +// use in the backends and then we can strip the error +// in the frontend of the API. +// +// This way we avoid exposing a public trait implementation for +// `From` +#[derive(Error, Debug)] +pub(crate) enum InternalAppError { + #[error("A JNI error")] + JniError(jni::errors::JniError), + #[error("A Java Exception was thrown via a JNI method call")] + JniException(String), + #[error("A Java VM error")] + JvmError(jni::errors::Error), + #[error("Input unavailable")] + InputUnavailable, +} + +pub(crate) type InternalResult = std::result::Result; + +impl From for InternalAppError { + fn from(value: jni::errors::Error) -> Self { + InternalAppError::JvmError(value) + } +} +impl From for InternalAppError { + fn from(value: jni::errors::JniError) -> Self { + InternalAppError::JniError(value) + } +} + +impl From for AppError { + fn from(value: InternalAppError) -> Self { + match value { + InternalAppError::JniError(err) => AppError::JavaError(err.to_string()), + InternalAppError::JniException(msg) => AppError::JavaError(msg), + InternalAppError::JvmError(err) => AppError::JavaError(err.to_string()), + InternalAppError::InputUnavailable => AppError::InputUnavailable, + } + } +} diff --git a/android-activity/src/game_activity/ffi.rs b/android-activity/src/game_activity/ffi.rs index 3196865b..51063ff6 100644 --- a/android-activity/src/game_activity/ffi.rs +++ b/android-activity/src/game_activity/ffi.rs @@ -13,20 +13,17 @@ #![allow(dead_code)] use jni_sys::*; -use libc::{pthread_cond_t, pthread_mutex_t, pthread_t, size_t}; +use libc::{pthread_cond_t, pthread_mutex_t, pthread_t}; use ndk_sys::{AAssetManager, AConfiguration, ALooper, ALooper_callbackFunc, ANativeWindow, ARect}; -#[cfg(all( - any(target_os = "android", feature = "test"), - any(target_arch = "arm", target_arch = "armv7") -))] +#[cfg(all(any(target_os = "android"), target_arch = "arm"))] include!("ffi_arm.rs"); -#[cfg(all(any(target_os = "android", feature = "test"), target_arch = "aarch64"))] +#[cfg(all(any(target_os = "android"), target_arch = "aarch64"))] include!("ffi_aarch64.rs"); -#[cfg(all(any(target_os = "android", feature = "test"), target_arch = "x86"))] +#[cfg(all(any(target_os = "android"), target_arch = "x86"))] include!("ffi_i686.rs"); -#[cfg(all(any(target_os = "android", feature = "test"), target_arch = "x86_64"))] +#[cfg(all(any(target_os = "android"), target_arch = "x86_64"))] include!("ffi_x86_64.rs"); diff --git a/android-activity/src/game_activity/ffi_aarch64.rs b/android-activity/src/game_activity/ffi_aarch64.rs index 20a66d0c..461f3775 100644 --- a/android-activity/src/game_activity/ffi_aarch64.rs +++ b/android-activity/src/game_activity/ffi_aarch64.rs @@ -1,5 +1,15 @@ -/* automatically generated by rust-bindgen 0.59.2 */ +/* automatically generated by rust-bindgen 0.71.1 */ +#[doc = r" If Bindgen could only determine the size and alignment of a"] +#[doc = r" type, it is represented like this."] +#[derive(PartialEq, Copy, Clone, Debug, Hash)] +#[repr(C)] +pub struct __BindgenOpaqueArray(pub [T; N]); +impl Default for __BindgenOpaqueArray { + fn default() -> Self { + Self([::default(); N]) + } +} pub const __BIONIC__: u32 = 1; pub const __WORDSIZE: u32 = 64; pub const __bos_level: u32 = 0; @@ -21,10 +31,15 @@ pub const __ANDROID_API_O_MR1__: u32 = 27; pub const __ANDROID_API_P__: u32 = 28; pub const __ANDROID_API_Q__: u32 = 29; pub const __ANDROID_API_R__: u32 = 30; -pub const __NDK_MAJOR__: u32 = 21; +pub const __ANDROID_API_S__: u32 = 31; +pub const __ANDROID_API_T__: u32 = 33; +pub const __ANDROID_API_U__: u32 = 34; +pub const __ANDROID_API_V__: u32 = 35; +pub const __ANDROID_NDK__: u32 = 1; +pub const __NDK_MAJOR__: u32 = 26; pub const __NDK_MINOR__: u32 = 1; pub const __NDK_BETA__: u32 = 0; -pub const __NDK_BUILD__: u32 = 6352462; +pub const __NDK_BUILD__: u32 = 10909125; pub const __NDK_CANARY__: u32 = 0; pub const WCHAR_MIN: u8 = 0u8; pub const INT8_MIN: i32 = -128; @@ -58,170 +73,230 @@ pub const WINT_MIN: u32 = 0; pub const __BITS_PER_LONG: u32 = 64; pub const __FD_SETSIZE: u32 = 1024; pub const AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT: u32 = 8; -pub const __PRI_64_prefix: &[u8; 2usize] = b"l\0"; -pub const __PRI_PTR_prefix: &[u8; 2usize] = b"l\0"; -pub const __PRI_FAST_prefix: &[u8; 2usize] = b"l\0"; -pub const PRId8: &[u8; 2usize] = b"d\0"; -pub const PRId16: &[u8; 2usize] = b"d\0"; -pub const PRId32: &[u8; 2usize] = b"d\0"; -pub const PRId64: &[u8; 3usize] = b"ld\0"; -pub const PRIdLEAST8: &[u8; 2usize] = b"d\0"; -pub const PRIdLEAST16: &[u8; 2usize] = b"d\0"; -pub const PRIdLEAST32: &[u8; 2usize] = b"d\0"; -pub const PRIdLEAST64: &[u8; 3usize] = b"ld\0"; -pub const PRIdFAST8: &[u8; 2usize] = b"d\0"; -pub const PRIdFAST16: &[u8; 3usize] = b"ld\0"; -pub const PRIdFAST32: &[u8; 3usize] = b"ld\0"; -pub const PRIdFAST64: &[u8; 3usize] = b"ld\0"; -pub const PRIdMAX: &[u8; 3usize] = b"jd\0"; -pub const PRIdPTR: &[u8; 3usize] = b"ld\0"; -pub const PRIi8: &[u8; 2usize] = b"i\0"; -pub const PRIi16: &[u8; 2usize] = b"i\0"; -pub const PRIi32: &[u8; 2usize] = b"i\0"; -pub const PRIi64: &[u8; 3usize] = b"li\0"; -pub const PRIiLEAST8: &[u8; 2usize] = b"i\0"; -pub const PRIiLEAST16: &[u8; 2usize] = b"i\0"; -pub const PRIiLEAST32: &[u8; 2usize] = b"i\0"; -pub const PRIiLEAST64: &[u8; 3usize] = b"li\0"; -pub const PRIiFAST8: &[u8; 2usize] = b"i\0"; -pub const PRIiFAST16: &[u8; 3usize] = b"li\0"; -pub const PRIiFAST32: &[u8; 3usize] = b"li\0"; -pub const PRIiFAST64: &[u8; 3usize] = b"li\0"; -pub const PRIiMAX: &[u8; 3usize] = b"ji\0"; -pub const PRIiPTR: &[u8; 3usize] = b"li\0"; -pub const PRIo8: &[u8; 2usize] = b"o\0"; -pub const PRIo16: &[u8; 2usize] = b"o\0"; -pub const PRIo32: &[u8; 2usize] = b"o\0"; -pub const PRIo64: &[u8; 3usize] = b"lo\0"; -pub const PRIoLEAST8: &[u8; 2usize] = b"o\0"; -pub const PRIoLEAST16: &[u8; 2usize] = b"o\0"; -pub const PRIoLEAST32: &[u8; 2usize] = b"o\0"; -pub const PRIoLEAST64: &[u8; 3usize] = b"lo\0"; -pub const PRIoFAST8: &[u8; 2usize] = b"o\0"; -pub const PRIoFAST16: &[u8; 3usize] = b"lo\0"; -pub const PRIoFAST32: &[u8; 3usize] = b"lo\0"; -pub const PRIoFAST64: &[u8; 3usize] = b"lo\0"; -pub const PRIoMAX: &[u8; 3usize] = b"jo\0"; -pub const PRIoPTR: &[u8; 3usize] = b"lo\0"; -pub const PRIu8: &[u8; 2usize] = b"u\0"; -pub const PRIu16: &[u8; 2usize] = b"u\0"; -pub const PRIu32: &[u8; 2usize] = b"u\0"; -pub const PRIu64: &[u8; 3usize] = b"lu\0"; -pub const PRIuLEAST8: &[u8; 2usize] = b"u\0"; -pub const PRIuLEAST16: &[u8; 2usize] = b"u\0"; -pub const PRIuLEAST32: &[u8; 2usize] = b"u\0"; -pub const PRIuLEAST64: &[u8; 3usize] = b"lu\0"; -pub const PRIuFAST8: &[u8; 2usize] = b"u\0"; -pub const PRIuFAST16: &[u8; 3usize] = b"lu\0"; -pub const PRIuFAST32: &[u8; 3usize] = b"lu\0"; -pub const PRIuFAST64: &[u8; 3usize] = b"lu\0"; -pub const PRIuMAX: &[u8; 3usize] = b"ju\0"; -pub const PRIuPTR: &[u8; 3usize] = b"lu\0"; -pub const PRIx8: &[u8; 2usize] = b"x\0"; -pub const PRIx16: &[u8; 2usize] = b"x\0"; -pub const PRIx32: &[u8; 2usize] = b"x\0"; -pub const PRIx64: &[u8; 3usize] = b"lx\0"; -pub const PRIxLEAST8: &[u8; 2usize] = b"x\0"; -pub const PRIxLEAST16: &[u8; 2usize] = b"x\0"; -pub const PRIxLEAST32: &[u8; 2usize] = b"x\0"; -pub const PRIxLEAST64: &[u8; 3usize] = b"lx\0"; -pub const PRIxFAST8: &[u8; 2usize] = b"x\0"; -pub const PRIxFAST16: &[u8; 3usize] = b"lx\0"; -pub const PRIxFAST32: &[u8; 3usize] = b"lx\0"; -pub const PRIxFAST64: &[u8; 3usize] = b"lx\0"; -pub const PRIxMAX: &[u8; 3usize] = b"jx\0"; -pub const PRIxPTR: &[u8; 3usize] = b"lx\0"; -pub const PRIX8: &[u8; 2usize] = b"X\0"; -pub const PRIX16: &[u8; 2usize] = b"X\0"; -pub const PRIX32: &[u8; 2usize] = b"X\0"; -pub const PRIX64: &[u8; 3usize] = b"lX\0"; -pub const PRIXLEAST8: &[u8; 2usize] = b"X\0"; -pub const PRIXLEAST16: &[u8; 2usize] = b"X\0"; -pub const PRIXLEAST32: &[u8; 2usize] = b"X\0"; -pub const PRIXLEAST64: &[u8; 3usize] = b"lX\0"; -pub const PRIXFAST8: &[u8; 2usize] = b"X\0"; -pub const PRIXFAST16: &[u8; 3usize] = b"lX\0"; -pub const PRIXFAST32: &[u8; 3usize] = b"lX\0"; -pub const PRIXFAST64: &[u8; 3usize] = b"lX\0"; -pub const PRIXMAX: &[u8; 3usize] = b"jX\0"; -pub const PRIXPTR: &[u8; 3usize] = b"lX\0"; -pub const SCNd8: &[u8; 4usize] = b"hhd\0"; -pub const SCNd16: &[u8; 3usize] = b"hd\0"; -pub const SCNd32: &[u8; 2usize] = b"d\0"; -pub const SCNd64: &[u8; 3usize] = b"ld\0"; -pub const SCNdLEAST8: &[u8; 4usize] = b"hhd\0"; -pub const SCNdLEAST16: &[u8; 3usize] = b"hd\0"; -pub const SCNdLEAST32: &[u8; 2usize] = b"d\0"; -pub const SCNdLEAST64: &[u8; 3usize] = b"ld\0"; -pub const SCNdFAST8: &[u8; 4usize] = b"hhd\0"; -pub const SCNdFAST16: &[u8; 3usize] = b"ld\0"; -pub const SCNdFAST32: &[u8; 3usize] = b"ld\0"; -pub const SCNdFAST64: &[u8; 3usize] = b"ld\0"; -pub const SCNdMAX: &[u8; 3usize] = b"jd\0"; -pub const SCNdPTR: &[u8; 3usize] = b"ld\0"; -pub const SCNi8: &[u8; 4usize] = b"hhi\0"; -pub const SCNi16: &[u8; 3usize] = b"hi\0"; -pub const SCNi32: &[u8; 2usize] = b"i\0"; -pub const SCNi64: &[u8; 3usize] = b"li\0"; -pub const SCNiLEAST8: &[u8; 4usize] = b"hhi\0"; -pub const SCNiLEAST16: &[u8; 3usize] = b"hi\0"; -pub const SCNiLEAST32: &[u8; 2usize] = b"i\0"; -pub const SCNiLEAST64: &[u8; 3usize] = b"li\0"; -pub const SCNiFAST8: &[u8; 4usize] = b"hhi\0"; -pub const SCNiFAST16: &[u8; 3usize] = b"li\0"; -pub const SCNiFAST32: &[u8; 3usize] = b"li\0"; -pub const SCNiFAST64: &[u8; 3usize] = b"li\0"; -pub const SCNiMAX: &[u8; 3usize] = b"ji\0"; -pub const SCNiPTR: &[u8; 3usize] = b"li\0"; -pub const SCNo8: &[u8; 4usize] = b"hho\0"; -pub const SCNo16: &[u8; 3usize] = b"ho\0"; -pub const SCNo32: &[u8; 2usize] = b"o\0"; -pub const SCNo64: &[u8; 3usize] = b"lo\0"; -pub const SCNoLEAST8: &[u8; 4usize] = b"hho\0"; -pub const SCNoLEAST16: &[u8; 3usize] = b"ho\0"; -pub const SCNoLEAST32: &[u8; 2usize] = b"o\0"; -pub const SCNoLEAST64: &[u8; 3usize] = b"lo\0"; -pub const SCNoFAST8: &[u8; 4usize] = b"hho\0"; -pub const SCNoFAST16: &[u8; 3usize] = b"lo\0"; -pub const SCNoFAST32: &[u8; 3usize] = b"lo\0"; -pub const SCNoFAST64: &[u8; 3usize] = b"lo\0"; -pub const SCNoMAX: &[u8; 3usize] = b"jo\0"; -pub const SCNoPTR: &[u8; 3usize] = b"lo\0"; -pub const SCNu8: &[u8; 4usize] = b"hhu\0"; -pub const SCNu16: &[u8; 3usize] = b"hu\0"; -pub const SCNu32: &[u8; 2usize] = b"u\0"; -pub const SCNu64: &[u8; 3usize] = b"lu\0"; -pub const SCNuLEAST8: &[u8; 4usize] = b"hhu\0"; -pub const SCNuLEAST16: &[u8; 3usize] = b"hu\0"; -pub const SCNuLEAST32: &[u8; 2usize] = b"u\0"; -pub const SCNuLEAST64: &[u8; 3usize] = b"lu\0"; -pub const SCNuFAST8: &[u8; 4usize] = b"hhu\0"; -pub const SCNuFAST16: &[u8; 3usize] = b"lu\0"; -pub const SCNuFAST32: &[u8; 3usize] = b"lu\0"; -pub const SCNuFAST64: &[u8; 3usize] = b"lu\0"; -pub const SCNuMAX: &[u8; 3usize] = b"ju\0"; -pub const SCNuPTR: &[u8; 3usize] = b"lu\0"; -pub const SCNx8: &[u8; 4usize] = b"hhx\0"; -pub const SCNx16: &[u8; 3usize] = b"hx\0"; -pub const SCNx32: &[u8; 2usize] = b"x\0"; -pub const SCNx64: &[u8; 3usize] = b"lx\0"; -pub const SCNxLEAST8: &[u8; 4usize] = b"hhx\0"; -pub const SCNxLEAST16: &[u8; 3usize] = b"hx\0"; -pub const SCNxLEAST32: &[u8; 2usize] = b"x\0"; -pub const SCNxLEAST64: &[u8; 3usize] = b"lx\0"; -pub const SCNxFAST8: &[u8; 4usize] = b"hhx\0"; -pub const SCNxFAST16: &[u8; 3usize] = b"lx\0"; -pub const SCNxFAST32: &[u8; 3usize] = b"lx\0"; -pub const SCNxFAST64: &[u8; 3usize] = b"lx\0"; -pub const SCNxMAX: &[u8; 3usize] = b"jx\0"; -pub const SCNxPTR: &[u8; 3usize] = b"lx\0"; -pub const __GNUC_VA_LIST: u32 = 1; +pub const __bool_true_false_are_defined: u32 = 1; pub const true_: u32 = 1; pub const false_: u32 = 0; -pub const __bool_true_false_are_defined: u32 = 1; +pub const __PRI_64_prefix: &[u8; 2] = b"l\0"; +pub const __PRI_PTR_prefix: &[u8; 2] = b"l\0"; +pub const __PRI_FAST_prefix: &[u8; 2] = b"l\0"; +pub const PRId8: &[u8; 2] = b"d\0"; +pub const PRId16: &[u8; 2] = b"d\0"; +pub const PRId32: &[u8; 2] = b"d\0"; +pub const PRId64: &[u8; 3] = b"ld\0"; +pub const PRIdLEAST8: &[u8; 2] = b"d\0"; +pub const PRIdLEAST16: &[u8; 2] = b"d\0"; +pub const PRIdLEAST32: &[u8; 2] = b"d\0"; +pub const PRIdLEAST64: &[u8; 3] = b"ld\0"; +pub const PRIdFAST8: &[u8; 2] = b"d\0"; +pub const PRIdFAST16: &[u8; 3] = b"ld\0"; +pub const PRIdFAST32: &[u8; 3] = b"ld\0"; +pub const PRIdFAST64: &[u8; 3] = b"ld\0"; +pub const PRIdMAX: &[u8; 3] = b"jd\0"; +pub const PRIdPTR: &[u8; 3] = b"ld\0"; +pub const PRIi8: &[u8; 2] = b"i\0"; +pub const PRIi16: &[u8; 2] = b"i\0"; +pub const PRIi32: &[u8; 2] = b"i\0"; +pub const PRIi64: &[u8; 3] = b"li\0"; +pub const PRIiLEAST8: &[u8; 2] = b"i\0"; +pub const PRIiLEAST16: &[u8; 2] = b"i\0"; +pub const PRIiLEAST32: &[u8; 2] = b"i\0"; +pub const PRIiLEAST64: &[u8; 3] = b"li\0"; +pub const PRIiFAST8: &[u8; 2] = b"i\0"; +pub const PRIiFAST16: &[u8; 3] = b"li\0"; +pub const PRIiFAST32: &[u8; 3] = b"li\0"; +pub const PRIiFAST64: &[u8; 3] = b"li\0"; +pub const PRIiMAX: &[u8; 3] = b"ji\0"; +pub const PRIiPTR: &[u8; 3] = b"li\0"; +pub const PRIb8: &[u8; 2] = b"b\0"; +pub const PRIb16: &[u8; 2] = b"b\0"; +pub const PRIb32: &[u8; 2] = b"b\0"; +pub const PRIb64: &[u8; 3] = b"lb\0"; +pub const PRIbLEAST8: &[u8; 2] = b"b\0"; +pub const PRIbLEAST16: &[u8; 2] = b"b\0"; +pub const PRIbLEAST32: &[u8; 2] = b"b\0"; +pub const PRIbLEAST64: &[u8; 3] = b"lb\0"; +pub const PRIbFAST8: &[u8; 2] = b"b\0"; +pub const PRIbFAST16: &[u8; 3] = b"lb\0"; +pub const PRIbFAST32: &[u8; 3] = b"lb\0"; +pub const PRIbFAST64: &[u8; 3] = b"lb\0"; +pub const PRIbMAX: &[u8; 3] = b"jb\0"; +pub const PRIbPTR: &[u8; 3] = b"lb\0"; +pub const PRIB8: &[u8; 2] = b"B\0"; +pub const PRIB16: &[u8; 2] = b"B\0"; +pub const PRIB32: &[u8; 2] = b"B\0"; +pub const PRIB64: &[u8; 3] = b"lB\0"; +pub const PRIBLEAST8: &[u8; 2] = b"B\0"; +pub const PRIBLEAST16: &[u8; 2] = b"B\0"; +pub const PRIBLEAST32: &[u8; 2] = b"B\0"; +pub const PRIBLEAST64: &[u8; 3] = b"lB\0"; +pub const PRIBFAST8: &[u8; 2] = b"B\0"; +pub const PRIBFAST16: &[u8; 3] = b"lB\0"; +pub const PRIBFAST32: &[u8; 3] = b"lB\0"; +pub const PRIBFAST64: &[u8; 3] = b"lB\0"; +pub const PRIBMAX: &[u8; 3] = b"jB\0"; +pub const PRIBPTR: &[u8; 3] = b"lB\0"; +pub const PRIo8: &[u8; 2] = b"o\0"; +pub const PRIo16: &[u8; 2] = b"o\0"; +pub const PRIo32: &[u8; 2] = b"o\0"; +pub const PRIo64: &[u8; 3] = b"lo\0"; +pub const PRIoLEAST8: &[u8; 2] = b"o\0"; +pub const PRIoLEAST16: &[u8; 2] = b"o\0"; +pub const PRIoLEAST32: &[u8; 2] = b"o\0"; +pub const PRIoLEAST64: &[u8; 3] = b"lo\0"; +pub const PRIoFAST8: &[u8; 2] = b"o\0"; +pub const PRIoFAST16: &[u8; 3] = b"lo\0"; +pub const PRIoFAST32: &[u8; 3] = b"lo\0"; +pub const PRIoFAST64: &[u8; 3] = b"lo\0"; +pub const PRIoMAX: &[u8; 3] = b"jo\0"; +pub const PRIoPTR: &[u8; 3] = b"lo\0"; +pub const PRIu8: &[u8; 2] = b"u\0"; +pub const PRIu16: &[u8; 2] = b"u\0"; +pub const PRIu32: &[u8; 2] = b"u\0"; +pub const PRIu64: &[u8; 3] = b"lu\0"; +pub const PRIuLEAST8: &[u8; 2] = b"u\0"; +pub const PRIuLEAST16: &[u8; 2] = b"u\0"; +pub const PRIuLEAST32: &[u8; 2] = b"u\0"; +pub const PRIuLEAST64: &[u8; 3] = b"lu\0"; +pub const PRIuFAST8: &[u8; 2] = b"u\0"; +pub const PRIuFAST16: &[u8; 3] = b"lu\0"; +pub const PRIuFAST32: &[u8; 3] = b"lu\0"; +pub const PRIuFAST64: &[u8; 3] = b"lu\0"; +pub const PRIuMAX: &[u8; 3] = b"ju\0"; +pub const PRIuPTR: &[u8; 3] = b"lu\0"; +pub const PRIx8: &[u8; 2] = b"x\0"; +pub const PRIx16: &[u8; 2] = b"x\0"; +pub const PRIx32: &[u8; 2] = b"x\0"; +pub const PRIx64: &[u8; 3] = b"lx\0"; +pub const PRIxLEAST8: &[u8; 2] = b"x\0"; +pub const PRIxLEAST16: &[u8; 2] = b"x\0"; +pub const PRIxLEAST32: &[u8; 2] = b"x\0"; +pub const PRIxLEAST64: &[u8; 3] = b"lx\0"; +pub const PRIxFAST8: &[u8; 2] = b"x\0"; +pub const PRIxFAST16: &[u8; 3] = b"lx\0"; +pub const PRIxFAST32: &[u8; 3] = b"lx\0"; +pub const PRIxFAST64: &[u8; 3] = b"lx\0"; +pub const PRIxMAX: &[u8; 3] = b"jx\0"; +pub const PRIxPTR: &[u8; 3] = b"lx\0"; +pub const PRIX8: &[u8; 2] = b"X\0"; +pub const PRIX16: &[u8; 2] = b"X\0"; +pub const PRIX32: &[u8; 2] = b"X\0"; +pub const PRIX64: &[u8; 3] = b"lX\0"; +pub const PRIXLEAST8: &[u8; 2] = b"X\0"; +pub const PRIXLEAST16: &[u8; 2] = b"X\0"; +pub const PRIXLEAST32: &[u8; 2] = b"X\0"; +pub const PRIXLEAST64: &[u8; 3] = b"lX\0"; +pub const PRIXFAST8: &[u8; 2] = b"X\0"; +pub const PRIXFAST16: &[u8; 3] = b"lX\0"; +pub const PRIXFAST32: &[u8; 3] = b"lX\0"; +pub const PRIXFAST64: &[u8; 3] = b"lX\0"; +pub const PRIXMAX: &[u8; 3] = b"jX\0"; +pub const PRIXPTR: &[u8; 3] = b"lX\0"; +pub const SCNd8: &[u8; 4] = b"hhd\0"; +pub const SCNd16: &[u8; 3] = b"hd\0"; +pub const SCNd32: &[u8; 2] = b"d\0"; +pub const SCNd64: &[u8; 3] = b"ld\0"; +pub const SCNdLEAST8: &[u8; 4] = b"hhd\0"; +pub const SCNdLEAST16: &[u8; 3] = b"hd\0"; +pub const SCNdLEAST32: &[u8; 2] = b"d\0"; +pub const SCNdLEAST64: &[u8; 3] = b"ld\0"; +pub const SCNdFAST8: &[u8; 4] = b"hhd\0"; +pub const SCNdFAST16: &[u8; 3] = b"ld\0"; +pub const SCNdFAST32: &[u8; 3] = b"ld\0"; +pub const SCNdFAST64: &[u8; 3] = b"ld\0"; +pub const SCNdMAX: &[u8; 3] = b"jd\0"; +pub const SCNdPTR: &[u8; 3] = b"ld\0"; +pub const SCNi8: &[u8; 4] = b"hhi\0"; +pub const SCNi16: &[u8; 3] = b"hi\0"; +pub const SCNi32: &[u8; 2] = b"i\0"; +pub const SCNi64: &[u8; 3] = b"li\0"; +pub const SCNiLEAST8: &[u8; 4] = b"hhi\0"; +pub const SCNiLEAST16: &[u8; 3] = b"hi\0"; +pub const SCNiLEAST32: &[u8; 2] = b"i\0"; +pub const SCNiLEAST64: &[u8; 3] = b"li\0"; +pub const SCNiFAST8: &[u8; 4] = b"hhi\0"; +pub const SCNiFAST16: &[u8; 3] = b"li\0"; +pub const SCNiFAST32: &[u8; 3] = b"li\0"; +pub const SCNiFAST64: &[u8; 3] = b"li\0"; +pub const SCNiMAX: &[u8; 3] = b"ji\0"; +pub const SCNiPTR: &[u8; 3] = b"li\0"; +pub const SCNb8: &[u8; 4] = b"hhb\0"; +pub const SCNb16: &[u8; 3] = b"hb\0"; +pub const SCNb32: &[u8; 2] = b"b\0"; +pub const SCNb64: &[u8; 3] = b"lb\0"; +pub const SCNbLEAST8: &[u8; 4] = b"hhb\0"; +pub const SCNbLEAST16: &[u8; 3] = b"hb\0"; +pub const SCNbLEAST32: &[u8; 2] = b"b\0"; +pub const SCNbLEAST64: &[u8; 3] = b"lb\0"; +pub const SCNbFAST8: &[u8; 4] = b"hhb\0"; +pub const SCNbFAST16: &[u8; 3] = b"lb\0"; +pub const SCNbFAST32: &[u8; 3] = b"lb\0"; +pub const SCNbFAST64: &[u8; 3] = b"lb\0"; +pub const SCNbMAX: &[u8; 3] = b"jb\0"; +pub const SCNbPTR: &[u8; 3] = b"lb\0"; +pub const SCNB8: &[u8; 4] = b"hhB\0"; +pub const SCNB16: &[u8; 3] = b"hB\0"; +pub const SCNB32: &[u8; 2] = b"B\0"; +pub const SCNB64: &[u8; 3] = b"lB\0"; +pub const SCNBLEAST8: &[u8; 4] = b"hhB\0"; +pub const SCNBLEAST16: &[u8; 3] = b"hB\0"; +pub const SCNBLEAST32: &[u8; 2] = b"B\0"; +pub const SCNBLEAST64: &[u8; 3] = b"lB\0"; +pub const SCNBFAST8: &[u8; 4] = b"hhB\0"; +pub const SCNBFAST16: &[u8; 3] = b"lB\0"; +pub const SCNBFAST32: &[u8; 3] = b"lB\0"; +pub const SCNBFAST64: &[u8; 3] = b"lB\0"; +pub const SCNBMAX: &[u8; 3] = b"jB\0"; +pub const SCNBPTR: &[u8; 3] = b"lB\0"; +pub const SCNo8: &[u8; 4] = b"hho\0"; +pub const SCNo16: &[u8; 3] = b"ho\0"; +pub const SCNo32: &[u8; 2] = b"o\0"; +pub const SCNo64: &[u8; 3] = b"lo\0"; +pub const SCNoLEAST8: &[u8; 4] = b"hho\0"; +pub const SCNoLEAST16: &[u8; 3] = b"ho\0"; +pub const SCNoLEAST32: &[u8; 2] = b"o\0"; +pub const SCNoLEAST64: &[u8; 3] = b"lo\0"; +pub const SCNoFAST8: &[u8; 4] = b"hho\0"; +pub const SCNoFAST16: &[u8; 3] = b"lo\0"; +pub const SCNoFAST32: &[u8; 3] = b"lo\0"; +pub const SCNoFAST64: &[u8; 3] = b"lo\0"; +pub const SCNoMAX: &[u8; 3] = b"jo\0"; +pub const SCNoPTR: &[u8; 3] = b"lo\0"; +pub const SCNu8: &[u8; 4] = b"hhu\0"; +pub const SCNu16: &[u8; 3] = b"hu\0"; +pub const SCNu32: &[u8; 2] = b"u\0"; +pub const SCNu64: &[u8; 3] = b"lu\0"; +pub const SCNuLEAST8: &[u8; 4] = b"hhu\0"; +pub const SCNuLEAST16: &[u8; 3] = b"hu\0"; +pub const SCNuLEAST32: &[u8; 2] = b"u\0"; +pub const SCNuLEAST64: &[u8; 3] = b"lu\0"; +pub const SCNuFAST8: &[u8; 4] = b"hhu\0"; +pub const SCNuFAST16: &[u8; 3] = b"lu\0"; +pub const SCNuFAST32: &[u8; 3] = b"lu\0"; +pub const SCNuFAST64: &[u8; 3] = b"lu\0"; +pub const SCNuMAX: &[u8; 3] = b"ju\0"; +pub const SCNuPTR: &[u8; 3] = b"lu\0"; +pub const SCNx8: &[u8; 4] = b"hhx\0"; +pub const SCNx16: &[u8; 3] = b"hx\0"; +pub const SCNx32: &[u8; 2] = b"x\0"; +pub const SCNx64: &[u8; 3] = b"lx\0"; +pub const SCNxLEAST8: &[u8; 4] = b"hhx\0"; +pub const SCNxLEAST16: &[u8; 3] = b"hx\0"; +pub const SCNxLEAST32: &[u8; 2] = b"x\0"; +pub const SCNxLEAST64: &[u8; 3] = b"lx\0"; +pub const SCNxFAST8: &[u8; 4] = b"hhx\0"; +pub const SCNxFAST16: &[u8; 3] = b"lx\0"; +pub const SCNxFAST32: &[u8; 3] = b"lx\0"; +pub const SCNxFAST64: &[u8; 3] = b"lx\0"; +pub const SCNxMAX: &[u8; 3] = b"jx\0"; +pub const SCNxPTR: &[u8; 3] = b"lx\0"; pub const GAME_ACTIVITY_POINTER_INFO_AXIS_COUNT: u32 = 48; pub const GAMEACTIVITY_MAX_NUM_POINTERS_IN_MOTION_EVENT: u32 = 8; -pub const GAMEACTIVITY_MAX_NUM_HISTORICAL_IN_MOTION_EVENT: u32 = 8; +pub const GAMETEXTINPUT_MAJOR_VERSION: u32 = 4; +pub const GAMETEXTINPUT_MINOR_VERSION: u32 = 0; +pub const GAMETEXTINPUT_BUGFIX_VERSION: u32 = 0; +pub const GAMEACTIVITY_MAJOR_VERSION: u32 = 4; +pub const GAMEACTIVITY_MINOR_VERSION: u32 = 0; +pub const GAMEACTIVITY_BUGFIX_VERSION: u32 = 0; pub const POLLIN: u32 = 1; pub const POLLPRI: u32 = 2; pub const POLLOUT: u32 = 4; @@ -239,6 +314,10 @@ pub const FPSIMD_MAGIC: u32 = 1179680769; pub const ESR_MAGIC: u32 = 1163088385; pub const EXTRA_MAGIC: u32 = 1163416577; pub const SVE_MAGIC: u32 = 1398162689; +pub const SVE_SIG_FLAG_SM: u32 = 1; +pub const TPIDR2_MAGIC: u32 = 1414547714; +pub const ZA_MAGIC: u32 = 1412850501; +pub const ZT_MAGIC: u32 = 1515474433; pub const __SVE_VQ_BYTES: u32 = 16; pub const __SVE_VQ_MIN: u32 = 1; pub const __SVE_VQ_MAX: u32 = 512; @@ -254,6 +333,8 @@ pub const SVE_VL_MIN: u32 = 16; pub const SVE_VL_MAX: u32 = 8192; pub const SVE_NUM_ZREGS: u32 = 32; pub const SVE_NUM_PREGS: u32 = 16; +pub const ZT_SIG_REG_SIZE: u32 = 512; +pub const ZT_SIG_REG_BYTES: u32 = 64; pub const NR_OPEN: u32 = 1024; pub const NGROUPS_MAX: u32 = 65536; pub const ARG_MAX: u32 = 131072; @@ -471,6 +552,8 @@ pub const __SIGRTMAX: u32 = 64; pub const SA_NOCLDSTOP: u32 = 1; pub const SA_NOCLDWAIT: u32 = 2; pub const SA_SIGINFO: u32 = 4; +pub const SA_UNSUPPORTED: u32 = 1024; +pub const SA_EXPOSE_TAGBITS: u32 = 2048; pub const SA_ONSTACK: u32 = 134217728; pub const SA_RESTART: u32 = 268435456; pub const SA_NODEFER: u32 = 1073741824; @@ -526,7 +609,9 @@ pub const SEGV_PKUERR: u32 = 4; pub const SEGV_ACCADI: u32 = 5; pub const SEGV_ADIDERR: u32 = 6; pub const SEGV_ADIPERR: u32 = 7; -pub const NSIGSEGV: u32 = 7; +pub const SEGV_MTEAERR: u32 = 8; +pub const SEGV_MTESERR: u32 = 9; +pub const NSIGSEGV: u32 = 9; pub const BUS_ADRALN: u32 = 1; pub const BUS_ADRERR: u32 = 2; pub const BUS_OBJERR: u32 = 3; @@ -538,7 +623,9 @@ pub const TRAP_TRACE: u32 = 2; pub const TRAP_BRANCH: u32 = 3; pub const TRAP_HWBKPT: u32 = 4; pub const TRAP_UNK: u32 = 5; -pub const NSIGTRAP: u32 = 5; +pub const TRAP_PERF: u32 = 6; +pub const NSIGTRAP: u32 = 6; +pub const TRAP_PERF_FLAG_ASYNC: u32 = 1; pub const CLD_EXITED: u32 = 1; pub const CLD_KILLED: u32 = 2; pub const CLD_DUMPED: u32 = 3; @@ -554,7 +641,8 @@ pub const POLL_PRI: u32 = 5; pub const POLL_HUP: u32 = 6; pub const NSIGPOLL: u32 = 6; pub const SYS_SECCOMP: u32 = 1; -pub const NSIGSYS: u32 = 1; +pub const SYS_USER_DISPATCH: u32 = 2; +pub const NSIGSYS: u32 = 2; pub const EMT_TAGOVF: u32 = 1; pub const NSIGEMT: u32 = 1; pub const SIGEV_SIGNAL: u32 = 0; @@ -593,6 +681,9 @@ pub const TIMER_ABSTIME: u32 = 1; pub const FD_SETSIZE: u32 = 1024; pub const CLOCKS_PER_SEC: u32 = 1000000; pub const TIME_UTC: u32 = 1; +pub const TIME_MONOTONIC: u32 = 2; +pub const TIME_ACTIVE: u32 = 3; +pub const TIME_THREAD_ACTIVE: u32 = 4; pub const CSIGNAL: u32 = 255; pub const CLONE_VM: u32 = 256; pub const CLONE_FS: u32 = 512; @@ -618,6 +709,12 @@ pub const CLONE_NEWUSER: u32 = 268435456; pub const CLONE_NEWPID: u32 = 536870912; pub const CLONE_NEWNET: u32 = 1073741824; pub const CLONE_IO: u32 = 2147483648; +pub const CLONE_CLEAR_SIGHAND: u64 = 4294967296; +pub const CLONE_INTO_CGROUP: u64 = 8589934592; +pub const CLONE_NEWTIME: u32 = 128; +pub const CLONE_ARGS_SIZE_VER0: u32 = 64; +pub const CLONE_ARGS_SIZE_VER1: u32 = 80; +pub const CLONE_ARGS_SIZE_VER2: u32 = 88; pub const SCHED_NORMAL: u32 = 0; pub const SCHED_FIFO: u32 = 1; pub const SCHED_RR: u32 = 2; @@ -649,9 +746,6 @@ pub const PTHREAD_PROCESS_PRIVATE: u32 = 0; pub const PTHREAD_PROCESS_SHARED: u32 = 1; pub const PTHREAD_SCOPE_SYSTEM: u32 = 0; pub const PTHREAD_SCOPE_PROCESS: u32 = 1; -pub const NATIVE_APP_GLUE_MAX_NUM_MOTION_EVENTS: u32 = 16; -pub const NATIVE_APP_GLUE_MAX_HISTORICAL_POINTER_SAMPLES: u32 = 64; -pub const NATIVE_APP_GLUE_MAX_NUM_KEY_EVENTS: u32 = 4; pub const NATIVE_APP_GLUE_MAX_INPUT_BUFFERS: u32 = 2; extern "C" { pub fn android_get_application_target_sdk_version() -> ::std::os::raw::c_int; @@ -670,39 +764,27 @@ pub struct max_align_t { } #[test] fn bindgen_test_layout_max_align_t() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 32usize, - concat!("Size of: ", stringify!(max_align_t)) + "Size of max_align_t" ); assert_eq!( ::std::mem::align_of::(), 16usize, - concat!("Alignment of ", stringify!(max_align_t)) + "Alignment of max_align_t" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).__clang_max_align_nonce1 as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce1) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(max_align_t), - "::", - stringify!(__clang_max_align_nonce1) - ) + "Offset of field: max_align_t::__clang_max_align_nonce1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).__clang_max_align_nonce2 as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce2) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(max_align_t), - "::", - stringify!(__clang_max_align_nonce2) - ) + "Offset of field: max_align_t::__clang_max_align_nonce2" ); } pub type __int8_t = ::std::os::raw::c_schar; @@ -748,25 +830,22 @@ pub struct __kernel_fd_set { } #[test] fn bindgen_test_layout___kernel_fd_set() { + const UNINIT: ::std::mem::MaybeUninit<__kernel_fd_set> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__kernel_fd_set>(), 128usize, - concat!("Size of: ", stringify!(__kernel_fd_set)) + "Size of __kernel_fd_set" ); assert_eq!( ::std::mem::align_of::<__kernel_fd_set>(), 8usize, - concat!("Alignment of ", stringify!(__kernel_fd_set)) + "Alignment of __kernel_fd_set" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_fd_set>())).fds_bits as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fds_bits) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__kernel_fd_set), - "::", - stringify!(fds_bits) - ) + "Offset of field: __kernel_fd_set::fds_bits" ); } pub type __kernel_sighandler_t = @@ -798,29 +877,27 @@ pub struct __kernel_fsid_t { } #[test] fn bindgen_test_layout___kernel_fsid_t() { + const UNINIT: ::std::mem::MaybeUninit<__kernel_fsid_t> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__kernel_fsid_t>(), 8usize, - concat!("Size of: ", stringify!(__kernel_fsid_t)) + "Size of __kernel_fsid_t" ); assert_eq!( ::std::mem::align_of::<__kernel_fsid_t>(), 4usize, - concat!("Alignment of ", stringify!(__kernel_fsid_t)) + "Alignment of __kernel_fsid_t" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_fsid_t>())).val as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).val) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__kernel_fsid_t), - "::", - stringify!(val) - ) + "Offset of field: __kernel_fsid_t::val" ); } pub type __kernel_off_t = __kernel_long_t; pub type __kernel_loff_t = ::std::os::raw::c_longlong; +pub type __kernel_old_time_t = __kernel_long_t; pub type __kernel_time_t = __kernel_long_t; pub type __kernel_time64_t = ::std::os::raw::c_longlong; pub type __kernel_clock_t = __kernel_long_t; @@ -878,8 +955,7 @@ pub type loff_t = off_t; pub type off64_t = loff_t; pub type __socklen_t = u32; pub type socklen_t = __socklen_t; -pub type __va_list = [u64; 4usize]; -pub type ssize_t = __kernel_ssize_t; +pub type __va_list = __BindgenOpaqueArray; pub type uint_t = ::std::os::raw::c_uint; pub type uint = ::std::os::raw::c_uint; pub type u_char = ::std::os::raw::c_uchar; @@ -890,483 +966,622 @@ pub type u_int32_t = u32; pub type u_int16_t = u16; pub type u_int8_t = u8; pub type u_int64_t = u64; -pub const AASSET_MODE_UNKNOWN: ::std::os::raw::c_uint = 0; -pub const AASSET_MODE_RANDOM: ::std::os::raw::c_uint = 1; -pub const AASSET_MODE_STREAMING: ::std::os::raw::c_uint = 2; -pub const AASSET_MODE_BUFFER: ::std::os::raw::c_uint = 3; +pub const AASSET_MODE_UNKNOWN: _bindgen_ty_1 = 0; +pub const AASSET_MODE_RANDOM: _bindgen_ty_1 = 1; +pub const AASSET_MODE_STREAMING: _bindgen_ty_1 = 2; +pub const AASSET_MODE_BUFFER: _bindgen_ty_1 = 3; pub type _bindgen_ty_1 = ::std::os::raw::c_uint; -pub const AKEYCODE_UNKNOWN: ::std::os::raw::c_uint = 0; -pub const AKEYCODE_SOFT_LEFT: ::std::os::raw::c_uint = 1; -pub const AKEYCODE_SOFT_RIGHT: ::std::os::raw::c_uint = 2; -pub const AKEYCODE_HOME: ::std::os::raw::c_uint = 3; -pub const AKEYCODE_BACK: ::std::os::raw::c_uint = 4; -pub const AKEYCODE_CALL: ::std::os::raw::c_uint = 5; -pub const AKEYCODE_ENDCALL: ::std::os::raw::c_uint = 6; -pub const AKEYCODE_0: ::std::os::raw::c_uint = 7; -pub const AKEYCODE_1: ::std::os::raw::c_uint = 8; -pub const AKEYCODE_2: ::std::os::raw::c_uint = 9; -pub const AKEYCODE_3: ::std::os::raw::c_uint = 10; -pub const AKEYCODE_4: ::std::os::raw::c_uint = 11; -pub const AKEYCODE_5: ::std::os::raw::c_uint = 12; -pub const AKEYCODE_6: ::std::os::raw::c_uint = 13; -pub const AKEYCODE_7: ::std::os::raw::c_uint = 14; -pub const AKEYCODE_8: ::std::os::raw::c_uint = 15; -pub const AKEYCODE_9: ::std::os::raw::c_uint = 16; -pub const AKEYCODE_STAR: ::std::os::raw::c_uint = 17; -pub const AKEYCODE_POUND: ::std::os::raw::c_uint = 18; -pub const AKEYCODE_DPAD_UP: ::std::os::raw::c_uint = 19; -pub const AKEYCODE_DPAD_DOWN: ::std::os::raw::c_uint = 20; -pub const AKEYCODE_DPAD_LEFT: ::std::os::raw::c_uint = 21; -pub const AKEYCODE_DPAD_RIGHT: ::std::os::raw::c_uint = 22; -pub const AKEYCODE_DPAD_CENTER: ::std::os::raw::c_uint = 23; -pub const AKEYCODE_VOLUME_UP: ::std::os::raw::c_uint = 24; -pub const AKEYCODE_VOLUME_DOWN: ::std::os::raw::c_uint = 25; -pub const AKEYCODE_POWER: ::std::os::raw::c_uint = 26; -pub const AKEYCODE_CAMERA: ::std::os::raw::c_uint = 27; -pub const AKEYCODE_CLEAR: ::std::os::raw::c_uint = 28; -pub const AKEYCODE_A: ::std::os::raw::c_uint = 29; -pub const AKEYCODE_B: ::std::os::raw::c_uint = 30; -pub const AKEYCODE_C: ::std::os::raw::c_uint = 31; -pub const AKEYCODE_D: ::std::os::raw::c_uint = 32; -pub const AKEYCODE_E: ::std::os::raw::c_uint = 33; -pub const AKEYCODE_F: ::std::os::raw::c_uint = 34; -pub const AKEYCODE_G: ::std::os::raw::c_uint = 35; -pub const AKEYCODE_H: ::std::os::raw::c_uint = 36; -pub const AKEYCODE_I: ::std::os::raw::c_uint = 37; -pub const AKEYCODE_J: ::std::os::raw::c_uint = 38; -pub const AKEYCODE_K: ::std::os::raw::c_uint = 39; -pub const AKEYCODE_L: ::std::os::raw::c_uint = 40; -pub const AKEYCODE_M: ::std::os::raw::c_uint = 41; -pub const AKEYCODE_N: ::std::os::raw::c_uint = 42; -pub const AKEYCODE_O: ::std::os::raw::c_uint = 43; -pub const AKEYCODE_P: ::std::os::raw::c_uint = 44; -pub const AKEYCODE_Q: ::std::os::raw::c_uint = 45; -pub const AKEYCODE_R: ::std::os::raw::c_uint = 46; -pub const AKEYCODE_S: ::std::os::raw::c_uint = 47; -pub const AKEYCODE_T: ::std::os::raw::c_uint = 48; -pub const AKEYCODE_U: ::std::os::raw::c_uint = 49; -pub const AKEYCODE_V: ::std::os::raw::c_uint = 50; -pub const AKEYCODE_W: ::std::os::raw::c_uint = 51; -pub const AKEYCODE_X: ::std::os::raw::c_uint = 52; -pub const AKEYCODE_Y: ::std::os::raw::c_uint = 53; -pub const AKEYCODE_Z: ::std::os::raw::c_uint = 54; -pub const AKEYCODE_COMMA: ::std::os::raw::c_uint = 55; -pub const AKEYCODE_PERIOD: ::std::os::raw::c_uint = 56; -pub const AKEYCODE_ALT_LEFT: ::std::os::raw::c_uint = 57; -pub const AKEYCODE_ALT_RIGHT: ::std::os::raw::c_uint = 58; -pub const AKEYCODE_SHIFT_LEFT: ::std::os::raw::c_uint = 59; -pub const AKEYCODE_SHIFT_RIGHT: ::std::os::raw::c_uint = 60; -pub const AKEYCODE_TAB: ::std::os::raw::c_uint = 61; -pub const AKEYCODE_SPACE: ::std::os::raw::c_uint = 62; -pub const AKEYCODE_SYM: ::std::os::raw::c_uint = 63; -pub const AKEYCODE_EXPLORER: ::std::os::raw::c_uint = 64; -pub const AKEYCODE_ENVELOPE: ::std::os::raw::c_uint = 65; -pub const AKEYCODE_ENTER: ::std::os::raw::c_uint = 66; -pub const AKEYCODE_DEL: ::std::os::raw::c_uint = 67; -pub const AKEYCODE_GRAVE: ::std::os::raw::c_uint = 68; -pub const AKEYCODE_MINUS: ::std::os::raw::c_uint = 69; -pub const AKEYCODE_EQUALS: ::std::os::raw::c_uint = 70; -pub const AKEYCODE_LEFT_BRACKET: ::std::os::raw::c_uint = 71; -pub const AKEYCODE_RIGHT_BRACKET: ::std::os::raw::c_uint = 72; -pub const AKEYCODE_BACKSLASH: ::std::os::raw::c_uint = 73; -pub const AKEYCODE_SEMICOLON: ::std::os::raw::c_uint = 74; -pub const AKEYCODE_APOSTROPHE: ::std::os::raw::c_uint = 75; -pub const AKEYCODE_SLASH: ::std::os::raw::c_uint = 76; -pub const AKEYCODE_AT: ::std::os::raw::c_uint = 77; -pub const AKEYCODE_NUM: ::std::os::raw::c_uint = 78; -pub const AKEYCODE_HEADSETHOOK: ::std::os::raw::c_uint = 79; -pub const AKEYCODE_FOCUS: ::std::os::raw::c_uint = 80; -pub const AKEYCODE_PLUS: ::std::os::raw::c_uint = 81; -pub const AKEYCODE_MENU: ::std::os::raw::c_uint = 82; -pub const AKEYCODE_NOTIFICATION: ::std::os::raw::c_uint = 83; -pub const AKEYCODE_SEARCH: ::std::os::raw::c_uint = 84; -pub const AKEYCODE_MEDIA_PLAY_PAUSE: ::std::os::raw::c_uint = 85; -pub const AKEYCODE_MEDIA_STOP: ::std::os::raw::c_uint = 86; -pub const AKEYCODE_MEDIA_NEXT: ::std::os::raw::c_uint = 87; -pub const AKEYCODE_MEDIA_PREVIOUS: ::std::os::raw::c_uint = 88; -pub const AKEYCODE_MEDIA_REWIND: ::std::os::raw::c_uint = 89; -pub const AKEYCODE_MEDIA_FAST_FORWARD: ::std::os::raw::c_uint = 90; -pub const AKEYCODE_MUTE: ::std::os::raw::c_uint = 91; -pub const AKEYCODE_PAGE_UP: ::std::os::raw::c_uint = 92; -pub const AKEYCODE_PAGE_DOWN: ::std::os::raw::c_uint = 93; -pub const AKEYCODE_PICTSYMBOLS: ::std::os::raw::c_uint = 94; -pub const AKEYCODE_SWITCH_CHARSET: ::std::os::raw::c_uint = 95; -pub const AKEYCODE_BUTTON_A: ::std::os::raw::c_uint = 96; -pub const AKEYCODE_BUTTON_B: ::std::os::raw::c_uint = 97; -pub const AKEYCODE_BUTTON_C: ::std::os::raw::c_uint = 98; -pub const AKEYCODE_BUTTON_X: ::std::os::raw::c_uint = 99; -pub const AKEYCODE_BUTTON_Y: ::std::os::raw::c_uint = 100; -pub const AKEYCODE_BUTTON_Z: ::std::os::raw::c_uint = 101; -pub const AKEYCODE_BUTTON_L1: ::std::os::raw::c_uint = 102; -pub const AKEYCODE_BUTTON_R1: ::std::os::raw::c_uint = 103; -pub const AKEYCODE_BUTTON_L2: ::std::os::raw::c_uint = 104; -pub const AKEYCODE_BUTTON_R2: ::std::os::raw::c_uint = 105; -pub const AKEYCODE_BUTTON_THUMBL: ::std::os::raw::c_uint = 106; -pub const AKEYCODE_BUTTON_THUMBR: ::std::os::raw::c_uint = 107; -pub const AKEYCODE_BUTTON_START: ::std::os::raw::c_uint = 108; -pub const AKEYCODE_BUTTON_SELECT: ::std::os::raw::c_uint = 109; -pub const AKEYCODE_BUTTON_MODE: ::std::os::raw::c_uint = 110; -pub const AKEYCODE_ESCAPE: ::std::os::raw::c_uint = 111; -pub const AKEYCODE_FORWARD_DEL: ::std::os::raw::c_uint = 112; -pub const AKEYCODE_CTRL_LEFT: ::std::os::raw::c_uint = 113; -pub const AKEYCODE_CTRL_RIGHT: ::std::os::raw::c_uint = 114; -pub const AKEYCODE_CAPS_LOCK: ::std::os::raw::c_uint = 115; -pub const AKEYCODE_SCROLL_LOCK: ::std::os::raw::c_uint = 116; -pub const AKEYCODE_META_LEFT: ::std::os::raw::c_uint = 117; -pub const AKEYCODE_META_RIGHT: ::std::os::raw::c_uint = 118; -pub const AKEYCODE_FUNCTION: ::std::os::raw::c_uint = 119; -pub const AKEYCODE_SYSRQ: ::std::os::raw::c_uint = 120; -pub const AKEYCODE_BREAK: ::std::os::raw::c_uint = 121; -pub const AKEYCODE_MOVE_HOME: ::std::os::raw::c_uint = 122; -pub const AKEYCODE_MOVE_END: ::std::os::raw::c_uint = 123; -pub const AKEYCODE_INSERT: ::std::os::raw::c_uint = 124; -pub const AKEYCODE_FORWARD: ::std::os::raw::c_uint = 125; -pub const AKEYCODE_MEDIA_PLAY: ::std::os::raw::c_uint = 126; -pub const AKEYCODE_MEDIA_PAUSE: ::std::os::raw::c_uint = 127; -pub const AKEYCODE_MEDIA_CLOSE: ::std::os::raw::c_uint = 128; -pub const AKEYCODE_MEDIA_EJECT: ::std::os::raw::c_uint = 129; -pub const AKEYCODE_MEDIA_RECORD: ::std::os::raw::c_uint = 130; -pub const AKEYCODE_F1: ::std::os::raw::c_uint = 131; -pub const AKEYCODE_F2: ::std::os::raw::c_uint = 132; -pub const AKEYCODE_F3: ::std::os::raw::c_uint = 133; -pub const AKEYCODE_F4: ::std::os::raw::c_uint = 134; -pub const AKEYCODE_F5: ::std::os::raw::c_uint = 135; -pub const AKEYCODE_F6: ::std::os::raw::c_uint = 136; -pub const AKEYCODE_F7: ::std::os::raw::c_uint = 137; -pub const AKEYCODE_F8: ::std::os::raw::c_uint = 138; -pub const AKEYCODE_F9: ::std::os::raw::c_uint = 139; -pub const AKEYCODE_F10: ::std::os::raw::c_uint = 140; -pub const AKEYCODE_F11: ::std::os::raw::c_uint = 141; -pub const AKEYCODE_F12: ::std::os::raw::c_uint = 142; -pub const AKEYCODE_NUM_LOCK: ::std::os::raw::c_uint = 143; -pub const AKEYCODE_NUMPAD_0: ::std::os::raw::c_uint = 144; -pub const AKEYCODE_NUMPAD_1: ::std::os::raw::c_uint = 145; -pub const AKEYCODE_NUMPAD_2: ::std::os::raw::c_uint = 146; -pub const AKEYCODE_NUMPAD_3: ::std::os::raw::c_uint = 147; -pub const AKEYCODE_NUMPAD_4: ::std::os::raw::c_uint = 148; -pub const AKEYCODE_NUMPAD_5: ::std::os::raw::c_uint = 149; -pub const AKEYCODE_NUMPAD_6: ::std::os::raw::c_uint = 150; -pub const AKEYCODE_NUMPAD_7: ::std::os::raw::c_uint = 151; -pub const AKEYCODE_NUMPAD_8: ::std::os::raw::c_uint = 152; -pub const AKEYCODE_NUMPAD_9: ::std::os::raw::c_uint = 153; -pub const AKEYCODE_NUMPAD_DIVIDE: ::std::os::raw::c_uint = 154; -pub const AKEYCODE_NUMPAD_MULTIPLY: ::std::os::raw::c_uint = 155; -pub const AKEYCODE_NUMPAD_SUBTRACT: ::std::os::raw::c_uint = 156; -pub const AKEYCODE_NUMPAD_ADD: ::std::os::raw::c_uint = 157; -pub const AKEYCODE_NUMPAD_DOT: ::std::os::raw::c_uint = 158; -pub const AKEYCODE_NUMPAD_COMMA: ::std::os::raw::c_uint = 159; -pub const AKEYCODE_NUMPAD_ENTER: ::std::os::raw::c_uint = 160; -pub const AKEYCODE_NUMPAD_EQUALS: ::std::os::raw::c_uint = 161; -pub const AKEYCODE_NUMPAD_LEFT_PAREN: ::std::os::raw::c_uint = 162; -pub const AKEYCODE_NUMPAD_RIGHT_PAREN: ::std::os::raw::c_uint = 163; -pub const AKEYCODE_VOLUME_MUTE: ::std::os::raw::c_uint = 164; -pub const AKEYCODE_INFO: ::std::os::raw::c_uint = 165; -pub const AKEYCODE_CHANNEL_UP: ::std::os::raw::c_uint = 166; -pub const AKEYCODE_CHANNEL_DOWN: ::std::os::raw::c_uint = 167; -pub const AKEYCODE_ZOOM_IN: ::std::os::raw::c_uint = 168; -pub const AKEYCODE_ZOOM_OUT: ::std::os::raw::c_uint = 169; -pub const AKEYCODE_TV: ::std::os::raw::c_uint = 170; -pub const AKEYCODE_WINDOW: ::std::os::raw::c_uint = 171; -pub const AKEYCODE_GUIDE: ::std::os::raw::c_uint = 172; -pub const AKEYCODE_DVR: ::std::os::raw::c_uint = 173; -pub const AKEYCODE_BOOKMARK: ::std::os::raw::c_uint = 174; -pub const AKEYCODE_CAPTIONS: ::std::os::raw::c_uint = 175; -pub const AKEYCODE_SETTINGS: ::std::os::raw::c_uint = 176; -pub const AKEYCODE_TV_POWER: ::std::os::raw::c_uint = 177; -pub const AKEYCODE_TV_INPUT: ::std::os::raw::c_uint = 178; -pub const AKEYCODE_STB_POWER: ::std::os::raw::c_uint = 179; -pub const AKEYCODE_STB_INPUT: ::std::os::raw::c_uint = 180; -pub const AKEYCODE_AVR_POWER: ::std::os::raw::c_uint = 181; -pub const AKEYCODE_AVR_INPUT: ::std::os::raw::c_uint = 182; -pub const AKEYCODE_PROG_RED: ::std::os::raw::c_uint = 183; -pub const AKEYCODE_PROG_GREEN: ::std::os::raw::c_uint = 184; -pub const AKEYCODE_PROG_YELLOW: ::std::os::raw::c_uint = 185; -pub const AKEYCODE_PROG_BLUE: ::std::os::raw::c_uint = 186; -pub const AKEYCODE_APP_SWITCH: ::std::os::raw::c_uint = 187; -pub const AKEYCODE_BUTTON_1: ::std::os::raw::c_uint = 188; -pub const AKEYCODE_BUTTON_2: ::std::os::raw::c_uint = 189; -pub const AKEYCODE_BUTTON_3: ::std::os::raw::c_uint = 190; -pub const AKEYCODE_BUTTON_4: ::std::os::raw::c_uint = 191; -pub const AKEYCODE_BUTTON_5: ::std::os::raw::c_uint = 192; -pub const AKEYCODE_BUTTON_6: ::std::os::raw::c_uint = 193; -pub const AKEYCODE_BUTTON_7: ::std::os::raw::c_uint = 194; -pub const AKEYCODE_BUTTON_8: ::std::os::raw::c_uint = 195; -pub const AKEYCODE_BUTTON_9: ::std::os::raw::c_uint = 196; -pub const AKEYCODE_BUTTON_10: ::std::os::raw::c_uint = 197; -pub const AKEYCODE_BUTTON_11: ::std::os::raw::c_uint = 198; -pub const AKEYCODE_BUTTON_12: ::std::os::raw::c_uint = 199; -pub const AKEYCODE_BUTTON_13: ::std::os::raw::c_uint = 200; -pub const AKEYCODE_BUTTON_14: ::std::os::raw::c_uint = 201; -pub const AKEYCODE_BUTTON_15: ::std::os::raw::c_uint = 202; -pub const AKEYCODE_BUTTON_16: ::std::os::raw::c_uint = 203; -pub const AKEYCODE_LANGUAGE_SWITCH: ::std::os::raw::c_uint = 204; -pub const AKEYCODE_MANNER_MODE: ::std::os::raw::c_uint = 205; -pub const AKEYCODE_3D_MODE: ::std::os::raw::c_uint = 206; -pub const AKEYCODE_CONTACTS: ::std::os::raw::c_uint = 207; -pub const AKEYCODE_CALENDAR: ::std::os::raw::c_uint = 208; -pub const AKEYCODE_MUSIC: ::std::os::raw::c_uint = 209; -pub const AKEYCODE_CALCULATOR: ::std::os::raw::c_uint = 210; -pub const AKEYCODE_ZENKAKU_HANKAKU: ::std::os::raw::c_uint = 211; -pub const AKEYCODE_EISU: ::std::os::raw::c_uint = 212; -pub const AKEYCODE_MUHENKAN: ::std::os::raw::c_uint = 213; -pub const AKEYCODE_HENKAN: ::std::os::raw::c_uint = 214; -pub const AKEYCODE_KATAKANA_HIRAGANA: ::std::os::raw::c_uint = 215; -pub const AKEYCODE_YEN: ::std::os::raw::c_uint = 216; -pub const AKEYCODE_RO: ::std::os::raw::c_uint = 217; -pub const AKEYCODE_KANA: ::std::os::raw::c_uint = 218; -pub const AKEYCODE_ASSIST: ::std::os::raw::c_uint = 219; -pub const AKEYCODE_BRIGHTNESS_DOWN: ::std::os::raw::c_uint = 220; -pub const AKEYCODE_BRIGHTNESS_UP: ::std::os::raw::c_uint = 221; -pub const AKEYCODE_MEDIA_AUDIO_TRACK: ::std::os::raw::c_uint = 222; -pub const AKEYCODE_SLEEP: ::std::os::raw::c_uint = 223; -pub const AKEYCODE_WAKEUP: ::std::os::raw::c_uint = 224; -pub const AKEYCODE_PAIRING: ::std::os::raw::c_uint = 225; -pub const AKEYCODE_MEDIA_TOP_MENU: ::std::os::raw::c_uint = 226; -pub const AKEYCODE_11: ::std::os::raw::c_uint = 227; -pub const AKEYCODE_12: ::std::os::raw::c_uint = 228; -pub const AKEYCODE_LAST_CHANNEL: ::std::os::raw::c_uint = 229; -pub const AKEYCODE_TV_DATA_SERVICE: ::std::os::raw::c_uint = 230; -pub const AKEYCODE_VOICE_ASSIST: ::std::os::raw::c_uint = 231; -pub const AKEYCODE_TV_RADIO_SERVICE: ::std::os::raw::c_uint = 232; -pub const AKEYCODE_TV_TELETEXT: ::std::os::raw::c_uint = 233; -pub const AKEYCODE_TV_NUMBER_ENTRY: ::std::os::raw::c_uint = 234; -pub const AKEYCODE_TV_TERRESTRIAL_ANALOG: ::std::os::raw::c_uint = 235; -pub const AKEYCODE_TV_TERRESTRIAL_DIGITAL: ::std::os::raw::c_uint = 236; -pub const AKEYCODE_TV_SATELLITE: ::std::os::raw::c_uint = 237; -pub const AKEYCODE_TV_SATELLITE_BS: ::std::os::raw::c_uint = 238; -pub const AKEYCODE_TV_SATELLITE_CS: ::std::os::raw::c_uint = 239; -pub const AKEYCODE_TV_SATELLITE_SERVICE: ::std::os::raw::c_uint = 240; -pub const AKEYCODE_TV_NETWORK: ::std::os::raw::c_uint = 241; -pub const AKEYCODE_TV_ANTENNA_CABLE: ::std::os::raw::c_uint = 242; -pub const AKEYCODE_TV_INPUT_HDMI_1: ::std::os::raw::c_uint = 243; -pub const AKEYCODE_TV_INPUT_HDMI_2: ::std::os::raw::c_uint = 244; -pub const AKEYCODE_TV_INPUT_HDMI_3: ::std::os::raw::c_uint = 245; -pub const AKEYCODE_TV_INPUT_HDMI_4: ::std::os::raw::c_uint = 246; -pub const AKEYCODE_TV_INPUT_COMPOSITE_1: ::std::os::raw::c_uint = 247; -pub const AKEYCODE_TV_INPUT_COMPOSITE_2: ::std::os::raw::c_uint = 248; -pub const AKEYCODE_TV_INPUT_COMPONENT_1: ::std::os::raw::c_uint = 249; -pub const AKEYCODE_TV_INPUT_COMPONENT_2: ::std::os::raw::c_uint = 250; -pub const AKEYCODE_TV_INPUT_VGA_1: ::std::os::raw::c_uint = 251; -pub const AKEYCODE_TV_AUDIO_DESCRIPTION: ::std::os::raw::c_uint = 252; -pub const AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_UP: ::std::os::raw::c_uint = 253; -pub const AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_DOWN: ::std::os::raw::c_uint = 254; -pub const AKEYCODE_TV_ZOOM_MODE: ::std::os::raw::c_uint = 255; -pub const AKEYCODE_TV_CONTENTS_MENU: ::std::os::raw::c_uint = 256; -pub const AKEYCODE_TV_MEDIA_CONTEXT_MENU: ::std::os::raw::c_uint = 257; -pub const AKEYCODE_TV_TIMER_PROGRAMMING: ::std::os::raw::c_uint = 258; -pub const AKEYCODE_HELP: ::std::os::raw::c_uint = 259; -pub const AKEYCODE_NAVIGATE_PREVIOUS: ::std::os::raw::c_uint = 260; -pub const AKEYCODE_NAVIGATE_NEXT: ::std::os::raw::c_uint = 261; -pub const AKEYCODE_NAVIGATE_IN: ::std::os::raw::c_uint = 262; -pub const AKEYCODE_NAVIGATE_OUT: ::std::os::raw::c_uint = 263; -pub const AKEYCODE_STEM_PRIMARY: ::std::os::raw::c_uint = 264; -pub const AKEYCODE_STEM_1: ::std::os::raw::c_uint = 265; -pub const AKEYCODE_STEM_2: ::std::os::raw::c_uint = 266; -pub const AKEYCODE_STEM_3: ::std::os::raw::c_uint = 267; -pub const AKEYCODE_DPAD_UP_LEFT: ::std::os::raw::c_uint = 268; -pub const AKEYCODE_DPAD_DOWN_LEFT: ::std::os::raw::c_uint = 269; -pub const AKEYCODE_DPAD_UP_RIGHT: ::std::os::raw::c_uint = 270; -pub const AKEYCODE_DPAD_DOWN_RIGHT: ::std::os::raw::c_uint = 271; -pub const AKEYCODE_MEDIA_SKIP_FORWARD: ::std::os::raw::c_uint = 272; -pub const AKEYCODE_MEDIA_SKIP_BACKWARD: ::std::os::raw::c_uint = 273; -pub const AKEYCODE_MEDIA_STEP_FORWARD: ::std::os::raw::c_uint = 274; -pub const AKEYCODE_MEDIA_STEP_BACKWARD: ::std::os::raw::c_uint = 275; -pub const AKEYCODE_SOFT_SLEEP: ::std::os::raw::c_uint = 276; -pub const AKEYCODE_CUT: ::std::os::raw::c_uint = 277; -pub const AKEYCODE_COPY: ::std::os::raw::c_uint = 278; -pub const AKEYCODE_PASTE: ::std::os::raw::c_uint = 279; -pub const AKEYCODE_SYSTEM_NAVIGATION_UP: ::std::os::raw::c_uint = 280; -pub const AKEYCODE_SYSTEM_NAVIGATION_DOWN: ::std::os::raw::c_uint = 281; -pub const AKEYCODE_SYSTEM_NAVIGATION_LEFT: ::std::os::raw::c_uint = 282; -pub const AKEYCODE_SYSTEM_NAVIGATION_RIGHT: ::std::os::raw::c_uint = 283; -pub const AKEYCODE_ALL_APPS: ::std::os::raw::c_uint = 284; -pub const AKEYCODE_REFRESH: ::std::os::raw::c_uint = 285; -pub const AKEYCODE_THUMBS_UP: ::std::os::raw::c_uint = 286; -pub const AKEYCODE_THUMBS_DOWN: ::std::os::raw::c_uint = 287; -pub const AKEYCODE_PROFILE_SWITCH: ::std::os::raw::c_uint = 288; +pub const AKEYCODE_UNKNOWN: _bindgen_ty_2 = 0; +pub const AKEYCODE_SOFT_LEFT: _bindgen_ty_2 = 1; +pub const AKEYCODE_SOFT_RIGHT: _bindgen_ty_2 = 2; +pub const AKEYCODE_HOME: _bindgen_ty_2 = 3; +pub const AKEYCODE_BACK: _bindgen_ty_2 = 4; +pub const AKEYCODE_CALL: _bindgen_ty_2 = 5; +pub const AKEYCODE_ENDCALL: _bindgen_ty_2 = 6; +pub const AKEYCODE_0: _bindgen_ty_2 = 7; +pub const AKEYCODE_1: _bindgen_ty_2 = 8; +pub const AKEYCODE_2: _bindgen_ty_2 = 9; +pub const AKEYCODE_3: _bindgen_ty_2 = 10; +pub const AKEYCODE_4: _bindgen_ty_2 = 11; +pub const AKEYCODE_5: _bindgen_ty_2 = 12; +pub const AKEYCODE_6: _bindgen_ty_2 = 13; +pub const AKEYCODE_7: _bindgen_ty_2 = 14; +pub const AKEYCODE_8: _bindgen_ty_2 = 15; +pub const AKEYCODE_9: _bindgen_ty_2 = 16; +pub const AKEYCODE_STAR: _bindgen_ty_2 = 17; +pub const AKEYCODE_POUND: _bindgen_ty_2 = 18; +pub const AKEYCODE_DPAD_UP: _bindgen_ty_2 = 19; +pub const AKEYCODE_DPAD_DOWN: _bindgen_ty_2 = 20; +pub const AKEYCODE_DPAD_LEFT: _bindgen_ty_2 = 21; +pub const AKEYCODE_DPAD_RIGHT: _bindgen_ty_2 = 22; +pub const AKEYCODE_DPAD_CENTER: _bindgen_ty_2 = 23; +pub const AKEYCODE_VOLUME_UP: _bindgen_ty_2 = 24; +pub const AKEYCODE_VOLUME_DOWN: _bindgen_ty_2 = 25; +pub const AKEYCODE_POWER: _bindgen_ty_2 = 26; +pub const AKEYCODE_CAMERA: _bindgen_ty_2 = 27; +pub const AKEYCODE_CLEAR: _bindgen_ty_2 = 28; +pub const AKEYCODE_A: _bindgen_ty_2 = 29; +pub const AKEYCODE_B: _bindgen_ty_2 = 30; +pub const AKEYCODE_C: _bindgen_ty_2 = 31; +pub const AKEYCODE_D: _bindgen_ty_2 = 32; +pub const AKEYCODE_E: _bindgen_ty_2 = 33; +pub const AKEYCODE_F: _bindgen_ty_2 = 34; +pub const AKEYCODE_G: _bindgen_ty_2 = 35; +pub const AKEYCODE_H: _bindgen_ty_2 = 36; +pub const AKEYCODE_I: _bindgen_ty_2 = 37; +pub const AKEYCODE_J: _bindgen_ty_2 = 38; +pub const AKEYCODE_K: _bindgen_ty_2 = 39; +pub const AKEYCODE_L: _bindgen_ty_2 = 40; +pub const AKEYCODE_M: _bindgen_ty_2 = 41; +pub const AKEYCODE_N: _bindgen_ty_2 = 42; +pub const AKEYCODE_O: _bindgen_ty_2 = 43; +pub const AKEYCODE_P: _bindgen_ty_2 = 44; +pub const AKEYCODE_Q: _bindgen_ty_2 = 45; +pub const AKEYCODE_R: _bindgen_ty_2 = 46; +pub const AKEYCODE_S: _bindgen_ty_2 = 47; +pub const AKEYCODE_T: _bindgen_ty_2 = 48; +pub const AKEYCODE_U: _bindgen_ty_2 = 49; +pub const AKEYCODE_V: _bindgen_ty_2 = 50; +pub const AKEYCODE_W: _bindgen_ty_2 = 51; +pub const AKEYCODE_X: _bindgen_ty_2 = 52; +pub const AKEYCODE_Y: _bindgen_ty_2 = 53; +pub const AKEYCODE_Z: _bindgen_ty_2 = 54; +pub const AKEYCODE_COMMA: _bindgen_ty_2 = 55; +pub const AKEYCODE_PERIOD: _bindgen_ty_2 = 56; +pub const AKEYCODE_ALT_LEFT: _bindgen_ty_2 = 57; +pub const AKEYCODE_ALT_RIGHT: _bindgen_ty_2 = 58; +pub const AKEYCODE_SHIFT_LEFT: _bindgen_ty_2 = 59; +pub const AKEYCODE_SHIFT_RIGHT: _bindgen_ty_2 = 60; +pub const AKEYCODE_TAB: _bindgen_ty_2 = 61; +pub const AKEYCODE_SPACE: _bindgen_ty_2 = 62; +pub const AKEYCODE_SYM: _bindgen_ty_2 = 63; +pub const AKEYCODE_EXPLORER: _bindgen_ty_2 = 64; +pub const AKEYCODE_ENVELOPE: _bindgen_ty_2 = 65; +pub const AKEYCODE_ENTER: _bindgen_ty_2 = 66; +pub const AKEYCODE_DEL: _bindgen_ty_2 = 67; +pub const AKEYCODE_GRAVE: _bindgen_ty_2 = 68; +pub const AKEYCODE_MINUS: _bindgen_ty_2 = 69; +pub const AKEYCODE_EQUALS: _bindgen_ty_2 = 70; +pub const AKEYCODE_LEFT_BRACKET: _bindgen_ty_2 = 71; +pub const AKEYCODE_RIGHT_BRACKET: _bindgen_ty_2 = 72; +pub const AKEYCODE_BACKSLASH: _bindgen_ty_2 = 73; +pub const AKEYCODE_SEMICOLON: _bindgen_ty_2 = 74; +pub const AKEYCODE_APOSTROPHE: _bindgen_ty_2 = 75; +pub const AKEYCODE_SLASH: _bindgen_ty_2 = 76; +pub const AKEYCODE_AT: _bindgen_ty_2 = 77; +pub const AKEYCODE_NUM: _bindgen_ty_2 = 78; +pub const AKEYCODE_HEADSETHOOK: _bindgen_ty_2 = 79; +pub const AKEYCODE_FOCUS: _bindgen_ty_2 = 80; +pub const AKEYCODE_PLUS: _bindgen_ty_2 = 81; +pub const AKEYCODE_MENU: _bindgen_ty_2 = 82; +pub const AKEYCODE_NOTIFICATION: _bindgen_ty_2 = 83; +pub const AKEYCODE_SEARCH: _bindgen_ty_2 = 84; +pub const AKEYCODE_MEDIA_PLAY_PAUSE: _bindgen_ty_2 = 85; +pub const AKEYCODE_MEDIA_STOP: _bindgen_ty_2 = 86; +pub const AKEYCODE_MEDIA_NEXT: _bindgen_ty_2 = 87; +pub const AKEYCODE_MEDIA_PREVIOUS: _bindgen_ty_2 = 88; +pub const AKEYCODE_MEDIA_REWIND: _bindgen_ty_2 = 89; +pub const AKEYCODE_MEDIA_FAST_FORWARD: _bindgen_ty_2 = 90; +pub const AKEYCODE_MUTE: _bindgen_ty_2 = 91; +pub const AKEYCODE_PAGE_UP: _bindgen_ty_2 = 92; +pub const AKEYCODE_PAGE_DOWN: _bindgen_ty_2 = 93; +pub const AKEYCODE_PICTSYMBOLS: _bindgen_ty_2 = 94; +pub const AKEYCODE_SWITCH_CHARSET: _bindgen_ty_2 = 95; +pub const AKEYCODE_BUTTON_A: _bindgen_ty_2 = 96; +pub const AKEYCODE_BUTTON_B: _bindgen_ty_2 = 97; +pub const AKEYCODE_BUTTON_C: _bindgen_ty_2 = 98; +pub const AKEYCODE_BUTTON_X: _bindgen_ty_2 = 99; +pub const AKEYCODE_BUTTON_Y: _bindgen_ty_2 = 100; +pub const AKEYCODE_BUTTON_Z: _bindgen_ty_2 = 101; +pub const AKEYCODE_BUTTON_L1: _bindgen_ty_2 = 102; +pub const AKEYCODE_BUTTON_R1: _bindgen_ty_2 = 103; +pub const AKEYCODE_BUTTON_L2: _bindgen_ty_2 = 104; +pub const AKEYCODE_BUTTON_R2: _bindgen_ty_2 = 105; +pub const AKEYCODE_BUTTON_THUMBL: _bindgen_ty_2 = 106; +pub const AKEYCODE_BUTTON_THUMBR: _bindgen_ty_2 = 107; +pub const AKEYCODE_BUTTON_START: _bindgen_ty_2 = 108; +pub const AKEYCODE_BUTTON_SELECT: _bindgen_ty_2 = 109; +pub const AKEYCODE_BUTTON_MODE: _bindgen_ty_2 = 110; +pub const AKEYCODE_ESCAPE: _bindgen_ty_2 = 111; +pub const AKEYCODE_FORWARD_DEL: _bindgen_ty_2 = 112; +pub const AKEYCODE_CTRL_LEFT: _bindgen_ty_2 = 113; +pub const AKEYCODE_CTRL_RIGHT: _bindgen_ty_2 = 114; +pub const AKEYCODE_CAPS_LOCK: _bindgen_ty_2 = 115; +pub const AKEYCODE_SCROLL_LOCK: _bindgen_ty_2 = 116; +pub const AKEYCODE_META_LEFT: _bindgen_ty_2 = 117; +pub const AKEYCODE_META_RIGHT: _bindgen_ty_2 = 118; +pub const AKEYCODE_FUNCTION: _bindgen_ty_2 = 119; +pub const AKEYCODE_SYSRQ: _bindgen_ty_2 = 120; +pub const AKEYCODE_BREAK: _bindgen_ty_2 = 121; +pub const AKEYCODE_MOVE_HOME: _bindgen_ty_2 = 122; +pub const AKEYCODE_MOVE_END: _bindgen_ty_2 = 123; +pub const AKEYCODE_INSERT: _bindgen_ty_2 = 124; +pub const AKEYCODE_FORWARD: _bindgen_ty_2 = 125; +pub const AKEYCODE_MEDIA_PLAY: _bindgen_ty_2 = 126; +pub const AKEYCODE_MEDIA_PAUSE: _bindgen_ty_2 = 127; +pub const AKEYCODE_MEDIA_CLOSE: _bindgen_ty_2 = 128; +pub const AKEYCODE_MEDIA_EJECT: _bindgen_ty_2 = 129; +pub const AKEYCODE_MEDIA_RECORD: _bindgen_ty_2 = 130; +pub const AKEYCODE_F1: _bindgen_ty_2 = 131; +pub const AKEYCODE_F2: _bindgen_ty_2 = 132; +pub const AKEYCODE_F3: _bindgen_ty_2 = 133; +pub const AKEYCODE_F4: _bindgen_ty_2 = 134; +pub const AKEYCODE_F5: _bindgen_ty_2 = 135; +pub const AKEYCODE_F6: _bindgen_ty_2 = 136; +pub const AKEYCODE_F7: _bindgen_ty_2 = 137; +pub const AKEYCODE_F8: _bindgen_ty_2 = 138; +pub const AKEYCODE_F9: _bindgen_ty_2 = 139; +pub const AKEYCODE_F10: _bindgen_ty_2 = 140; +pub const AKEYCODE_F11: _bindgen_ty_2 = 141; +pub const AKEYCODE_F12: _bindgen_ty_2 = 142; +pub const AKEYCODE_NUM_LOCK: _bindgen_ty_2 = 143; +pub const AKEYCODE_NUMPAD_0: _bindgen_ty_2 = 144; +pub const AKEYCODE_NUMPAD_1: _bindgen_ty_2 = 145; +pub const AKEYCODE_NUMPAD_2: _bindgen_ty_2 = 146; +pub const AKEYCODE_NUMPAD_3: _bindgen_ty_2 = 147; +pub const AKEYCODE_NUMPAD_4: _bindgen_ty_2 = 148; +pub const AKEYCODE_NUMPAD_5: _bindgen_ty_2 = 149; +pub const AKEYCODE_NUMPAD_6: _bindgen_ty_2 = 150; +pub const AKEYCODE_NUMPAD_7: _bindgen_ty_2 = 151; +pub const AKEYCODE_NUMPAD_8: _bindgen_ty_2 = 152; +pub const AKEYCODE_NUMPAD_9: _bindgen_ty_2 = 153; +pub const AKEYCODE_NUMPAD_DIVIDE: _bindgen_ty_2 = 154; +pub const AKEYCODE_NUMPAD_MULTIPLY: _bindgen_ty_2 = 155; +pub const AKEYCODE_NUMPAD_SUBTRACT: _bindgen_ty_2 = 156; +pub const AKEYCODE_NUMPAD_ADD: _bindgen_ty_2 = 157; +pub const AKEYCODE_NUMPAD_DOT: _bindgen_ty_2 = 158; +pub const AKEYCODE_NUMPAD_COMMA: _bindgen_ty_2 = 159; +pub const AKEYCODE_NUMPAD_ENTER: _bindgen_ty_2 = 160; +pub const AKEYCODE_NUMPAD_EQUALS: _bindgen_ty_2 = 161; +pub const AKEYCODE_NUMPAD_LEFT_PAREN: _bindgen_ty_2 = 162; +pub const AKEYCODE_NUMPAD_RIGHT_PAREN: _bindgen_ty_2 = 163; +pub const AKEYCODE_VOLUME_MUTE: _bindgen_ty_2 = 164; +pub const AKEYCODE_INFO: _bindgen_ty_2 = 165; +pub const AKEYCODE_CHANNEL_UP: _bindgen_ty_2 = 166; +pub const AKEYCODE_CHANNEL_DOWN: _bindgen_ty_2 = 167; +pub const AKEYCODE_ZOOM_IN: _bindgen_ty_2 = 168; +pub const AKEYCODE_ZOOM_OUT: _bindgen_ty_2 = 169; +pub const AKEYCODE_TV: _bindgen_ty_2 = 170; +pub const AKEYCODE_WINDOW: _bindgen_ty_2 = 171; +pub const AKEYCODE_GUIDE: _bindgen_ty_2 = 172; +pub const AKEYCODE_DVR: _bindgen_ty_2 = 173; +pub const AKEYCODE_BOOKMARK: _bindgen_ty_2 = 174; +pub const AKEYCODE_CAPTIONS: _bindgen_ty_2 = 175; +pub const AKEYCODE_SETTINGS: _bindgen_ty_2 = 176; +pub const AKEYCODE_TV_POWER: _bindgen_ty_2 = 177; +pub const AKEYCODE_TV_INPUT: _bindgen_ty_2 = 178; +pub const AKEYCODE_STB_POWER: _bindgen_ty_2 = 179; +pub const AKEYCODE_STB_INPUT: _bindgen_ty_2 = 180; +pub const AKEYCODE_AVR_POWER: _bindgen_ty_2 = 181; +pub const AKEYCODE_AVR_INPUT: _bindgen_ty_2 = 182; +pub const AKEYCODE_PROG_RED: _bindgen_ty_2 = 183; +pub const AKEYCODE_PROG_GREEN: _bindgen_ty_2 = 184; +pub const AKEYCODE_PROG_YELLOW: _bindgen_ty_2 = 185; +pub const AKEYCODE_PROG_BLUE: _bindgen_ty_2 = 186; +pub const AKEYCODE_APP_SWITCH: _bindgen_ty_2 = 187; +pub const AKEYCODE_BUTTON_1: _bindgen_ty_2 = 188; +pub const AKEYCODE_BUTTON_2: _bindgen_ty_2 = 189; +pub const AKEYCODE_BUTTON_3: _bindgen_ty_2 = 190; +pub const AKEYCODE_BUTTON_4: _bindgen_ty_2 = 191; +pub const AKEYCODE_BUTTON_5: _bindgen_ty_2 = 192; +pub const AKEYCODE_BUTTON_6: _bindgen_ty_2 = 193; +pub const AKEYCODE_BUTTON_7: _bindgen_ty_2 = 194; +pub const AKEYCODE_BUTTON_8: _bindgen_ty_2 = 195; +pub const AKEYCODE_BUTTON_9: _bindgen_ty_2 = 196; +pub const AKEYCODE_BUTTON_10: _bindgen_ty_2 = 197; +pub const AKEYCODE_BUTTON_11: _bindgen_ty_2 = 198; +pub const AKEYCODE_BUTTON_12: _bindgen_ty_2 = 199; +pub const AKEYCODE_BUTTON_13: _bindgen_ty_2 = 200; +pub const AKEYCODE_BUTTON_14: _bindgen_ty_2 = 201; +pub const AKEYCODE_BUTTON_15: _bindgen_ty_2 = 202; +pub const AKEYCODE_BUTTON_16: _bindgen_ty_2 = 203; +pub const AKEYCODE_LANGUAGE_SWITCH: _bindgen_ty_2 = 204; +pub const AKEYCODE_MANNER_MODE: _bindgen_ty_2 = 205; +pub const AKEYCODE_3D_MODE: _bindgen_ty_2 = 206; +pub const AKEYCODE_CONTACTS: _bindgen_ty_2 = 207; +pub const AKEYCODE_CALENDAR: _bindgen_ty_2 = 208; +pub const AKEYCODE_MUSIC: _bindgen_ty_2 = 209; +pub const AKEYCODE_CALCULATOR: _bindgen_ty_2 = 210; +pub const AKEYCODE_ZENKAKU_HANKAKU: _bindgen_ty_2 = 211; +pub const AKEYCODE_EISU: _bindgen_ty_2 = 212; +pub const AKEYCODE_MUHENKAN: _bindgen_ty_2 = 213; +pub const AKEYCODE_HENKAN: _bindgen_ty_2 = 214; +pub const AKEYCODE_KATAKANA_HIRAGANA: _bindgen_ty_2 = 215; +pub const AKEYCODE_YEN: _bindgen_ty_2 = 216; +pub const AKEYCODE_RO: _bindgen_ty_2 = 217; +pub const AKEYCODE_KANA: _bindgen_ty_2 = 218; +pub const AKEYCODE_ASSIST: _bindgen_ty_2 = 219; +pub const AKEYCODE_BRIGHTNESS_DOWN: _bindgen_ty_2 = 220; +pub const AKEYCODE_BRIGHTNESS_UP: _bindgen_ty_2 = 221; +pub const AKEYCODE_MEDIA_AUDIO_TRACK: _bindgen_ty_2 = 222; +pub const AKEYCODE_SLEEP: _bindgen_ty_2 = 223; +pub const AKEYCODE_WAKEUP: _bindgen_ty_2 = 224; +pub const AKEYCODE_PAIRING: _bindgen_ty_2 = 225; +pub const AKEYCODE_MEDIA_TOP_MENU: _bindgen_ty_2 = 226; +pub const AKEYCODE_11: _bindgen_ty_2 = 227; +pub const AKEYCODE_12: _bindgen_ty_2 = 228; +pub const AKEYCODE_LAST_CHANNEL: _bindgen_ty_2 = 229; +pub const AKEYCODE_TV_DATA_SERVICE: _bindgen_ty_2 = 230; +pub const AKEYCODE_VOICE_ASSIST: _bindgen_ty_2 = 231; +pub const AKEYCODE_TV_RADIO_SERVICE: _bindgen_ty_2 = 232; +pub const AKEYCODE_TV_TELETEXT: _bindgen_ty_2 = 233; +pub const AKEYCODE_TV_NUMBER_ENTRY: _bindgen_ty_2 = 234; +pub const AKEYCODE_TV_TERRESTRIAL_ANALOG: _bindgen_ty_2 = 235; +pub const AKEYCODE_TV_TERRESTRIAL_DIGITAL: _bindgen_ty_2 = 236; +pub const AKEYCODE_TV_SATELLITE: _bindgen_ty_2 = 237; +pub const AKEYCODE_TV_SATELLITE_BS: _bindgen_ty_2 = 238; +pub const AKEYCODE_TV_SATELLITE_CS: _bindgen_ty_2 = 239; +pub const AKEYCODE_TV_SATELLITE_SERVICE: _bindgen_ty_2 = 240; +pub const AKEYCODE_TV_NETWORK: _bindgen_ty_2 = 241; +pub const AKEYCODE_TV_ANTENNA_CABLE: _bindgen_ty_2 = 242; +pub const AKEYCODE_TV_INPUT_HDMI_1: _bindgen_ty_2 = 243; +pub const AKEYCODE_TV_INPUT_HDMI_2: _bindgen_ty_2 = 244; +pub const AKEYCODE_TV_INPUT_HDMI_3: _bindgen_ty_2 = 245; +pub const AKEYCODE_TV_INPUT_HDMI_4: _bindgen_ty_2 = 246; +pub const AKEYCODE_TV_INPUT_COMPOSITE_1: _bindgen_ty_2 = 247; +pub const AKEYCODE_TV_INPUT_COMPOSITE_2: _bindgen_ty_2 = 248; +pub const AKEYCODE_TV_INPUT_COMPONENT_1: _bindgen_ty_2 = 249; +pub const AKEYCODE_TV_INPUT_COMPONENT_2: _bindgen_ty_2 = 250; +pub const AKEYCODE_TV_INPUT_VGA_1: _bindgen_ty_2 = 251; +pub const AKEYCODE_TV_AUDIO_DESCRIPTION: _bindgen_ty_2 = 252; +pub const AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_UP: _bindgen_ty_2 = 253; +pub const AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_DOWN: _bindgen_ty_2 = 254; +pub const AKEYCODE_TV_ZOOM_MODE: _bindgen_ty_2 = 255; +pub const AKEYCODE_TV_CONTENTS_MENU: _bindgen_ty_2 = 256; +pub const AKEYCODE_TV_MEDIA_CONTEXT_MENU: _bindgen_ty_2 = 257; +pub const AKEYCODE_TV_TIMER_PROGRAMMING: _bindgen_ty_2 = 258; +pub const AKEYCODE_HELP: _bindgen_ty_2 = 259; +pub const AKEYCODE_NAVIGATE_PREVIOUS: _bindgen_ty_2 = 260; +pub const AKEYCODE_NAVIGATE_NEXT: _bindgen_ty_2 = 261; +pub const AKEYCODE_NAVIGATE_IN: _bindgen_ty_2 = 262; +pub const AKEYCODE_NAVIGATE_OUT: _bindgen_ty_2 = 263; +pub const AKEYCODE_STEM_PRIMARY: _bindgen_ty_2 = 264; +pub const AKEYCODE_STEM_1: _bindgen_ty_2 = 265; +pub const AKEYCODE_STEM_2: _bindgen_ty_2 = 266; +pub const AKEYCODE_STEM_3: _bindgen_ty_2 = 267; +pub const AKEYCODE_DPAD_UP_LEFT: _bindgen_ty_2 = 268; +pub const AKEYCODE_DPAD_DOWN_LEFT: _bindgen_ty_2 = 269; +pub const AKEYCODE_DPAD_UP_RIGHT: _bindgen_ty_2 = 270; +pub const AKEYCODE_DPAD_DOWN_RIGHT: _bindgen_ty_2 = 271; +pub const AKEYCODE_MEDIA_SKIP_FORWARD: _bindgen_ty_2 = 272; +pub const AKEYCODE_MEDIA_SKIP_BACKWARD: _bindgen_ty_2 = 273; +pub const AKEYCODE_MEDIA_STEP_FORWARD: _bindgen_ty_2 = 274; +pub const AKEYCODE_MEDIA_STEP_BACKWARD: _bindgen_ty_2 = 275; +pub const AKEYCODE_SOFT_SLEEP: _bindgen_ty_2 = 276; +pub const AKEYCODE_CUT: _bindgen_ty_2 = 277; +pub const AKEYCODE_COPY: _bindgen_ty_2 = 278; +pub const AKEYCODE_PASTE: _bindgen_ty_2 = 279; +pub const AKEYCODE_SYSTEM_NAVIGATION_UP: _bindgen_ty_2 = 280; +pub const AKEYCODE_SYSTEM_NAVIGATION_DOWN: _bindgen_ty_2 = 281; +pub const AKEYCODE_SYSTEM_NAVIGATION_LEFT: _bindgen_ty_2 = 282; +pub const AKEYCODE_SYSTEM_NAVIGATION_RIGHT: _bindgen_ty_2 = 283; +pub const AKEYCODE_ALL_APPS: _bindgen_ty_2 = 284; +pub const AKEYCODE_REFRESH: _bindgen_ty_2 = 285; +pub const AKEYCODE_THUMBS_UP: _bindgen_ty_2 = 286; +pub const AKEYCODE_THUMBS_DOWN: _bindgen_ty_2 = 287; +pub const AKEYCODE_PROFILE_SWITCH: _bindgen_ty_2 = 288; +pub const AKEYCODE_VIDEO_APP_1: _bindgen_ty_2 = 289; +pub const AKEYCODE_VIDEO_APP_2: _bindgen_ty_2 = 290; +pub const AKEYCODE_VIDEO_APP_3: _bindgen_ty_2 = 291; +pub const AKEYCODE_VIDEO_APP_4: _bindgen_ty_2 = 292; +pub const AKEYCODE_VIDEO_APP_5: _bindgen_ty_2 = 293; +pub const AKEYCODE_VIDEO_APP_6: _bindgen_ty_2 = 294; +pub const AKEYCODE_VIDEO_APP_7: _bindgen_ty_2 = 295; +pub const AKEYCODE_VIDEO_APP_8: _bindgen_ty_2 = 296; +pub const AKEYCODE_FEATURED_APP_1: _bindgen_ty_2 = 297; +pub const AKEYCODE_FEATURED_APP_2: _bindgen_ty_2 = 298; +pub const AKEYCODE_FEATURED_APP_3: _bindgen_ty_2 = 299; +pub const AKEYCODE_FEATURED_APP_4: _bindgen_ty_2 = 300; +pub const AKEYCODE_DEMO_APP_1: _bindgen_ty_2 = 301; +pub const AKEYCODE_DEMO_APP_2: _bindgen_ty_2 = 302; +pub const AKEYCODE_DEMO_APP_3: _bindgen_ty_2 = 303; +pub const AKEYCODE_DEMO_APP_4: _bindgen_ty_2 = 304; pub type _bindgen_ty_2 = ::std::os::raw::c_uint; -pub const ALOOPER_PREPARE_ALLOW_NON_CALLBACKS: ::std::os::raw::c_uint = 1; +pub const ALOOPER_PREPARE_ALLOW_NON_CALLBACKS: _bindgen_ty_3 = 1; pub type _bindgen_ty_3 = ::std::os::raw::c_uint; -pub const ALOOPER_POLL_WAKE: ::std::os::raw::c_int = -1; -pub const ALOOPER_POLL_CALLBACK: ::std::os::raw::c_int = -2; -pub const ALOOPER_POLL_TIMEOUT: ::std::os::raw::c_int = -3; -pub const ALOOPER_POLL_ERROR: ::std::os::raw::c_int = -4; +pub const ALOOPER_POLL_WAKE: _bindgen_ty_4 = -1; +pub const ALOOPER_POLL_CALLBACK: _bindgen_ty_4 = -2; +pub const ALOOPER_POLL_TIMEOUT: _bindgen_ty_4 = -3; +pub const ALOOPER_POLL_ERROR: _bindgen_ty_4 = -4; pub type _bindgen_ty_4 = ::std::os::raw::c_int; -pub const ALOOPER_EVENT_INPUT: ::std::os::raw::c_uint = 1; -pub const ALOOPER_EVENT_OUTPUT: ::std::os::raw::c_uint = 2; -pub const ALOOPER_EVENT_ERROR: ::std::os::raw::c_uint = 4; -pub const ALOOPER_EVENT_HANGUP: ::std::os::raw::c_uint = 8; -pub const ALOOPER_EVENT_INVALID: ::std::os::raw::c_uint = 16; +pub const ALOOPER_EVENT_INPUT: _bindgen_ty_5 = 1; +pub const ALOOPER_EVENT_OUTPUT: _bindgen_ty_5 = 2; +pub const ALOOPER_EVENT_ERROR: _bindgen_ty_5 = 4; +pub const ALOOPER_EVENT_HANGUP: _bindgen_ty_5 = 8; +pub const ALOOPER_EVENT_INVALID: _bindgen_ty_5 = 16; pub type _bindgen_ty_5 = ::std::os::raw::c_uint; -pub const AKEY_STATE_UNKNOWN: ::std::os::raw::c_int = -1; -pub const AKEY_STATE_UP: ::std::os::raw::c_int = 0; -pub const AKEY_STATE_DOWN: ::std::os::raw::c_int = 1; -pub const AKEY_STATE_VIRTUAL: ::std::os::raw::c_int = 2; +pub type __gnuc_va_list = __BindgenOpaqueArray; +pub type va_list = __BindgenOpaqueArray; +#[repr(C)] +pub struct JavaVMAttachArgs { + pub version: jint, + pub name: *const ::std::os::raw::c_char, + pub group: jobject, +} +#[test] +fn bindgen_test_layout_JavaVMAttachArgs() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 24usize, + "Size of JavaVMAttachArgs" + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + "Alignment of JavaVMAttachArgs" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).version) as usize - ptr as usize }, + 0usize, + "Offset of field: JavaVMAttachArgs::version" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize }, + 8usize, + "Offset of field: JavaVMAttachArgs::name" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).group) as usize - ptr as usize }, + 16usize, + "Offset of field: JavaVMAttachArgs::group" + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct JavaVMOption { + pub optionString: *const ::std::os::raw::c_char, + pub extraInfo: *mut ::std::os::raw::c_void, +} +#[test] +fn bindgen_test_layout_JavaVMOption() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 16usize, + "Size of JavaVMOption" + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + "Alignment of JavaVMOption" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).optionString) as usize - ptr as usize }, + 0usize, + "Offset of field: JavaVMOption::optionString" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).extraInfo) as usize - ptr as usize }, + 8usize, + "Offset of field: JavaVMOption::extraInfo" + ); +} +#[repr(C)] +pub struct JavaVMInitArgs { + pub version: jint, + pub nOptions: jint, + pub options: *mut JavaVMOption, + pub ignoreUnrecognized: jboolean, +} +#[test] +fn bindgen_test_layout_JavaVMInitArgs() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 24usize, + "Size of JavaVMInitArgs" + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + "Alignment of JavaVMInitArgs" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).version) as usize - ptr as usize }, + 0usize, + "Offset of field: JavaVMInitArgs::version" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).nOptions) as usize - ptr as usize }, + 4usize, + "Offset of field: JavaVMInitArgs::nOptions" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).options) as usize - ptr as usize }, + 8usize, + "Offset of field: JavaVMInitArgs::options" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ignoreUnrecognized) as usize - ptr as usize }, + 16usize, + "Offset of field: JavaVMInitArgs::ignoreUnrecognized" + ); +} +pub const AKEY_STATE_UNKNOWN: _bindgen_ty_6 = -1; +pub const AKEY_STATE_UP: _bindgen_ty_6 = 0; +pub const AKEY_STATE_DOWN: _bindgen_ty_6 = 1; +pub const AKEY_STATE_VIRTUAL: _bindgen_ty_6 = 2; pub type _bindgen_ty_6 = ::std::os::raw::c_int; -pub const AMETA_NONE: ::std::os::raw::c_uint = 0; -pub const AMETA_ALT_ON: ::std::os::raw::c_uint = 2; -pub const AMETA_ALT_LEFT_ON: ::std::os::raw::c_uint = 16; -pub const AMETA_ALT_RIGHT_ON: ::std::os::raw::c_uint = 32; -pub const AMETA_SHIFT_ON: ::std::os::raw::c_uint = 1; -pub const AMETA_SHIFT_LEFT_ON: ::std::os::raw::c_uint = 64; -pub const AMETA_SHIFT_RIGHT_ON: ::std::os::raw::c_uint = 128; -pub const AMETA_SYM_ON: ::std::os::raw::c_uint = 4; -pub const AMETA_FUNCTION_ON: ::std::os::raw::c_uint = 8; -pub const AMETA_CTRL_ON: ::std::os::raw::c_uint = 4096; -pub const AMETA_CTRL_LEFT_ON: ::std::os::raw::c_uint = 8192; -pub const AMETA_CTRL_RIGHT_ON: ::std::os::raw::c_uint = 16384; -pub const AMETA_META_ON: ::std::os::raw::c_uint = 65536; -pub const AMETA_META_LEFT_ON: ::std::os::raw::c_uint = 131072; -pub const AMETA_META_RIGHT_ON: ::std::os::raw::c_uint = 262144; -pub const AMETA_CAPS_LOCK_ON: ::std::os::raw::c_uint = 1048576; -pub const AMETA_NUM_LOCK_ON: ::std::os::raw::c_uint = 2097152; -pub const AMETA_SCROLL_LOCK_ON: ::std::os::raw::c_uint = 4194304; +pub const AMETA_NONE: _bindgen_ty_7 = 0; +pub const AMETA_ALT_ON: _bindgen_ty_7 = 2; +pub const AMETA_ALT_LEFT_ON: _bindgen_ty_7 = 16; +pub const AMETA_ALT_RIGHT_ON: _bindgen_ty_7 = 32; +pub const AMETA_SHIFT_ON: _bindgen_ty_7 = 1; +pub const AMETA_SHIFT_LEFT_ON: _bindgen_ty_7 = 64; +pub const AMETA_SHIFT_RIGHT_ON: _bindgen_ty_7 = 128; +pub const AMETA_SYM_ON: _bindgen_ty_7 = 4; +pub const AMETA_FUNCTION_ON: _bindgen_ty_7 = 8; +pub const AMETA_CTRL_ON: _bindgen_ty_7 = 4096; +pub const AMETA_CTRL_LEFT_ON: _bindgen_ty_7 = 8192; +pub const AMETA_CTRL_RIGHT_ON: _bindgen_ty_7 = 16384; +pub const AMETA_META_ON: _bindgen_ty_7 = 65536; +pub const AMETA_META_LEFT_ON: _bindgen_ty_7 = 131072; +pub const AMETA_META_RIGHT_ON: _bindgen_ty_7 = 262144; +pub const AMETA_CAPS_LOCK_ON: _bindgen_ty_7 = 1048576; +pub const AMETA_NUM_LOCK_ON: _bindgen_ty_7 = 2097152; +pub const AMETA_SCROLL_LOCK_ON: _bindgen_ty_7 = 4194304; pub type _bindgen_ty_7 = ::std::os::raw::c_uint; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct AInputEvent { _unused: [u8; 0], } -pub const AINPUT_EVENT_TYPE_KEY: ::std::os::raw::c_uint = 1; -pub const AINPUT_EVENT_TYPE_MOTION: ::std::os::raw::c_uint = 2; +pub const AINPUT_EVENT_TYPE_KEY: _bindgen_ty_8 = 1; +pub const AINPUT_EVENT_TYPE_MOTION: _bindgen_ty_8 = 2; +pub const AINPUT_EVENT_TYPE_FOCUS: _bindgen_ty_8 = 3; +pub const AINPUT_EVENT_TYPE_CAPTURE: _bindgen_ty_8 = 4; +pub const AINPUT_EVENT_TYPE_DRAG: _bindgen_ty_8 = 5; +pub const AINPUT_EVENT_TYPE_TOUCH_MODE: _bindgen_ty_8 = 6; pub type _bindgen_ty_8 = ::std::os::raw::c_uint; -pub const AKEY_EVENT_ACTION_DOWN: ::std::os::raw::c_uint = 0; -pub const AKEY_EVENT_ACTION_UP: ::std::os::raw::c_uint = 1; -pub const AKEY_EVENT_ACTION_MULTIPLE: ::std::os::raw::c_uint = 2; +pub const AKEY_EVENT_ACTION_DOWN: _bindgen_ty_9 = 0; +pub const AKEY_EVENT_ACTION_UP: _bindgen_ty_9 = 1; +pub const AKEY_EVENT_ACTION_MULTIPLE: _bindgen_ty_9 = 2; pub type _bindgen_ty_9 = ::std::os::raw::c_uint; -pub const AKEY_EVENT_FLAG_WOKE_HERE: ::std::os::raw::c_uint = 1; -pub const AKEY_EVENT_FLAG_SOFT_KEYBOARD: ::std::os::raw::c_uint = 2; -pub const AKEY_EVENT_FLAG_KEEP_TOUCH_MODE: ::std::os::raw::c_uint = 4; -pub const AKEY_EVENT_FLAG_FROM_SYSTEM: ::std::os::raw::c_uint = 8; -pub const AKEY_EVENT_FLAG_EDITOR_ACTION: ::std::os::raw::c_uint = 16; -pub const AKEY_EVENT_FLAG_CANCELED: ::std::os::raw::c_uint = 32; -pub const AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY: ::std::os::raw::c_uint = 64; -pub const AKEY_EVENT_FLAG_LONG_PRESS: ::std::os::raw::c_uint = 128; -pub const AKEY_EVENT_FLAG_CANCELED_LONG_PRESS: ::std::os::raw::c_uint = 256; -pub const AKEY_EVENT_FLAG_TRACKING: ::std::os::raw::c_uint = 512; -pub const AKEY_EVENT_FLAG_FALLBACK: ::std::os::raw::c_uint = 1024; +pub const AKEY_EVENT_FLAG_WOKE_HERE: _bindgen_ty_10 = 1; +pub const AKEY_EVENT_FLAG_SOFT_KEYBOARD: _bindgen_ty_10 = 2; +pub const AKEY_EVENT_FLAG_KEEP_TOUCH_MODE: _bindgen_ty_10 = 4; +pub const AKEY_EVENT_FLAG_FROM_SYSTEM: _bindgen_ty_10 = 8; +pub const AKEY_EVENT_FLAG_EDITOR_ACTION: _bindgen_ty_10 = 16; +pub const AKEY_EVENT_FLAG_CANCELED: _bindgen_ty_10 = 32; +pub const AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY: _bindgen_ty_10 = 64; +pub const AKEY_EVENT_FLAG_LONG_PRESS: _bindgen_ty_10 = 128; +pub const AKEY_EVENT_FLAG_CANCELED_LONG_PRESS: _bindgen_ty_10 = 256; +pub const AKEY_EVENT_FLAG_TRACKING: _bindgen_ty_10 = 512; +pub const AKEY_EVENT_FLAG_FALLBACK: _bindgen_ty_10 = 1024; pub type _bindgen_ty_10 = ::std::os::raw::c_uint; -pub const AMOTION_EVENT_ACTION_MASK: ::std::os::raw::c_uint = 255; -pub const AMOTION_EVENT_ACTION_POINTER_INDEX_MASK: ::std::os::raw::c_uint = 65280; -pub const AMOTION_EVENT_ACTION_DOWN: ::std::os::raw::c_uint = 0; -pub const AMOTION_EVENT_ACTION_UP: ::std::os::raw::c_uint = 1; -pub const AMOTION_EVENT_ACTION_MOVE: ::std::os::raw::c_uint = 2; -pub const AMOTION_EVENT_ACTION_CANCEL: ::std::os::raw::c_uint = 3; -pub const AMOTION_EVENT_ACTION_OUTSIDE: ::std::os::raw::c_uint = 4; -pub const AMOTION_EVENT_ACTION_POINTER_DOWN: ::std::os::raw::c_uint = 5; -pub const AMOTION_EVENT_ACTION_POINTER_UP: ::std::os::raw::c_uint = 6; -pub const AMOTION_EVENT_ACTION_HOVER_MOVE: ::std::os::raw::c_uint = 7; -pub const AMOTION_EVENT_ACTION_SCROLL: ::std::os::raw::c_uint = 8; -pub const AMOTION_EVENT_ACTION_HOVER_ENTER: ::std::os::raw::c_uint = 9; -pub const AMOTION_EVENT_ACTION_HOVER_EXIT: ::std::os::raw::c_uint = 10; -pub const AMOTION_EVENT_ACTION_BUTTON_PRESS: ::std::os::raw::c_uint = 11; -pub const AMOTION_EVENT_ACTION_BUTTON_RELEASE: ::std::os::raw::c_uint = 12; +pub const AMOTION_EVENT_ACTION_MASK: _bindgen_ty_11 = 255; +pub const AMOTION_EVENT_ACTION_POINTER_INDEX_MASK: _bindgen_ty_11 = 65280; +pub const AMOTION_EVENT_ACTION_DOWN: _bindgen_ty_11 = 0; +pub const AMOTION_EVENT_ACTION_UP: _bindgen_ty_11 = 1; +pub const AMOTION_EVENT_ACTION_MOVE: _bindgen_ty_11 = 2; +pub const AMOTION_EVENT_ACTION_CANCEL: _bindgen_ty_11 = 3; +pub const AMOTION_EVENT_ACTION_OUTSIDE: _bindgen_ty_11 = 4; +pub const AMOTION_EVENT_ACTION_POINTER_DOWN: _bindgen_ty_11 = 5; +pub const AMOTION_EVENT_ACTION_POINTER_UP: _bindgen_ty_11 = 6; +pub const AMOTION_EVENT_ACTION_HOVER_MOVE: _bindgen_ty_11 = 7; +pub const AMOTION_EVENT_ACTION_SCROLL: _bindgen_ty_11 = 8; +pub const AMOTION_EVENT_ACTION_HOVER_ENTER: _bindgen_ty_11 = 9; +pub const AMOTION_EVENT_ACTION_HOVER_EXIT: _bindgen_ty_11 = 10; +pub const AMOTION_EVENT_ACTION_BUTTON_PRESS: _bindgen_ty_11 = 11; +pub const AMOTION_EVENT_ACTION_BUTTON_RELEASE: _bindgen_ty_11 = 12; pub type _bindgen_ty_11 = ::std::os::raw::c_uint; -pub const AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED: ::std::os::raw::c_uint = 1; +pub const AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED: _bindgen_ty_12 = 1; pub type _bindgen_ty_12 = ::std::os::raw::c_uint; -pub const AMOTION_EVENT_EDGE_FLAG_NONE: ::std::os::raw::c_uint = 0; -pub const AMOTION_EVENT_EDGE_FLAG_TOP: ::std::os::raw::c_uint = 1; -pub const AMOTION_EVENT_EDGE_FLAG_BOTTOM: ::std::os::raw::c_uint = 2; -pub const AMOTION_EVENT_EDGE_FLAG_LEFT: ::std::os::raw::c_uint = 4; -pub const AMOTION_EVENT_EDGE_FLAG_RIGHT: ::std::os::raw::c_uint = 8; +pub const AMOTION_EVENT_EDGE_FLAG_NONE: _bindgen_ty_13 = 0; +pub const AMOTION_EVENT_EDGE_FLAG_TOP: _bindgen_ty_13 = 1; +pub const AMOTION_EVENT_EDGE_FLAG_BOTTOM: _bindgen_ty_13 = 2; +pub const AMOTION_EVENT_EDGE_FLAG_LEFT: _bindgen_ty_13 = 4; +pub const AMOTION_EVENT_EDGE_FLAG_RIGHT: _bindgen_ty_13 = 8; pub type _bindgen_ty_13 = ::std::os::raw::c_uint; -pub const AMOTION_EVENT_AXIS_X: ::std::os::raw::c_uint = 0; -pub const AMOTION_EVENT_AXIS_Y: ::std::os::raw::c_uint = 1; -pub const AMOTION_EVENT_AXIS_PRESSURE: ::std::os::raw::c_uint = 2; -pub const AMOTION_EVENT_AXIS_SIZE: ::std::os::raw::c_uint = 3; -pub const AMOTION_EVENT_AXIS_TOUCH_MAJOR: ::std::os::raw::c_uint = 4; -pub const AMOTION_EVENT_AXIS_TOUCH_MINOR: ::std::os::raw::c_uint = 5; -pub const AMOTION_EVENT_AXIS_TOOL_MAJOR: ::std::os::raw::c_uint = 6; -pub const AMOTION_EVENT_AXIS_TOOL_MINOR: ::std::os::raw::c_uint = 7; -pub const AMOTION_EVENT_AXIS_ORIENTATION: ::std::os::raw::c_uint = 8; -pub const AMOTION_EVENT_AXIS_VSCROLL: ::std::os::raw::c_uint = 9; -pub const AMOTION_EVENT_AXIS_HSCROLL: ::std::os::raw::c_uint = 10; -pub const AMOTION_EVENT_AXIS_Z: ::std::os::raw::c_uint = 11; -pub const AMOTION_EVENT_AXIS_RX: ::std::os::raw::c_uint = 12; -pub const AMOTION_EVENT_AXIS_RY: ::std::os::raw::c_uint = 13; -pub const AMOTION_EVENT_AXIS_RZ: ::std::os::raw::c_uint = 14; -pub const AMOTION_EVENT_AXIS_HAT_X: ::std::os::raw::c_uint = 15; -pub const AMOTION_EVENT_AXIS_HAT_Y: ::std::os::raw::c_uint = 16; -pub const AMOTION_EVENT_AXIS_LTRIGGER: ::std::os::raw::c_uint = 17; -pub const AMOTION_EVENT_AXIS_RTRIGGER: ::std::os::raw::c_uint = 18; -pub const AMOTION_EVENT_AXIS_THROTTLE: ::std::os::raw::c_uint = 19; -pub const AMOTION_EVENT_AXIS_RUDDER: ::std::os::raw::c_uint = 20; -pub const AMOTION_EVENT_AXIS_WHEEL: ::std::os::raw::c_uint = 21; -pub const AMOTION_EVENT_AXIS_GAS: ::std::os::raw::c_uint = 22; -pub const AMOTION_EVENT_AXIS_BRAKE: ::std::os::raw::c_uint = 23; -pub const AMOTION_EVENT_AXIS_DISTANCE: ::std::os::raw::c_uint = 24; -pub const AMOTION_EVENT_AXIS_TILT: ::std::os::raw::c_uint = 25; -pub const AMOTION_EVENT_AXIS_SCROLL: ::std::os::raw::c_uint = 26; -pub const AMOTION_EVENT_AXIS_RELATIVE_X: ::std::os::raw::c_uint = 27; -pub const AMOTION_EVENT_AXIS_RELATIVE_Y: ::std::os::raw::c_uint = 28; -pub const AMOTION_EVENT_AXIS_GENERIC_1: ::std::os::raw::c_uint = 32; -pub const AMOTION_EVENT_AXIS_GENERIC_2: ::std::os::raw::c_uint = 33; -pub const AMOTION_EVENT_AXIS_GENERIC_3: ::std::os::raw::c_uint = 34; -pub const AMOTION_EVENT_AXIS_GENERIC_4: ::std::os::raw::c_uint = 35; -pub const AMOTION_EVENT_AXIS_GENERIC_5: ::std::os::raw::c_uint = 36; -pub const AMOTION_EVENT_AXIS_GENERIC_6: ::std::os::raw::c_uint = 37; -pub const AMOTION_EVENT_AXIS_GENERIC_7: ::std::os::raw::c_uint = 38; -pub const AMOTION_EVENT_AXIS_GENERIC_8: ::std::os::raw::c_uint = 39; -pub const AMOTION_EVENT_AXIS_GENERIC_9: ::std::os::raw::c_uint = 40; -pub const AMOTION_EVENT_AXIS_GENERIC_10: ::std::os::raw::c_uint = 41; -pub const AMOTION_EVENT_AXIS_GENERIC_11: ::std::os::raw::c_uint = 42; -pub const AMOTION_EVENT_AXIS_GENERIC_12: ::std::os::raw::c_uint = 43; -pub const AMOTION_EVENT_AXIS_GENERIC_13: ::std::os::raw::c_uint = 44; -pub const AMOTION_EVENT_AXIS_GENERIC_14: ::std::os::raw::c_uint = 45; -pub const AMOTION_EVENT_AXIS_GENERIC_15: ::std::os::raw::c_uint = 46; -pub const AMOTION_EVENT_AXIS_GENERIC_16: ::std::os::raw::c_uint = 47; +pub const AMOTION_EVENT_AXIS_X: _bindgen_ty_14 = 0; +pub const AMOTION_EVENT_AXIS_Y: _bindgen_ty_14 = 1; +pub const AMOTION_EVENT_AXIS_PRESSURE: _bindgen_ty_14 = 2; +pub const AMOTION_EVENT_AXIS_SIZE: _bindgen_ty_14 = 3; +pub const AMOTION_EVENT_AXIS_TOUCH_MAJOR: _bindgen_ty_14 = 4; +pub const AMOTION_EVENT_AXIS_TOUCH_MINOR: _bindgen_ty_14 = 5; +pub const AMOTION_EVENT_AXIS_TOOL_MAJOR: _bindgen_ty_14 = 6; +pub const AMOTION_EVENT_AXIS_TOOL_MINOR: _bindgen_ty_14 = 7; +pub const AMOTION_EVENT_AXIS_ORIENTATION: _bindgen_ty_14 = 8; +pub const AMOTION_EVENT_AXIS_VSCROLL: _bindgen_ty_14 = 9; +pub const AMOTION_EVENT_AXIS_HSCROLL: _bindgen_ty_14 = 10; +pub const AMOTION_EVENT_AXIS_Z: _bindgen_ty_14 = 11; +pub const AMOTION_EVENT_AXIS_RX: _bindgen_ty_14 = 12; +pub const AMOTION_EVENT_AXIS_RY: _bindgen_ty_14 = 13; +pub const AMOTION_EVENT_AXIS_RZ: _bindgen_ty_14 = 14; +pub const AMOTION_EVENT_AXIS_HAT_X: _bindgen_ty_14 = 15; +pub const AMOTION_EVENT_AXIS_HAT_Y: _bindgen_ty_14 = 16; +pub const AMOTION_EVENT_AXIS_LTRIGGER: _bindgen_ty_14 = 17; +pub const AMOTION_EVENT_AXIS_RTRIGGER: _bindgen_ty_14 = 18; +pub const AMOTION_EVENT_AXIS_THROTTLE: _bindgen_ty_14 = 19; +pub const AMOTION_EVENT_AXIS_RUDDER: _bindgen_ty_14 = 20; +pub const AMOTION_EVENT_AXIS_WHEEL: _bindgen_ty_14 = 21; +pub const AMOTION_EVENT_AXIS_GAS: _bindgen_ty_14 = 22; +pub const AMOTION_EVENT_AXIS_BRAKE: _bindgen_ty_14 = 23; +pub const AMOTION_EVENT_AXIS_DISTANCE: _bindgen_ty_14 = 24; +pub const AMOTION_EVENT_AXIS_TILT: _bindgen_ty_14 = 25; +pub const AMOTION_EVENT_AXIS_SCROLL: _bindgen_ty_14 = 26; +pub const AMOTION_EVENT_AXIS_RELATIVE_X: _bindgen_ty_14 = 27; +pub const AMOTION_EVENT_AXIS_RELATIVE_Y: _bindgen_ty_14 = 28; +pub const AMOTION_EVENT_AXIS_GENERIC_1: _bindgen_ty_14 = 32; +pub const AMOTION_EVENT_AXIS_GENERIC_2: _bindgen_ty_14 = 33; +pub const AMOTION_EVENT_AXIS_GENERIC_3: _bindgen_ty_14 = 34; +pub const AMOTION_EVENT_AXIS_GENERIC_4: _bindgen_ty_14 = 35; +pub const AMOTION_EVENT_AXIS_GENERIC_5: _bindgen_ty_14 = 36; +pub const AMOTION_EVENT_AXIS_GENERIC_6: _bindgen_ty_14 = 37; +pub const AMOTION_EVENT_AXIS_GENERIC_7: _bindgen_ty_14 = 38; +pub const AMOTION_EVENT_AXIS_GENERIC_8: _bindgen_ty_14 = 39; +pub const AMOTION_EVENT_AXIS_GENERIC_9: _bindgen_ty_14 = 40; +pub const AMOTION_EVENT_AXIS_GENERIC_10: _bindgen_ty_14 = 41; +pub const AMOTION_EVENT_AXIS_GENERIC_11: _bindgen_ty_14 = 42; +pub const AMOTION_EVENT_AXIS_GENERIC_12: _bindgen_ty_14 = 43; +pub const AMOTION_EVENT_AXIS_GENERIC_13: _bindgen_ty_14 = 44; +pub const AMOTION_EVENT_AXIS_GENERIC_14: _bindgen_ty_14 = 45; +pub const AMOTION_EVENT_AXIS_GENERIC_15: _bindgen_ty_14 = 46; +pub const AMOTION_EVENT_AXIS_GENERIC_16: _bindgen_ty_14 = 47; pub type _bindgen_ty_14 = ::std::os::raw::c_uint; -pub const AMOTION_EVENT_BUTTON_PRIMARY: ::std::os::raw::c_uint = 1; -pub const AMOTION_EVENT_BUTTON_SECONDARY: ::std::os::raw::c_uint = 2; -pub const AMOTION_EVENT_BUTTON_TERTIARY: ::std::os::raw::c_uint = 4; -pub const AMOTION_EVENT_BUTTON_BACK: ::std::os::raw::c_uint = 8; -pub const AMOTION_EVENT_BUTTON_FORWARD: ::std::os::raw::c_uint = 16; -pub const AMOTION_EVENT_BUTTON_STYLUS_PRIMARY: ::std::os::raw::c_uint = 32; -pub const AMOTION_EVENT_BUTTON_STYLUS_SECONDARY: ::std::os::raw::c_uint = 64; +pub const AMOTION_EVENT_BUTTON_PRIMARY: _bindgen_ty_15 = 1; +pub const AMOTION_EVENT_BUTTON_SECONDARY: _bindgen_ty_15 = 2; +pub const AMOTION_EVENT_BUTTON_TERTIARY: _bindgen_ty_15 = 4; +pub const AMOTION_EVENT_BUTTON_BACK: _bindgen_ty_15 = 8; +pub const AMOTION_EVENT_BUTTON_FORWARD: _bindgen_ty_15 = 16; +pub const AMOTION_EVENT_BUTTON_STYLUS_PRIMARY: _bindgen_ty_15 = 32; +pub const AMOTION_EVENT_BUTTON_STYLUS_SECONDARY: _bindgen_ty_15 = 64; pub type _bindgen_ty_15 = ::std::os::raw::c_uint; -pub const AMOTION_EVENT_TOOL_TYPE_UNKNOWN: ::std::os::raw::c_uint = 0; -pub const AMOTION_EVENT_TOOL_TYPE_FINGER: ::std::os::raw::c_uint = 1; -pub const AMOTION_EVENT_TOOL_TYPE_STYLUS: ::std::os::raw::c_uint = 2; -pub const AMOTION_EVENT_TOOL_TYPE_MOUSE: ::std::os::raw::c_uint = 3; -pub const AMOTION_EVENT_TOOL_TYPE_ERASER: ::std::os::raw::c_uint = 4; +pub const AMOTION_EVENT_TOOL_TYPE_UNKNOWN: _bindgen_ty_16 = 0; +pub const AMOTION_EVENT_TOOL_TYPE_FINGER: _bindgen_ty_16 = 1; +pub const AMOTION_EVENT_TOOL_TYPE_STYLUS: _bindgen_ty_16 = 2; +pub const AMOTION_EVENT_TOOL_TYPE_MOUSE: _bindgen_ty_16 = 3; +pub const AMOTION_EVENT_TOOL_TYPE_ERASER: _bindgen_ty_16 = 4; +pub const AMOTION_EVENT_TOOL_TYPE_PALM: _bindgen_ty_16 = 5; pub type _bindgen_ty_16 = ::std::os::raw::c_uint; -pub const AINPUT_SOURCE_CLASS_MASK: ::std::os::raw::c_uint = 255; -pub const AINPUT_SOURCE_CLASS_NONE: ::std::os::raw::c_uint = 0; -pub const AINPUT_SOURCE_CLASS_BUTTON: ::std::os::raw::c_uint = 1; -pub const AINPUT_SOURCE_CLASS_POINTER: ::std::os::raw::c_uint = 2; -pub const AINPUT_SOURCE_CLASS_NAVIGATION: ::std::os::raw::c_uint = 4; -pub const AINPUT_SOURCE_CLASS_POSITION: ::std::os::raw::c_uint = 8; -pub const AINPUT_SOURCE_CLASS_JOYSTICK: ::std::os::raw::c_uint = 16; +pub const AMotionClassification_AMOTION_EVENT_CLASSIFICATION_NONE: AMotionClassification = 0; +pub const AMotionClassification_AMOTION_EVENT_CLASSIFICATION_AMBIGUOUS_GESTURE: + AMotionClassification = 1; +pub const AMotionClassification_AMOTION_EVENT_CLASSIFICATION_DEEP_PRESS: AMotionClassification = 2; +pub type AMotionClassification = u32; +pub const AINPUT_SOURCE_CLASS_MASK: _bindgen_ty_17 = 255; +pub const AINPUT_SOURCE_CLASS_NONE: _bindgen_ty_17 = 0; +pub const AINPUT_SOURCE_CLASS_BUTTON: _bindgen_ty_17 = 1; +pub const AINPUT_SOURCE_CLASS_POINTER: _bindgen_ty_17 = 2; +pub const AINPUT_SOURCE_CLASS_NAVIGATION: _bindgen_ty_17 = 4; +pub const AINPUT_SOURCE_CLASS_POSITION: _bindgen_ty_17 = 8; +pub const AINPUT_SOURCE_CLASS_JOYSTICK: _bindgen_ty_17 = 16; pub type _bindgen_ty_17 = ::std::os::raw::c_uint; -pub const AINPUT_SOURCE_UNKNOWN: ::std::os::raw::c_uint = 0; -pub const AINPUT_SOURCE_KEYBOARD: ::std::os::raw::c_uint = 257; -pub const AINPUT_SOURCE_DPAD: ::std::os::raw::c_uint = 513; -pub const AINPUT_SOURCE_GAMEPAD: ::std::os::raw::c_uint = 1025; -pub const AINPUT_SOURCE_TOUCHSCREEN: ::std::os::raw::c_uint = 4098; -pub const AINPUT_SOURCE_MOUSE: ::std::os::raw::c_uint = 8194; -pub const AINPUT_SOURCE_STYLUS: ::std::os::raw::c_uint = 16386; -pub const AINPUT_SOURCE_BLUETOOTH_STYLUS: ::std::os::raw::c_uint = 49154; -pub const AINPUT_SOURCE_TRACKBALL: ::std::os::raw::c_uint = 65540; -pub const AINPUT_SOURCE_MOUSE_RELATIVE: ::std::os::raw::c_uint = 131076; -pub const AINPUT_SOURCE_TOUCHPAD: ::std::os::raw::c_uint = 1048584; -pub const AINPUT_SOURCE_TOUCH_NAVIGATION: ::std::os::raw::c_uint = 2097152; -pub const AINPUT_SOURCE_JOYSTICK: ::std::os::raw::c_uint = 16777232; -pub const AINPUT_SOURCE_ROTARY_ENCODER: ::std::os::raw::c_uint = 4194304; -pub const AINPUT_SOURCE_ANY: ::std::os::raw::c_uint = 4294967040; +pub const AINPUT_SOURCE_UNKNOWN: _bindgen_ty_18 = 0; +pub const AINPUT_SOURCE_KEYBOARD: _bindgen_ty_18 = 257; +pub const AINPUT_SOURCE_DPAD: _bindgen_ty_18 = 513; +pub const AINPUT_SOURCE_GAMEPAD: _bindgen_ty_18 = 1025; +pub const AINPUT_SOURCE_TOUCHSCREEN: _bindgen_ty_18 = 4098; +pub const AINPUT_SOURCE_MOUSE: _bindgen_ty_18 = 8194; +pub const AINPUT_SOURCE_STYLUS: _bindgen_ty_18 = 16386; +pub const AINPUT_SOURCE_BLUETOOTH_STYLUS: _bindgen_ty_18 = 49154; +pub const AINPUT_SOURCE_TRACKBALL: _bindgen_ty_18 = 65540; +pub const AINPUT_SOURCE_MOUSE_RELATIVE: _bindgen_ty_18 = 131076; +pub const AINPUT_SOURCE_TOUCHPAD: _bindgen_ty_18 = 1048584; +pub const AINPUT_SOURCE_TOUCH_NAVIGATION: _bindgen_ty_18 = 2097152; +pub const AINPUT_SOURCE_JOYSTICK: _bindgen_ty_18 = 16777232; +pub const AINPUT_SOURCE_HDMI: _bindgen_ty_18 = 33554433; +pub const AINPUT_SOURCE_SENSOR: _bindgen_ty_18 = 67108864; +pub const AINPUT_SOURCE_ROTARY_ENCODER: _bindgen_ty_18 = 4194304; +pub const AINPUT_SOURCE_ANY: _bindgen_ty_18 = 4294967040; pub type _bindgen_ty_18 = ::std::os::raw::c_uint; -pub const AINPUT_KEYBOARD_TYPE_NONE: ::std::os::raw::c_uint = 0; -pub const AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC: ::std::os::raw::c_uint = 1; -pub const AINPUT_KEYBOARD_TYPE_ALPHABETIC: ::std::os::raw::c_uint = 2; +pub const AINPUT_KEYBOARD_TYPE_NONE: _bindgen_ty_19 = 0; +pub const AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC: _bindgen_ty_19 = 1; +pub const AINPUT_KEYBOARD_TYPE_ALPHABETIC: _bindgen_ty_19 = 2; pub type _bindgen_ty_19 = ::std::os::raw::c_uint; -pub const AINPUT_MOTION_RANGE_X: ::std::os::raw::c_uint = 0; -pub const AINPUT_MOTION_RANGE_Y: ::std::os::raw::c_uint = 1; -pub const AINPUT_MOTION_RANGE_PRESSURE: ::std::os::raw::c_uint = 2; -pub const AINPUT_MOTION_RANGE_SIZE: ::std::os::raw::c_uint = 3; -pub const AINPUT_MOTION_RANGE_TOUCH_MAJOR: ::std::os::raw::c_uint = 4; -pub const AINPUT_MOTION_RANGE_TOUCH_MINOR: ::std::os::raw::c_uint = 5; -pub const AINPUT_MOTION_RANGE_TOOL_MAJOR: ::std::os::raw::c_uint = 6; -pub const AINPUT_MOTION_RANGE_TOOL_MINOR: ::std::os::raw::c_uint = 7; -pub const AINPUT_MOTION_RANGE_ORIENTATION: ::std::os::raw::c_uint = 8; +pub const AINPUT_MOTION_RANGE_X: _bindgen_ty_20 = 0; +pub const AINPUT_MOTION_RANGE_Y: _bindgen_ty_20 = 1; +pub const AINPUT_MOTION_RANGE_PRESSURE: _bindgen_ty_20 = 2; +pub const AINPUT_MOTION_RANGE_SIZE: _bindgen_ty_20 = 3; +pub const AINPUT_MOTION_RANGE_TOUCH_MAJOR: _bindgen_ty_20 = 4; +pub const AINPUT_MOTION_RANGE_TOUCH_MINOR: _bindgen_ty_20 = 5; +pub const AINPUT_MOTION_RANGE_TOOL_MAJOR: _bindgen_ty_20 = 6; +pub const AINPUT_MOTION_RANGE_TOOL_MINOR: _bindgen_ty_20 = 7; +pub const AINPUT_MOTION_RANGE_ORIENTATION: _bindgen_ty_20 = 8; pub type _bindgen_ty_20 = ::std::os::raw::c_uint; extern "C" { pub fn AInputEvent_getType(event: *const AInputEvent) -> i32; @@ -1377,6 +1592,9 @@ extern "C" { extern "C" { pub fn AInputEvent_getSource(event: *const AInputEvent) -> i32; } +extern "C" { + pub fn AInputEvent_release(event: *const AInputEvent); +} extern "C" { pub fn AKeyEvent_getAction(key_event: *const AInputEvent) -> i32; } @@ -1401,6 +1619,9 @@ extern "C" { extern "C" { pub fn AKeyEvent_getEventTime(key_event: *const AInputEvent) -> i64; } +extern "C" { + pub fn AKeyEvent_fromJava(env: *mut JNIEnv, keyEvent: jobject) -> *const AInputEvent; +} extern "C" { pub fn AMotionEvent_getAction(motion_event: *const AInputEvent) -> i32; } @@ -1435,168 +1656,169 @@ extern "C" { pub fn AMotionEvent_getYPrecision(motion_event: *const AInputEvent) -> f32; } extern "C" { - pub fn AMotionEvent_getPointerCount(motion_event: *const AInputEvent) -> size_t; + pub fn AMotionEvent_getPointerCount(motion_event: *const AInputEvent) -> usize; } extern "C" { - pub fn AMotionEvent_getPointerId( - motion_event: *const AInputEvent, - pointer_index: size_t, - ) -> i32; + pub fn AMotionEvent_getPointerId(motion_event: *const AInputEvent, pointer_index: usize) + -> i32; } extern "C" { - pub fn AMotionEvent_getToolType(motion_event: *const AInputEvent, pointer_index: size_t) - -> i32; + pub fn AMotionEvent_getToolType(motion_event: *const AInputEvent, pointer_index: usize) -> i32; } extern "C" { - pub fn AMotionEvent_getRawX(motion_event: *const AInputEvent, pointer_index: size_t) -> f32; + pub fn AMotionEvent_getRawX(motion_event: *const AInputEvent, pointer_index: usize) -> f32; } extern "C" { - pub fn AMotionEvent_getRawY(motion_event: *const AInputEvent, pointer_index: size_t) -> f32; + pub fn AMotionEvent_getRawY(motion_event: *const AInputEvent, pointer_index: usize) -> f32; } extern "C" { - pub fn AMotionEvent_getX(motion_event: *const AInputEvent, pointer_index: size_t) -> f32; + pub fn AMotionEvent_getX(motion_event: *const AInputEvent, pointer_index: usize) -> f32; } extern "C" { - pub fn AMotionEvent_getY(motion_event: *const AInputEvent, pointer_index: size_t) -> f32; + pub fn AMotionEvent_getY(motion_event: *const AInputEvent, pointer_index: usize) -> f32; } extern "C" { - pub fn AMotionEvent_getPressure(motion_event: *const AInputEvent, pointer_index: size_t) - -> f32; + pub fn AMotionEvent_getPressure(motion_event: *const AInputEvent, pointer_index: usize) -> f32; } extern "C" { - pub fn AMotionEvent_getSize(motion_event: *const AInputEvent, pointer_index: size_t) -> f32; + pub fn AMotionEvent_getSize(motion_event: *const AInputEvent, pointer_index: usize) -> f32; } extern "C" { pub fn AMotionEvent_getTouchMajor( motion_event: *const AInputEvent, - pointer_index: size_t, + pointer_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getTouchMinor( motion_event: *const AInputEvent, - pointer_index: size_t, + pointer_index: usize, ) -> f32; } extern "C" { - pub fn AMotionEvent_getToolMajor( - motion_event: *const AInputEvent, - pointer_index: size_t, - ) -> f32; + pub fn AMotionEvent_getToolMajor(motion_event: *const AInputEvent, pointer_index: usize) + -> f32; } extern "C" { - pub fn AMotionEvent_getToolMinor( - motion_event: *const AInputEvent, - pointer_index: size_t, - ) -> f32; + pub fn AMotionEvent_getToolMinor(motion_event: *const AInputEvent, pointer_index: usize) + -> f32; } extern "C" { pub fn AMotionEvent_getOrientation( motion_event: *const AInputEvent, - pointer_index: size_t, + pointer_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getAxisValue( motion_event: *const AInputEvent, axis: i32, - pointer_index: size_t, + pointer_index: usize, ) -> f32; } extern "C" { - pub fn AMotionEvent_getHistorySize(motion_event: *const AInputEvent) -> size_t; + pub fn AMotionEvent_getHistorySize(motion_event: *const AInputEvent) -> usize; } extern "C" { pub fn AMotionEvent_getHistoricalEventTime( motion_event: *const AInputEvent, - history_index: size_t, + history_index: usize, ) -> i64; } extern "C" { pub fn AMotionEvent_getHistoricalRawX( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalRawY( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalX( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalY( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalPressure( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalSize( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalTouchMajor( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalTouchMinor( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalToolMajor( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalToolMinor( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalOrientation( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalAxisValue( motion_event: *const AInputEvent, axis: i32, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } +extern "C" { + pub fn AMotionEvent_getActionButton(motion_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AMotionEvent_getClassification(motion_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AMotionEvent_fromJava(env: *mut JNIEnv, motionEvent: jobject) -> *const AInputEvent; +} #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct AInputQueue { @@ -1630,6 +1852,9 @@ extern "C" { handled: ::std::os::raw::c_int, ); } +extern "C" { + pub fn AInputQueue_fromJava(env: *mut JNIEnv, inputQueue: jobject) -> *mut AInputQueue; +} #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct imaxdiv_t { @@ -1638,35 +1863,27 @@ pub struct imaxdiv_t { } #[test] fn bindgen_test_layout_imaxdiv_t() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 16usize, - concat!("Size of: ", stringify!(imaxdiv_t)) + "Size of imaxdiv_t" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(imaxdiv_t)) + "Alignment of imaxdiv_t" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).quot as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).quot) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(imaxdiv_t), - "::", - stringify!(quot) - ) + "Offset of field: imaxdiv_t::quot" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rem as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rem) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(imaxdiv_t), - "::", - stringify!(rem) - ) + "Offset of field: imaxdiv_t::rem" ); } extern "C" { @@ -1704,11 +1921,52 @@ extern "C" { ) -> uintmax_t; } pub const ADataSpace_ADATASPACE_UNKNOWN: ADataSpace = 0; +pub const ADataSpace_STANDARD_MASK: ADataSpace = 4128768; +pub const ADataSpace_STANDARD_UNSPECIFIED: ADataSpace = 0; +pub const ADataSpace_STANDARD_BT709: ADataSpace = 65536; +pub const ADataSpace_STANDARD_BT601_625: ADataSpace = 131072; +pub const ADataSpace_STANDARD_BT601_625_UNADJUSTED: ADataSpace = 196608; +pub const ADataSpace_STANDARD_BT601_525: ADataSpace = 262144; +pub const ADataSpace_STANDARD_BT601_525_UNADJUSTED: ADataSpace = 327680; +pub const ADataSpace_STANDARD_BT2020: ADataSpace = 393216; +pub const ADataSpace_STANDARD_BT2020_CONSTANT_LUMINANCE: ADataSpace = 458752; +pub const ADataSpace_STANDARD_BT470M: ADataSpace = 524288; +pub const ADataSpace_STANDARD_FILM: ADataSpace = 589824; +pub const ADataSpace_STANDARD_DCI_P3: ADataSpace = 655360; +pub const ADataSpace_STANDARD_ADOBE_RGB: ADataSpace = 720896; +pub const ADataSpace_TRANSFER_MASK: ADataSpace = 130023424; +pub const ADataSpace_TRANSFER_UNSPECIFIED: ADataSpace = 0; +pub const ADataSpace_TRANSFER_LINEAR: ADataSpace = 4194304; +pub const ADataSpace_TRANSFER_SRGB: ADataSpace = 8388608; +pub const ADataSpace_TRANSFER_SMPTE_170M: ADataSpace = 12582912; +pub const ADataSpace_TRANSFER_GAMMA2_2: ADataSpace = 16777216; +pub const ADataSpace_TRANSFER_GAMMA2_6: ADataSpace = 20971520; +pub const ADataSpace_TRANSFER_GAMMA2_8: ADataSpace = 25165824; +pub const ADataSpace_TRANSFER_ST2084: ADataSpace = 29360128; +pub const ADataSpace_TRANSFER_HLG: ADataSpace = 33554432; +pub const ADataSpace_RANGE_MASK: ADataSpace = 939524096; +pub const ADataSpace_RANGE_UNSPECIFIED: ADataSpace = 0; +pub const ADataSpace_RANGE_FULL: ADataSpace = 134217728; +pub const ADataSpace_RANGE_LIMITED: ADataSpace = 268435456; +pub const ADataSpace_RANGE_EXTENDED: ADataSpace = 402653184; pub const ADataSpace_ADATASPACE_SCRGB_LINEAR: ADataSpace = 406913024; pub const ADataSpace_ADATASPACE_SRGB: ADataSpace = 142671872; pub const ADataSpace_ADATASPACE_SCRGB: ADataSpace = 411107328; pub const ADataSpace_ADATASPACE_DISPLAY_P3: ADataSpace = 143261696; pub const ADataSpace_ADATASPACE_BT2020_PQ: ADataSpace = 163971072; +pub const ADataSpace_ADATASPACE_BT2020_ITU_PQ: ADataSpace = 298188800; +pub const ADataSpace_ADATASPACE_ADOBE_RGB: ADataSpace = 151715840; +pub const ADataSpace_ADATASPACE_JFIF: ADataSpace = 146931712; +pub const ADataSpace_ADATASPACE_BT601_625: ADataSpace = 281149440; +pub const ADataSpace_ADATASPACE_BT601_525: ADataSpace = 281280512; +pub const ADataSpace_ADATASPACE_BT2020: ADataSpace = 147193856; +pub const ADataSpace_ADATASPACE_BT709: ADataSpace = 281083904; +pub const ADataSpace_ADATASPACE_DCI_P3: ADataSpace = 155844608; +pub const ADataSpace_ADATASPACE_SRGB_LINEAR: ADataSpace = 138477568; +pub const ADataSpace_ADATASPACE_BT2020_HLG: ADataSpace = 168165376; +pub const ADataSpace_ADATASPACE_BT2020_ITU_HLG: ADataSpace = 302383104; +pub const ADataSpace_DEPTH: ADataSpace = 4096; +pub const ADataSpace_DYNAMIC_DEPTH: ADataSpace = 4098; pub type ADataSpace = ::std::os::raw::c_uint; pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM: AHardwareBuffer_Format = 1; pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM: AHardwareBuffer_Format = 2; @@ -1728,6 +1986,12 @@ pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_D32_FLOAT_S8_UINT: AHard 52; pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_S8_UINT: AHardwareBuffer_Format = 53; pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_Y8Cb8Cr8_420: AHardwareBuffer_Format = 35; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_YCbCr_P010: AHardwareBuffer_Format = 54; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8_UNORM: AHardwareBuffer_Format = 56; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R16_UINT: AHardwareBuffer_Format = 57; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R16G16_UINT: AHardwareBuffer_Format = 58; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R10G10B10A10_UNORM: AHardwareBuffer_Format = + 59; pub type AHardwareBuffer_Format = ::std::os::raw::c_uint; pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_READ_NEVER: AHardwareBuffer_UsageFlags = 0; @@ -1765,6 +2029,8 @@ pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_GPU_CUBE_MAP: AHardwareBuffer_UsageFlags = 33554432; pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_GPU_MIPMAP_COMPLETE: AHardwareBuffer_UsageFlags = 67108864; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_FRONT_BUFFER: + AHardwareBuffer_UsageFlags = 4294967296; pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_0: AHardwareBuffer_UsageFlags = 268435456; pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_1: AHardwareBuffer_UsageFlags = @@ -1820,95 +2086,57 @@ pub struct AHardwareBuffer_Desc { } #[test] fn bindgen_test_layout_AHardwareBuffer_Desc() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 40usize, - concat!("Size of: ", stringify!(AHardwareBuffer_Desc)) + "Size of AHardwareBuffer_Desc" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(AHardwareBuffer_Desc)) + "Alignment of AHardwareBuffer_Desc" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).width as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).width) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Desc), - "::", - stringify!(width) - ) + "Offset of field: AHardwareBuffer_Desc::width" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).height as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).height) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Desc), - "::", - stringify!(height) - ) + "Offset of field: AHardwareBuffer_Desc::height" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).layers as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).layers) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Desc), - "::", - stringify!(layers) - ) + "Offset of field: AHardwareBuffer_Desc::layers" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).format as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).format) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Desc), - "::", - stringify!(format) - ) + "Offset of field: AHardwareBuffer_Desc::format" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).usage as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).usage) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Desc), - "::", - stringify!(usage) - ) + "Offset of field: AHardwareBuffer_Desc::usage" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).stride as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).stride) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Desc), - "::", - stringify!(stride) - ) + "Offset of field: AHardwareBuffer_Desc::stride" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rfu0 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rfu0) as usize - ptr as usize }, 28usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Desc), - "::", - stringify!(rfu0) - ) + "Offset of field: AHardwareBuffer_Desc::rfu0" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rfu1 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rfu1) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Desc), - "::", - stringify!(rfu1) - ) + "Offset of field: AHardwareBuffer_Desc::rfu1" ); } #[repr(C)] @@ -1920,47 +2148,33 @@ pub struct AHardwareBuffer_Plane { } #[test] fn bindgen_test_layout_AHardwareBuffer_Plane() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 16usize, - concat!("Size of: ", stringify!(AHardwareBuffer_Plane)) + "Size of AHardwareBuffer_Plane" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(AHardwareBuffer_Plane)) + "Alignment of AHardwareBuffer_Plane" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Plane), - "::", - stringify!(data) - ) + "Offset of field: AHardwareBuffer_Plane::data" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).pixelStride as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).pixelStride) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Plane), - "::", - stringify!(pixelStride) - ) + "Offset of field: AHardwareBuffer_Plane::pixelStride" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rowStride as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rowStride) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Plane), - "::", - stringify!(rowStride) - ) + "Offset of field: AHardwareBuffer_Plane::rowStride" ); } #[repr(C)] @@ -1971,37 +2185,28 @@ pub struct AHardwareBuffer_Planes { } #[test] fn bindgen_test_layout_AHardwareBuffer_Planes() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 72usize, - concat!("Size of: ", stringify!(AHardwareBuffer_Planes)) + "Size of AHardwareBuffer_Planes" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(AHardwareBuffer_Planes)) + "Alignment of AHardwareBuffer_Planes" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).planeCount as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).planeCount) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Planes), - "::", - stringify!(planeCount) - ) + "Offset of field: AHardwareBuffer_Planes::planeCount" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).planes as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).planes) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Planes), - "::", - stringify!(planes) - ) + "Offset of field: AHardwareBuffer_Planes::planes" ); } #[repr(C)] @@ -2036,15 +2241,6 @@ extern "C" { outVirtualAddress: *mut *mut ::std::os::raw::c_void, ) -> ::std::os::raw::c_int; } -extern "C" { - pub fn AHardwareBuffer_lockPlanes( - buffer: *mut AHardwareBuffer, - usage: u64, - fence: i32, - rect: *const ARect, - outPlanes: *mut AHardwareBuffer_Planes, - ) -> ::std::os::raw::c_int; -} extern "C" { pub fn AHardwareBuffer_unlock( buffer: *mut AHardwareBuffer, @@ -2063,6 +2259,15 @@ extern "C" { outBuffer: *mut *mut AHardwareBuffer, ) -> ::std::os::raw::c_int; } +extern "C" { + pub fn AHardwareBuffer_lockPlanes( + buffer: *mut AHardwareBuffer, + usage: u64, + fence: i32, + rect: *const ARect, + outPlanes: *mut AHardwareBuffer_Planes, + ) -> ::std::os::raw::c_int; +} extern "C" { pub fn AHardwareBuffer_isSupported(desc: *const AHardwareBuffer_Desc) -> ::std::os::raw::c_int; } @@ -2077,230 +2282,353 @@ extern "C" { outBytesPerStride: *mut i32, ) -> ::std::os::raw::c_int; } -pub type va_list = [u64; 4usize]; -pub type __gnuc_va_list = [u64; 4usize]; +extern "C" { + pub fn AHardwareBuffer_getId( + buffer: *const AHardwareBuffer, + outId: *mut u64, + ) -> ::std::os::raw::c_int; +} +#[doc = " \\brief Describe information about a pointer, found in a\n GameActivityMotionEvent.\n\n You can read values directly from this structure, or use helper functions\n (`GameActivityPointerAxes_getX`, `GameActivityPointerAxes_getY` and\n `GameActivityPointerAxes_getAxisValue`).\n\n The X axis and Y axis are enabled by default but any other axis that you want\n to read **must** be enabled first, using\n `GameActivityPointerAxes_enableAxis`.\n\n \\see GameActivityMotionEvent"] #[repr(C)] -pub struct JavaVMAttachArgs { - pub version: jint, - pub name: *const ::std::os::raw::c_char, - pub group: jobject, +#[derive(Debug, Copy, Clone)] +pub struct GameActivityPointerAxes { + pub id: i32, + pub toolType: i32, + pub axisValues: [f32; 48usize], + pub rawX: f32, + pub rawY: f32, } #[test] -fn bindgen_test_layout_JavaVMAttachArgs() { +fn bindgen_test_layout_GameActivityPointerAxes() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - ::std::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(JavaVMAttachArgs)) + ::std::mem::size_of::(), + 208usize, + "Size of GameActivityPointerAxes" ); assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(JavaVMAttachArgs)) + ::std::mem::align_of::(), + 4usize, + "Alignment of GameActivityPointerAxes" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).version as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).id) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(JavaVMAttachArgs), - "::", - stringify!(version) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).name as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(JavaVMAttachArgs), - "::", - stringify!(name) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).group as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(JavaVMAttachArgs), - "::", - stringify!(group) - ) + "Offset of field: GameActivityPointerAxes::id" ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct JavaVMOption { - pub optionString: *const ::std::os::raw::c_char, - pub extraInfo: *mut ::std::os::raw::c_void, -} -#[test] -fn bindgen_test_layout_JavaVMOption() { assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(JavaVMOption)) + unsafe { ::std::ptr::addr_of!((*ptr).toolType) as usize - ptr as usize }, + 4usize, + "Offset of field: GameActivityPointerAxes::toolType" ); assert_eq!( - ::std::mem::align_of::(), + unsafe { ::std::ptr::addr_of!((*ptr).axisValues) as usize - ptr as usize }, 8usize, - concat!("Alignment of ", stringify!(JavaVMOption)) + "Offset of field: GameActivityPointerAxes::axisValues" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).optionString as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(JavaVMOption), - "::", - stringify!(optionString) - ) + unsafe { ::std::ptr::addr_of!((*ptr).rawX) as usize - ptr as usize }, + 200usize, + "Offset of field: GameActivityPointerAxes::rawX" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).extraInfo as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(JavaVMOption), - "::", - stringify!(extraInfo) - ) + unsafe { ::std::ptr::addr_of!((*ptr).rawY) as usize - ptr as usize }, + 204usize, + "Offset of field: GameActivityPointerAxes::rawY" ); } +extern "C" { + #[doc = " \\brief Enable the specified axis, so that its value is reported in the\n GameActivityPointerAxes structures stored in a motion event.\n\n You must enable any axis that you want to read, apart from\n `AMOTION_EVENT_AXIS_X` and `AMOTION_EVENT_AXIS_Y` that are enabled by\n default.\n\n If the axis index is out of range, nothing is done."] + pub fn GameActivityPointerAxes_enableAxis(axis: i32); +} +extern "C" { + #[doc = " \\brief Disable the specified axis. Its value won't be reported in the\n GameActivityPointerAxes structures stored in a motion event anymore.\n\n Apart from X and Y, any axis that you want to read **must** be enabled first,\n using `GameActivityPointerAxes_enableAxis`.\n\n If the axis index is out of range, nothing is done."] + pub fn GameActivityPointerAxes_disableAxis(axis: i32); +} +extern "C" { + #[doc = " \\brief Get the value of the requested axis.\n\n Apart from X and Y, any axis that you want to read **must** be enabled first,\n using `GameActivityPointerAxes_enableAxis`.\n\n Find the valid enums for the axis (`AMOTION_EVENT_AXIS_X`,\n `AMOTION_EVENT_AXIS_Y`, `AMOTION_EVENT_AXIS_PRESSURE`...)\n in https://developer.android.com/ndk/reference/group/input.\n\n @param pointerInfo The structure containing information about the pointer,\n obtained from GameActivityMotionEvent.\n @param axis The axis to get the value from\n @return The value of the axis, or 0 if the axis is invalid or was not\n enabled."] + pub fn GameActivityPointerAxes_getAxisValue( + pointerInfo: *const GameActivityPointerAxes, + axis: i32, + ) -> f32; +} +#[doc = " \\brief Describe a motion event that happened on the GameActivity SurfaceView.\n\n This is 1:1 mapping to the information contained in a Java `MotionEvent`\n (see https://developer.android.com/reference/android/view/MotionEvent)."] #[repr(C)] -pub struct JavaVMInitArgs { - pub version: jint, - pub nOptions: jint, - pub options: *mut JavaVMOption, - pub ignoreUnrecognized: jboolean, +#[derive(Debug, Copy, Clone)] +pub struct GameActivityMotionEvent { + pub deviceId: i32, + pub source: i32, + pub action: i32, + pub eventTime: i64, + pub downTime: i64, + pub flags: i32, + pub metaState: i32, + pub actionButton: i32, + pub buttonState: i32, + pub classification: i32, + pub edgeFlags: i32, + pub pointerCount: u32, + pub pointers: [GameActivityPointerAxes; 8usize], + pub historySize: ::std::os::raw::c_int, + pub historicalEventTimesMillis: *mut i64, + pub historicalEventTimesNanos: *mut i64, + pub historicalAxisValues: *mut f32, + pub precisionX: f32, + pub precisionY: f32, } #[test] -fn bindgen_test_layout_JavaVMInitArgs() { +fn bindgen_test_layout_GameActivityMotionEvent() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - ::std::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(JavaVMInitArgs)) + ::std::mem::size_of::(), + 1760usize, + "Size of GameActivityMotionEvent" ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(JavaVMInitArgs)) + "Alignment of GameActivityMotionEvent" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).version as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).deviceId) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(JavaVMInitArgs), - "::", - stringify!(version) - ) + "Offset of field: GameActivityMotionEvent::deviceId" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).nOptions as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).source) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(JavaVMInitArgs), - "::", - stringify!(nOptions) - ) + "Offset of field: GameActivityMotionEvent::source" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).options as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).action) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(JavaVMInitArgs), - "::", - stringify!(options) - ) + "Offset of field: GameActivityMotionEvent::action" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).ignoreUnrecognized as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).eventTime) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(JavaVMInitArgs), - "::", - stringify!(ignoreUnrecognized) - ) + "Offset of field: GameActivityMotionEvent::eventTime" ); -} -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_CAPTION_BAR: GameCommonInsetsType = 0; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_DISPLAY_CUTOUT: GameCommonInsetsType = 1; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_IME: GameCommonInsetsType = 2; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_MANDATORY_SYSTEM_GESTURES: - GameCommonInsetsType = 3; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_NAVIGATION_BARS: GameCommonInsetsType = 4; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_STATUS_BARS: GameCommonInsetsType = 5; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_SYSTEM_BARS: GameCommonInsetsType = 6; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_SYSTEM_GESTURES: GameCommonInsetsType = 7; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_TAPABLE_ELEMENT: GameCommonInsetsType = 8; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_WATERFALL: GameCommonInsetsType = 9; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_COUNT: GameCommonInsetsType = 10; -#[doc = " The type of a component for which to retrieve insets. See"] -#[doc = " https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat.Type"] -pub type GameCommonInsetsType = ::std::os::raw::c_uint; -#[doc = " This struct holds a span within a region of text from start (inclusive) to"] -#[doc = " end (exclusive). An empty span or cursor position is specified with"] -#[doc = " start==end. An undefined span is specified with start = end = SPAN_UNDEFINED."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct GameTextInputSpan { - #[doc = " The start of the region (inclusive)."] - pub start: i32, - #[doc = " The end of the region (exclusive)."] - pub end: i32, -} -#[test] -fn bindgen_test_layout_GameTextInputSpan() { assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(GameTextInputSpan)) + unsafe { ::std::ptr::addr_of!((*ptr).downTime) as usize - ptr as usize }, + 24usize, + "Offset of field: GameActivityMotionEvent::downTime" ); assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(GameTextInputSpan)) + unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, + 32usize, + "Offset of field: GameActivityMotionEvent::flags" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).start as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(GameTextInputSpan), - "::", - stringify!(start) - ) + unsafe { ::std::ptr::addr_of!((*ptr).metaState) as usize - ptr as usize }, + 36usize, + "Offset of field: GameActivityMotionEvent::metaState" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).end as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(GameTextInputSpan), - "::", - stringify!(end) - ) + unsafe { ::std::ptr::addr_of!((*ptr).actionButton) as usize - ptr as usize }, + 40usize, + "Offset of field: GameActivityMotionEvent::actionButton" ); -} -pub const GameTextInputSpanFlag_SPAN_UNDEFINED: GameTextInputSpanFlag = -1; -#[doc = " Values with special meaning in a GameTextInputSpan."] -pub type GameTextInputSpanFlag = ::std::os::raw::c_int; -#[doc = " This struct holds the state of an editable section of text."] -#[doc = " The text can have a selection and a composing region defined on it."] -#[doc = " A composing region is used by IMEs that allow input using multiple steps to"] -#[doc = " compose a glyph or word. Use functions GameTextInput_getState and"] -#[doc = " GameTextInput_setState to read and modify the state that an IME is editing."] + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).buttonState) as usize - ptr as usize }, + 44usize, + "Offset of field: GameActivityMotionEvent::buttonState" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).classification) as usize - ptr as usize }, + 48usize, + "Offset of field: GameActivityMotionEvent::classification" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).edgeFlags) as usize - ptr as usize }, + 52usize, + "Offset of field: GameActivityMotionEvent::edgeFlags" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pointerCount) as usize - ptr as usize }, + 56usize, + "Offset of field: GameActivityMotionEvent::pointerCount" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pointers) as usize - ptr as usize }, + 60usize, + "Offset of field: GameActivityMotionEvent::pointers" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).historySize) as usize - ptr as usize }, + 1724usize, + "Offset of field: GameActivityMotionEvent::historySize" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).historicalEventTimesMillis) as usize - ptr as usize }, + 1728usize, + "Offset of field: GameActivityMotionEvent::historicalEventTimesMillis" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).historicalEventTimesNanos) as usize - ptr as usize }, + 1736usize, + "Offset of field: GameActivityMotionEvent::historicalEventTimesNanos" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).historicalAxisValues) as usize - ptr as usize }, + 1744usize, + "Offset of field: GameActivityMotionEvent::historicalAxisValues" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).precisionX) as usize - ptr as usize }, + 1752usize, + "Offset of field: GameActivityMotionEvent::precisionX" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).precisionY) as usize - ptr as usize }, + 1756usize, + "Offset of field: GameActivityMotionEvent::precisionY" + ); +} +extern "C" { + pub fn GameActivityMotionEvent_getHistoricalAxisValue( + event: *const GameActivityMotionEvent, + axis: ::std::os::raw::c_int, + pointerIndex: ::std::os::raw::c_int, + historyPos: ::std::os::raw::c_int, + ) -> f32; +} +extern "C" { + #[doc = " \\brief Handle the freeing of the GameActivityMotionEvent struct."] + pub fn GameActivityMotionEvent_destroy(c_event: *mut GameActivityMotionEvent); +} +#[doc = " \\brief Describe a key event that happened on the GameActivity SurfaceView.\n\n This is 1:1 mapping to the information contained in a Java `KeyEvent`\n (see https://developer.android.com/reference/android/view/KeyEvent).\n The only exception is the event times, which are reported as\n nanoseconds in this struct."] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct GameActivityKeyEvent { + pub deviceId: i32, + pub source: i32, + pub action: i32, + pub eventTime: i64, + pub downTime: i64, + pub flags: i32, + pub metaState: i32, + pub modifiers: i32, + pub repeatCount: i32, + pub keyCode: i32, + pub scanCode: i32, +} +#[test] +fn bindgen_test_layout_GameActivityKeyEvent() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 56usize, + "Size of GameActivityKeyEvent" + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + "Alignment of GameActivityKeyEvent" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).deviceId) as usize - ptr as usize }, + 0usize, + "Offset of field: GameActivityKeyEvent::deviceId" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).source) as usize - ptr as usize }, + 4usize, + "Offset of field: GameActivityKeyEvent::source" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).action) as usize - ptr as usize }, + 8usize, + "Offset of field: GameActivityKeyEvent::action" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).eventTime) as usize - ptr as usize }, + 16usize, + "Offset of field: GameActivityKeyEvent::eventTime" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).downTime) as usize - ptr as usize }, + 24usize, + "Offset of field: GameActivityKeyEvent::downTime" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, + 32usize, + "Offset of field: GameActivityKeyEvent::flags" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).metaState) as usize - ptr as usize }, + 36usize, + "Offset of field: GameActivityKeyEvent::metaState" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).modifiers) as usize - ptr as usize }, + 40usize, + "Offset of field: GameActivityKeyEvent::modifiers" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).repeatCount) as usize - ptr as usize }, + 44usize, + "Offset of field: GameActivityKeyEvent::repeatCount" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).keyCode) as usize - ptr as usize }, + 48usize, + "Offset of field: GameActivityKeyEvent::keyCode" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).scanCode) as usize - ptr as usize }, + 52usize, + "Offset of field: GameActivityKeyEvent::scanCode" + ); +} +#[doc = " This struct holds a span within a region of text from start (inclusive) to\n end (exclusive). An empty span or cursor position is specified with\n start==end. An undefined span is specified with start = end = SPAN_UNDEFINED."] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct GameTextInputSpan { + #[doc = " The start of the region (inclusive)."] + pub start: i32, + #[doc = " The end of the region (exclusive)."] + pub end: i32, +} +#[test] +fn bindgen_test_layout_GameTextInputSpan() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 8usize, + "Size of GameTextInputSpan" + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + "Alignment of GameTextInputSpan" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).start) as usize - ptr as usize }, + 0usize, + "Offset of field: GameTextInputSpan::start" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).end) as usize - ptr as usize }, + 4usize, + "Offset of field: GameTextInputSpan::end" + ); +} +pub const GameTextInputSpanFlag_SPAN_UNDEFINED: GameTextInputSpanFlag = -1; +#[doc = " Values with special meaning in a GameTextInputSpan."] +pub type GameTextInputSpanFlag = i32; +#[doc = " This struct holds the state of an editable section of text.\n The text can have a selection and a composing region defined on it.\n A composing region is used by IMEs that allow input using multiple steps to\n compose a glyph or word. Use functions GameTextInput_getState and\n GameTextInput_setState to read and modify the state that an IME is editing."] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct GameTextInputState { - #[doc = " Text owned by the state, as a modified UTF-8 string. Null-terminated."] - #[doc = " https://en.wikipedia.org/wiki/UTF-8#Modified_UTF-8"] + #[doc = " Text owned by the state, as a modified UTF-8 string. Null-terminated.\n https://en.wikipedia.org/wiki/UTF-8#Modified_UTF-8"] pub text_UTF8: *const ::std::os::raw::c_char, #[doc = " Length in bytes of text_UTF8, *not* including the null at end."] pub text_length: i32, @@ -2311,63 +2639,40 @@ pub struct GameTextInputState { } #[test] fn bindgen_test_layout_GameTextInputState() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 32usize, - concat!("Size of: ", stringify!(GameTextInputState)) + "Size of GameTextInputState" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(GameTextInputState)) + "Alignment of GameTextInputState" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).text_UTF8 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).text_UTF8) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(GameTextInputState), - "::", - stringify!(text_UTF8) - ) + "Offset of field: GameTextInputState::text_UTF8" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).text_length as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).text_length) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(GameTextInputState), - "::", - stringify!(text_length) - ) + "Offset of field: GameTextInputState::text_length" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).selection as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).selection) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(GameTextInputState), - "::", - stringify!(selection) - ) + "Offset of field: GameTextInputState::selection" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).composingRegion as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).composingRegion) as usize - ptr as usize }, 20usize, - concat!( - "Offset of field: ", - stringify!(GameTextInputState), - "::", - stringify!(composingRegion) - ) - ); -} -#[doc = " A callback called by GameTextInput_getState."] -#[doc = " @param context User-defined context."] -#[doc = " @param state State, owned by the library, that will be valid for the duration"] -#[doc = " of the callback."] + "Offset of field: GameTextInputState::composingRegion" + ); +} +#[doc = " A callback called by GameTextInput_getState.\n @param context User-defined context.\n @param state State, owned by the library, that will be valid for the duration\n of the callback."] pub type GameTextInputGetStateCallback = ::std::option::Option< unsafe extern "C" fn(context: *mut ::std::os::raw::c_void, state: *const GameTextInputState), >; @@ -2377,74 +2682,45 @@ pub struct GameTextInput { _unused: [u8; 0], } extern "C" { - #[doc = " Initialize the GameTextInput library."] - #[doc = " If called twice without GameTextInput_destroy being called, the same pointer"] - #[doc = " will be returned and a warning will be issued."] - #[doc = " @param env A JNI env valid on the calling thread."] - #[doc = " @param max_string_size The maximum length of a string that can be edited. If"] - #[doc = " zero, the maximum defaults to 65536 bytes. A buffer of this size is allocated"] - #[doc = " at initialization."] - #[doc = " @return A handle to the library."] + #[doc = " Initialize the GameTextInput library.\n If called twice without GameTextInput_destroy being called, the same pointer\n will be returned and a warning will be issued.\n @param env A JNI env valid on the calling thread.\n @param max_string_size The maximum length of a string that can be edited. If\n zero, the maximum defaults to 65536 bytes. A buffer of this size is allocated\n at initialization.\n @return A handle to the library."] pub fn GameTextInput_init(env: *mut JNIEnv, max_string_size: u32) -> *mut GameTextInput; } extern "C" { - #[doc = " When using GameTextInput, you need to create a gametextinput.InputConnection"] - #[doc = " on the Java side and pass it using this function to the library, unless using"] - #[doc = " GameActivity in which case this will be done for you. See the GameActivity"] - #[doc = " source code or GameTextInput samples for examples of usage."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param inputConnection A gametextinput.InputConnection object."] + #[doc = " When using GameTextInput, you need to create a gametextinput.InputConnection\n on the Java side and pass it using this function to the library, unless using\n GameActivity in which case this will be done for you. See the GameActivity\n source code or GameTextInput samples for examples of usage.\n @param input A valid GameTextInput library handle.\n @param inputConnection A gametextinput.InputConnection object."] pub fn GameTextInput_setInputConnection(input: *mut GameTextInput, inputConnection: jobject); } extern "C" { - #[doc = " Unless using GameActivity, it is required to call this function from your"] - #[doc = " Java gametextinput.Listener.stateChanged method to convert eventState and"] - #[doc = " trigger any event callbacks. When using GameActivity, this does not need to"] - #[doc = " be called as event processing is handled by the Activity."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param eventState A Java gametextinput.State object."] + #[doc = " Unless using GameActivity, it is required to call this function from your\n Java gametextinput.Listener.stateChanged method to convert eventState and\n trigger any event callbacks. When using GameActivity, this does not need to\n be called as event processing is handled by the Activity.\n @param input A valid GameTextInput library handle.\n @param eventState A Java gametextinput.State object."] pub fn GameTextInput_processEvent(input: *mut GameTextInput, eventState: jobject); } extern "C" { - #[doc = " Free any resources owned by the GameTextInput library."] - #[doc = " Any subsequent calls to the library will fail until GameTextInput_init is"] - #[doc = " called again."] - #[doc = " @param input A valid GameTextInput library handle."] + #[doc = " Free any resources owned by the GameTextInput library.\n Any subsequent calls to the library will fail until GameTextInput_init is\n called again.\n @param input A valid GameTextInput library handle."] pub fn GameTextInput_destroy(input: *mut GameTextInput); } pub const ShowImeFlags_SHOW_IME_UNDEFINED: ShowImeFlags = 0; pub const ShowImeFlags_SHOW_IMPLICIT: ShowImeFlags = 1; pub const ShowImeFlags_SHOW_FORCED: ShowImeFlags = 2; #[doc = " Flags to be passed to GameTextInput_showIme."] -pub type ShowImeFlags = ::std::os::raw::c_uint; +pub type ShowImeFlags = u32; extern "C" { - #[doc = " Show the IME. Calls InputMethodManager.showSoftInput()."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param flags Defined in ShowImeFlags above. For more information see:"] - #[doc = " https://developer.android.com/reference/android/view/inputmethod/InputMethodManager"] + #[doc = " Show the IME. Calls InputMethodManager.showSoftInput().\n @param input A valid GameTextInput library handle.\n @param flags Defined in ShowImeFlags above. For more information see:\n https://developer.android.com/reference/android/view/inputmethod/InputMethodManager"] pub fn GameTextInput_showIme(input: *mut GameTextInput, flags: u32); } pub const HideImeFlags_HIDE_IME_UNDEFINED: HideImeFlags = 0; pub const HideImeFlags_HIDE_IMPLICIT_ONLY: HideImeFlags = 1; pub const HideImeFlags_HIDE_NOT_ALWAYS: HideImeFlags = 2; #[doc = " Flags to be passed to GameTextInput_hideIme."] -pub type HideImeFlags = ::std::os::raw::c_uint; +pub type HideImeFlags = u32; extern "C" { - #[doc = " Show the IME. Calls InputMethodManager.hideSoftInputFromWindow()."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param flags Defined in HideImeFlags above. For more information see:"] - #[doc = " https://developer.android.com/reference/android/view/inputmethod/InputMethodManager"] + #[doc = " Hide the IME. Calls InputMethodManager.hideSoftInputFromWindow().\n @param input A valid GameTextInput library handle.\n @param flags Defined in HideImeFlags above. For more information see:\n https://developer.android.com/reference/android/view/inputmethod/InputMethodManager"] pub fn GameTextInput_hideIme(input: *mut GameTextInput, flags: u32); } extern "C" { - #[doc = " Call a callback with the current GameTextInput state, which may have been"] - #[doc = " modified by changes in the IME and calls to GameTextInput_setState. We use a"] - #[doc = " callback rather than returning the state in order to simplify ownership of"] - #[doc = " text_UTF8 strings. These strings are only valid during the calling of the"] - #[doc = " callback."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param callback A function that will be called with valid state."] - #[doc = " @param context Context used by the callback."] + #[doc = " Restarts the input method. Calls InputMethodManager.restartInput().\n @param input A valid GameTextInput library handle."] + pub fn GameTextInput_restartInput(input: *mut GameTextInput); +} +extern "C" { + #[doc = " Call a callback with the current GameTextInput state, which may have been\n modified by changes in the IME and calls to GameTextInput_setState. We use a\n callback rather than returning the state in order to simplify ownership of\n text_UTF8 strings. These strings are only valid during the calling of the\n callback.\n @param input A valid GameTextInput library handle.\n @param callback A function that will be called with valid state.\n @param context Context used by the callback."] pub fn GameTextInput_getState( input: *mut GameTextInput, callback: GameTextInputGetStateCallback, @@ -2452,18 +2728,10 @@ extern "C" { ); } extern "C" { - #[doc = " Set the current GameTextInput state. This state is reflected to any active"] - #[doc = " IME."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param state The state to set. Ownership is maintained by the caller and must"] - #[doc = " remain valid for the duration of the call."] + #[doc = " Set the current GameTextInput state. This state is reflected to any active\n IME.\n @param input A valid GameTextInput library handle.\n @param state The state to set. Ownership is maintained by the caller and must\n remain valid for the duration of the call."] pub fn GameTextInput_setState(input: *mut GameTextInput, state: *const GameTextInputState); } -#[doc = " Type of the callback needed by GameTextInput_setEventCallback that will be"] -#[doc = " called every time the IME state changes."] -#[doc = " @param context User-defined context set in GameTextInput_setEventCallback."] -#[doc = " @param current_state Current IME state, owned by the library and valid during"] -#[doc = " the callback."] +#[doc = " Type of the callback needed by GameTextInput_setEventCallback that will be\n called every time the IME state changes.\n @param context User-defined context set in GameTextInput_setEventCallback.\n @param current_state Current IME state, owned by the library and valid during\n the callback."] pub type GameTextInputEventCallback = ::std::option::Option< unsafe extern "C" fn( context: *mut ::std::os::raw::c_void, @@ -2471,34 +2739,19 @@ pub type GameTextInputEventCallback = ::std::option::Option< ), >; extern "C" { - #[doc = " Optionally set a callback to be called whenever the IME state changes."] - #[doc = " Not necessary if you are using GameActivity, which handles these callbacks"] - #[doc = " for you."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param callback Called by the library when the IME state changes."] - #[doc = " @param context Context passed as first argument to the callback."] + #[doc = " Optionally set a callback to be called whenever the IME state changes.\n Not necessary if you are using GameActivity, which handles these callbacks\n for you.\n @param input A valid GameTextInput library handle.\n @param callback Called by the library when the IME state changes.\n @param context Context passed as first argument to the callback.\n This function is deprecated. Don't perform any complex processing inside\n the callback other than copying the state variable. Using any synchronization\n primitives inside this callback may cause a deadlock."] pub fn GameTextInput_setEventCallback( input: *mut GameTextInput, callback: GameTextInputEventCallback, context: *mut ::std::os::raw::c_void, ); } -#[doc = " Type of the callback needed by GameTextInput_setImeInsetsCallback that will"] -#[doc = " be called every time the IME window insets change."] -#[doc = " @param context User-defined context set in"] -#[doc = " GameTextInput_setImeWIndowInsetsCallback."] -#[doc = " @param current_insets Current IME insets, owned by the library and valid"] -#[doc = " during the callback."] +#[doc = " Type of the callback needed by GameTextInput_setImeInsetsCallback that will\n be called every time the IME window insets change.\n @param context User-defined context set in\n GameTextInput_setImeWIndowInsetsCallback.\n @param current_insets Current IME insets, owned by the library and valid\n during the callback."] pub type GameTextInputImeInsetsCallback = ::std::option::Option< unsafe extern "C" fn(context: *mut ::std::os::raw::c_void, current_insets: *const ARect), >; extern "C" { - #[doc = " Optionally set a callback to be called whenever the IME insets change."] - #[doc = " Not necessary if you are using GameActivity, which handles these callbacks"] - #[doc = " for you."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param callback Called by the library when the IME insets change."] - #[doc = " @param context Context passed as first argument to the callback."] + #[doc = " Optionally set a callback to be called whenever the IME insets change.\n Not necessary if you are using GameActivity, which handles these callbacks\n for you.\n @param input A valid GameTextInput library handle.\n @param callback Called by the library when the IME insets change.\n @param context Context passed as first argument to the callback."] pub fn GameTextInput_setImeInsetsCallback( input: *mut GameTextInput, callback: GameTextInputImeInsetsCallback, @@ -2506,754 +2759,257 @@ extern "C" { ); } extern "C" { - #[doc = " Get the current window insets for the IME."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param insets Filled with the current insets by this function."] + #[doc = " Get the current window insets for the IME.\n @param input A valid GameTextInput library handle.\n @param insets Filled with the current insets by this function."] pub fn GameTextInput_getImeInsets(input: *const GameTextInput, insets: *mut ARect); } extern "C" { - #[doc = " Unless using GameActivity, it is required to call this function from your"] - #[doc = " Java gametextinput.Listener.onImeInsetsChanged method to"] - #[doc = " trigger any event callbacks. When using GameActivity, this does not need to"] - #[doc = " be called as insets processing is handled by the Activity."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param eventState A Java gametextinput.State object."] + #[doc = " Unless using GameActivity, it is required to call this function from your\n Java gametextinput.Listener.onImeInsetsChanged method to\n trigger any event callbacks. When using GameActivity, this does not need to\n be called as insets processing is handled by the Activity.\n @param input A valid GameTextInput library handle.\n @param eventState A Java gametextinput.State object."] pub fn GameTextInput_processImeInsets(input: *mut GameTextInput, insets: *const ARect); } extern "C" { - #[doc = " Convert a GameTextInputState struct to a Java gametextinput.State object."] - #[doc = " Don't forget to delete the returned Java local ref when you're done."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param state Input state to convert."] - #[doc = " @return A Java object of class gametextinput.State. The caller is required to"] - #[doc = " delete this local reference."] + #[doc = " Convert a GameTextInputState struct to a Java gametextinput.State object.\n Don't forget to delete the returned Java local ref when you're done.\n @param input A valid GameTextInput library handle.\n @param state Input state to convert.\n @return A Java object of class gametextinput.State. The caller is required to\n delete this local reference."] pub fn GameTextInputState_toJava( input: *const GameTextInput, state: *const GameTextInputState, ) -> jobject; -} -extern "C" { - #[doc = " Convert from a Java gametextinput.State object into a C GameTextInputState"] - #[doc = " struct."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param state A Java gametextinput.State object."] - #[doc = " @param callback A function called with the C struct, valid for the duration"] - #[doc = " of the call."] - #[doc = " @param context Context passed to the callback."] - pub fn GameTextInputState_fromJava( - input: *const GameTextInput, - state: jobject, - callback: GameTextInputGetStateCallback, - context: *mut ::std::os::raw::c_void, - ); -} -#[doc = " This structure defines the native side of an android.app.GameActivity."] -#[doc = " It is created by the framework, and handed to the application's native"] -#[doc = " code as it is being launched."] -#[repr(C)] -pub struct GameActivity { - #[doc = " Pointer to the callback function table of the native application."] - #[doc = " You can set the functions here to your own callbacks. The callbacks"] - #[doc = " pointer itself here should not be changed; it is allocated and managed"] - #[doc = " for you by the framework."] - pub callbacks: *mut GameActivityCallbacks, - #[doc = " The global handle on the process's Java VM."] - pub vm: *mut JavaVM, - #[doc = " JNI context for the main thread of the app. Note that this field"] - #[doc = " can ONLY be used from the main thread of the process; that is, the"] - #[doc = " thread that calls into the GameActivityCallbacks."] - pub env: *mut JNIEnv, - #[doc = " The GameActivity object handle."] - pub javaGameActivity: jobject, - #[doc = " Path to this application's internal data directory."] - pub internalDataPath: *const ::std::os::raw::c_char, - #[doc = " Path to this application's external (removable/mountable) data directory."] - pub externalDataPath: *const ::std::os::raw::c_char, - #[doc = " The platform's SDK version code."] - pub sdkVersion: i32, - #[doc = " This is the native instance of the application. It is not used by"] - #[doc = " the framework, but can be set by the application to its own instance"] - #[doc = " state."] - pub instance: *mut ::std::os::raw::c_void, - #[doc = " Pointer to the Asset Manager instance for the application. The"] - #[doc = " application uses this to access binary assets bundled inside its own .apk"] - #[doc = " file."] - pub assetManager: *mut AAssetManager, - #[doc = " Available starting with Honeycomb: path to the directory containing"] - #[doc = " the application's OBB files (if any). If the app doesn't have any"] - #[doc = " OBB files, this directory may not exist."] - pub obbPath: *const ::std::os::raw::c_char, -} -#[test] -fn bindgen_test_layout_GameActivity() { - assert_eq!( - ::std::mem::size_of::(), - 80usize, - concat!("Size of: ", stringify!(GameActivity)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(GameActivity)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).callbacks as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(callbacks) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).vm as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(vm) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).env as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(env) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).javaGameActivity as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(javaGameActivity) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).internalDataPath as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(internalDataPath) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).externalDataPath as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(externalDataPath) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).sdkVersion as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(sdkVersion) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).instance as *const _ as usize }, - 56usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(instance) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).assetManager as *const _ as usize }, - 64usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(assetManager) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).obbPath as *const _ as usize }, - 72usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(obbPath) - ) - ); -} -#[doc = " \\brief Describe information about a pointer, found in a"] -#[doc = " GameActivityMotionEvent."] -#[doc = ""] -#[doc = " You can read values directly from this structure, or use helper functions"] -#[doc = " (`GameActivityPointerAxes_getX`, `GameActivityPointerAxes_getY` and"] -#[doc = " `GameActivityPointerAxes_getAxisValue`)."] -#[doc = ""] -#[doc = " The X axis and Y axis are enabled by default but any other axis that you want"] -#[doc = " to read **must** be enabled first, using"] -#[doc = " `GameActivityPointerAxes_enableAxis`."] -#[doc = ""] -#[doc = " \\see GameActivityMotionEvent"] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct GameActivityPointerAxes { - pub id: i32, - pub toolType: i32, - pub axisValues: [f32; 48usize], - pub rawX: f32, - pub rawY: f32, -} -#[test] -fn bindgen_test_layout_GameActivityPointerAxes() { - assert_eq!( - ::std::mem::size_of::(), - 208usize, - concat!("Size of: ", stringify!(GameActivityPointerAxes)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(GameActivityPointerAxes)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).id as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(GameActivityPointerAxes), - "::", - stringify!(id) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).toolType as *const _ as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(GameActivityPointerAxes), - "::", - stringify!(toolType) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).axisValues as *const _ as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(GameActivityPointerAxes), - "::", - stringify!(axisValues) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).rawX as *const _ as usize }, - 200usize, - concat!( - "Offset of field: ", - stringify!(GameActivityPointerAxes), - "::", - stringify!(rawX) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).rawY as *const _ as usize }, - 204usize, - concat!( - "Offset of field: ", - stringify!(GameActivityPointerAxes), - "::", - stringify!(rawY) - ) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct GameActivityHistoricalPointerAxes { - pub eventTime: i64, - pub axisValues: [f32; 48usize], -} -#[test] -fn bindgen_test_layout_GameActivityHistoricalPointerAxes() { - assert_eq!( - ::std::mem::size_of::(), - 200usize, - concat!("Size of: ", stringify!(GameActivityHistoricalPointerAxes)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!( - "Alignment of ", - stringify!(GameActivityHistoricalPointerAxes) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).eventTime as *const _ - as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(GameActivityHistoricalPointerAxes), - "::", - stringify!(eventTime) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).axisValues as *const _ - as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(GameActivityHistoricalPointerAxes), - "::", - stringify!(axisValues) - ) - ); -} -extern "C" { - #[doc = " \\brief Enable the specified axis, so that its value is reported in the"] - #[doc = " GameActivityPointerAxes structures stored in a motion event."] - #[doc = ""] - #[doc = " You must enable any axis that you want to read, apart from"] - #[doc = " `AMOTION_EVENT_AXIS_X` and `AMOTION_EVENT_AXIS_Y` that are enabled by"] - #[doc = " default."] - #[doc = ""] - #[doc = " If the axis index is out of range, nothing is done."] - pub fn GameActivityPointerAxes_enableAxis(axis: i32); -} -extern "C" { - #[doc = " \\brief Disable the specified axis. Its value won't be reported in the"] - #[doc = " GameActivityPointerAxes structures stored in a motion event anymore."] - #[doc = ""] - #[doc = " Apart from X and Y, any axis that you want to read **must** be enabled first,"] - #[doc = " using `GameActivityPointerAxes_enableAxis`."] - #[doc = ""] - #[doc = " If the axis index is out of range, nothing is done."] - pub fn GameActivityPointerAxes_disableAxis(axis: i32); -} -extern "C" { - #[doc = " \\brief Enable the specified axis, so that its value is reported in the"] - #[doc = " GameActivityHistoricalPointerAxes structures associated with a motion event."] - #[doc = ""] - #[doc = " You must enable any axis that you want to read (no axes are enabled by"] - #[doc = " default)."] - #[doc = ""] - #[doc = " If the axis index is out of range, nothing is done."] - pub fn GameActivityHistoricalPointerAxes_enableAxis(axis: i32); -} -extern "C" { - #[doc = " \\brief Disable the specified axis. Its value won't be reported in the"] - #[doc = " GameActivityHistoricalPointerAxes structures associated with motion events"] - #[doc = " anymore."] - #[doc = ""] - #[doc = " If the axis index is out of range, nothing is done."] - pub fn GameActivityHistoricalPointerAxes_disableAxis(axis: i32); -} -#[doc = " \\brief Describe a motion event that happened on the GameActivity SurfaceView."] -#[doc = ""] -#[doc = " This is 1:1 mapping to the information contained in a Java `MotionEvent`"] -#[doc = " (see https://developer.android.com/reference/android/view/MotionEvent)."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct GameActivityMotionEvent { - pub deviceId: i32, - pub source: i32, - pub action: i32, - pub eventTime: i64, - pub downTime: i64, - pub flags: i32, - pub metaState: i32, - pub actionButton: i32, - pub buttonState: i32, - pub classification: i32, - pub edgeFlags: i32, - pub pointerCount: u32, - pub pointers: [GameActivityPointerAxes; 8usize], - pub precisionX: f32, - pub precisionY: f32, - pub historicalStart: i16, - pub historicalCount: i16, -} -#[test] -fn bindgen_test_layout_GameActivityMotionEvent() { - assert_eq!( - ::std::mem::size_of::(), - 1736usize, - concat!("Size of: ", stringify!(GameActivityMotionEvent)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(GameActivityMotionEvent)) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).deviceId as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(deviceId) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).source as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(source) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).action as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(action) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).eventTime as *const _ as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(eventTime) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).downTime as *const _ as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(downTime) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(flags) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).metaState as *const _ as usize - }, - 36usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(metaState) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).actionButton as *const _ as usize - }, - 40usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(actionButton) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).buttonState as *const _ as usize - }, - 44usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(buttonState) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).classification as *const _ as usize - }, - 48usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(classification) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).edgeFlags as *const _ as usize - }, - 52usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(edgeFlags) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).pointerCount as *const _ as usize - }, - 56usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(pointerCount) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).pointers as *const _ as usize - }, - 60usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(pointers) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).precisionX as *const _ as usize - }, - 1724usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(precisionX) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).precisionY as *const _ as usize - }, - 1728usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(precisionY) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).historicalStart as *const _ as usize - }, - 1732usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(historicalStart) - ) +} +extern "C" { + #[doc = " Convert from a Java gametextinput.State object into a C GameTextInputState\n struct.\n @param input A valid GameTextInput library handle.\n @param state A Java gametextinput.State object.\n @param callback A function called with the C struct, valid for the duration\n of the call.\n @param context Context passed to the callback."] + pub fn GameTextInputState_fromJava( + input: *const GameTextInput, + state: jobject, + callback: GameTextInputGetStateCallback, + context: *mut ::std::os::raw::c_void, ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).historicalCount as *const _ as usize - }, - 1734usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(historicalCount) - ) - ); -} -#[doc = " \\brief Describe a key event that happened on the GameActivity SurfaceView."] -#[doc = ""] -#[doc = " This is 1:1 mapping to the information contained in a Java `KeyEvent`"] -#[doc = " (see https://developer.android.com/reference/android/view/KeyEvent)."] +} +#[doc = " Mask of bits that determine the overall class\n of text being given. Currently supported classes are:\n {@link #TYPE_CLASS_TEXT}, {@link #TYPE_CLASS_NUMBER},\n {@link #TYPE_CLASS_PHONE}, {@link #TYPE_CLASS_DATETIME}.\n

IME authors: If the class is not one you\n understand, assume {@link #TYPE_CLASS_TEXT} with NO variation\n or flags.

"] +pub const GameTextInputType_TYPE_MASK_CLASS: GameTextInputType = 15; +#[doc = " Mask of bits that determine the variation of\n the base content class."] +pub const GameTextInputType_TYPE_MASK_VARIATION: GameTextInputType = 4080; +#[doc = " Mask of bits that provide addition bit flags\n of options."] +pub const GameTextInputType_TYPE_MASK_FLAGS: GameTextInputType = 16773120; +#[doc = " Special content type for when no explicit type has been specified.\n This should be interpreted to mean that the target input connection\n is not rich, it can not process and show things like candidate text nor\n retrieve the current text, so the input method will need to run in a\n limited \"generate key events\" mode, if it supports it. Note that some\n input methods may not support it, for example a voice-based input\n method will likely not be able to generate key events even if this\n flag is set."] +pub const GameTextInputType_TYPE_NULL: GameTextInputType = 0; +#[doc = " Class for normal text. This class supports the following flags (only\n one of which should be set):\n {@link #TYPE_TEXT_FLAG_CAP_CHARACTERS},\n {@link #TYPE_TEXT_FLAG_CAP_WORDS}, and.\n {@link #TYPE_TEXT_FLAG_CAP_SENTENCES}. It also supports the\n following variations:\n {@link #TYPE_TEXT_VARIATION_NORMAL}, and\n {@link #TYPE_TEXT_VARIATION_URI}. If you do not recognize the\n variation, normal should be assumed."] +pub const GameTextInputType_TYPE_CLASS_TEXT: GameTextInputType = 1; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: capitalize all characters. Overrides\n {@link #TYPE_TEXT_FLAG_CAP_WORDS} and\n {@link #TYPE_TEXT_FLAG_CAP_SENTENCES}. This value is explicitly defined\n to be the same as {@link TextUtils#CAP_MODE_CHARACTERS}. Of course,\n this only affects languages where there are upper-case and lower-case\n letters."] +pub const GameTextInputType_TYPE_TEXT_FLAG_CAP_CHARACTERS: GameTextInputType = 4096; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: capitalize the first character of\n every word. Overrides {@link #TYPE_TEXT_FLAG_CAP_SENTENCES}. This\n value is explicitly defined\n to be the same as {@link TextUtils#CAP_MODE_WORDS}. Of course,\n this only affects languages where there are upper-case and lower-case\n letters."] +pub const GameTextInputType_TYPE_TEXT_FLAG_CAP_WORDS: GameTextInputType = 8192; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: capitalize the first character of\n each sentence. This value is explicitly defined\n to be the same as {@link TextUtils#CAP_MODE_SENTENCES}. For example\n in English it means to capitalize after a period and a space (note that\n other languages may have different characters for period, or not use\n spaces, or use different grammatical rules). Of course, this only affects\n languages where there are upper-case and lower-case letters."] +pub const GameTextInputType_TYPE_TEXT_FLAG_CAP_SENTENCES: GameTextInputType = 16384; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: the user is entering free-form\n text that should have auto-correction applied to it. Without this flag,\n the IME will not try to correct typos. You should always set this flag\n unless you really expect users to type non-words in this field, for\n example to choose a name for a character in a game.\n Contrast this with {@link #TYPE_TEXT_FLAG_AUTO_COMPLETE} and\n {@link #TYPE_TEXT_FLAG_NO_SUGGESTIONS}:\n {@code TYPE_TEXT_FLAG_AUTO_CORRECT} means that the IME will try to\n auto-correct typos as the user is typing, but does not define whether\n the IME offers an interface to show suggestions."] +pub const GameTextInputType_TYPE_TEXT_FLAG_AUTO_CORRECT: GameTextInputType = 32768; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: the text editor (which means\n the application) is performing auto-completion of the text being entered\n based on its own semantics, which it will present to the user as they type.\n This generally means that the input method should not be showing\n candidates itself, but can expect the editor to supply its own\n completions/candidates from\n {@link android.view.inputmethod.InputMethodSession#displayCompletions\n InputMethodSession.displayCompletions()} as a result of the editor calling\n {@link android.view.inputmethod.InputMethodManager#displayCompletions\n InputMethodManager.displayCompletions()}.\n Note the contrast with {@link #TYPE_TEXT_FLAG_AUTO_CORRECT} and\n {@link #TYPE_TEXT_FLAG_NO_SUGGESTIONS}:\n {@code TYPE_TEXT_FLAG_AUTO_COMPLETE} means the editor should show an\n interface for displaying suggestions, but instead of supplying its own\n it will rely on the Editor to pass completions/corrections."] +pub const GameTextInputType_TYPE_TEXT_FLAG_AUTO_COMPLETE: GameTextInputType = 65536; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: multiple lines of text can be\n entered into the field. If this flag is not set, the text field\n will be constrained to a single line. The IME may also choose not to\n display an enter key when this flag is not set, as there should be no\n need to create new lines."] +pub const GameTextInputType_TYPE_TEXT_FLAG_MULTI_LINE: GameTextInputType = 131072; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: the regular text view associated\n with this should not be multi-line, but when a fullscreen input method\n is providing text it should use multiple lines if it can."] +pub const GameTextInputType_TYPE_TEXT_FLAG_IME_MULTI_LINE: GameTextInputType = 262144; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: the input method does not need to\n display any dictionary-based candidates. This is useful for text views that\n do not contain words from the language and do not benefit from any\n dictionary-based completions or corrections. It overrides the\n {@link #TYPE_TEXT_FLAG_AUTO_CORRECT} value when set.\n Please avoid using this unless you are certain this is what you want.\n Many input methods need suggestions to work well, for example the ones\n based on gesture typing. Consider clearing\n {@link #TYPE_TEXT_FLAG_AUTO_CORRECT} instead if you just do not\n want the IME to correct typos.\n Note the contrast with {@link #TYPE_TEXT_FLAG_AUTO_CORRECT} and\n {@link #TYPE_TEXT_FLAG_AUTO_COMPLETE}:\n {@code TYPE_TEXT_FLAG_NO_SUGGESTIONS} means the IME does not need to\n show an interface to display suggestions. Most IMEs will also take this to\n mean they do not need to try to auto-correct what the user is typing."] +pub const GameTextInputType_TYPE_TEXT_FLAG_NO_SUGGESTIONS: GameTextInputType = 524288; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: Let the IME know the text conversion\n suggestions are required by the application. Text conversion suggestion is\n for the transliteration languages which has pronunciation characters and\n target characters. When the user is typing the pronunciation charactes, the\n IME could provide the possible target characters to the user. When this\n flag is set, the IME should insert the text conversion suggestions through\n {@link Builder#setTextConversionSuggestions(List)} and\n the {@link TextAttribute} with initialized with the text conversion\n suggestions is provided by the IME to the application. To receive the\n additional information, the application needs to implement {@link\n InputConnection#setComposingText(CharSequence, int, TextAttribute)},\n {@link InputConnection#setComposingRegion(int, int, TextAttribute)}, and\n {@link InputConnection#commitText(CharSequence, int, TextAttribute)}."] +pub const GameTextInputType_TYPE_TEXT_FLAG_ENABLE_TEXT_CONVERSION_SUGGESTIONS: GameTextInputType = + 1048576; +#[doc = " Default variation of {@link #TYPE_CLASS_TEXT}: plain old normal text."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_NORMAL: GameTextInputType = 0; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering a URI."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_URI: GameTextInputType = 16; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering an e-mail address."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_EMAIL_ADDRESS: GameTextInputType = 32; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering the subject line of\n an e-mail."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_EMAIL_SUBJECT: GameTextInputType = 48; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering a short, possibly informal\n message such as an instant message or a text message."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_SHORT_MESSAGE: GameTextInputType = 64; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering the content of a long,\n possibly formal message such as the body of an e-mail."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_LONG_MESSAGE: GameTextInputType = 80; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering the name of a person."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_PERSON_NAME: GameTextInputType = 96; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering a postal mailing address."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_POSTAL_ADDRESS: GameTextInputType = 112; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering a password."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_PASSWORD: GameTextInputType = 128; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering a password, which should\n be visible to the user."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_VISIBLE_PASSWORD: GameTextInputType = 144; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering text inside of a web form."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_WEB_EDIT_TEXT: GameTextInputType = 160; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering text to filter contents\n of a list etc."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_FILTER: GameTextInputType = 176; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering text for phonetic\n pronunciation, such as a phonetic name field in contacts. This is mostly\n useful for languages where one spelling may have several phonetic\n readings, like Japanese."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_PHONETIC: GameTextInputType = 192; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering e-mail address inside\n of a web form. This was added in\n {@link android.os.Build.VERSION_CODES#HONEYCOMB}. An IME must target\n this API version or later to see this input type; if it doesn't, a request\n for this type will be seen as {@link #TYPE_TEXT_VARIATION_EMAIL_ADDRESS}\n when passed through {@link\n android.view.inputmethod.EditorInfo#makeCompatible(int)\n EditorInfo.makeCompatible(int)}."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS: GameTextInputType = 208; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering password inside\n of a web form. This was added in\n {@link android.os.Build.VERSION_CODES#HONEYCOMB}. An IME must target\n this API version or later to see this input type; if it doesn't, a request\n for this type will be seen as {@link #TYPE_TEXT_VARIATION_PASSWORD}\n when passed through {@link\n android.view.inputmethod.EditorInfo#makeCompatible(int)\n EditorInfo.makeCompatible(int)}."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_WEB_PASSWORD: GameTextInputType = 224; +#[doc = " Class for numeric text. This class supports the following flags:\n {@link #TYPE_NUMBER_FLAG_SIGNED} and\n {@link #TYPE_NUMBER_FLAG_DECIMAL}. It also supports the following\n variations: {@link #TYPE_NUMBER_VARIATION_NORMAL} and\n {@link #TYPE_NUMBER_VARIATION_PASSWORD}.\n

IME authors: If you do not recognize\n the variation, normal should be assumed.

"] +pub const GameTextInputType_TYPE_CLASS_NUMBER: GameTextInputType = 2; +#[doc = " Flag of {@link #TYPE_CLASS_NUMBER}: the number is signed, allowing\n a positive or negative sign at the start."] +pub const GameTextInputType_TYPE_NUMBER_FLAG_SIGNED: GameTextInputType = 4096; +#[doc = " Flag of {@link #TYPE_CLASS_NUMBER}: the number is decimal, allowing\n a decimal point to provide fractional values."] +pub const GameTextInputType_TYPE_NUMBER_FLAG_DECIMAL: GameTextInputType = 8192; +#[doc = " Default variation of {@link #TYPE_CLASS_NUMBER}: plain normal\n numeric text. This was added in\n {@link android.os.Build.VERSION_CODES#HONEYCOMB}. An IME must target\n this API version or later to see this input type; if it doesn't, a request\n for this type will be dropped when passed through\n {@link android.view.inputmethod.EditorInfo#makeCompatible(int)\n EditorInfo.makeCompatible(int)}."] +pub const GameTextInputType_TYPE_NUMBER_VARIATION_NORMAL: GameTextInputType = 0; +#[doc = " Variation of {@link #TYPE_CLASS_NUMBER}: entering a numeric password.\n This was added in {@link android.os.Build.VERSION_CODES#HONEYCOMB}. An\n IME must target this API version or later to see this input type; if it\n doesn't, a request for this type will be dropped when passed\n through {@link android.view.inputmethod.EditorInfo#makeCompatible(int)\n EditorInfo.makeCompatible(int)}."] +pub const GameTextInputType_TYPE_NUMBER_VARIATION_PASSWORD: GameTextInputType = 16; +#[doc = " Class for a phone number. This class currently supports no variations\n or flags."] +pub const GameTextInputType_TYPE_CLASS_PHONE: GameTextInputType = 3; +#[doc = " Class for dates and times. It supports the\n following variations:\n {@link #TYPE_DATETIME_VARIATION_NORMAL}\n {@link #TYPE_DATETIME_VARIATION_DATE}, and\n {@link #TYPE_DATETIME_VARIATION_TIME}."] +pub const GameTextInputType_TYPE_CLASS_DATETIME: GameTextInputType = 4; +#[doc = " Default variation of {@link #TYPE_CLASS_DATETIME}: allows entering\n both a date and time."] +pub const GameTextInputType_TYPE_DATETIME_VARIATION_NORMAL: GameTextInputType = 0; +#[doc = " Default variation of {@link #TYPE_CLASS_DATETIME}: allows entering\n only a date."] +pub const GameTextInputType_TYPE_DATETIME_VARIATION_DATE: GameTextInputType = 16; +#[doc = " Default variation of {@link #TYPE_CLASS_DATETIME}: allows entering\n only a time."] +pub const GameTextInputType_TYPE_DATETIME_VARIATION_TIME: GameTextInputType = 32; +#[doc = " Definitions for inputType argument of GameActivity_setImeEditorInfo()\n\n
\n |-------|-------|-------|-------|\n                              1111 TYPE_MASK_CLASS\n                      11111111     TYPE_MASK_VARIATION\n          111111111111             TYPE_MASK_FLAGS\n |-------|-------|-------|-------|\n                                   TYPE_NULL\n |-------|-------|-------|-------|\n                                 1 TYPE_CLASS_TEXT\n                             1     TYPE_TEXT_VARIATION_URI\n                            1      TYPE_TEXT_VARIATION_EMAIL_ADDRESS\n                            11     TYPE_TEXT_VARIATION_EMAIL_SUBJECT\n                           1       TYPE_TEXT_VARIATION_SHORT_MESSAGE\n                           1 1     TYPE_TEXT_VARIATION_LONG_MESSAGE\n                           11      TYPE_TEXT_VARIATION_PERSON_NAME\n                           111     TYPE_TEXT_VARIATION_POSTAL_ADDRESS\n                          1        TYPE_TEXT_VARIATION_PASSWORD\n                          1  1     TYPE_TEXT_VARIATION_VISIBLE_PASSWORD\n                          1 1      TYPE_TEXT_VARIATION_WEB_EDIT_TEXT\n                          1 11     TYPE_TEXT_VARIATION_FILTER\n                          11       TYPE_TEXT_VARIATION_PHONETIC\n                          11 1     TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS\n                          111      TYPE_TEXT_VARIATION_WEB_PASSWORD\n                     1             TYPE_TEXT_FLAG_CAP_CHARACTERS\n                    1              TYPE_TEXT_FLAG_CAP_WORDS\n                   1               TYPE_TEXT_FLAG_CAP_SENTENCES\n                  1                TYPE_TEXT_FLAG_AUTO_CORRECT\n                 1                 TYPE_TEXT_FLAG_AUTO_COMPLETE\n                1                  TYPE_TEXT_FLAG_MULTI_LINE\n               1                   TYPE_TEXT_FLAG_IME_MULTI_LINE\n              1                    TYPE_TEXT_FLAG_NO_SUGGESTIONS\n             1 TYPE_TEXT_FLAG_ENABLE_TEXT_CONVERSION_SUGGESTIONS\n |-------|-------|-------|-------|\n                                1  TYPE_CLASS_NUMBER\n                             1     TYPE_NUMBER_VARIATION_PASSWORD\n                     1             TYPE_NUMBER_FLAG_SIGNED\n                    1              TYPE_NUMBER_FLAG_DECIMAL\n |-------|-------|-------|-------|\n                                11 TYPE_CLASS_PHONE\n |-------|-------|-------|-------|\n                               1   TYPE_CLASS_DATETIME\n                             1     TYPE_DATETIME_VARIATION_DATE\n                            1      TYPE_DATETIME_VARIATION_TIME\n |-------|-------|-------|-------|
"] +pub type GameTextInputType = u32; +#[doc = " Set of bits in {@link #imeOptions} that provide alternative actions\n associated with the \"enter\" key. This both helps the IME provide\n better feedback about what the enter key will do, and also allows it\n to provide alternative mechanisms for providing that command."] +pub const GameTextInputActionType_IME_MASK_ACTION: GameTextInputActionType = 255; +#[doc = " Bits of {@link #IME_MASK_ACTION}: no specific action has been\n associated with this editor, let the editor come up with its own if\n it can."] +pub const GameTextInputActionType_IME_ACTION_UNSPECIFIED: GameTextInputActionType = 0; +#[doc = " Bits of {@link #IME_MASK_ACTION}: there is no available action."] +pub const GameTextInputActionType_IME_ACTION_NONE: GameTextInputActionType = 1; +#[doc = " Bits of {@link #IME_MASK_ACTION}: the action key performs a \"go\"\n operation to take the user to the target of the text they typed.\n Typically used, for example, when entering a URL."] +pub const GameTextInputActionType_IME_ACTION_GO: GameTextInputActionType = 2; +#[doc = " Bits of {@link #IME_MASK_ACTION}: the action key performs a \"search\"\n operation, taking the user to the results of searching for the text\n they have typed (in whatever context is appropriate)."] +pub const GameTextInputActionType_IME_ACTION_SEARCH: GameTextInputActionType = 3; +#[doc = " Bits of {@link #IME_MASK_ACTION}: the action key performs a \"send\"\n operation, delivering the text to its target. This is typically used\n when composing a message in IM or SMS where sending is immediate."] +pub const GameTextInputActionType_IME_ACTION_SEND: GameTextInputActionType = 4; +#[doc = " Bits of {@link #IME_MASK_ACTION}: the action key performs a \"next\"\n operation, taking the user to the next field that will accept text."] +pub const GameTextInputActionType_IME_ACTION_NEXT: GameTextInputActionType = 5; +#[doc = " Bits of {@link #IME_MASK_ACTION}: the action key performs a \"done\"\n operation, typically meaning there is nothing more to input and the\n IME will be closed."] +pub const GameTextInputActionType_IME_ACTION_DONE: GameTextInputActionType = 6; +#[doc = " Bits of {@link #IME_MASK_ACTION}: like {@link #IME_ACTION_NEXT}, but\n for moving to the previous field. This will normally not be used to\n specify an action (since it precludes {@link #IME_ACTION_NEXT}), but\n can be returned to the app if it sets {@link #IME_FLAG_NAVIGATE_PREVIOUS}."] +pub const GameTextInputActionType_IME_ACTION_PREVIOUS: GameTextInputActionType = 7; +#[doc = " actionId and imeOptions argument of GameActivity_setImeEditorInfo().\n\n
\n |-------|-------|-------|-------|\n                              1111 IME_MASK_ACTION\n |-------|-------|-------|-------|\n                                   IME_ACTION_UNSPECIFIED\n                                 1 IME_ACTION_NONE\n                                1  IME_ACTION_GO\n                                11 IME_ACTION_SEARCH\n                               1   IME_ACTION_SEND\n                               1 1 IME_ACTION_NEXT\n                               11  IME_ACTION_DONE\n                               111 IME_ACTION_PREVIOUS\n         1                         IME_FLAG_NO_PERSONALIZED_LEARNING\n        1                          IME_FLAG_NO_FULLSCREEN\n       1                           IME_FLAG_NAVIGATE_PREVIOUS\n      1                            IME_FLAG_NAVIGATE_NEXT\n     1                             IME_FLAG_NO_EXTRACT_UI\n    1                              IME_FLAG_NO_ACCESSORY_ACTION\n   1                               IME_FLAG_NO_ENTER_ACTION\n  1                                IME_FLAG_FORCE_ASCII\n |-------|-------|-------|-------|
"] +pub type GameTextInputActionType = u32; +#[doc = " Flag of {@link #imeOptions}: used to request that the IME should not update\n any personalized data such as typing history and personalized language\n model based on what the user typed on this text editing object. Typical\n use cases are:
  • When the application is in a special mode, where\n user's activities are expected to be not recorded in the application's\n history. Some web browsers and chat applications may have this kind of\n modes.
  • When storing typing history does not make much sense.\n Specifying this flag in typing games may help to avoid typing history from\n being filled up with words that the user is less likely to type in their\n daily life. Another example is that when the application already knows\n that the expected input is not a valid word (e.g. a promotion code that is\n not a valid word in any natural language).
  • \n
\n\n

Applications need to be aware that the flag is not a guarantee, and some\n IMEs may not respect it.

"] +pub const GameTextInputImeOptions_IME_FLAG_NO_PERSONALIZED_LEARNING: GameTextInputImeOptions = + 16777216; +#[doc = " Flag of {@link #imeOptions}: used to request that the IME never go\n into fullscreen mode.\n By default, IMEs may go into full screen mode when they think\n it's appropriate, for example on small screens in landscape\n orientation where displaying a software keyboard may occlude\n such a large portion of the screen that the remaining part is\n too small to meaningfully display the application UI.\n If this flag is set, compliant IMEs will never go into full screen mode,\n and always leave some space to display the application UI.\n Applications need to be aware that the flag is not a guarantee, and\n some IMEs may ignore it."] +pub const GameTextInputImeOptions_IME_FLAG_NO_FULLSCREEN: GameTextInputImeOptions = 33554432; +#[doc = " Flag of {@link #imeOptions}: like {@link #IME_FLAG_NAVIGATE_NEXT}, but\n specifies there is something interesting that a backward navigation\n can focus on. If the user selects the IME's facility to backward\n navigate, this will show up in the application as an {@link\n #IME_ACTION_PREVIOUS} at {@link InputConnection#performEditorAction(int)\n InputConnection.performEditorAction(int)}."] +pub const GameTextInputImeOptions_IME_FLAG_NAVIGATE_PREVIOUS: GameTextInputImeOptions = 67108864; +#[doc = " Flag of {@link #imeOptions}: used to specify that there is something\n interesting that a forward navigation can focus on. This is like using\n {@link #IME_ACTION_NEXT}, except allows the IME to be multiline (with\n an enter key) as well as provide forward navigation. Note that some\n IMEs may not be able to do this, especially when running on a small\n screen where there is little space. In that case it does not need to\n present a UI for this option. Like {@link #IME_ACTION_NEXT}, if the\n user selects the IME's facility to forward navigate, this will show up\n in the application at {@link InputConnection#performEditorAction(int)\n InputConnection.performEditorAction(int)}."] +pub const GameTextInputImeOptions_IME_FLAG_NAVIGATE_NEXT: GameTextInputImeOptions = 134217728; +#[doc = " Flag of {@link #imeOptions}: used to specify that the IME does not need\n to show its extracted text UI. For input methods that may be fullscreen,\n often when in landscape mode, this allows them to be smaller and let part\n of the application be shown behind, through transparent UI parts in the\n fullscreen IME. The part of the UI visible to the user may not be\n responsive to touch because the IME will receive touch events, which may\n confuse the user; use {@link #IME_FLAG_NO_FULLSCREEN} instead for a better\n experience. Using this flag is discouraged and it may become deprecated in\n the future. Its meaning is unclear in some situations and it may not work\n appropriately on older versions of the platform."] +pub const GameTextInputImeOptions_IME_FLAG_NO_EXTRACT_UI: GameTextInputImeOptions = 268435456; +#[doc = " Flag of {@link #imeOptions}: used in conjunction with one of the actions\n masked by {@link #IME_MASK_ACTION}, this indicates that the action\n should not be available as an accessory button on the right of the\n extracted text when the input method is full-screen. Note that by setting\n this flag, there can be cases where the action is simply never available to\n the user. Setting this generally means that you think that in fullscreen\n mode, where there is little space to show the text, it's not worth taking\n some screen real estate to display the action and it should be used instead\n to show more text."] +pub const GameTextInputImeOptions_IME_FLAG_NO_ACCESSORY_ACTION: GameTextInputImeOptions = 536870912; +#[doc = " Flag of {@link #imeOptions}: used in conjunction with one of the actions\n masked by {@link #IME_MASK_ACTION}. If this flag is not set, IMEs will\n normally replace the \"enter\" key with the action supplied. This flag\n indicates that the action should not be available in-line as a replacement\n for the \"enter\" key. Typically this is because the action has such a\n significant impact or is not recoverable enough that accidentally hitting\n it should be avoided, such as sending a message. Note that\n {@link android.widget.TextView} will automatically set this flag for you\n on multi-line text views."] +pub const GameTextInputImeOptions_IME_FLAG_NO_ENTER_ACTION: GameTextInputImeOptions = 1073741824; +#[doc = " Flag of {@link #imeOptions}: used to request an IME that is capable of\n inputting ASCII characters. The intention of this flag is to ensure that\n the user can type Roman alphabet characters in a {@link\n android.widget.TextView}. It is typically used for an account ID or\n password input. A lot of the time, IMEs are already able to input ASCII\n even without being told so (such IMEs already respect this flag in a\n sense), but there are cases when this is not the default. For instance,\n users of languages using a different script like Arabic, Greek, Hebrew or\n Russian typically have a keyboard that can't input ASCII characters by\n default. Applications need to be aware that the flag is not a guarantee,\n and some IMEs may not respect it. However, it is strongly recommended for\n IME authors to respect this flag especially when their IME could end up\n with a state where only languages using non-ASCII are enabled."] +pub const GameTextInputImeOptions_IME_FLAG_FORCE_ASCII: GameTextInputImeOptions = 2147483648; +#[doc = " Flag of {@link #internalImeOptions}: flag is set when app window containing\n this\n {@link EditorInfo} is using {@link Configuration#ORIENTATION_PORTRAIT}\n mode.\n @hide"] +pub const GameTextInputImeOptions_IME_INTERNAL_FLAG_APP_WINDOW_PORTRAIT: GameTextInputImeOptions = + 1; +#[doc = " Generic unspecified type for {@link #imeOptions}."] +pub const GameTextInputImeOptions_IME_NULL: GameTextInputImeOptions = 0; +pub type GameTextInputImeOptions = u32; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_CAPTION_BAR: GameCommonInsetsType = 0; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_DISPLAY_CUTOUT: GameCommonInsetsType = 1; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_IME: GameCommonInsetsType = 2; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_MANDATORY_SYSTEM_GESTURES: + GameCommonInsetsType = 3; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_NAVIGATION_BARS: GameCommonInsetsType = 4; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_STATUS_BARS: GameCommonInsetsType = 5; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_SYSTEM_BARS: GameCommonInsetsType = 6; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_SYSTEM_GESTURES: GameCommonInsetsType = 7; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_TAPABLE_ELEMENT: GameCommonInsetsType = 8; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_WATERFALL: GameCommonInsetsType = 9; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_COUNT: GameCommonInsetsType = 10; +#[doc = " The type of a component for which to retrieve insets. See\n https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat.Type"] +pub type GameCommonInsetsType = u8; +#[doc = " This structure defines the native side of an android.app.GameActivity.\n It is created by the framework, and handed to the application's native\n code as it is being launched."] #[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct GameActivityKeyEvent { - pub deviceId: i32, - pub source: i32, - pub action: i32, - pub eventTime: i64, - pub downTime: i64, - pub flags: i32, - pub metaState: i32, - pub modifiers: i32, - pub repeatCount: i32, - pub keyCode: i32, - pub scanCode: i32, +pub struct GameActivity { + #[doc = " Pointer to the callback function table of the native application.\n You can set the functions here to your own callbacks. The callbacks\n pointer itself here should not be changed; it is allocated and managed\n for you by the framework."] + pub callbacks: *mut GameActivityCallbacks, + #[doc = " The global handle on the process's Java VM."] + pub vm: *mut JavaVM, + #[doc = " JNI context for the main thread of the app. Note that this field\n can ONLY be used from the main thread of the process; that is, the\n thread that calls into the GameActivityCallbacks."] + pub env: *mut JNIEnv, + #[doc = " The GameActivity object handle."] + pub javaGameActivity: jobject, + #[doc = " Path to this application's internal data directory."] + pub internalDataPath: *const ::std::os::raw::c_char, + #[doc = " Path to this application's external (removable/mountable) data directory."] + pub externalDataPath: *const ::std::os::raw::c_char, + #[doc = " The platform's SDK version code."] + pub sdkVersion: i32, + #[doc = " This is the native instance of the application. It is not used by\n the framework, but can be set by the application to its own instance\n state."] + pub instance: *mut ::std::os::raw::c_void, + #[doc = " Pointer to the Asset Manager instance for the application. The\n application uses this to access binary assets bundled inside its own .apk\n file."] + pub assetManager: *mut AAssetManager, + #[doc = " Available starting with Honeycomb: path to the directory containing\n the application's OBB files (if any). If the app doesn't have any\n OBB files, this directory may not exist."] + pub obbPath: *const ::std::os::raw::c_char, } #[test] -fn bindgen_test_layout_GameActivityKeyEvent() { +fn bindgen_test_layout_GameActivity() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - ::std::mem::size_of::(), - 56usize, - concat!("Size of: ", stringify!(GameActivityKeyEvent)) + ::std::mem::size_of::(), + 80usize, + "Size of GameActivity" ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(GameActivityKeyEvent)) + "Alignment of GameActivity" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).deviceId as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).callbacks) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(deviceId) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).source as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(source) - ) + "Offset of field: GameActivity::callbacks" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).action as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).vm) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(action) - ) + "Offset of field: GameActivity::vm" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).eventTime as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).env) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(eventTime) - ) + "Offset of field: GameActivity::env" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).downTime as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).javaGameActivity) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(downTime) - ) + "Offset of field: GameActivity::javaGameActivity" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).internalDataPath) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(flags) - ) + "Offset of field: GameActivity::internalDataPath" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).metaState as *const _ as usize }, - 36usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(metaState) - ) + unsafe { ::std::ptr::addr_of!((*ptr).externalDataPath) as usize - ptr as usize }, + 40usize, + "Offset of field: GameActivity::externalDataPath" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).modifiers as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(modifiers) - ) + unsafe { ::std::ptr::addr_of!((*ptr).sdkVersion) as usize - ptr as usize }, + 48usize, + "Offset of field: GameActivity::sdkVersion" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).repeatCount as *const _ as usize - }, - 44usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(repeatCount) - ) + unsafe { ::std::ptr::addr_of!((*ptr).instance) as usize - ptr as usize }, + 56usize, + "Offset of field: GameActivity::instance" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).keyCode as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(keyCode) - ) + unsafe { ::std::ptr::addr_of!((*ptr).assetManager) as usize - ptr as usize }, + 64usize, + "Offset of field: GameActivity::assetManager" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).scanCode as *const _ as usize }, - 52usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(scanCode) - ) + unsafe { ::std::ptr::addr_of!((*ptr).obbPath) as usize - ptr as usize }, + 72usize, + "Offset of field: GameActivity::obbPath" ); } -#[doc = " A function the user should call from their callback with the data, its length"] -#[doc = " and the library- supplied context."] +#[doc = " A function the user should call from their callback with the data, its length\n and the library- supplied context."] pub type SaveInstanceStateRecallback = ::std::option::Option< unsafe extern "C" fn( bytes: *const ::std::os::raw::c_char, @@ -3265,18 +3021,11 @@ pub type SaveInstanceStateRecallback = ::std::option::Option< #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct GameActivityCallbacks { - #[doc = " GameActivity has started. See Java documentation for Activity.onStart()"] - #[doc = " for more information."] + #[doc = " GameActivity has started. See Java documentation for Activity.onStart()\n for more information."] pub onStart: ::std::option::Option, - #[doc = " GameActivity has resumed. See Java documentation for Activity.onResume()"] - #[doc = " for more information."] + #[doc = " GameActivity has resumed. See Java documentation for Activity.onResume()\n for more information."] pub onResume: ::std::option::Option, - #[doc = " The framework is asking GameActivity to save its current instance state."] - #[doc = " See the Java documentation for Activity.onSaveInstanceState() for more"] - #[doc = " information. The user should call the recallback with their data, its"] - #[doc = " length and the provided context; they retain ownership of the data. Note"] - #[doc = " that the saved state will be persisted, so it can not contain any active"] - #[doc = " entities (pointers to memory, file descriptors, etc)."] + #[doc = " The framework is asking GameActivity to save its current instance state.\n See the Java documentation for Activity.onSaveInstanceState() for more\n information. The user should call the recallback with their data, its\n length and the provided context; they retain ownership of the data. Note\n that the saved state will be persisted, so it can not contain any active\n entities (pointers to memory, file descriptors, etc)."] pub onSaveInstanceState: ::std::option::Option< unsafe extern "C" fn( activity: *mut GameActivity, @@ -3284,27 +3033,20 @@ pub struct GameActivityCallbacks { context: *mut ::std::os::raw::c_void, ), >, - #[doc = " GameActivity has paused. See Java documentation for Activity.onPause()"] - #[doc = " for more information."] + #[doc = " GameActivity has paused. See Java documentation for Activity.onPause()\n for more information."] pub onPause: ::std::option::Option, - #[doc = " GameActivity has stopped. See Java documentation for Activity.onStop()"] - #[doc = " for more information."] + #[doc = " GameActivity has stopped. See Java documentation for Activity.onStop()\n for more information."] pub onStop: ::std::option::Option, - #[doc = " GameActivity is being destroyed. See Java documentation for"] - #[doc = " Activity.onDestroy() for more information."] + #[doc = " GameActivity is being destroyed. See Java documentation for\n Activity.onDestroy() for more information."] pub onDestroy: ::std::option::Option, - #[doc = " Focus has changed in this GameActivity's window. This is often used,"] - #[doc = " for example, to pause a game when it loses input focus."] + #[doc = " Focus has changed in this GameActivity's window. This is often used,\n for example, to pause a game when it loses input focus."] pub onWindowFocusChanged: ::std::option::Option, - #[doc = " The drawing window for this native activity has been created. You"] - #[doc = " can use the given native window object to start drawing."] + #[doc = " The drawing window for this native activity has been created. You\n can use the given native window object to start drawing."] pub onNativeWindowCreated: ::std::option::Option< unsafe extern "C" fn(activity: *mut GameActivity, window: *mut ANativeWindow), >, - #[doc = " The drawing window for this native activity has been resized. You should"] - #[doc = " retrieve the new size from the window and ensure that your rendering in"] - #[doc = " it now matches."] + #[doc = " The drawing window for this native activity has been resized. You should\n retrieve the new size from the window and ensure that your rendering in\n it now matches."] pub onNativeWindowResized: ::std::option::Option< unsafe extern "C" fn( activity: *mut GameActivity, @@ -3313,557 +3055,295 @@ pub struct GameActivityCallbacks { newHeight: i32, ), >, - #[doc = " The drawing window for this native activity needs to be redrawn. To"] - #[doc = " avoid transient artifacts during screen changes (such resizing after"] - #[doc = " rotation), applications should not return from this function until they"] - #[doc = " have finished drawing their window in its current state."] + #[doc = " The drawing window for this native activity needs to be redrawn. To\n avoid transient artifacts during screen changes (such resizing after\n rotation), applications should not return from this function until they\n have finished drawing their window in its current state."] pub onNativeWindowRedrawNeeded: ::std::option::Option< unsafe extern "C" fn(activity: *mut GameActivity, window: *mut ANativeWindow), >, - #[doc = " The drawing window for this native activity is going to be destroyed."] - #[doc = " You MUST ensure that you do not touch the window object after returning"] - #[doc = " from this function: in the common case of drawing to the window from"] - #[doc = " another thread, that means the implementation of this callback must"] - #[doc = " properly synchronize with the other thread to stop its drawing before"] - #[doc = " returning from here."] + #[doc = " The drawing window for this native activity is going to be destroyed.\n You MUST ensure that you do not touch the window object after returning\n from this function: in the common case of drawing to the window from\n another thread, that means the implementation of this callback must\n properly synchronize with the other thread to stop its drawing before\n returning from here."] pub onNativeWindowDestroyed: ::std::option::Option< unsafe extern "C" fn(activity: *mut GameActivity, window: *mut ANativeWindow), >, - #[doc = " The current device AConfiguration has changed. The new configuration can"] - #[doc = " be retrieved from assetManager."] + #[doc = " The current device AConfiguration has changed. The new configuration can\n be retrieved from assetManager."] pub onConfigurationChanged: ::std::option::Option, - #[doc = " The system is running low on memory. Use this callback to release"] - #[doc = " resources you do not need, to help the system avoid killing more"] - #[doc = " important processes."] + #[doc = " The system is running low on memory. Use this callback to release\n resources you do not need, to help the system avoid killing more\n important processes."] pub onTrimMemory: ::std::option::Option< unsafe extern "C" fn(activity: *mut GameActivity, level: ::std::os::raw::c_int), >, - #[doc = " Callback called for every MotionEvent done on the GameActivity"] - #[doc = " SurfaceView. Ownership of `event` is maintained by the library and it is"] - #[doc = " only valid during the callback."] + #[doc = " Callback called for every MotionEvent done on the GameActivity\n SurfaceView. Ownership of `event` is maintained by the library and it is\n only valid during the callback."] pub onTouchEvent: ::std::option::Option< unsafe extern "C" fn( activity: *mut GameActivity, event: *const GameActivityMotionEvent, - historical: *const GameActivityHistoricalPointerAxes, - historicalLen: ::std::os::raw::c_int, ) -> bool, >, - #[doc = " Callback called for every key down event on the GameActivity SurfaceView."] - #[doc = " Ownership of `event` is maintained by the library and it is only valid"] - #[doc = " during the callback."] + #[doc = " Callback called for every key down event on the GameActivity SurfaceView.\n Ownership of `event` is maintained by the library and it is only valid\n during the callback."] pub onKeyDown: ::std::option::Option< unsafe extern "C" fn( activity: *mut GameActivity, event: *const GameActivityKeyEvent, ) -> bool, >, - #[doc = " Callback called for every key up event on the GameActivity SurfaceView."] - #[doc = " Ownership of `event` is maintained by the library and it is only valid"] - #[doc = " during the callback."] + #[doc = " Callback called for every key up event on the GameActivity SurfaceView.\n Ownership of `event` is maintained by the library and it is only valid\n during the callback."] pub onKeyUp: ::std::option::Option< unsafe extern "C" fn( activity: *mut GameActivity, event: *const GameActivityKeyEvent, ) -> bool, >, - #[doc = " Callback called for every soft-keyboard text input event."] - #[doc = " Ownership of `state` is maintained by the library and it is only valid"] - #[doc = " during the callback."] + #[doc = " Callback called for every soft-keyboard text input event.\n Ownership of `state` is maintained by the library and it is only valid\n during the callback."] pub onTextInputEvent: ::std::option::Option< unsafe extern "C" fn(activity: *mut GameActivity, state: *const GameTextInputState), >, - #[doc = " Callback called when WindowInsets of the main app window have changed."] - #[doc = " Call GameActivity_getWindowInsets to retrieve the insets themselves."] + #[doc = " Callback called when WindowInsets of the main app window have changed.\n Call GameActivity_getWindowInsets to retrieve the insets themselves."] pub onWindowInsetsChanged: ::std::option::Option, + #[doc = " Callback called when the rectangle in the window where the content\n should be placed has changed."] + pub onContentRectChanged: ::std::option::Option< + unsafe extern "C" fn(activity: *mut GameActivity, rect: *const ARect), + >, + #[doc = " Callback called when the software keyboard is shown or hidden."] + pub onSoftwareKeyboardVisibilityChanged: + ::std::option::Option, + #[doc = " Callback called when the software keyboard is shown or hidden."] + pub onEditorAction: ::std::option::Option< + unsafe extern "C" fn(activity: *mut GameActivity, action: ::std::os::raw::c_int) -> bool, + >, } #[test] fn bindgen_test_layout_GameActivityCallbacks() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), - 144usize, - concat!("Size of: ", stringify!(GameActivityCallbacks)) + 168usize, + "Size of GameActivityCallbacks" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(GameActivityCallbacks)) + "Alignment of GameActivityCallbacks" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).onStart as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).onStart) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onStart) - ) + "Offset of field: GameActivityCallbacks::onStart" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).onResume as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).onResume) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onResume) - ) + "Offset of field: GameActivityCallbacks::onResume" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onSaveInstanceState as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onSaveInstanceState) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onSaveInstanceState) - ) + "Offset of field: GameActivityCallbacks::onSaveInstanceState" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).onPause as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).onPause) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onPause) - ) + "Offset of field: GameActivityCallbacks::onPause" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).onStop as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).onStop) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onStop) - ) + "Offset of field: GameActivityCallbacks::onStop" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).onDestroy as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).onDestroy) as usize - ptr as usize }, 40usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onDestroy) - ) + "Offset of field: GameActivityCallbacks::onDestroy" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onWindowFocusChanged as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onWindowFocusChanged) as usize - ptr as usize }, 48usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onWindowFocusChanged) - ) + "Offset of field: GameActivityCallbacks::onWindowFocusChanged" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onNativeWindowCreated as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onNativeWindowCreated) as usize - ptr as usize }, 56usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onNativeWindowCreated) - ) + "Offset of field: GameActivityCallbacks::onNativeWindowCreated" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onNativeWindowResized as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onNativeWindowResized) as usize - ptr as usize }, 64usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onNativeWindowResized) - ) + "Offset of field: GameActivityCallbacks::onNativeWindowResized" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onNativeWindowRedrawNeeded as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onNativeWindowRedrawNeeded) as usize - ptr as usize }, 72usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onNativeWindowRedrawNeeded) - ) + "Offset of field: GameActivityCallbacks::onNativeWindowRedrawNeeded" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onNativeWindowDestroyed as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onNativeWindowDestroyed) as usize - ptr as usize }, 80usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onNativeWindowDestroyed) - ) + "Offset of field: GameActivityCallbacks::onNativeWindowDestroyed" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onConfigurationChanged as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onConfigurationChanged) as usize - ptr as usize }, 88usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onConfigurationChanged) - ) + "Offset of field: GameActivityCallbacks::onConfigurationChanged" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onTrimMemory as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onTrimMemory) as usize - ptr as usize }, 96usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onTrimMemory) - ) + "Offset of field: GameActivityCallbacks::onTrimMemory" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onTouchEvent as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onTouchEvent) as usize - ptr as usize }, 104usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onTouchEvent) - ) + "Offset of field: GameActivityCallbacks::onTouchEvent" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).onKeyDown as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).onKeyDown) as usize - ptr as usize }, 112usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onKeyDown) - ) + "Offset of field: GameActivityCallbacks::onKeyDown" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).onKeyUp as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).onKeyUp) as usize - ptr as usize }, 120usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onKeyUp) - ) + "Offset of field: GameActivityCallbacks::onKeyUp" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onTextInputEvent as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onTextInputEvent) as usize - ptr as usize }, 128usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onTextInputEvent) - ) + "Offset of field: GameActivityCallbacks::onTextInputEvent" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).onWindowInsetsChanged) as usize - ptr as usize }, + 136usize, + "Offset of field: GameActivityCallbacks::onWindowInsetsChanged" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).onContentRectChanged) as usize - ptr as usize }, + 144usize, + "Offset of field: GameActivityCallbacks::onContentRectChanged" ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).onWindowInsetsChanged as *const _ - as usize + ::std::ptr::addr_of!((*ptr).onSoftwareKeyboardVisibilityChanged) as usize - ptr as usize }, - 136usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onWindowInsetsChanged) - ) - ); -} -extern "C" { - #[doc = " \\brief Convert a Java `MotionEvent` to a `GameActivityMotionEvent`."] - #[doc = ""] - #[doc = " This is done automatically by the GameActivity: see `onTouchEvent` to set"] - #[doc = " a callback to consume the received events."] - #[doc = " This function can be used if you re-implement events handling in your own"] - #[doc = " activity. On return, the out_event->historicalStart will be zero, and should"] - #[doc = " be updated to index into whatever buffer out_historical is copied."] - #[doc = " On return the length of out_historical is"] - #[doc = " (out_event->pointerCount x out_event->historicalCount) and is in a"] - #[doc = " pointer-major order (i.e. all axis for a pointer are contiguous)"] - #[doc = " Ownership of out_event is maintained by the caller."] - pub fn GameActivityMotionEvent_fromJava( - env: *mut JNIEnv, - motionEvent: jobject, - out_event: *mut GameActivityMotionEvent, - out_historical: *mut GameActivityHistoricalPointerAxes, - ) -> ::std::os::raw::c_int; + 152usize, + "Offset of field: GameActivityCallbacks::onSoftwareKeyboardVisibilityChanged" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).onEditorAction) as usize - ptr as usize }, + 160usize, + "Offset of field: GameActivityCallbacks::onEditorAction" + ); } -extern "C" { - #[doc = " \\brief Convert a Java `KeyEvent` to a `GameActivityKeyEvent`."] - #[doc = ""] - #[doc = " This is done automatically by the GameActivity: see `onKeyUp` and `onKeyDown`"] - #[doc = " to set a callback to consume the received events."] - #[doc = " This function can be used if you re-implement events handling in your own"] - #[doc = " activity."] - #[doc = " Ownership of out_event is maintained by the caller."] - pub fn GameActivityKeyEvent_fromJava( - env: *mut JNIEnv, - motionEvent: jobject, - out_event: *mut GameActivityKeyEvent, - ); -} -#[doc = " This is the function that must be in the native code to instantiate the"] -#[doc = " application's native activity. It is called with the activity instance (see"] -#[doc = " above); if the code is being instantiated from a previously saved instance,"] -#[doc = " the savedState will be non-NULL and point to the saved data. You must make"] -#[doc = " any copy of this data you need -- it will be released after you return from"] -#[doc = " this function."] +#[doc = " This is the function that must be in the native code to instantiate the\n application's native activity. It is called with the activity instance (see\n above); if the code is being instantiated from a previously saved instance,\n the savedState will be non-NULL and point to the saved data. You must make\n any copy of this data you need -- it will be released after you return from\n this function."] pub type GameActivity_createFunc = ::std::option::Option< unsafe extern "C" fn( activity: *mut GameActivity, savedState: *mut ::std::os::raw::c_void, - savedStateSize: size_t, + savedStateSize: usize, ), >; extern "C" { - #[doc = " Finish the given activity. Its finish() method will be called, causing it"] - #[doc = " to be stopped and destroyed. Note that this method can be called from"] - #[doc = " *any* thread; it will send a message to the main thread of the process"] - #[doc = " where the Java finish call will take place."] + #[doc = " Finish the given activity. Its finish() method will be called, causing it\n to be stopped and destroyed. Note that this method can be called from\n *any* thread; it will send a message to the main thread of the process\n where the Java finish call will take place."] pub fn GameActivity_finish(activity: *mut GameActivity); } -#[doc = " As long as this window is visible to the user, allow the lock"] -#[doc = " screen to activate while the screen is on. This can be used"] -#[doc = " independently, or in combination with {@link"] -#[doc = " GAMEACTIVITY_FLAG_KEEP_SCREEN_ON} and/or {@link"] -#[doc = " GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED}"] +#[doc = " As long as this window is visible to the user, allow the lock\n screen to activate while the screen is on. This can be used\n independently, or in combination with {@link\n GAMEACTIVITY_FLAG_KEEP_SCREEN_ON} and/or {@link\n GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED}"] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_ALLOW_LOCK_WHILE_SCREEN_ON: GameActivitySetWindowFlags = 1; #[doc = " Everything behind this window will be dimmed."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_DIM_BEHIND: GameActivitySetWindowFlags = 2; -#[doc = " Blur everything behind this window."] -#[doc = " @deprecated Blurring is no longer supported."] +#[doc = " Blur everything behind this window.\n @deprecated Blurring is no longer supported."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_BLUR_BEHIND: GameActivitySetWindowFlags = 4; -#[doc = " This window won't ever get key input focus, so the"] -#[doc = " user can not send key or other button events to it. Those will"] -#[doc = " instead go to whatever focusable window is behind it. This flag"] -#[doc = " will also enable {@link GAMEACTIVITY_FLAG_NOT_TOUCH_MODAL} whether or not"] -#[doc = " that is explicitly set."] -#[doc = ""] -#[doc = " Setting this flag also implies that the window will not need to"] -#[doc = " interact with"] -#[doc = " a soft input method, so it will be Z-ordered and positioned"] -#[doc = " independently of any active input method (typically this means it"] -#[doc = " gets Z-ordered on top of the input method, so it can use the full"] -#[doc = " screen for its content and cover the input method if needed. You"] -#[doc = " can use {@link GAMEACTIVITY_FLAG_ALT_FOCUSABLE_IM} to modify this"] -#[doc = " behavior."] +#[doc = " This window won't ever get key input focus, so the\n user can not send key or other button events to it. Those will\n instead go to whatever focusable window is behind it. This flag\n will also enable {@link GAMEACTIVITY_FLAG_NOT_TOUCH_MODAL} whether or not\n that is explicitly set.\n\n Setting this flag also implies that the window will not need to\n interact with\n a soft input method, so it will be Z-ordered and positioned\n independently of any active input method (typically this means it\n gets Z-ordered on top of the input method, so it can use the full\n screen for its content and cover the input method if needed. You\n can use {@link GAMEACTIVITY_FLAG_ALT_FOCUSABLE_IM} to modify this\n behavior."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_NOT_FOCUSABLE: GameActivitySetWindowFlags = 8; #[doc = " This window can never receive touch events."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_NOT_TOUCHABLE: GameActivitySetWindowFlags = 16; -#[doc = " Even when this window is focusable (its"] -#[doc = " {@link GAMEACTIVITY_FLAG_NOT_FOCUSABLE} is not set), allow any pointer"] -#[doc = " events outside of the window to be sent to the windows behind it."] -#[doc = " Otherwise it will consume all pointer events itself, regardless of"] -#[doc = " whether they are inside of the window."] +#[doc = " Even when this window is focusable (its\n {@link GAMEACTIVITY_FLAG_NOT_FOCUSABLE} is not set), allow any pointer\n events outside of the window to be sent to the windows behind it.\n Otherwise it will consume all pointer events itself, regardless of\n whether they are inside of the window."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_NOT_TOUCH_MODAL: GameActivitySetWindowFlags = 32; -#[doc = " When set, if the device is asleep when the touch"] -#[doc = " screen is pressed, you will receive this first touch event. Usually"] -#[doc = " the first touch event is consumed by the system since the user can"] -#[doc = " not see what they are pressing on."] -#[doc = ""] -#[doc = " @deprecated This flag has no effect."] +#[doc = " When set, if the device is asleep when the touch\n screen is pressed, you will receive this first touch event. Usually\n the first touch event is consumed by the system since the user can\n not see what they are pressing on.\n\n @deprecated This flag has no effect."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_TOUCHABLE_WHEN_WAKING: GameActivitySetWindowFlags = 64; -#[doc = " As long as this window is visible to the user, keep"] -#[doc = " the device's screen turned on and bright."] +#[doc = " As long as this window is visible to the user, keep\n the device's screen turned on and bright."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_KEEP_SCREEN_ON: GameActivitySetWindowFlags = 128; -#[doc = " Place the window within the entire screen, ignoring"] -#[doc = " decorations around the border (such as the status bar). The"] -#[doc = " window must correctly position its contents to take the screen"] -#[doc = " decoration into account."] +#[doc = " Place the window within the entire screen, ignoring\n decorations around the border (such as the status bar). The\n window must correctly position its contents to take the screen\n decoration into account."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_LAYOUT_IN_SCREEN: GameActivitySetWindowFlags = 256; #[doc = " Allows the window to extend outside of the screen."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_LAYOUT_NO_LIMITS: GameActivitySetWindowFlags = 512; -#[doc = " Hide all screen decorations (such as the status"] -#[doc = " bar) while this window is displayed. This allows the window to"] -#[doc = " use the entire display space for itself -- the status bar will"] -#[doc = " be hidden when an app window with this flag set is on the top"] -#[doc = " layer. A fullscreen window will ignore a value of {@link"] -#[doc = " GAMEACTIVITY_SOFT_INPUT_ADJUST_RESIZE}; the window will stay"] -#[doc = " fullscreen and will not resize."] +#[doc = " Hide all screen decorations (such as the status\n bar) while this window is displayed. This allows the window to\n use the entire display space for itself -- the status bar will\n be hidden when an app window with this flag set is on the top\n layer. A fullscreen window will ignore a value of {@link\n GAMEACTIVITY_SOFT_INPUT_ADJUST_RESIZE}; the window will stay\n fullscreen and will not resize."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_FULLSCREEN: GameActivitySetWindowFlags = 1024; -#[doc = " Override {@link GAMEACTIVITY_FLAG_FULLSCREEN} and force the"] -#[doc = " screen decorations (such as the status bar) to be shown."] +#[doc = " Override {@link GAMEACTIVITY_FLAG_FULLSCREEN} and force the\n screen decorations (such as the status bar) to be shown."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_FORCE_NOT_FULLSCREEN: GameActivitySetWindowFlags = 2048; -#[doc = " Turn on dithering when compositing this window to"] -#[doc = " the screen."] -#[doc = " @deprecated This flag is no longer used."] +#[doc = " Turn on dithering when compositing this window to\n the screen.\n @deprecated This flag is no longer used."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_DITHER: GameActivitySetWindowFlags = 4096; -#[doc = " Treat the content of the window as secure, preventing"] -#[doc = " it from appearing in screenshots or from being viewed on non-secure"] -#[doc = " displays."] +#[doc = " Treat the content of the window as secure, preventing\n it from appearing in screenshots or from being viewed on non-secure\n displays."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_SECURE: GameActivitySetWindowFlags = 8192; -#[doc = " A special mode where the layout parameters are used"] -#[doc = " to perform scaling of the surface when it is composited to the"] -#[doc = " screen."] +#[doc = " A special mode where the layout parameters are used\n to perform scaling of the surface when it is composited to the\n screen."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_SCALED: GameActivitySetWindowFlags = 16384; -#[doc = " Intended for windows that will often be used when the user is"] -#[doc = " holding the screen against their face, it will aggressively"] -#[doc = " filter the event stream to prevent unintended presses in this"] -#[doc = " situation that may not be desired for a particular window, when"] -#[doc = " such an event stream is detected, the application will receive"] -#[doc = " a {@link AMOTION_EVENT_ACTION_CANCEL} to indicate this so"] -#[doc = " applications can handle this accordingly by taking no action on"] -#[doc = " the event until the finger is released."] +#[doc = " Intended for windows that will often be used when the user is\n holding the screen against their face, it will aggressively\n filter the event stream to prevent unintended presses in this\n situation that may not be desired for a particular window, when\n such an event stream is detected, the application will receive\n a {@link AMOTION_EVENT_ACTION_CANCEL} to indicate this so\n applications can handle this accordingly by taking no action on\n the event until the finger is released."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_IGNORE_CHEEK_PRESSES: GameActivitySetWindowFlags = 32768; -#[doc = " A special option only for use in combination with"] -#[doc = " {@link GAMEACTIVITY_FLAG_LAYOUT_IN_SCREEN}. When requesting layout in"] -#[doc = " the screen your window may appear on top of or behind screen decorations"] -#[doc = " such as the status bar. By also including this flag, the window"] -#[doc = " manager will report the inset rectangle needed to ensure your"] -#[doc = " content is not covered by screen decorations."] +#[doc = " A special option only for use in combination with\n {@link GAMEACTIVITY_FLAG_LAYOUT_IN_SCREEN}. When requesting layout in\n the screen your window may appear on top of or behind screen decorations\n such as the status bar. By also including this flag, the window\n manager will report the inset rectangle needed to ensure your\n content is not covered by screen decorations."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_LAYOUT_INSET_DECOR: GameActivitySetWindowFlags = 65536; -#[doc = " Invert the state of {@link GAMEACTIVITY_FLAG_NOT_FOCUSABLE} with"] -#[doc = " respect to how this window interacts with the current method."] -#[doc = " That is, if FLAG_NOT_FOCUSABLE is set and this flag is set,"] -#[doc = " then the window will behave as if it needs to interact with the"] -#[doc = " input method and thus be placed behind/away from it; if {@link"] -#[doc = " GAMEACTIVITY_FLAG_NOT_FOCUSABLE} is not set and this flag is set,"] -#[doc = " then the window will behave as if it doesn't need to interact"] -#[doc = " with the input method and can be placed to use more space and"] -#[doc = " cover the input method."] +#[doc = " Invert the state of {@link GAMEACTIVITY_FLAG_NOT_FOCUSABLE} with\n respect to how this window interacts with the current method.\n That is, if FLAG_NOT_FOCUSABLE is set and this flag is set,\n then the window will behave as if it needs to interact with the\n input method and thus be placed behind/away from it; if {@link\n GAMEACTIVITY_FLAG_NOT_FOCUSABLE} is not set and this flag is set,\n then the window will behave as if it doesn't need to interact\n with the input method and can be placed to use more space and\n cover the input method."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_ALT_FOCUSABLE_IM: GameActivitySetWindowFlags = 131072; -#[doc = " If you have set {@link GAMEACTIVITY_FLAG_NOT_TOUCH_MODAL}, you"] -#[doc = " can set this flag to receive a single special MotionEvent with"] -#[doc = " the action"] -#[doc = " {@link AMOTION_EVENT_ACTION_OUTSIDE} for"] -#[doc = " touches that occur outside of your window. Note that you will not"] -#[doc = " receive the full down/move/up gesture, only the location of the"] -#[doc = " first down as an {@link AMOTION_EVENT_ACTION_OUTSIDE}."] +#[doc = " If you have set {@link GAMEACTIVITY_FLAG_NOT_TOUCH_MODAL}, you\n can set this flag to receive a single special MotionEvent with\n the action\n {@link AMOTION_EVENT_ACTION_OUTSIDE} for\n touches that occur outside of your window. Note that you will not\n receive the full down/move/up gesture, only the location of the\n first down as an {@link AMOTION_EVENT_ACTION_OUTSIDE}."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_WATCH_OUTSIDE_TOUCH: GameActivitySetWindowFlags = 262144; -#[doc = " Special flag to let windows be shown when the screen"] -#[doc = " is locked. This will let application windows take precedence over"] -#[doc = " key guard or any other lock screens. Can be used with"] -#[doc = " {@link GAMEACTIVITY_FLAG_KEEP_SCREEN_ON} to turn screen on and display"] -#[doc = " windows directly before showing the key guard window. Can be used with"] -#[doc = " {@link GAMEACTIVITY_FLAG_DISMISS_KEYGUARD} to automatically fully"] -#[doc = " dismisss non-secure keyguards. This flag only applies to the top-most"] -#[doc = " full-screen window."] +#[doc = " Special flag to let windows be shown when the screen\n is locked. This will let application windows take precedence over\n key guard or any other lock screens. Can be used with\n {@link GAMEACTIVITY_FLAG_KEEP_SCREEN_ON} to turn screen on and display\n windows directly before showing the key guard window. Can be used with\n {@link GAMEACTIVITY_FLAG_DISMISS_KEYGUARD} to automatically fully\n dismisss non-secure keyguards. This flag only applies to the top-most\n full-screen window."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED: GameActivitySetWindowFlags = 524288; -#[doc = " Ask that the system wallpaper be shown behind"] -#[doc = " your window. The window surface must be translucent to be able"] -#[doc = " to actually see the wallpaper behind it; this flag just ensures"] -#[doc = " that the wallpaper surface will be there if this window actually"] -#[doc = " has translucent regions."] +#[doc = " Ask that the system wallpaper be shown behind\n your window. The window surface must be translucent to be able\n to actually see the wallpaper behind it; this flag just ensures\n that the wallpaper surface will be there if this window actually\n has translucent regions."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_SHOW_WALLPAPER: GameActivitySetWindowFlags = 1048576; -#[doc = " When set as a window is being added or made"] -#[doc = " visible, once the window has been shown then the system will"] -#[doc = " poke the power manager's user activity (as if the user had woken"] -#[doc = " up the device) to turn the screen on."] +#[doc = " When set as a window is being added or made\n visible, once the window has been shown then the system will\n poke the power manager's user activity (as if the user had woken\n up the device) to turn the screen on."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_TURN_SCREEN_ON: GameActivitySetWindowFlags = 2097152; -#[doc = " When set the window will cause the keyguard to"] -#[doc = " be dismissed, only if it is not a secure lock keyguard. Because such"] -#[doc = " a keyguard is not needed for security, it will never re-appear if"] -#[doc = " the user navigates to another window (in contrast to"] -#[doc = " {@link GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED}, which will only temporarily"] -#[doc = " hide both secure and non-secure keyguards but ensure they reappear"] -#[doc = " when the user moves to another UI that doesn't hide them)."] -#[doc = " If the keyguard is currently active and is secure (requires an"] -#[doc = " unlock pattern) than the user will still need to confirm it before"] -#[doc = " seeing this window, unless {@link GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED} has"] -#[doc = " also been set."] +#[doc = " When set the window will cause the keyguard to\n be dismissed, only if it is not a secure lock keyguard. Because such\n a keyguard is not needed for security, it will never re-appear if\n the user navigates to another window (in contrast to\n {@link GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED}, which will only temporarily\n hide both secure and non-secure keyguards but ensure they reappear\n when the user moves to another UI that doesn't hide them).\n If the keyguard is currently active and is secure (requires an\n unlock pattern) than the user will still need to confirm it before\n seeing this window, unless {@link GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED} has\n also been set."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_DISMISS_KEYGUARD: GameActivitySetWindowFlags = 4194304; -#[doc = " Flags for GameActivity_setWindowFlags,"] -#[doc = " as per the Java API at android.view.WindowManager.LayoutParams."] -pub type GameActivitySetWindowFlags = ::std::os::raw::c_uint; -extern "C" { - #[doc = " Change the window flags of the given activity. Calls getWindow().setFlags()"] - #[doc = " of the given activity."] - #[doc = " Note that some flags must be set before the window decoration is created,"] - #[doc = " see"] - #[doc = " https://developer.android.com/reference/android/view/Window#setFlags(int,%20int)."] - #[doc = " Note also that this method can be called from"] - #[doc = " *any* thread; it will send a message to the main thread of the process"] - #[doc = " where the Java finish call will take place."] +#[doc = " Flags for GameActivity_setWindowFlags,\n as per the Java API at android.view.WindowManager.LayoutParams."] +pub type GameActivitySetWindowFlags = u32; +extern "C" { + #[doc = " Change the window flags of the given activity. Calls getWindow().setFlags()\n of the given activity.\n Note that some flags must be set before the window decoration is created,\n see\n https://developer.android.com/reference/android/view/Window#setFlags(int,%20int).\n Note also that this method can be called from\n *any* thread; it will send a message to the main thread of the process\n where the Java finish call will take place."] pub fn GameActivity_setWindowFlags( activity: *mut GameActivity, addFlags: u32, removeFlags: u32, ); } -#[doc = " Implicit request to show the input window, not as the result"] -#[doc = " of a direct request by the user."] +#[doc = " Implicit request to show the input window, not as the result\n of a direct request by the user."] pub const GameActivityShowSoftInputFlags_GAMEACTIVITY_SHOW_SOFT_INPUT_IMPLICIT: GameActivityShowSoftInputFlags = 1; -#[doc = " The user has forced the input method open (such as by"] -#[doc = " long-pressing menu) so it should not be closed until they"] -#[doc = " explicitly do so."] +#[doc = " The user has forced the input method open (such as by\n long-pressing menu) so it should not be closed until they\n explicitly do so."] pub const GameActivityShowSoftInputFlags_GAMEACTIVITY_SHOW_SOFT_INPUT_FORCED: GameActivityShowSoftInputFlags = 2; -#[doc = " Flags for GameActivity_showSoftInput; see the Java InputMethodManager"] -#[doc = " API for documentation."] -pub type GameActivityShowSoftInputFlags = ::std::os::raw::c_uint; -extern "C" { - #[doc = " Show the IME while in the given activity. Calls"] - #[doc = " InputMethodManager.showSoftInput() for the given activity. Note that this"] - #[doc = " method can be called from *any* thread; it will send a message to the main"] - #[doc = " thread of the process where the Java call will take place."] +#[doc = " Flags for GameActivity_showSoftInput; see the Java InputMethodManager\n API for documentation."] +pub type GameActivityShowSoftInputFlags = u8; +extern "C" { + #[doc = " Show the IME while in the given activity. Calls\n InputMethodManager.showSoftInput() for the given activity. Note that this\n method can be called from *any* thread; it will send a message to the main\n thread of the process where the Java call will take place."] pub fn GameActivity_showSoftInput(activity: *mut GameActivity, flags: u32); } extern "C" { - #[doc = " Set the text entry state (see documentation of the GameTextInputState struct"] - #[doc = " in the Game Text Input library reference)."] - #[doc = ""] - #[doc = " Ownership of the state is maintained by the caller."] + #[doc = " Restarts the input method. Calls InputMethodManager.restartInput().\n Note that this method can be called from *any* thread; it will send a message\n to the main thread of the process where the Java call will take place."] + pub fn GameActivity_restartInput(activity: *mut GameActivity); +} +extern "C" { + #[doc = " Set the text entry state (see documentation of the GameTextInputState struct\n in the Game Text Input library reference).\n\n Ownership of the state is maintained by the caller."] pub fn GameActivity_setTextInputState( activity: *mut GameActivity, state: *const GameTextInputState, ); } extern "C" { - #[doc = " Get the last-received text entry state (see documentation of the"] - #[doc = " GameTextInputState struct in the Game Text Input library reference)."] - #[doc = ""] + #[doc = " Get the last-received text entry state (see documentation of the\n GameTextInputState struct in the Game Text Input library reference).\n"] pub fn GameActivity_getTextInputState( activity: *mut GameActivity, callback: GameTextInputGetStateCallback, @@ -3874,29 +3354,20 @@ extern "C" { #[doc = " Get a pointer to the GameTextInput library instance."] pub fn GameActivity_getTextInput(activity: *const GameActivity) -> *mut GameTextInput; } -#[doc = " The soft input window should only be hidden if it was not"] -#[doc = " explicitly shown by the user."] +#[doc = " The soft input window should only be hidden if it was not\n explicitly shown by the user."] pub const GameActivityHideSoftInputFlags_GAMEACTIVITY_HIDE_SOFT_INPUT_IMPLICIT_ONLY: GameActivityHideSoftInputFlags = 1; -#[doc = " The soft input window should normally be hidden, unless it was"] -#[doc = " originally shown with {@link GAMEACTIVITY_SHOW_SOFT_INPUT_FORCED}."] +#[doc = " The soft input window should normally be hidden, unless it was\n originally shown with {@link GAMEACTIVITY_SHOW_SOFT_INPUT_FORCED}."] pub const GameActivityHideSoftInputFlags_GAMEACTIVITY_HIDE_SOFT_INPUT_NOT_ALWAYS: GameActivityHideSoftInputFlags = 2; -#[doc = " Flags for GameActivity_hideSoftInput; see the Java InputMethodManager"] -#[doc = " API for documentation."] -pub type GameActivityHideSoftInputFlags = ::std::os::raw::c_uint; -extern "C" { - #[doc = " Hide the IME while in the given activity. Calls"] - #[doc = " InputMethodManager.hideSoftInput() for the given activity. Note that this"] - #[doc = " method can be called from *any* thread; it will send a message to the main"] - #[doc = " thread of the process where the Java finish call will take place."] +#[doc = " Flags for GameActivity_hideSoftInput; see the Java InputMethodManager\n API for documentation."] +pub type GameActivityHideSoftInputFlags = u16; +extern "C" { + #[doc = " Hide the IME while in the given activity. Calls\n InputMethodManager.hideSoftInput() for the given activity. Note that this\n method can be called from *any* thread; it will send a message to the main\n thread of the process where the Java finish call will take place."] pub fn GameActivity_hideSoftInput(activity: *mut GameActivity, flags: u32); } extern "C" { - #[doc = " Get the current window insets of the particular component. See"] - #[doc = " https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat.Type"] - #[doc = " for more details."] - #[doc = " You can use these insets to influence what you show on the screen."] + #[doc = " Get the current window insets of the particular component. See\n https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat.Type\n for more details.\n You can use these insets to influence what you show on the screen."] pub fn GameActivity_getWindowInsets( activity: *mut GameActivity, type_: GameCommonInsetsType, @@ -3904,107 +3375,200 @@ extern "C" { ); } extern "C" { - #[doc = " Set options on how the IME behaves when it is requested for text input."] - #[doc = " See"] - #[doc = " https://developer.android.com/reference/android/view/inputmethod/EditorInfo"] - #[doc = " for the meaning of inputType, actionId and imeOptions."] - #[doc = ""] - #[doc = " Note that this function will attach the current thread to the JVM if it is"] - #[doc = " not already attached, so the caller must detach the thread from the JVM"] - #[doc = " before the thread is destroyed using DetachCurrentThread."] + #[doc = " Tells whether the software keyboard is visible or not."] + pub fn GameActivity_isSoftwareKeyboardVisible(activity: *mut GameActivity) -> bool; +} +extern "C" { + #[doc = " Set options on how the IME behaves when it is requested for text input.\n See\n https://developer.android.com/reference/android/view/inputmethod/EditorInfo\n for the meaning of inputType, actionId and imeOptions.\n\n Note: currently only TYPE_NULL AND TYPE_CLASS_NUMBER are supported."] pub fn GameActivity_setImeEditorInfo( activity: *mut GameActivity, - inputType: ::std::os::raw::c_int, - actionId: ::std::os::raw::c_int, - imeOptions: ::std::os::raw::c_int, - ); -} -pub const ACONFIGURATION_ORIENTATION_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_ORIENTATION_PORT: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_ORIENTATION_LAND: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_ORIENTATION_SQUARE: ::std::os::raw::c_uint = 3; -pub const ACONFIGURATION_TOUCHSCREEN_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_TOUCHSCREEN_NOTOUCH: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_TOUCHSCREEN_STYLUS: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_TOUCHSCREEN_FINGER: ::std::os::raw::c_uint = 3; -pub const ACONFIGURATION_DENSITY_DEFAULT: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_DENSITY_LOW: ::std::os::raw::c_uint = 120; -pub const ACONFIGURATION_DENSITY_MEDIUM: ::std::os::raw::c_uint = 160; -pub const ACONFIGURATION_DENSITY_TV: ::std::os::raw::c_uint = 213; -pub const ACONFIGURATION_DENSITY_HIGH: ::std::os::raw::c_uint = 240; -pub const ACONFIGURATION_DENSITY_XHIGH: ::std::os::raw::c_uint = 320; -pub const ACONFIGURATION_DENSITY_XXHIGH: ::std::os::raw::c_uint = 480; -pub const ACONFIGURATION_DENSITY_XXXHIGH: ::std::os::raw::c_uint = 640; -pub const ACONFIGURATION_DENSITY_ANY: ::std::os::raw::c_uint = 65534; -pub const ACONFIGURATION_DENSITY_NONE: ::std::os::raw::c_uint = 65535; -pub const ACONFIGURATION_KEYBOARD_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_KEYBOARD_NOKEYS: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_KEYBOARD_QWERTY: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_KEYBOARD_12KEY: ::std::os::raw::c_uint = 3; -pub const ACONFIGURATION_NAVIGATION_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_NAVIGATION_NONAV: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_NAVIGATION_DPAD: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_NAVIGATION_TRACKBALL: ::std::os::raw::c_uint = 3; -pub const ACONFIGURATION_NAVIGATION_WHEEL: ::std::os::raw::c_uint = 4; -pub const ACONFIGURATION_KEYSHIDDEN_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_KEYSHIDDEN_NO: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_KEYSHIDDEN_YES: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_KEYSHIDDEN_SOFT: ::std::os::raw::c_uint = 3; -pub const ACONFIGURATION_NAVHIDDEN_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_NAVHIDDEN_NO: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_NAVHIDDEN_YES: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_SCREENSIZE_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_SCREENSIZE_SMALL: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_SCREENSIZE_NORMAL: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_SCREENSIZE_LARGE: ::std::os::raw::c_uint = 3; -pub const ACONFIGURATION_SCREENSIZE_XLARGE: ::std::os::raw::c_uint = 4; -pub const ACONFIGURATION_SCREENLONG_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_SCREENLONG_NO: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_SCREENLONG_YES: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_SCREENROUND_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_SCREENROUND_NO: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_SCREENROUND_YES: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_WIDE_COLOR_GAMUT_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_WIDE_COLOR_GAMUT_NO: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_WIDE_COLOR_GAMUT_YES: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_HDR_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_HDR_NO: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_HDR_YES: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_UI_MODE_TYPE_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_UI_MODE_TYPE_NORMAL: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_UI_MODE_TYPE_DESK: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_UI_MODE_TYPE_CAR: ::std::os::raw::c_uint = 3; -pub const ACONFIGURATION_UI_MODE_TYPE_TELEVISION: ::std::os::raw::c_uint = 4; -pub const ACONFIGURATION_UI_MODE_TYPE_APPLIANCE: ::std::os::raw::c_uint = 5; -pub const ACONFIGURATION_UI_MODE_TYPE_WATCH: ::std::os::raw::c_uint = 6; -pub const ACONFIGURATION_UI_MODE_TYPE_VR_HEADSET: ::std::os::raw::c_uint = 7; -pub const ACONFIGURATION_UI_MODE_NIGHT_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_UI_MODE_NIGHT_NO: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_UI_MODE_NIGHT_YES: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_SCREEN_WIDTH_DP_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_SCREEN_HEIGHT_DP_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_LAYOUTDIR_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_LAYOUTDIR_LTR: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_LAYOUTDIR_RTL: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_MCC: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_MNC: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_LOCALE: ::std::os::raw::c_uint = 4; -pub const ACONFIGURATION_TOUCHSCREEN: ::std::os::raw::c_uint = 8; -pub const ACONFIGURATION_KEYBOARD: ::std::os::raw::c_uint = 16; -pub const ACONFIGURATION_KEYBOARD_HIDDEN: ::std::os::raw::c_uint = 32; -pub const ACONFIGURATION_NAVIGATION: ::std::os::raw::c_uint = 64; -pub const ACONFIGURATION_ORIENTATION: ::std::os::raw::c_uint = 128; -pub const ACONFIGURATION_DENSITY: ::std::os::raw::c_uint = 256; -pub const ACONFIGURATION_SCREEN_SIZE: ::std::os::raw::c_uint = 512; -pub const ACONFIGURATION_VERSION: ::std::os::raw::c_uint = 1024; -pub const ACONFIGURATION_SCREEN_LAYOUT: ::std::os::raw::c_uint = 2048; -pub const ACONFIGURATION_UI_MODE: ::std::os::raw::c_uint = 4096; -pub const ACONFIGURATION_SMALLEST_SCREEN_SIZE: ::std::os::raw::c_uint = 8192; -pub const ACONFIGURATION_LAYOUTDIR: ::std::os::raw::c_uint = 16384; -pub const ACONFIGURATION_SCREEN_ROUND: ::std::os::raw::c_uint = 32768; -pub const ACONFIGURATION_COLOR_MODE: ::std::os::raw::c_uint = 65536; -pub const ACONFIGURATION_MNC_ZERO: ::std::os::raw::c_uint = 65535; + inputType: GameTextInputType, + actionId: GameTextInputActionType, + imeOptions: GameTextInputImeOptions, + ); +} +extern "C" { + #[doc = " These are getters for Configuration class members. They may be called from\n any thread."] + pub fn GameActivity_getOrientation(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getColorMode(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getDensityDpi(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getFontScale(activity: *mut GameActivity) -> f32; +} +extern "C" { + pub fn GameActivity_getFontWeightAdjustment( + activity: *mut GameActivity, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getHardKeyboardHidden(activity: *mut GameActivity) + -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getKeyboard(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getKeyboardHidden(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getLocalesCount(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getMcc(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getMnc(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getNavigation(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getNavigationHidden(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getScreenHeightDp(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getScreenLayout(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getScreenWidthDp(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getSmallestScreenWidthDp( + activity: *mut GameActivity, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getTouchscreen(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getUIMode(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " The functions below return Java locale information.\n\n In simple cases there will be just one locale, but it's possible tha\n there are more than one locale objects. Users are encouraged to write code\n that handles all locales and not just the first one.\n\n The functions in the block below return string values in the provided buffer.\n Return value is zero if there were no errors, otherwise it's non-zero.\n If the return value is zero, `dst` will contain a null-terminated string:\n strlen(dst) <= dst_size - 1.\n If the return value is non-zero, the content of dst is undefined.\n\n Parameters:\n\n dst, dst_size: define a receiver buffer. Locale string can be something\n short like \"EN/EN\", but it may be longer. You should be safe with a buffer\n size of 256 bytes.\n\n If the buffer is too small, ENOBUFS is returned. Try allocating a larger\n buffer in this case.\n\n localeIdx must be between 0 and the value of GameActivity_getLocalesCount().\n If localeIdx is out of range, EINVAL is returned.\n\n Refer to Java documentation of locales for more information."] + pub fn GameActivity_getLocaleLanguage( + dst: *mut ::std::os::raw::c_char, + dst_size: usize, + activity: *mut GameActivity, + localeIdx: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getLocaleScript( + dst: *mut ::std::os::raw::c_char, + dst_size: usize, + activity: *mut GameActivity, + localeIdx: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getLocaleCountry( + dst: *mut ::std::os::raw::c_char, + dst_size: usize, + activity: *mut GameActivity, + localeIdx: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getLocaleVariant( + dst: *mut ::std::os::raw::c_char, + dst_size: usize, + activity: *mut GameActivity, + localeIdx: usize, + ) -> ::std::os::raw::c_int; +} +pub const ACONFIGURATION_ORIENTATION_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_ORIENTATION_PORT: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_ORIENTATION_LAND: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_ORIENTATION_SQUARE: _bindgen_ty_21 = 3; +pub const ACONFIGURATION_TOUCHSCREEN_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_TOUCHSCREEN_NOTOUCH: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_TOUCHSCREEN_STYLUS: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_TOUCHSCREEN_FINGER: _bindgen_ty_21 = 3; +pub const ACONFIGURATION_DENSITY_DEFAULT: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_DENSITY_LOW: _bindgen_ty_21 = 120; +pub const ACONFIGURATION_DENSITY_MEDIUM: _bindgen_ty_21 = 160; +pub const ACONFIGURATION_DENSITY_TV: _bindgen_ty_21 = 213; +pub const ACONFIGURATION_DENSITY_HIGH: _bindgen_ty_21 = 240; +pub const ACONFIGURATION_DENSITY_XHIGH: _bindgen_ty_21 = 320; +pub const ACONFIGURATION_DENSITY_XXHIGH: _bindgen_ty_21 = 480; +pub const ACONFIGURATION_DENSITY_XXXHIGH: _bindgen_ty_21 = 640; +pub const ACONFIGURATION_DENSITY_ANY: _bindgen_ty_21 = 65534; +pub const ACONFIGURATION_DENSITY_NONE: _bindgen_ty_21 = 65535; +pub const ACONFIGURATION_KEYBOARD_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_KEYBOARD_NOKEYS: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_KEYBOARD_QWERTY: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_KEYBOARD_12KEY: _bindgen_ty_21 = 3; +pub const ACONFIGURATION_NAVIGATION_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_NAVIGATION_NONAV: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_NAVIGATION_DPAD: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_NAVIGATION_TRACKBALL: _bindgen_ty_21 = 3; +pub const ACONFIGURATION_NAVIGATION_WHEEL: _bindgen_ty_21 = 4; +pub const ACONFIGURATION_KEYSHIDDEN_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_KEYSHIDDEN_NO: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_KEYSHIDDEN_YES: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_KEYSHIDDEN_SOFT: _bindgen_ty_21 = 3; +pub const ACONFIGURATION_NAVHIDDEN_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_NAVHIDDEN_NO: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_NAVHIDDEN_YES: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_SCREENSIZE_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_SCREENSIZE_SMALL: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_SCREENSIZE_NORMAL: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_SCREENSIZE_LARGE: _bindgen_ty_21 = 3; +pub const ACONFIGURATION_SCREENSIZE_XLARGE: _bindgen_ty_21 = 4; +pub const ACONFIGURATION_SCREENLONG_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_SCREENLONG_NO: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_SCREENLONG_YES: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_SCREENROUND_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_SCREENROUND_NO: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_SCREENROUND_YES: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_WIDE_COLOR_GAMUT_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_WIDE_COLOR_GAMUT_NO: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_WIDE_COLOR_GAMUT_YES: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_HDR_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_HDR_NO: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_HDR_YES: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_UI_MODE_TYPE_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_UI_MODE_TYPE_NORMAL: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_UI_MODE_TYPE_DESK: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_UI_MODE_TYPE_CAR: _bindgen_ty_21 = 3; +pub const ACONFIGURATION_UI_MODE_TYPE_TELEVISION: _bindgen_ty_21 = 4; +pub const ACONFIGURATION_UI_MODE_TYPE_APPLIANCE: _bindgen_ty_21 = 5; +pub const ACONFIGURATION_UI_MODE_TYPE_WATCH: _bindgen_ty_21 = 6; +pub const ACONFIGURATION_UI_MODE_TYPE_VR_HEADSET: _bindgen_ty_21 = 7; +pub const ACONFIGURATION_UI_MODE_NIGHT_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_UI_MODE_NIGHT_NO: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_UI_MODE_NIGHT_YES: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_SCREEN_WIDTH_DP_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_SCREEN_HEIGHT_DP_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_LAYOUTDIR_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_LAYOUTDIR_LTR: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_LAYOUTDIR_RTL: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_MCC: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_MNC: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_LOCALE: _bindgen_ty_21 = 4; +pub const ACONFIGURATION_TOUCHSCREEN: _bindgen_ty_21 = 8; +pub const ACONFIGURATION_KEYBOARD: _bindgen_ty_21 = 16; +pub const ACONFIGURATION_KEYBOARD_HIDDEN: _bindgen_ty_21 = 32; +pub const ACONFIGURATION_NAVIGATION: _bindgen_ty_21 = 64; +pub const ACONFIGURATION_ORIENTATION: _bindgen_ty_21 = 128; +pub const ACONFIGURATION_DENSITY: _bindgen_ty_21 = 256; +pub const ACONFIGURATION_SCREEN_SIZE: _bindgen_ty_21 = 512; +pub const ACONFIGURATION_VERSION: _bindgen_ty_21 = 1024; +pub const ACONFIGURATION_SCREEN_LAYOUT: _bindgen_ty_21 = 2048; +pub const ACONFIGURATION_UI_MODE: _bindgen_ty_21 = 4096; +pub const ACONFIGURATION_SMALLEST_SCREEN_SIZE: _bindgen_ty_21 = 8192; +pub const ACONFIGURATION_LAYOUTDIR: _bindgen_ty_21 = 16384; +pub const ACONFIGURATION_SCREEN_ROUND: _bindgen_ty_21 = 32768; +pub const ACONFIGURATION_COLOR_MODE: _bindgen_ty_21 = 65536; +pub const ACONFIGURATION_MNC_ZERO: _bindgen_ty_21 = 65535; pub type _bindgen_ty_21 = ::std::os::raw::c_uint; #[repr(C)] #[derive(Debug, Copy, Clone)] @@ -4015,45 +3579,28 @@ pub struct pollfd { } #[test] fn bindgen_test_layout_pollfd() { - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(pollfd)) - ); + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!(::std::mem::size_of::(), 8usize, "Size of pollfd"); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(pollfd)) + "Alignment of pollfd" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fd as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fd) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(pollfd), - "::", - stringify!(fd) - ) + "Offset of field: pollfd::fd" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).events as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).events) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(pollfd), - "::", - stringify!(events) - ) + "Offset of field: pollfd::events" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).revents as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).revents) as usize - ptr as usize }, 6usize, - concat!( - "Offset of field: ", - stringify!(pollfd), - "::", - stringify!(revents) - ) + "Offset of field: pollfd::revents" ); } #[repr(C)] @@ -4070,75 +3617,47 @@ pub struct sigcontext { } #[test] fn bindgen_test_layout_sigcontext() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 4384usize, - concat!("Size of: ", stringify!(sigcontext)) + "Size of sigcontext" ); assert_eq!( ::std::mem::align_of::(), 16usize, - concat!("Alignment of ", stringify!(sigcontext)) + "Alignment of sigcontext" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fault_address as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fault_address) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(fault_address) - ) + "Offset of field: sigcontext::fault_address" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).regs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).regs) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(regs) - ) + "Offset of field: sigcontext::regs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sp as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sp) as usize - ptr as usize }, 256usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(sp) - ) + "Offset of field: sigcontext::sp" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).pc as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).pc) as usize - ptr as usize }, 264usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(pc) - ) + "Offset of field: sigcontext::pc" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).pstate as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).pstate) as usize - ptr as usize }, 272usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(pstate) - ) + "Offset of field: sigcontext::pstate" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).__reserved as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).__reserved) as usize - ptr as usize }, 288usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(__reserved) - ) + "Offset of field: sigcontext::__reserved" ); } #[repr(C)] @@ -4149,35 +3668,27 @@ pub struct _aarch64_ctx { } #[test] fn bindgen_test_layout__aarch64_ctx() { + const UNINIT: ::std::mem::MaybeUninit<_aarch64_ctx> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<_aarch64_ctx>(), 8usize, - concat!("Size of: ", stringify!(_aarch64_ctx)) + "Size of _aarch64_ctx" ); assert_eq!( ::std::mem::align_of::<_aarch64_ctx>(), 4usize, - concat!("Alignment of ", stringify!(_aarch64_ctx)) + "Alignment of _aarch64_ctx" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_aarch64_ctx>())).magic as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).magic) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_aarch64_ctx), - "::", - stringify!(magic) - ) + "Offset of field: _aarch64_ctx::magic" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_aarch64_ctx>())).size as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).size) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(_aarch64_ctx), - "::", - stringify!(size) - ) + "Offset of field: _aarch64_ctx::size" ); } #[repr(C)] @@ -4191,55 +3702,37 @@ pub struct fpsimd_context { } #[test] fn bindgen_test_layout_fpsimd_context() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 528usize, - concat!("Size of: ", stringify!(fpsimd_context)) + "Size of fpsimd_context" ); assert_eq!( ::std::mem::align_of::(), 16usize, - concat!("Alignment of ", stringify!(fpsimd_context)) + "Alignment of fpsimd_context" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).head as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).head) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(fpsimd_context), - "::", - stringify!(head) - ) + "Offset of field: fpsimd_context::head" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fpsr as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fpsr) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(fpsimd_context), - "::", - stringify!(fpsr) - ) + "Offset of field: fpsimd_context::fpsr" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fpcr as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fpcr) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(fpsimd_context), - "::", - stringify!(fpcr) - ) + "Offset of field: fpsimd_context::fpcr" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).vregs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).vregs) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(fpsimd_context), - "::", - stringify!(vregs) - ) + "Offset of field: fpsimd_context::vregs" ); } #[repr(C)] @@ -4250,35 +3743,27 @@ pub struct esr_context { } #[test] fn bindgen_test_layout_esr_context() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 16usize, - concat!("Size of: ", stringify!(esr_context)) + "Size of esr_context" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(esr_context)) + "Alignment of esr_context" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).head as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).head) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(esr_context), - "::", - stringify!(head) - ) + "Offset of field: esr_context::head" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).esr as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).esr) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(esr_context), - "::", - stringify!(esr) - ) + "Offset of field: esr_context::esr" ); } #[repr(C)] @@ -4291,105 +3776,185 @@ pub struct extra_context { } #[test] fn bindgen_test_layout_extra_context() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 32usize, - concat!("Size of: ", stringify!(extra_context)) + "Size of extra_context" + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + "Alignment of extra_context" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).head) as usize - ptr as usize }, + 0usize, + "Offset of field: extra_context::head" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).datap) as usize - ptr as usize }, + 8usize, + "Offset of field: extra_context::datap" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).size) as usize - ptr as usize }, + 16usize, + "Offset of field: extra_context::size" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__reserved) as usize - ptr as usize }, + 20usize, + "Offset of field: extra_context::__reserved" + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sve_context { + pub head: _aarch64_ctx, + pub vl: __u16, + pub flags: __u16, + pub __reserved: [__u16; 2usize], +} +#[test] +fn bindgen_test_layout_sve_context() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 16usize, + "Size of sve_context" + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + "Alignment of sve_context" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).head) as usize - ptr as usize }, + 0usize, + "Offset of field: sve_context::head" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).vl) as usize - ptr as usize }, + 8usize, + "Offset of field: sve_context::vl" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, + 10usize, + "Offset of field: sve_context::flags" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__reserved) as usize - ptr as usize }, + 12usize, + "Offset of field: sve_context::__reserved" + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct tpidr2_context { + pub head: _aarch64_ctx, + pub tpidr2: __u64, +} +#[test] +fn bindgen_test_layout_tpidr2_context() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 16usize, + "Size of tpidr2_context" + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + "Alignment of tpidr2_context" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).head) as usize - ptr as usize }, + 0usize, + "Offset of field: tpidr2_context::head" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).tpidr2) as usize - ptr as usize }, + 8usize, + "Offset of field: tpidr2_context::tpidr2" + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct za_context { + pub head: _aarch64_ctx, + pub vl: __u16, + pub __reserved: [__u16; 3usize], +} +#[test] +fn bindgen_test_layout_za_context() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 16usize, + "Size of za_context" ); assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(extra_context)) + ::std::mem::align_of::(), + 4usize, + "Alignment of za_context" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).head as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).head) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(extra_context), - "::", - stringify!(head) - ) + "Offset of field: za_context::head" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).datap as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).vl) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(extra_context), - "::", - stringify!(datap) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).size as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(extra_context), - "::", - stringify!(size) - ) + "Offset of field: za_context::vl" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).__reserved as *const _ as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(extra_context), - "::", - stringify!(__reserved) - ) + unsafe { ::std::ptr::addr_of!((*ptr).__reserved) as usize - ptr as usize }, + 10usize, + "Offset of field: za_context::__reserved" ); } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct sve_context { +pub struct zt_context { pub head: _aarch64_ctx, - pub vl: __u16, + pub nregs: __u16, pub __reserved: [__u16; 3usize], } #[test] -fn bindgen_test_layout_sve_context() { +fn bindgen_test_layout_zt_context() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - ::std::mem::size_of::(), + ::std::mem::size_of::(), 16usize, - concat!("Size of: ", stringify!(sve_context)) + "Size of zt_context" ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(sve_context)) + "Alignment of zt_context" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).head as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).head) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sve_context), - "::", - stringify!(head) - ) + "Offset of field: zt_context::head" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).vl as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).nregs) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(sve_context), - "::", - stringify!(vl) - ) + "Offset of field: zt_context::nregs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).__reserved as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).__reserved) as usize - ptr as usize }, 10usize, - concat!( - "Offset of field: ", - stringify!(sve_context), - "::", - stringify!(__reserved) - ) + "Offset of field: zt_context::__reserved" ); } #[repr(C)] @@ -4399,25 +3964,22 @@ pub struct sigset_t { } #[test] fn bindgen_test_layout_sigset_t() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 8usize, - concat!("Size of: ", stringify!(sigset_t)) + "Size of sigset_t" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(sigset_t)) + "Alignment of sigset_t" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sig as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sig) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigset_t), - "::", - stringify!(sig) - ) + "Offset of field: sigset_t::sig" ); } pub type old_sigset_t = ::std::os::raw::c_ulong; @@ -4435,104 +3997,74 @@ pub struct __kernel_sigaction { } #[test] fn bindgen_test_layout___kernel_sigaction() { + const UNINIT: ::std::mem::MaybeUninit<__kernel_sigaction> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__kernel_sigaction>(), 32usize, - concat!("Size of: ", stringify!(__kernel_sigaction)) + "Size of __kernel_sigaction" ); assert_eq!( ::std::mem::align_of::<__kernel_sigaction>(), 8usize, - concat!("Alignment of ", stringify!(__kernel_sigaction)) + "Alignment of __kernel_sigaction" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_sigaction>())).sa_handler as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_handler) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__kernel_sigaction), - "::", - stringify!(sa_handler) - ) + "Offset of field: __kernel_sigaction::sa_handler" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_sigaction>())).sa_flags as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_flags) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__kernel_sigaction), - "::", - stringify!(sa_flags) - ) + "Offset of field: __kernel_sigaction::sa_flags" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_sigaction>())).sa_restorer as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_restorer) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(__kernel_sigaction), - "::", - stringify!(sa_restorer) - ) + "Offset of field: __kernel_sigaction::sa_restorer" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_sigaction>())).sa_mask as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_mask) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(__kernel_sigaction), - "::", - stringify!(sa_mask) - ) + "Offset of field: __kernel_sigaction::sa_mask" ); } #[repr(C)] +#[derive(Debug, Copy, Clone)] pub struct sigaltstack { pub ss_sp: *mut ::std::os::raw::c_void, pub ss_flags: ::std::os::raw::c_int, - pub ss_size: size_t, + pub ss_size: __kernel_size_t, } #[test] fn bindgen_test_layout_sigaltstack() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 24usize, - concat!("Size of: ", stringify!(sigaltstack)) + "Size of sigaltstack" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(sigaltstack)) + "Alignment of sigaltstack" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ss_sp as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ss_sp) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigaltstack), - "::", - stringify!(ss_sp) - ) + "Offset of field: sigaltstack::ss_sp" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ss_flags as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ss_flags) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(sigaltstack), - "::", - stringify!(ss_flags) - ) + "Offset of field: sigaltstack::ss_flags" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ss_size as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ss_size) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(sigaltstack), - "::", - stringify!(ss_size) - ) + "Offset of field: sigaltstack::ss_size" ); } pub type stack_t = sigaltstack; @@ -4544,35 +4076,23 @@ pub union sigval { } #[test] fn bindgen_test_layout_sigval() { - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(sigval)) - ); + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!(::std::mem::size_of::(), 8usize, "Size of sigval"); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(sigval)) + "Alignment of sigval" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sival_int as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sival_int) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigval), - "::", - stringify!(sival_int) - ) + "Offset of field: sigval::sival_int" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sival_ptr as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sival_ptr) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigval), - "::", - stringify!(sival_ptr) - ) + "Offset of field: sigval::sival_ptr" ); } pub type sigval_t = sigval; @@ -4595,35 +4115,28 @@ pub struct __sifields__bindgen_ty_1 { } #[test] fn bindgen_test_layout___sifields__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_1> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_1>(), 8usize, - concat!("Size of: ", stringify!(__sifields__bindgen_ty_1)) + "Size of __sifields__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_1>(), 4usize, - concat!("Alignment of ", stringify!(__sifields__bindgen_ty_1)) + "Alignment of __sifields__bindgen_ty_1" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_1>()))._pid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._pid) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_1), - "::", - stringify!(_pid) - ) + "Offset of field: __sifields__bindgen_ty_1::_pid" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_1>()))._uid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._uid) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_1), - "::", - stringify!(_uid) - ) + "Offset of field: __sifields__bindgen_ty_1::_uid" ); } #[repr(C)] @@ -4636,61 +4149,38 @@ pub struct __sifields__bindgen_ty_2 { } #[test] fn bindgen_test_layout___sifields__bindgen_ty_2() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_2> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_2>(), 24usize, - concat!("Size of: ", stringify!(__sifields__bindgen_ty_2)) + "Size of __sifields__bindgen_ty_2" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_2>(), 8usize, - concat!("Alignment of ", stringify!(__sifields__bindgen_ty_2)) + "Alignment of __sifields__bindgen_ty_2" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_2>()))._tid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._tid) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_2), - "::", - stringify!(_tid) - ) + "Offset of field: __sifields__bindgen_ty_2::_tid" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_2>()))._overrun as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._overrun) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_2), - "::", - stringify!(_overrun) - ) + "Offset of field: __sifields__bindgen_ty_2::_overrun" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_2>()))._sigval as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._sigval) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_2), - "::", - stringify!(_sigval) - ) + "Offset of field: __sifields__bindgen_ty_2::_sigval" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_2>()))._sys_private as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._sys_private) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_2), - "::", - stringify!(_sys_private) - ) + "Offset of field: __sifields__bindgen_ty_2::_sys_private" ); } #[repr(C)] @@ -4702,47 +4192,33 @@ pub struct __sifields__bindgen_ty_3 { } #[test] fn bindgen_test_layout___sifields__bindgen_ty_3() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_3> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_3>(), 16usize, - concat!("Size of: ", stringify!(__sifields__bindgen_ty_3)) + "Size of __sifields__bindgen_ty_3" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_3>(), 8usize, - concat!("Alignment of ", stringify!(__sifields__bindgen_ty_3)) + "Alignment of __sifields__bindgen_ty_3" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_3>()))._pid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._pid) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_3), - "::", - stringify!(_pid) - ) + "Offset of field: __sifields__bindgen_ty_3::_pid" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_3>()))._uid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._uid) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_3), - "::", - stringify!(_uid) - ) + "Offset of field: __sifields__bindgen_ty_3::_uid" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_3>()))._sigval as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._sigval) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_3), - "::", - stringify!(_sigval) - ) + "Offset of field: __sifields__bindgen_ty_3::_sigval" ); } #[repr(C)] @@ -4756,67 +4232,43 @@ pub struct __sifields__bindgen_ty_4 { } #[test] fn bindgen_test_layout___sifields__bindgen_ty_4() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_4> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_4>(), 32usize, - concat!("Size of: ", stringify!(__sifields__bindgen_ty_4)) + "Size of __sifields__bindgen_ty_4" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_4>(), 8usize, - concat!("Alignment of ", stringify!(__sifields__bindgen_ty_4)) + "Alignment of __sifields__bindgen_ty_4" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_4>()))._pid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._pid) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_4), - "::", - stringify!(_pid) - ) + "Offset of field: __sifields__bindgen_ty_4::_pid" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_4>()))._uid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._uid) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_4), - "::", - stringify!(_uid) - ) + "Offset of field: __sifields__bindgen_ty_4::_uid" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_4>()))._status as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._status) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_4), - "::", - stringify!(_status) - ) + "Offset of field: __sifields__bindgen_ty_4::_status" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_4>()))._utime as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._utime) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_4), - "::", - stringify!(_utime) - ) + "Offset of field: __sifields__bindgen_ty_4::_utime" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_4>()))._stime as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._stime) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_4), - "::", - stringify!(_stime) - ) + "Offset of field: __sifields__bindgen_ty_4::_stime" ); } #[repr(C)] @@ -4828,9 +4280,11 @@ pub struct __sifields__bindgen_ty_5 { #[repr(C)] #[derive(Copy, Clone)] pub union __sifields__bindgen_ty_5__bindgen_ty_1 { + pub _trapno: ::std::os::raw::c_int, pub _addr_lsb: ::std::os::raw::c_short, pub _addr_bnd: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1, pub _addr_pkey: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2, + pub _perf: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3, } #[repr(C)] #[derive(Debug, Copy, Clone)] @@ -4841,60 +4295,33 @@ pub struct __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1 { } #[test] fn bindgen_test_layout___sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1>(), 24usize, - concat!( - "Size of: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1) - ) + "Size of __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1>(), 8usize, - concat!( - "Alignment of ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1) - ) + "Alignment of __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1>())) - ._dummy_bnd as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._dummy_bnd) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(_dummy_bnd) - ) + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1::_dummy_bnd" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1>()))._lower - as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._lower) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(_lower) - ) + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1::_lower" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1>()))._upper - as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._upper) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(_upper) - ) + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1::_upper" ); } #[repr(C)] @@ -4905,128 +4332,128 @@ pub struct __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2 { } #[test] fn bindgen_test_layout___sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2>(), 12usize, - concat!( - "Size of: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2) - ) + "Size of __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2>(), 4usize, - concat!( - "Alignment of ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2) - ) + "Alignment of __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2>())) - ._dummy_pkey as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._dummy_pkey) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2), - "::", - stringify!(_dummy_pkey) - ) + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2::_dummy_pkey" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2>()))._pkey - as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._pkey) as usize - ptr as usize }, + 8usize, + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2::_pkey" + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3 { + pub _data: ::std::os::raw::c_ulong, + pub _type: __u32, + pub _flags: __u32, +} +#[test] +fn bindgen_test_layout___sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3>(), + 16usize, + "Size of __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3" + ); + assert_eq!( + ::std::mem::align_of::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3>(), 8usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2), - "::", - stringify!(_pkey) - ) + "Alignment of __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._data) as usize - ptr as usize }, + 0usize, + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3::_data" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._type) as usize - ptr as usize }, + 8usize, + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3::_type" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._flags) as usize - ptr as usize }, + 12usize, + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3::_flags" ); } #[test] fn bindgen_test_layout___sifields__bindgen_ty_5__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_5__bindgen_ty_1> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_5__bindgen_ty_1>(), 24usize, - concat!( - "Size of: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1) - ) + "Size of __sifields__bindgen_ty_5__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_5__bindgen_ty_1>(), 8usize, - concat!( - "Alignment of ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1) - ) + "Alignment of __sifields__bindgen_ty_5__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_5__bindgen_ty_1>()))._addr_lsb as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._trapno) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1), - "::", - stringify!(_addr_lsb) - ) + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1::_trapno" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_5__bindgen_ty_1>()))._addr_bnd as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._addr_lsb) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1), - "::", - stringify!(_addr_bnd) - ) + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1::_addr_lsb" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_5__bindgen_ty_1>()))._addr_pkey - as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._addr_bnd) as usize - ptr as usize }, + 0usize, + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1::_addr_bnd" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._addr_pkey) as usize - ptr as usize }, + 0usize, + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1::_addr_pkey" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._perf) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1), - "::", - stringify!(_addr_pkey) - ) + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1::_perf" ); } #[test] fn bindgen_test_layout___sifields__bindgen_ty_5() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_5> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_5>(), 32usize, - concat!("Size of: ", stringify!(__sifields__bindgen_ty_5)) + "Size of __sifields__bindgen_ty_5" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_5>(), 8usize, - concat!("Alignment of ", stringify!(__sifields__bindgen_ty_5)) + "Alignment of __sifields__bindgen_ty_5" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_5>()))._addr as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._addr) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5), - "::", - stringify!(_addr) - ) + "Offset of field: __sifields__bindgen_ty_5::_addr" ); } #[repr(C)] @@ -5037,35 +4464,28 @@ pub struct __sifields__bindgen_ty_6 { } #[test] fn bindgen_test_layout___sifields__bindgen_ty_6() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_6> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_6>(), 16usize, - concat!("Size of: ", stringify!(__sifields__bindgen_ty_6)) + "Size of __sifields__bindgen_ty_6" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_6>(), 8usize, - concat!("Alignment of ", stringify!(__sifields__bindgen_ty_6)) + "Alignment of __sifields__bindgen_ty_6" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_6>()))._band as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._band) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_6), - "::", - stringify!(_band) - ) + "Offset of field: __sifields__bindgen_ty_6::_band" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_6>()))._fd as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._fd) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_6), - "::", - stringify!(_fd) - ) + "Offset of field: __sifields__bindgen_ty_6::_fd" ); } #[repr(C)] @@ -5077,132 +4497,83 @@ pub struct __sifields__bindgen_ty_7 { } #[test] fn bindgen_test_layout___sifields__bindgen_ty_7() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_7> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_7>(), 16usize, - concat!("Size of: ", stringify!(__sifields__bindgen_ty_7)) + "Size of __sifields__bindgen_ty_7" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_7>(), 8usize, - concat!("Alignment of ", stringify!(__sifields__bindgen_ty_7)) + "Alignment of __sifields__bindgen_ty_7" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_7>()))._call_addr as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._call_addr) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_7), - "::", - stringify!(_call_addr) - ) + "Offset of field: __sifields__bindgen_ty_7::_call_addr" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_7>()))._syscall as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._syscall) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_7), - "::", - stringify!(_syscall) - ) + "Offset of field: __sifields__bindgen_ty_7::_syscall" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_7>()))._arch as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._arch) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_7), - "::", - stringify!(_arch) - ) + "Offset of field: __sifields__bindgen_ty_7::_arch" ); } #[test] fn bindgen_test_layout___sifields() { + const UNINIT: ::std::mem::MaybeUninit<__sifields> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields>(), 32usize, - concat!("Size of: ", stringify!(__sifields)) + "Size of __sifields" ); assert_eq!( ::std::mem::align_of::<__sifields>(), 8usize, - concat!("Alignment of ", stringify!(__sifields)) + "Alignment of __sifields" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields>()))._kill as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._kill) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields), - "::", - stringify!(_kill) - ) + "Offset of field: __sifields::_kill" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields>()))._timer as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._timer) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields), - "::", - stringify!(_timer) - ) + "Offset of field: __sifields::_timer" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields>()))._rt as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._rt) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields), - "::", - stringify!(_rt) - ) + "Offset of field: __sifields::_rt" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields>()))._sigchld as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._sigchld) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields), - "::", - stringify!(_sigchld) - ) + "Offset of field: __sifields::_sigchld" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields>()))._sigfault as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._sigfault) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields), - "::", - stringify!(_sigfault) - ) + "Offset of field: __sifields::_sigfault" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields>()))._sigpoll as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._sigpoll) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields), - "::", - stringify!(_sigpoll) - ) + "Offset of field: __sifields::_sigpoll" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields>()))._sigsys as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._sigsys) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields), - "::", - stringify!(_sigsys) - ) + "Offset of field: __sifields::_sigsys" ); } #[repr(C)] @@ -5226,93 +4597,59 @@ pub struct siginfo__bindgen_ty_1__bindgen_ty_1 { } #[test] fn bindgen_test_layout_siginfo__bindgen_ty_1__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 48usize, - concat!("Size of: ", stringify!(siginfo__bindgen_ty_1__bindgen_ty_1)) + "Size of siginfo__bindgen_ty_1__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!( - "Alignment of ", - stringify!(siginfo__bindgen_ty_1__bindgen_ty_1) - ) + "Alignment of siginfo__bindgen_ty_1__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).si_signo as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).si_signo) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(siginfo__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(si_signo) - ) + "Offset of field: siginfo__bindgen_ty_1__bindgen_ty_1::si_signo" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).si_errno as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).si_errno) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(siginfo__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(si_errno) - ) + "Offset of field: siginfo__bindgen_ty_1__bindgen_ty_1::si_errno" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).si_code as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).si_code) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(siginfo__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(si_code) - ) + "Offset of field: siginfo__bindgen_ty_1__bindgen_ty_1::si_code" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::()))._sifields as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._sifields) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(siginfo__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(_sifields) - ) + "Offset of field: siginfo__bindgen_ty_1__bindgen_ty_1::_sifields" ); } #[test] fn bindgen_test_layout_siginfo__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 128usize, - concat!("Size of: ", stringify!(siginfo__bindgen_ty_1)) + "Size of siginfo__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(siginfo__bindgen_ty_1)) + "Alignment of siginfo__bindgen_ty_1" ); assert_eq!( - unsafe { &(*(::std::ptr::null::()))._si_pad as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._si_pad) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(siginfo__bindgen_ty_1), - "::", - stringify!(_si_pad) - ) + "Offset of field: siginfo__bindgen_ty_1::_si_pad" ); } #[test] @@ -5320,12 +4657,12 @@ fn bindgen_test_layout_siginfo() { assert_eq!( ::std::mem::size_of::(), 128usize, - concat!("Size of: ", stringify!(siginfo)) + "Size of siginfo" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(siginfo)) + "Alignment of siginfo" ); } pub type siginfo_t = siginfo; @@ -5352,145 +4689,94 @@ pub struct sigevent__bindgen_ty_1__bindgen_ty_1 { } #[test] fn bindgen_test_layout_sigevent__bindgen_ty_1__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 16usize, - concat!( - "Size of: ", - stringify!(sigevent__bindgen_ty_1__bindgen_ty_1) - ) + "Size of sigevent__bindgen_ty_1__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!( - "Alignment of ", - stringify!(sigevent__bindgen_ty_1__bindgen_ty_1) - ) + "Alignment of sigevent__bindgen_ty_1__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::()))._function as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._function) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigevent__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(_function) - ) + "Offset of field: sigevent__bindgen_ty_1__bindgen_ty_1::_function" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::()))._attribute as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._attribute) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(sigevent__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(_attribute) - ) + "Offset of field: sigevent__bindgen_ty_1__bindgen_ty_1::_attribute" ); } #[test] fn bindgen_test_layout_sigevent__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 48usize, - concat!("Size of: ", stringify!(sigevent__bindgen_ty_1)) + "Size of sigevent__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(sigevent__bindgen_ty_1)) + "Alignment of sigevent__bindgen_ty_1" ); assert_eq!( - unsafe { &(*(::std::ptr::null::()))._pad as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._pad) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigevent__bindgen_ty_1), - "::", - stringify!(_pad) - ) + "Offset of field: sigevent__bindgen_ty_1::_pad" ); assert_eq!( - unsafe { &(*(::std::ptr::null::()))._tid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._tid) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigevent__bindgen_ty_1), - "::", - stringify!(_tid) - ) + "Offset of field: sigevent__bindgen_ty_1::_tid" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::()))._sigev_thread as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._sigev_thread) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigevent__bindgen_ty_1), - "::", - stringify!(_sigev_thread) - ) + "Offset of field: sigevent__bindgen_ty_1::_sigev_thread" ); } #[test] fn bindgen_test_layout_sigevent() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 64usize, - concat!("Size of: ", stringify!(sigevent)) + "Size of sigevent" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(sigevent)) + "Alignment of sigevent" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sigev_value as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sigev_value) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigevent), - "::", - stringify!(sigev_value) - ) + "Offset of field: sigevent::sigev_value" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sigev_signo as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sigev_signo) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(sigevent), - "::", - stringify!(sigev_signo) - ) + "Offset of field: sigevent::sigev_signo" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sigev_notify as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sigev_notify) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(sigevent), - "::", - stringify!(sigev_notify) - ) + "Offset of field: sigevent::sigev_notify" ); assert_eq!( - unsafe { &(*(::std::ptr::null::()))._sigev_un as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._sigev_un) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(sigevent), - "::", - stringify!(_sigev_un) - ) + "Offset of field: sigevent::_sigev_un" ); } pub type sigevent_t = sigevent; @@ -5520,82 +4806,58 @@ pub union sigaction__bindgen_ty_1 { } #[test] fn bindgen_test_layout_sigaction__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 8usize, - concat!("Size of: ", stringify!(sigaction__bindgen_ty_1)) + "Size of sigaction__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(sigaction__bindgen_ty_1)) + "Alignment of sigaction__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).sa_handler as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_handler) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigaction__bindgen_ty_1), - "::", - stringify!(sa_handler) - ) + "Offset of field: sigaction__bindgen_ty_1::sa_handler" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).sa_sigaction as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_sigaction) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigaction__bindgen_ty_1), - "::", - stringify!(sa_sigaction) - ) + "Offset of field: sigaction__bindgen_ty_1::sa_sigaction" ); } #[test] fn bindgen_test_layout_sigaction() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 32usize, - concat!("Size of: ", stringify!(sigaction)) + "Size of sigaction" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(sigaction)) + "Alignment of sigaction" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sa_flags as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_flags) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigaction), - "::", - stringify!(sa_flags) - ) + "Offset of field: sigaction::sa_flags" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sa_mask as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_mask) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(sigaction), - "::", - stringify!(sa_mask) - ) + "Offset of field: sigaction::sa_mask" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sa_restorer as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_restorer) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(sigaction), - "::", - stringify!(sa_restorer) - ) + "Offset of field: sigaction::sa_restorer" ); } #[repr(C)] @@ -5620,82 +4882,58 @@ pub union sigaction64__bindgen_ty_1 { } #[test] fn bindgen_test_layout_sigaction64__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 8usize, - concat!("Size of: ", stringify!(sigaction64__bindgen_ty_1)) + "Size of sigaction64__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(sigaction64__bindgen_ty_1)) + "Alignment of sigaction64__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).sa_handler as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_handler) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigaction64__bindgen_ty_1), - "::", - stringify!(sa_handler) - ) + "Offset of field: sigaction64__bindgen_ty_1::sa_handler" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).sa_sigaction as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_sigaction) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigaction64__bindgen_ty_1), - "::", - stringify!(sa_sigaction) - ) + "Offset of field: sigaction64__bindgen_ty_1::sa_sigaction" ); } #[test] fn bindgen_test_layout_sigaction64() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 32usize, - concat!("Size of: ", stringify!(sigaction64)) + "Size of sigaction64" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(sigaction64)) + "Alignment of sigaction64" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sa_flags as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_flags) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigaction64), - "::", - stringify!(sa_flags) - ) + "Offset of field: sigaction64::sa_flags" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sa_mask as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_mask) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(sigaction64), - "::", - stringify!(sa_mask) - ) + "Offset of field: sigaction64::sa_mask" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sa_restorer as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_restorer) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(sigaction64), - "::", - stringify!(sa_restorer) - ) + "Offset of field: sigaction64::sa_restorer" ); } #[repr(C)] @@ -5706,35 +4944,27 @@ pub struct timespec { } #[test] fn bindgen_test_layout_timespec() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 16usize, - concat!("Size of: ", stringify!(timespec)) + "Size of timespec" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(timespec)) + "Alignment of timespec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tv_sec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tv_sec) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(timespec), - "::", - stringify!(tv_sec) - ) + "Offset of field: timespec::tv_sec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tv_nsec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tv_nsec) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(timespec), - "::", - stringify!(tv_nsec) - ) + "Offset of field: timespec::tv_nsec" ); } #[repr(C)] @@ -5747,55 +4977,37 @@ pub struct user_regs_struct { } #[test] fn bindgen_test_layout_user_regs_struct() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 272usize, - concat!("Size of: ", stringify!(user_regs_struct)) + "Size of user_regs_struct" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(user_regs_struct)) + "Alignment of user_regs_struct" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).regs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).regs) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(regs) - ) + "Offset of field: user_regs_struct::regs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sp as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sp) as usize - ptr as usize }, 248usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(sp) - ) + "Offset of field: user_regs_struct::sp" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).pc as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).pc) as usize - ptr as usize }, 256usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(pc) - ) + "Offset of field: user_regs_struct::pc" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).pstate as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).pstate) as usize - ptr as usize }, 264usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(pstate) - ) + "Offset of field: user_regs_struct::pstate" ); } #[repr(C)] @@ -5808,45 +5020,32 @@ pub struct user_fpsimd_struct { } #[test] fn bindgen_test_layout_user_fpsimd_struct() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 528usize, - concat!("Size of: ", stringify!(user_fpsimd_struct)) + "Size of user_fpsimd_struct" ); assert_eq!( ::std::mem::align_of::(), 16usize, - concat!("Alignment of ", stringify!(user_fpsimd_struct)) + "Alignment of user_fpsimd_struct" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).vregs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).vregs) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(user_fpsimd_struct), - "::", - stringify!(vregs) - ) + "Offset of field: user_fpsimd_struct::vregs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fpsr as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fpsr) as usize - ptr as usize }, 512usize, - concat!( - "Offset of field: ", - stringify!(user_fpsimd_struct), - "::", - stringify!(fpsr) - ) + "Offset of field: user_fpsimd_struct::fpsr" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fpcr as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fpcr) as usize - ptr as usize }, 516usize, - concat!( - "Offset of field: ", - stringify!(user_fpsimd_struct), - "::", - stringify!(fpcr) - ) + "Offset of field: user_fpsimd_struct::fpcr" ); } pub type greg_t = ::std::os::raw::c_ulong; @@ -5855,6 +5054,7 @@ pub type fpregset_t = user_fpsimd_struct; pub type mcontext_t = sigcontext; #[repr(C)] #[repr(align(16))] +#[derive(Copy, Clone)] pub struct ucontext { pub uc_flags: ::std::os::raw::c_ulong, pub uc_link: *mut ucontext, @@ -5872,102 +5072,68 @@ pub union ucontext__bindgen_ty_1 { } #[test] fn bindgen_test_layout_ucontext__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 8usize, - concat!("Size of: ", stringify!(ucontext__bindgen_ty_1)) + "Size of ucontext__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(ucontext__bindgen_ty_1)) + "Alignment of ucontext__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).uc_sigmask as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).uc_sigmask) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(ucontext__bindgen_ty_1), - "::", - stringify!(uc_sigmask) - ) + "Offset of field: ucontext__bindgen_ty_1::uc_sigmask" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).uc_sigmask64 as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).uc_sigmask64) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(ucontext__bindgen_ty_1), - "::", - stringify!(uc_sigmask64) - ) + "Offset of field: ucontext__bindgen_ty_1::uc_sigmask64" ); } #[test] fn bindgen_test_layout_ucontext() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 4560usize, - concat!("Size of: ", stringify!(ucontext)) + "Size of ucontext" ); assert_eq!( ::std::mem::align_of::(), 16usize, - concat!("Alignment of ", stringify!(ucontext)) + "Alignment of ucontext" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).uc_flags as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).uc_flags) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(ucontext), - "::", - stringify!(uc_flags) - ) + "Offset of field: ucontext::uc_flags" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).uc_link as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).uc_link) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(ucontext), - "::", - stringify!(uc_link) - ) + "Offset of field: ucontext::uc_link" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).uc_stack as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).uc_stack) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(ucontext), - "::", - stringify!(uc_stack) - ) + "Offset of field: ucontext::uc_stack" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).__padding as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).__padding) as usize - ptr as usize }, 48usize, - concat!( - "Offset of field: ", - stringify!(ucontext), - "::", - stringify!(__padding) - ) + "Offset of field: ucontext::__padding" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).uc_mcontext as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).uc_mcontext) as usize - ptr as usize }, 176usize, - concat!( - "Offset of field: ", - stringify!(ucontext), - "::", - stringify!(uc_mcontext) - ) + "Offset of field: ucontext::uc_mcontext" ); } pub type ucontext_t = ucontext; @@ -6174,35 +5340,27 @@ pub struct __kernel_timespec { } #[test] fn bindgen_test_layout___kernel_timespec() { + const UNINIT: ::std::mem::MaybeUninit<__kernel_timespec> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__kernel_timespec>(), 16usize, - concat!("Size of: ", stringify!(__kernel_timespec)) + "Size of __kernel_timespec" ); assert_eq!( ::std::mem::align_of::<__kernel_timespec>(), 8usize, - concat!("Alignment of ", stringify!(__kernel_timespec)) + "Alignment of __kernel_timespec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_timespec>())).tv_sec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tv_sec) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__kernel_timespec), - "::", - stringify!(tv_sec) - ) + "Offset of field: __kernel_timespec::tv_sec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_timespec>())).tv_nsec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tv_nsec) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__kernel_timespec), - "::", - stringify!(tv_nsec) - ) + "Offset of field: __kernel_timespec::tv_nsec" ); } #[repr(C)] @@ -6213,74 +5371,59 @@ pub struct __kernel_itimerspec { } #[test] fn bindgen_test_layout___kernel_itimerspec() { + const UNINIT: ::std::mem::MaybeUninit<__kernel_itimerspec> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__kernel_itimerspec>(), 32usize, - concat!("Size of: ", stringify!(__kernel_itimerspec)) + "Size of __kernel_itimerspec" ); assert_eq!( ::std::mem::align_of::<__kernel_itimerspec>(), 8usize, - concat!("Alignment of ", stringify!(__kernel_itimerspec)) + "Alignment of __kernel_itimerspec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_itimerspec>())).it_interval as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).it_interval) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__kernel_itimerspec), - "::", - stringify!(it_interval) - ) + "Offset of field: __kernel_itimerspec::it_interval" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_itimerspec>())).it_value as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).it_value) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(__kernel_itimerspec), - "::", - stringify!(it_value) - ) + "Offset of field: __kernel_itimerspec::it_value" ); } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct __kernel_old_timeval { - pub tv_sec: __kernel_long_t, - pub tv_usec: __kernel_long_t, +pub struct __kernel_old_timespec { + pub tv_sec: __kernel_old_time_t, + pub tv_nsec: ::std::os::raw::c_long, } #[test] -fn bindgen_test_layout___kernel_old_timeval() { +fn bindgen_test_layout___kernel_old_timespec() { + const UNINIT: ::std::mem::MaybeUninit<__kernel_old_timespec> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - ::std::mem::size_of::<__kernel_old_timeval>(), + ::std::mem::size_of::<__kernel_old_timespec>(), 16usize, - concat!("Size of: ", stringify!(__kernel_old_timeval)) + "Size of __kernel_old_timespec" ); assert_eq!( - ::std::mem::align_of::<__kernel_old_timeval>(), + ::std::mem::align_of::<__kernel_old_timespec>(), 8usize, - concat!("Alignment of ", stringify!(__kernel_old_timeval)) + "Alignment of __kernel_old_timespec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_old_timeval>())).tv_sec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tv_sec) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__kernel_old_timeval), - "::", - stringify!(tv_sec) - ) + "Offset of field: __kernel_old_timespec::tv_sec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_old_timeval>())).tv_usec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tv_nsec) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__kernel_old_timeval), - "::", - stringify!(tv_usec) - ) + "Offset of field: __kernel_old_timespec::tv_nsec" ); } #[repr(C)] @@ -6291,113 +5434,55 @@ pub struct __kernel_sock_timeval { } #[test] fn bindgen_test_layout___kernel_sock_timeval() { + const UNINIT: ::std::mem::MaybeUninit<__kernel_sock_timeval> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__kernel_sock_timeval>(), 16usize, - concat!("Size of: ", stringify!(__kernel_sock_timeval)) + "Size of __kernel_sock_timeval" ); assert_eq!( ::std::mem::align_of::<__kernel_sock_timeval>(), 8usize, - concat!("Alignment of ", stringify!(__kernel_sock_timeval)) + "Alignment of __kernel_sock_timeval" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_sock_timeval>())).tv_sec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tv_sec) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__kernel_sock_timeval), - "::", - stringify!(tv_sec) - ) + "Offset of field: __kernel_sock_timeval::tv_sec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_sock_timeval>())).tv_usec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tv_usec) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__kernel_sock_timeval), - "::", - stringify!(tv_usec) - ) + "Offset of field: __kernel_sock_timeval::tv_usec" ); } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct timeval { - pub tv_sec: __kernel_time_t, + pub tv_sec: __kernel_old_time_t, pub tv_usec: __kernel_suseconds_t, } #[test] fn bindgen_test_layout_timeval() { - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(timeval)) - ); + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!(::std::mem::size_of::(), 16usize, "Size of timeval"); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(timeval)) + "Alignment of timeval" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tv_sec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tv_sec) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(timeval), - "::", - stringify!(tv_sec) - ) + "Offset of field: timeval::tv_sec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tv_usec as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(timeval), - "::", - stringify!(tv_usec) - ) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct timezone { - pub tz_minuteswest: ::std::os::raw::c_int, - pub tz_dsttime: ::std::os::raw::c_int, -} -#[test] -fn bindgen_test_layout_timezone() { - assert_eq!( - ::std::mem::size_of::(), + unsafe { ::std::ptr::addr_of!((*ptr).tv_usec) as usize - ptr as usize }, 8usize, - concat!("Size of: ", stringify!(timezone)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(timezone)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).tz_minuteswest as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(timezone), - "::", - stringify!(tz_minuteswest) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).tz_dsttime as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(timezone), - "::", - stringify!(tz_dsttime) - ) + "Offset of field: timeval::tv_usec" ); } #[repr(C)] @@ -6408,35 +5493,27 @@ pub struct itimerspec { } #[test] fn bindgen_test_layout_itimerspec() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 32usize, - concat!("Size of: ", stringify!(itimerspec)) + "Size of itimerspec" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(itimerspec)) + "Alignment of itimerspec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).it_interval as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).it_interval) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(itimerspec), - "::", - stringify!(it_interval) - ) + "Offset of field: itimerspec::it_interval" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).it_value as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).it_value) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(itimerspec), - "::", - stringify!(it_value) - ) + "Offset of field: itimerspec::it_value" ); } #[repr(C)] @@ -6447,35 +5524,58 @@ pub struct itimerval { } #[test] fn bindgen_test_layout_itimerval() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 32usize, - concat!("Size of: ", stringify!(itimerval)) + "Size of itimerval" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(itimerval)) + "Alignment of itimerval" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).it_interval as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).it_interval) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(itimerval), - "::", - stringify!(it_interval) - ) + "Offset of field: itimerval::it_interval" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).it_value as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).it_value) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(itimerval), - "::", - stringify!(it_value) - ) + "Offset of field: itimerval::it_value" + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct timezone { + pub tz_minuteswest: ::std::os::raw::c_int, + pub tz_dsttime: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_timezone() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 8usize, + "Size of timezone" + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + "Alignment of timezone" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).tz_minuteswest) as usize - ptr as usize }, + 0usize, + "Offset of field: timezone::tz_minuteswest" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).tz_dsttime) as usize - ptr as usize }, + 4usize, + "Offset of field: timezone::tz_dsttime" ); } pub type fd_mask = ::std::os::raw::c_ulong; @@ -6486,43 +5586,36 @@ pub struct fd_set { } #[test] fn bindgen_test_layout_fd_set() { - assert_eq!( - ::std::mem::size_of::(), - 128usize, - concat!("Size of: ", stringify!(fd_set)) - ); + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!(::std::mem::size_of::(), 128usize, "Size of fd_set"); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(fd_set)) + "Alignment of fd_set" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fds_bits as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fds_bits) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(fd_set), - "::", - stringify!(fds_bits) - ) + "Offset of field: fd_set::fds_bits" ); } extern "C" { - pub fn __FD_CLR_chk(arg1: ::std::os::raw::c_int, arg2: *mut fd_set, arg3: size_t); + pub fn __FD_CLR_chk(arg1: ::std::os::raw::c_int, arg2: *mut fd_set, arg3: usize); } extern "C" { - pub fn __FD_SET_chk(arg1: ::std::os::raw::c_int, arg2: *mut fd_set, arg3: size_t); + pub fn __FD_SET_chk(arg1: ::std::os::raw::c_int, arg2: *mut fd_set, arg3: usize); } extern "C" { pub fn __FD_ISSET_chk( arg1: ::std::os::raw::c_int, arg2: *const fd_set, - arg3: size_t, + arg3: usize, ) -> ::std::os::raw::c_int; } extern "C" { pub fn select( - __fd_count: ::std::os::raw::c_int, + __max_fd_plus_one: ::std::os::raw::c_int, __read_fds: *mut fd_set, __write_fds: *mut fd_set, __exception_fds: *mut fd_set, @@ -6531,7 +5624,7 @@ extern "C" { } extern "C" { pub fn pselect( - __fd_count: ::std::os::raw::c_int, + __max_fd_plus_one: ::std::os::raw::c_int, __read_fds: *mut fd_set, __write_fds: *mut fd_set, __exception_fds: *mut fd_set, @@ -6541,7 +5634,7 @@ extern "C" { } extern "C" { pub fn pselect64( - __fd_count: ::std::os::raw::c_int, + __max_fd_plus_one: ::std::os::raw::c_int, __read_fds: *mut fd_set, __write_fds: *mut fd_set, __exception_fds: *mut fd_set, @@ -6606,125 +5699,64 @@ pub struct tm { } #[test] fn bindgen_test_layout_tm() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!(::std::mem::size_of::(), 56usize, "Size of tm"); + assert_eq!(::std::mem::align_of::(), 8usize, "Alignment of tm"); assert_eq!( - ::std::mem::size_of::(), - 56usize, - concat!("Size of: ", stringify!(tm)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(tm)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_sec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_sec) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_sec) - ) + "Offset of field: tm::tm_sec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_min as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_min) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_min) - ) + "Offset of field: tm::tm_min" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_hour as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_hour) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_hour) - ) + "Offset of field: tm::tm_hour" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_mday as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_mday) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_mday) - ) + "Offset of field: tm::tm_mday" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_mon as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_mon) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_mon) - ) + "Offset of field: tm::tm_mon" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_year as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_year) as usize - ptr as usize }, 20usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_year) - ) + "Offset of field: tm::tm_year" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_wday as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_wday) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_wday) - ) + "Offset of field: tm::tm_wday" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_yday as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_yday) as usize - ptr as usize }, 28usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_yday) - ) + "Offset of field: tm::tm_yday" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_isdst as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_isdst) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_isdst) - ) + "Offset of field: tm::tm_isdst" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_gmtoff as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_gmtoff) as usize - ptr as usize }, 40usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_gmtoff) - ) + "Offset of field: tm::tm_gmtoff" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_zone as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_zone) as usize - ptr as usize }, 48usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_zone) - ) + "Offset of field: tm::tm_zone" ); } extern "C" { @@ -6757,12 +5789,18 @@ extern "C" { extern "C" { pub fn localtime_r(__t: *const time_t, __tm: *mut tm) -> *mut tm; } +extern "C" { + pub fn timelocal(__tm: *mut tm) -> time_t; +} extern "C" { pub fn gmtime(__t: *const time_t) -> *mut tm; } extern "C" { pub fn gmtime_r(__t: *const time_t, __tm: *mut tm) -> *mut tm; } +extern "C" { + pub fn timegm(__tm: *mut tm) -> time_t; +} extern "C" { pub fn strptime( __s: *const ::std::os::raw::c_char, @@ -6781,19 +5819,19 @@ extern "C" { extern "C" { pub fn strftime( __buf: *mut ::std::os::raw::c_char, - __n: size_t, + __n: usize, __fmt: *const ::std::os::raw::c_char, __tm: *const tm, - ) -> size_t; + ) -> usize; } extern "C" { pub fn strftime_l( __buf: *mut ::std::os::raw::c_char, - __n: size_t, + __n: usize, __fmt: *const ::std::os::raw::c_char, __tm: *const tm, __l: locale_t, - ) -> size_t; + ) -> usize; } extern "C" { pub fn ctime(__t: *const time_t) -> *mut ::std::os::raw::c_char; @@ -6849,19 +5887,19 @@ extern "C" { ) -> ::std::os::raw::c_int; } extern "C" { - pub fn timer_gettime(__timer: timer_t, __ts: *mut itimerspec) -> ::std::os::raw::c_int; + pub fn timer_gettime(_timer: timer_t, __ts: *mut itimerspec) -> ::std::os::raw::c_int; } extern "C" { pub fn timer_getoverrun(__timer: timer_t) -> ::std::os::raw::c_int; } extern "C" { - pub fn timelocal(__tm: *mut tm) -> time_t; -} -extern "C" { - pub fn timegm(__tm: *mut tm) -> time_t; + pub fn timespec_get( + __ts: *mut timespec, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; } extern "C" { - pub fn timespec_get( + pub fn timespec_getres( __ts: *mut timespec, __base: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; @@ -6901,98 +5939,78 @@ pub struct clone_args { pub stack: __u64, pub stack_size: __u64, pub tls: __u64, + pub set_tid: __u64, + pub set_tid_size: __u64, + pub cgroup: __u64, } #[test] fn bindgen_test_layout_clone_args() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), - 64usize, - concat!("Size of: ", stringify!(clone_args)) + 88usize, + "Size of clone_args" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(clone_args)) + "Alignment of clone_args" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(clone_args), - "::", - stringify!(flags) - ) + "Offset of field: clone_args::flags" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).pidfd as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).pidfd) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(clone_args), - "::", - stringify!(pidfd) - ) + "Offset of field: clone_args::pidfd" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).child_tid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).child_tid) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(clone_args), - "::", - stringify!(child_tid) - ) + "Offset of field: clone_args::child_tid" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).parent_tid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).parent_tid) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(clone_args), - "::", - stringify!(parent_tid) - ) + "Offset of field: clone_args::parent_tid" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).exit_signal as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).exit_signal) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(clone_args), - "::", - stringify!(exit_signal) - ) + "Offset of field: clone_args::exit_signal" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).stack as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).stack) as usize - ptr as usize }, 40usize, - concat!( - "Offset of field: ", - stringify!(clone_args), - "::", - stringify!(stack) - ) + "Offset of field: clone_args::stack" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).stack_size as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).stack_size) as usize - ptr as usize }, 48usize, - concat!( - "Offset of field: ", - stringify!(clone_args), - "::", - stringify!(stack_size) - ) + "Offset of field: clone_args::stack_size" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tls as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tls) as usize - ptr as usize }, 56usize, - concat!( - "Offset of field: ", - stringify!(clone_args), - "::", - stringify!(tls) - ) + "Offset of field: clone_args::tls" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).set_tid) as usize - ptr as usize }, + 64usize, + "Offset of field: clone_args::set_tid" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).set_tid_size) as usize - ptr as usize }, + 72usize, + "Offset of field: clone_args::set_tid_size" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).cgroup) as usize - ptr as usize }, + 80usize, + "Offset of field: clone_args::cgroup" ); } #[repr(C)] @@ -7002,25 +6020,22 @@ pub struct sched_param { } #[test] fn bindgen_test_layout_sched_param() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 4usize, - concat!("Size of: ", stringify!(sched_param)) + "Size of sched_param" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(sched_param)) + "Alignment of sched_param" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sched_priority as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sched_priority) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sched_param), - "::", - stringify!(sched_priority) - ) + "Offset of field: sched_param::sched_priority" ); } extern "C" { @@ -7051,356 +6066,207 @@ extern "C" { extern "C" { pub fn sched_rr_get_interval(__pid: pid_t, __quantum: *mut timespec) -> ::std::os::raw::c_int; } -pub const PTHREAD_MUTEX_NORMAL: ::std::os::raw::c_uint = 0; -pub const PTHREAD_MUTEX_RECURSIVE: ::std::os::raw::c_uint = 1; -pub const PTHREAD_MUTEX_ERRORCHECK: ::std::os::raw::c_uint = 2; -pub const PTHREAD_MUTEX_ERRORCHECK_NP: ::std::os::raw::c_uint = 2; -pub const PTHREAD_MUTEX_RECURSIVE_NP: ::std::os::raw::c_uint = 1; -pub const PTHREAD_MUTEX_DEFAULT: ::std::os::raw::c_uint = 0; +pub const PTHREAD_MUTEX_NORMAL: _bindgen_ty_22 = 0; +pub const PTHREAD_MUTEX_RECURSIVE: _bindgen_ty_22 = 1; +pub const PTHREAD_MUTEX_ERRORCHECK: _bindgen_ty_22 = 2; +pub const PTHREAD_MUTEX_ERRORCHECK_NP: _bindgen_ty_22 = 2; +pub const PTHREAD_MUTEX_RECURSIVE_NP: _bindgen_ty_22 = 1; +pub const PTHREAD_MUTEX_DEFAULT: _bindgen_ty_22 = 0; pub type _bindgen_ty_22 = ::std::os::raw::c_uint; -pub const PTHREAD_RWLOCK_PREFER_READER_NP: ::std::os::raw::c_uint = 0; -pub const PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP: ::std::os::raw::c_uint = 1; +pub const PTHREAD_RWLOCK_PREFER_READER_NP: _bindgen_ty_23 = 0; +pub const PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP: _bindgen_ty_23 = 1; pub type _bindgen_ty_23 = ::std::os::raw::c_uint; -pub type __pthread_cleanup_func_t = - ::std::option::Option; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct __pthread_cleanup_t { pub __cleanup_prev: *mut __pthread_cleanup_t, - pub __cleanup_routine: __pthread_cleanup_func_t, + pub __cleanup_routine: + ::std::option::Option, pub __cleanup_arg: *mut ::std::os::raw::c_void, } #[test] fn bindgen_test_layout___pthread_cleanup_t() { + const UNINIT: ::std::mem::MaybeUninit<__pthread_cleanup_t> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__pthread_cleanup_t>(), 24usize, - concat!("Size of: ", stringify!(__pthread_cleanup_t)) + "Size of __pthread_cleanup_t" ); assert_eq!( ::std::mem::align_of::<__pthread_cleanup_t>(), 8usize, - concat!("Alignment of ", stringify!(__pthread_cleanup_t)) + "Alignment of __pthread_cleanup_t" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__pthread_cleanup_t>())).__cleanup_prev as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).__cleanup_prev) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__pthread_cleanup_t), - "::", - stringify!(__cleanup_prev) - ) + "Offset of field: __pthread_cleanup_t::__cleanup_prev" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__pthread_cleanup_t>())).__cleanup_routine as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).__cleanup_routine) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__pthread_cleanup_t), - "::", - stringify!(__cleanup_routine) - ) + "Offset of field: __pthread_cleanup_t::__cleanup_routine" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__pthread_cleanup_t>())).__cleanup_arg as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).__cleanup_arg) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(__pthread_cleanup_t), - "::", - stringify!(__cleanup_arg) - ) + "Offset of field: __pthread_cleanup_t::__cleanup_arg" ); } extern "C" { pub fn __pthread_cleanup_push( c: *mut __pthread_cleanup_t, - arg1: __pthread_cleanup_func_t, + arg1: ::std::option::Option, arg2: *mut ::std::os::raw::c_void, ); } extern "C" { pub fn __pthread_cleanup_pop(arg1: *mut __pthread_cleanup_t, arg2: ::std::os::raw::c_int); } -#[doc = " Data associated with an ALooper fd that will be returned as the \"outData\""] -#[doc = " when that source has data ready."] +#[doc = " Data associated with an ALooper fd that will be returned as the \"outData\"\n when that source has data ready."] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct android_poll_source { - #[doc = " The identifier of this source. May be LOOPER_ID_MAIN or"] - #[doc = " LOOPER_ID_INPUT."] + #[doc = " The identifier of this source. May be LOOPER_ID_MAIN or\n LOOPER_ID_INPUT."] pub id: i32, #[doc = " The android_app this ident is associated with."] pub app: *mut android_app, - #[doc = " Function to call to perform the standard processing of data from"] - #[doc = " this source."] + #[doc = " Function to call to perform the standard processing of data from\n this source."] pub process: ::std::option::Option< unsafe extern "C" fn(app: *mut android_app, source: *mut android_poll_source), >, } #[test] fn bindgen_test_layout_android_poll_source() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 24usize, - concat!("Size of: ", stringify!(android_poll_source)) + "Size of android_poll_source" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(android_poll_source)) + "Alignment of android_poll_source" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).id as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).id) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(android_poll_source), - "::", - stringify!(id) - ) + "Offset of field: android_poll_source::id" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).app as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).app) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(android_poll_source), - "::", - stringify!(app) - ) + "Offset of field: android_poll_source::app" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).process as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).process) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(android_poll_source), - "::", - stringify!(process) - ) + "Offset of field: android_poll_source::process" ); } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct android_input_buffer { - #[doc = " Pointer to a read-only array of pointers to GameActivityMotionEvent."] - #[doc = " Only the first motionEventsCount events are valid."] - pub motionEvents: [GameActivityMotionEvent; 16usize], + #[doc = " Pointer to a read-only array of GameActivityMotionEvent.\n Only the first motionEventsCount events are valid."] + pub motionEvents: *mut GameActivityMotionEvent, #[doc = " The number of valid motion events in `motionEvents`."] pub motionEventsCount: u64, - #[doc = " Pointer to a read-only array of pointers to GameActivityHistoricalPointerAxes."] - #[doc = ""] - #[doc = " Only the first historicalSamplesCount samples are valid."] - #[doc = " Refer to event->historicalStart, event->pointerCount and event->historicalCount"] - #[doc = " to access the specific samples that relate to an event."] - #[doc = ""] - #[doc = " Each slice of samples for one event has a length of"] - #[doc = " (event->pointerCount and event->historicalCount) and is in pointer-major"] - #[doc = " order so the historic samples for each pointer are contiguous."] - #[doc = " E.g. you would access historic sample index 3 for pointer 2 of an event with:"] - #[doc = ""] - #[doc = " historicalAxisSamples[event->historicalStart + (event->historicalCount * 2) + 3];"] - pub historicalAxisSamples: [GameActivityHistoricalPointerAxes; 64usize], - #[doc = " The number of valid historical samples in `historicalAxisSamples`."] - pub historicalSamplesCount: u64, - #[doc = " Pointer to a read-only array of pointers to GameActivityKeyEvent."] - #[doc = " Only the first keyEventsCount events are valid."] - pub keyEvents: [GameActivityKeyEvent; 4usize], + #[doc = " The size of the `motionEvents` buffer."] + pub motionEventsBufferSize: u64, + #[doc = " Pointer to a read-only array of GameActivityKeyEvent.\n Only the first keyEventsCount events are valid."] + pub keyEvents: *mut GameActivityKeyEvent, #[doc = " The number of valid \"Key\" events in `keyEvents`."] pub keyEventsCount: u64, + #[doc = " The size of the `keyEvents` buffer."] + pub keyEventsBufferSize: u64, } #[test] fn bindgen_test_layout_android_input_buffer() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), - 40824usize, - concat!("Size of: ", stringify!(android_input_buffer)) + 48usize, + "Size of android_input_buffer" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(android_input_buffer)) + "Alignment of android_input_buffer" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).motionEvents as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).motionEvents) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(android_input_buffer), - "::", - stringify!(motionEvents) - ) + "Offset of field: android_input_buffer::motionEvents" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).motionEventsCount as *const _ as usize - }, - 27776usize, - concat!( - "Offset of field: ", - stringify!(android_input_buffer), - "::", - stringify!(motionEventsCount) - ) + unsafe { ::std::ptr::addr_of!((*ptr).motionEventsCount) as usize - ptr as usize }, + 8usize, + "Offset of field: android_input_buffer::motionEventsCount" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).historicalAxisSamples as *const _ - as usize - }, - 27784usize, - concat!( - "Offset of field: ", - stringify!(android_input_buffer), - "::", - stringify!(historicalAxisSamples) - ) + unsafe { ::std::ptr::addr_of!((*ptr).motionEventsBufferSize) as usize - ptr as usize }, + 16usize, + "Offset of field: android_input_buffer::motionEventsBufferSize" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).historicalSamplesCount as *const _ - as usize - }, - 40584usize, - concat!( - "Offset of field: ", - stringify!(android_input_buffer), - "::", - stringify!(historicalSamplesCount) - ) + unsafe { ::std::ptr::addr_of!((*ptr).keyEvents) as usize - ptr as usize }, + 24usize, + "Offset of field: android_input_buffer::keyEvents" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).keyEvents as *const _ as usize }, - 40592usize, - concat!( - "Offset of field: ", - stringify!(android_input_buffer), - "::", - stringify!(keyEvents) - ) + unsafe { ::std::ptr::addr_of!((*ptr).keyEventsCount) as usize - ptr as usize }, + 32usize, + "Offset of field: android_input_buffer::keyEventsCount" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).keyEventsCount as *const _ as usize - }, - 40816usize, - concat!( - "Offset of field: ", - stringify!(android_input_buffer), - "::", - stringify!(keyEventsCount) - ) - ); -} -#[doc = " Function pointer declaration for the filtering of key events."] -#[doc = " A function with this signature should be passed to"] -#[doc = " android_app_set_key_event_filter and return false for any events that should"] -#[doc = " not be handled by android_native_app_glue. These events will be handled by"] -#[doc = " the system instead."] + unsafe { ::std::ptr::addr_of!((*ptr).keyEventsBufferSize) as usize - ptr as usize }, + 40usize, + "Offset of field: android_input_buffer::keyEventsBufferSize" + ); +} +#[doc = " Function pointer declaration for the filtering of key events.\n A function with this signature should be passed to\n android_app_set_key_event_filter and return false for any events that should\n not be handled by android_native_app_glue. These events will be handled by\n the system instead."] pub type android_key_event_filter = ::std::option::Option bool>; -#[doc = " Function pointer definition for the filtering of motion events."] -#[doc = " A function with this signature should be passed to"] -#[doc = " android_app_set_motion_event_filter and return false for any events that"] -#[doc = " should not be handled by android_native_app_glue. These events will be"] -#[doc = " handled by the system instead."] +#[doc = " Function pointer definition for the filtering of motion events.\n A function with this signature should be passed to\n android_app_set_motion_event_filter and return false for any events that\n should not be handled by android_native_app_glue. These events will be\n handled by the system instead."] pub type android_motion_event_filter = ::std::option::Option bool>; -#[doc = " The GameActivity interface provided by "] -#[doc = " is based on a set of application-provided callbacks that will be called"] -#[doc = " by the Activity's main thread when certain events occur."] -#[doc = ""] -#[doc = " This means that each one of this callbacks _should_ _not_ block, or they"] -#[doc = " risk having the system force-close the application. This programming"] -#[doc = " model is direct, lightweight, but constraining."] -#[doc = ""] -#[doc = " The 'android_native_app_glue' static library is used to provide a different"] -#[doc = " execution model where the application can implement its own main event"] -#[doc = " loop in a different thread instead. Here's how it works:"] -#[doc = ""] -#[doc = " 1/ The application must provide a function named \"android_main()\" that"] -#[doc = " will be called when the activity is created, in a new thread that is"] -#[doc = " distinct from the activity's main thread."] -#[doc = ""] -#[doc = " 2/ android_main() receives a pointer to a valid \"android_app\" structure"] -#[doc = " that contains references to other important objects, e.g. the"] -#[doc = " GameActivity obejct instance the application is running in."] -#[doc = ""] -#[doc = " 3/ the \"android_app\" object holds an ALooper instance that already"] -#[doc = " listens to activity lifecycle events (e.g. \"pause\", \"resume\")."] -#[doc = " See APP_CMD_XXX declarations below."] -#[doc = ""] -#[doc = " This corresponds to an ALooper identifier returned by"] -#[doc = " ALooper_pollOnce with value LOOPER_ID_MAIN."] -#[doc = ""] -#[doc = " Your application can use the same ALooper to listen to additional"] -#[doc = " file-descriptors. They can either be callback based, or with return"] -#[doc = " identifiers starting with LOOPER_ID_USER."] -#[doc = ""] -#[doc = " 4/ Whenever you receive a LOOPER_ID_MAIN event,"] -#[doc = " the returned data will point to an android_poll_source structure. You"] -#[doc = " can call the process() function on it, and fill in android_app->onAppCmd"] -#[doc = " to be called for your own processing of the event."] -#[doc = ""] -#[doc = " Alternatively, you can call the low-level functions to read and process"] -#[doc = " the data directly... look at the process_cmd() and process_input()"] -#[doc = " implementations in the glue to see how to do this."] -#[doc = ""] -#[doc = " See the sample named \"native-activity\" that comes with the NDK with a"] -#[doc = " full usage example. Also look at the documentation of GameActivity."] +#[doc = " The GameActivity interface provided by \n is based on a set of application-provided callbacks that will be called\n by the Activity's main thread when certain events occur.\n\n This means that each one of this callbacks _should_ _not_ block, or they\n risk having the system force-close the application. This programming\n model is direct, lightweight, but constraining.\n\n The 'android_native_app_glue' static library is used to provide a different\n execution model where the application can implement its own main event\n loop in a different thread instead. Here's how it works:\n\n 1/ The application must provide a function named \"android_main()\" that\n will be called when the activity is created, in a new thread that is\n distinct from the activity's main thread.\n\n 2/ android_main() receives a pointer to a valid \"android_app\" structure\n that contains references to other important objects, e.g. the\n GameActivity obejct instance the application is running in.\n\n 3/ the \"android_app\" object holds an ALooper instance that already\n listens to activity lifecycle events (e.g. \"pause\", \"resume\").\n See APP_CMD_XXX declarations below.\n\n This corresponds to an ALooper identifier returned by\n ALooper_pollOnce with value LOOPER_ID_MAIN.\n\n Your application can use the same ALooper to listen to additional\n file-descriptors. They can either be callback based, or with return\n identifiers starting with LOOPER_ID_USER.\n\n 4/ Whenever you receive a LOOPER_ID_MAIN event,\n the returned data will point to an android_poll_source structure. You\n can call the process() function on it, and fill in android_app->onAppCmd\n to be called for your own processing of the event.\n\n Alternatively, you can call the low-level functions to read and process\n the data directly... look at the process_cmd() and process_input()\n implementations in the glue to see how to do this.\n\n See the sample named \"native-activity\" that comes with the NDK with a\n full usage example. Also look at the documentation of GameActivity."] #[repr(C)] pub struct android_app { #[doc = " An optional pointer to application-defined state."] pub userData: *mut ::std::os::raw::c_void, - #[doc = " A required callback for processing main app commands (`APP_CMD_*`)."] - #[doc = " This is called each frame if there are app commands that need processing."] + #[doc = " A required callback for processing main app commands (`APP_CMD_*`).\n This is called each frame if there are app commands that need processing."] pub onAppCmd: ::std::option::Option, #[doc = " The GameActivity object instance that this app is running in."] pub activity: *mut GameActivity, #[doc = " The current configuration the app is running in."] pub config: *mut AConfiguration, - #[doc = " The last activity saved state, as provided at creation time."] - #[doc = " It is NULL if there was no state. You can use this as you need; the"] - #[doc = " memory will remain around until you call android_app_exec_cmd() for"] - #[doc = " APP_CMD_RESUME, at which point it will be freed and savedState set to"] - #[doc = " NULL. These variables should only be changed when processing a"] - #[doc = " APP_CMD_SAVE_STATE, at which point they will be initialized to NULL and"] - #[doc = " you can malloc your state and place the information here. In that case"] - #[doc = " the memory will be freed for you later."] + #[doc = " The last activity saved state, as provided at creation time.\n It is NULL if there was no state. You can use this as you need; the\n memory will remain around until you call android_app_exec_cmd() for\n APP_CMD_RESUME, at which point it will be freed and savedState set to\n NULL. These variables should only be changed when processing a\n APP_CMD_SAVE_STATE, at which point they will be initialized to NULL and\n you can malloc your state and place the information here. In that case\n the memory will be freed for you later."] pub savedState: *mut ::std::os::raw::c_void, #[doc = " The size of the activity saved state. It is 0 if `savedState` is NULL."] - pub savedStateSize: size_t, + pub savedStateSize: usize, #[doc = " The ALooper associated with the app's thread."] pub looper: *mut ALooper, #[doc = " When non-NULL, this is the window surface that the app can draw in."] pub window: *mut ANativeWindow, - #[doc = " Current content rectangle of the window; this is the area where the"] - #[doc = " window's content should be placed to be seen by the user."] + #[doc = " Current content rectangle of the window; this is the area where the\n window's content should be placed to be seen by the user."] pub contentRect: ARect, - #[doc = " Current state of the app's activity. May be either APP_CMD_START,"] - #[doc = " APP_CMD_RESUME, APP_CMD_PAUSE, or APP_CMD_STOP."] + #[doc = " Whether the software keyboard is visible or not."] + 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 = " 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"] - #[doc = " destroyed and waiting for the app thread to complete."] + #[doc = " This is non-zero when the application's GameActivity is being\n destroyed and waiting for the app thread to complete."] pub destroyRequested: ::std::os::raw::c_int, - #[doc = " This is used for buffering input from GameActivity. Once ready, the"] - #[doc = " application thread switches the buffers and processes what was"] - #[doc = " accumulated."] + #[doc = " This is used for buffering input from GameActivity. Once ready, the\n application thread switches the buffers and processes what was\n accumulated."] pub inputBuffers: [android_input_buffer; 2usize], pub currentInputBuffer: ::std::os::raw::c_int, - #[doc = " 0 if no text input event is outstanding, 1 if it is."] - #[doc = " Use `GameActivity_getTextInputState` to get information"] - #[doc = " about the text entered by the user."] + #[doc = " 0 if no text input event is outstanding, 1 if it is.\n Use `GameActivity_getTextInputState` to get information\n about the text entered by the user."] pub textInputState: ::std::os::raw::c_int, #[doc = " @cond INTERNAL"] pub mutex: pthread_mutex_t, @@ -7422,457 +6288,273 @@ pub struct android_app { } #[test] fn bindgen_test_layout_android_app() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), - 81936usize, - concat!("Size of: ", stringify!(android_app)) + 392usize, + "Size of android_app" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(android_app)) + "Alignment of android_app" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).userData as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).userData) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(userData) - ) + "Offset of field: android_app::userData" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).onAppCmd as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).onAppCmd) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(onAppCmd) - ) + "Offset of field: android_app::onAppCmd" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).activity as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).activity) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(activity) - ) + "Offset of field: android_app::activity" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).config as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).config) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(config) - ) + "Offset of field: android_app::config" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).savedState as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).savedState) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(savedState) - ) + "Offset of field: android_app::savedState" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).savedStateSize as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).savedStateSize) as usize - ptr as usize }, 40usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(savedStateSize) - ) + "Offset of field: android_app::savedStateSize" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).looper as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).looper) as usize - ptr as usize }, 48usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(looper) - ) + "Offset of field: android_app::looper" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).window as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).window) as usize - ptr as usize }, 56usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(window) - ) + "Offset of field: android_app::window" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).contentRect as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).contentRect) as usize - ptr as usize }, 64usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(contentRect) - ) + "Offset of field: android_app::contentRect" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).activityState as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).softwareKeyboardVisible) as usize - ptr as usize }, 80usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(activityState) - ) + "Offset of field: android_app::softwareKeyboardVisible" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).destroyRequested as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).editorAction) as usize - ptr as usize }, 84usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(destroyRequested) - ) + "Offset of field: android_app::editorAction" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).inputBuffers as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).activityState) as usize - ptr as usize }, 88usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(inputBuffers) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).currentInputBuffer as *const _ as usize }, - 81736usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(currentInputBuffer) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).textInputState as *const _ as usize }, - 81740usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(textInputState) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).mutex as *const _ as usize }, - 81744usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(mutex) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).cond as *const _ as usize }, - 81784usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(cond) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).msgread as *const _ as usize }, - 81832usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(msgread) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).msgwrite as *const _ as usize }, - 81836usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(msgwrite) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).thread as *const _ as usize }, - 81840usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(thread) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).cmdPollSource as *const _ as usize }, - 81848usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(cmdPollSource) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).running as *const _ as usize }, - 81872usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(running) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).stateSaved as *const _ as usize }, - 81876usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(stateSaved) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).destroyed as *const _ as usize }, - 81880usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(destroyed) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).redrawNeeded as *const _ as usize }, - 81884usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(redrawNeeded) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).pendingWindow as *const _ as usize }, - 81888usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(pendingWindow) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).pendingContentRect as *const _ as usize }, - 81896usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(pendingContentRect) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).keyEventFilter as *const _ as usize }, - 81912usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(keyEventFilter) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).motionEventFilter as *const _ as usize }, - 81920usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(motionEventFilter) - ) + "Offset of field: android_app::activityState" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).inputAvailableWakeUp as *const _ as usize - }, - 81928usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(inputAvailableWakeUp) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).inputSwapPending as *const _ as usize }, - 81929usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(inputSwapPending) - ) - ); -} -#[doc = " Looper data ID of commands coming from the app's main thread, which"] -#[doc = " is returned as an identifier from ALooper_pollOnce(). The data for this"] -#[doc = " identifier is a pointer to an android_poll_source structure."] -#[doc = " These can be retrieved and processed with android_app_read_cmd()"] -#[doc = " and android_app_exec_cmd()."] + unsafe { ::std::ptr::addr_of!((*ptr).destroyRequested) as usize - ptr as usize }, + 92usize, + "Offset of field: android_app::destroyRequested" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).inputBuffers) as usize - ptr as usize }, + 96usize, + "Offset of field: android_app::inputBuffers" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).currentInputBuffer) as usize - ptr as usize }, + 192usize, + "Offset of field: android_app::currentInputBuffer" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).textInputState) as usize - ptr as usize }, + 196usize, + "Offset of field: android_app::textInputState" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mutex) as usize - ptr as usize }, + 200usize, + "Offset of field: android_app::mutex" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).cond) as usize - ptr as usize }, + 240usize, + "Offset of field: android_app::cond" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).msgread) as usize - ptr as usize }, + 288usize, + "Offset of field: android_app::msgread" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).msgwrite) as usize - ptr as usize }, + 292usize, + "Offset of field: android_app::msgwrite" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).thread) as usize - ptr as usize }, + 296usize, + "Offset of field: android_app::thread" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).cmdPollSource) as usize - ptr as usize }, + 304usize, + "Offset of field: android_app::cmdPollSource" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).running) as usize - ptr as usize }, + 328usize, + "Offset of field: android_app::running" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).stateSaved) as usize - ptr as usize }, + 332usize, + "Offset of field: android_app::stateSaved" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).destroyed) as usize - ptr as usize }, + 336usize, + "Offset of field: android_app::destroyed" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).redrawNeeded) as usize - ptr as usize }, + 340usize, + "Offset of field: android_app::redrawNeeded" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pendingWindow) as usize - ptr as usize }, + 344usize, + "Offset of field: android_app::pendingWindow" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pendingContentRect) as usize - ptr as usize }, + 352usize, + "Offset of field: android_app::pendingContentRect" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).keyEventFilter) as usize - ptr as usize }, + 368usize, + "Offset of field: android_app::keyEventFilter" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).motionEventFilter) as usize - ptr as usize }, + 376usize, + "Offset of field: android_app::motionEventFilter" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).inputAvailableWakeUp) as usize - ptr as usize }, + 384usize, + "Offset of field: android_app::inputAvailableWakeUp" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).inputSwapPending) as usize - ptr as usize }, + 385usize, + "Offset of field: android_app::inputSwapPending" + ); +} +#[doc = " Looper data ID of commands coming from the app's main thread, which\n is returned as an identifier from ALooper_pollOnce(). The data for this\n identifier is a pointer to an android_poll_source structure.\n These can be retrieved and processed with android_app_read_cmd()\n and android_app_exec_cmd()."] pub const NativeAppGlueLooperId_LOOPER_ID_MAIN: NativeAppGlueLooperId = 1; -#[doc = " Unused. Reserved for future use when usage of AInputQueue will be"] -#[doc = " supported."] +#[doc = " Unused. Reserved for future use when usage of AInputQueue will be\n supported."] pub const NativeAppGlueLooperId_LOOPER_ID_INPUT: NativeAppGlueLooperId = 2; #[doc = " Start of user-defined ALooper identifiers."] pub const NativeAppGlueLooperId_LOOPER_ID_USER: NativeAppGlueLooperId = 3; -#[doc = " Looper ID of commands coming from the app's main thread, an AInputQueue or"] -#[doc = " user-defined sources."] -pub type NativeAppGlueLooperId = ::std::os::raw::c_uint; -#[doc = " Unused. Reserved for future use when usage of AInputQueue will be"] -#[doc = " supported."] +#[doc = " Looper ID of commands coming from the app's main thread, an AInputQueue or\n user-defined sources."] +pub type NativeAppGlueLooperId = i8; +#[doc = " Unused. Reserved for future use when usage of AInputQueue will be\n supported."] pub const NativeAppGlueAppCmd_UNUSED_APP_CMD_INPUT_CHANGED: NativeAppGlueAppCmd = 0; -#[doc = " Command from main thread: a new ANativeWindow is ready for use. Upon"] -#[doc = " receiving this command, android_app->window will contain the new window"] -#[doc = " surface."] +#[doc = " Command from main thread: a new ANativeWindow is ready for use. Upon\n receiving this command, android_app->window will contain the new window\n surface."] pub const NativeAppGlueAppCmd_APP_CMD_INIT_WINDOW: NativeAppGlueAppCmd = 1; -#[doc = " Command from main thread: the existing ANativeWindow needs to be"] -#[doc = " terminated. Upon receiving this command, android_app->window still"] -#[doc = " contains the existing window; after calling android_app_exec_cmd"] -#[doc = " it will be set to NULL."] +#[doc = " Command from main thread: the existing ANativeWindow needs to be\n terminated. Upon receiving this command, android_app->window still\n contains the existing window; after calling android_app_exec_cmd\n it will be set to NULL."] pub const NativeAppGlueAppCmd_APP_CMD_TERM_WINDOW: NativeAppGlueAppCmd = 2; -#[doc = " Command from main thread: the current ANativeWindow has been resized."] -#[doc = " Please redraw with its new size."] +#[doc = " Command from main thread: the current ANativeWindow has been resized.\n Please redraw with its new size."] pub const NativeAppGlueAppCmd_APP_CMD_WINDOW_RESIZED: NativeAppGlueAppCmd = 3; -#[doc = " Command from main thread: the system needs that the current ANativeWindow"] -#[doc = " be redrawn. You should redraw the window before handing this to"] -#[doc = " android_app_exec_cmd() in order to avoid transient drawing glitches."] +#[doc = " Command from main thread: the system needs that the current ANativeWindow\n be redrawn. You should redraw the window before handing this to\n android_app_exec_cmd() in order to avoid transient drawing glitches."] pub const NativeAppGlueAppCmd_APP_CMD_WINDOW_REDRAW_NEEDED: NativeAppGlueAppCmd = 4; -#[doc = " Command from main thread: the content area of the window has changed,"] -#[doc = " such as from the soft input window being shown or hidden. You can"] -#[doc = " find the new content rect in android_app::contentRect."] +#[doc = " Command from main thread: the content area of the window has changed,\n such as from the soft input window being shown or hidden. You can\n find the new content rect in android_app::contentRect."] pub const NativeAppGlueAppCmd_APP_CMD_CONTENT_RECT_CHANGED: NativeAppGlueAppCmd = 5; -#[doc = " Command from main thread: the app's activity window has gained"] -#[doc = " input focus."] -pub const NativeAppGlueAppCmd_APP_CMD_GAINED_FOCUS: NativeAppGlueAppCmd = 6; -#[doc = " Command from main thread: the app's activity window has lost"] -#[doc = " input focus."] -pub const NativeAppGlueAppCmd_APP_CMD_LOST_FOCUS: NativeAppGlueAppCmd = 7; +#[doc = " Command from main thread: the software keyboard was shown or hidden."] +pub const NativeAppGlueAppCmd_APP_CMD_SOFTWARE_KB_VIS_CHANGED: NativeAppGlueAppCmd = 6; +#[doc = " Command from main thread: the app's activity window has gained\n input focus."] +pub const NativeAppGlueAppCmd_APP_CMD_GAINED_FOCUS: NativeAppGlueAppCmd = 7; +#[doc = " Command from main thread: the app's activity window has lost\n input focus."] +pub const NativeAppGlueAppCmd_APP_CMD_LOST_FOCUS: NativeAppGlueAppCmd = 8; #[doc = " Command from main thread: the current device configuration has changed."] -pub const NativeAppGlueAppCmd_APP_CMD_CONFIG_CHANGED: NativeAppGlueAppCmd = 8; -#[doc = " Command from main thread: the system is running low on memory."] -#[doc = " Try to reduce your memory use."] -pub const NativeAppGlueAppCmd_APP_CMD_LOW_MEMORY: NativeAppGlueAppCmd = 9; +pub const NativeAppGlueAppCmd_APP_CMD_CONFIG_CHANGED: NativeAppGlueAppCmd = 9; +#[doc = " Command from main thread: the system is running low on memory.\n Try to reduce your memory use."] +pub const NativeAppGlueAppCmd_APP_CMD_LOW_MEMORY: NativeAppGlueAppCmd = 10; #[doc = " Command from main thread: the app's activity has been started."] -pub const NativeAppGlueAppCmd_APP_CMD_START: NativeAppGlueAppCmd = 10; +pub const NativeAppGlueAppCmd_APP_CMD_START: NativeAppGlueAppCmd = 11; #[doc = " Command from main thread: the app's activity has been resumed."] -pub const NativeAppGlueAppCmd_APP_CMD_RESUME: NativeAppGlueAppCmd = 11; -#[doc = " Command from main thread: the app should generate a new saved state"] -#[doc = " for itself, to restore from later if needed. If you have saved state,"] -#[doc = " allocate it with malloc and place it in android_app.savedState with"] -#[doc = " the size in android_app.savedStateSize. The will be freed for you"] -#[doc = " later."] -pub const NativeAppGlueAppCmd_APP_CMD_SAVE_STATE: NativeAppGlueAppCmd = 12; +pub const NativeAppGlueAppCmd_APP_CMD_RESUME: NativeAppGlueAppCmd = 12; +#[doc = " Command from main thread: the app should generate a new saved state\n for itself, to restore from later if needed. If you have saved state,\n allocate it with malloc and place it in android_app.savedState with\n the size in android_app.savedStateSize. The will be freed for you\n later."] +pub const NativeAppGlueAppCmd_APP_CMD_SAVE_STATE: NativeAppGlueAppCmd = 13; #[doc = " Command from main thread: the app's activity has been paused."] -pub const NativeAppGlueAppCmd_APP_CMD_PAUSE: NativeAppGlueAppCmd = 13; +pub const NativeAppGlueAppCmd_APP_CMD_PAUSE: NativeAppGlueAppCmd = 14; #[doc = " Command from main thread: the app's activity has been stopped."] -pub const NativeAppGlueAppCmd_APP_CMD_STOP: NativeAppGlueAppCmd = 14; -#[doc = " Command from main thread: the app's activity is being destroyed,"] -#[doc = " and waiting for the app thread to clean up and exit before proceeding."] -pub const NativeAppGlueAppCmd_APP_CMD_DESTROY: NativeAppGlueAppCmd = 15; +pub const NativeAppGlueAppCmd_APP_CMD_STOP: NativeAppGlueAppCmd = 15; +#[doc = " Command from main thread: the app's activity is being destroyed,\n and waiting for the app thread to clean up and exit before proceeding."] +pub const NativeAppGlueAppCmd_APP_CMD_DESTROY: NativeAppGlueAppCmd = 16; #[doc = " Command from main thread: the app's insets have changed."] -pub const NativeAppGlueAppCmd_APP_CMD_WINDOW_INSETS_CHANGED: NativeAppGlueAppCmd = 16; -#[doc = " Commands passed from the application's main Java thread to the game's thread."] -pub type NativeAppGlueAppCmd = ::std::os::raw::c_uint; +pub const NativeAppGlueAppCmd_APP_CMD_WINDOW_INSETS_CHANGED: NativeAppGlueAppCmd = 17; +#[doc = " Commands passed from the application's main Java thread to the game's thread.\n\n Values from 0 to 127 are reserved for this library; values from -128 to -1\n can be used for custom user's events."] +pub type NativeAppGlueAppCmd = i8; extern "C" { - #[doc = " Call when ALooper_pollAll() returns LOOPER_ID_MAIN, reading the next"] - #[doc = " app command message."] + #[doc = " Call when ALooper_pollAll() returns LOOPER_ID_MAIN, reading the next\n app command message."] pub fn android_app_read_cmd(android_app: *mut android_app) -> i8; } extern "C" { - #[doc = " Call with the command returned by android_app_read_cmd() to do the"] - #[doc = " initial pre-processing of the given command. You can perform your own"] - #[doc = " actions for the command after calling this function."] + #[doc = " Call with the command returned by android_app_read_cmd() to do the\n initial pre-processing of the given command. You can perform your own\n actions for the command after calling this function."] pub fn android_app_pre_exec_cmd(android_app: *mut android_app, cmd: i8); } extern "C" { - #[doc = " Call with the command returned by android_app_read_cmd() to do the"] - #[doc = " final post-processing of the given command. You must have done your own"] - #[doc = " actions for the command before calling this function."] + #[doc = " Call with the command returned by android_app_read_cmd() to do the\n final post-processing of the given command. You must have done your own\n actions for the command before calling this function."] pub fn android_app_post_exec_cmd(android_app: *mut android_app, cmd: i8); } extern "C" { - #[doc = " Call this before processing input events to get the events buffer."] - #[doc = " The function returns NULL if there are no events to process."] + #[doc = " Call this before processing input events to get the events buffer.\n The function returns NULL if there are no events to process."] pub fn android_app_swap_input_buffers( android_app: *mut android_app, ) -> *mut android_input_buffer; } extern "C" { - #[doc = " Clear the array of motion events that were waiting to be handled, and release"] - #[doc = " each of them."] - #[doc = ""] - #[doc = " This method should be called after you have processed the motion events in"] - #[doc = " your game loop. You should handle events at each iteration of your game loop."] + #[doc = " Clear the array of motion events that were waiting to be handled, and release\n each of them.\n\n This method should be called after you have processed the motion events in\n your game loop. You should handle events at each iteration of your game loop."] pub fn android_app_clear_motion_events(inputBuffer: *mut android_input_buffer); } extern "C" { - #[doc = " Clear the array of key events that were waiting to be handled, and release"] - #[doc = " each of them."] - #[doc = ""] - #[doc = " This method should be called after you have processed the key up events in"] - #[doc = " your game loop. You should handle events at each iteration of your game loop."] + #[doc = " Clear the array of key events that were waiting to be handled, and release\n each of them.\n\n This method should be called after you have processed the key up events in\n your game loop. You should handle events at each iteration of your game loop."] pub fn android_app_clear_key_events(inputBuffer: *mut android_input_buffer); } extern "C" { - #[doc = " This is a springboard into the Rust glue layer that wraps calling the"] - #[doc = " main entry for the app itself."] + #[doc = " This is a springboard into the Rust glue layer that wraps calling the\n main entry for the app itself."] pub fn _rust_glue_entry(app: *mut android_app); } extern "C" { - #[doc = " Set the filter to use when processing key events."] - #[doc = " Any events for which the filter returns false will be ignored by"] - #[doc = " android_native_app_glue. If filter is set to NULL, no filtering is done."] - #[doc = ""] - #[doc = " The default key filter will filter out volume and camera button presses."] + #[doc = " Set the filter to use when processing key events.\n Any events for which the filter returns false will be ignored by\n android_native_app_glue. If filter is set to NULL, no filtering is done.\n\n The default key filter will filter out volume and camera button presses."] pub fn android_app_set_key_event_filter( app: *mut android_app, filter: android_key_event_filter, ); } extern "C" { - #[doc = " Set the filter to use when processing touch and motion events."] - #[doc = " Any events for which the filter returns false will be ignored by"] - #[doc = " android_native_app_glue. If filter is set to NULL, no filtering is done."] - #[doc = ""] - #[doc = " Note that the default motion event filter will only allow touchscreen events"] - #[doc = " through, in order to mimic NativeActivity's behaviour, so for controller"] - #[doc = " events to be passed to the app, set the filter to NULL."] + #[doc = " Set the filter to use when processing touch and motion events.\n Any events for which the filter returns false will be ignored by\n android_native_app_glue. If filter is set to NULL, no filtering is done.\n\n Note that the default motion event filter will only allow touchscreen events\n through, in order to mimic NativeActivity's behaviour, so for controller\n events to be passed to the app, set the filter to NULL."] pub fn android_app_set_motion_event_filter( app: *mut android_app, filter: android_motion_event_filter, ); } +extern "C" { + #[doc = " You can send your custom events using the function below.\n\n Make sure your custom codes do not overlap with this library's ones.\n\n Values from 0 to 127 are reserved for this library; values from -128 to -1\n can be used for custom user's events."] + pub fn android_app_write_cmd(android_app: *mut android_app, cmd: i8); +} extern "C" { #[doc = " Determines if a looper wake up was due to new input becoming available"] pub fn android_app_input_available_wake_up(app: *mut android_app) -> bool; diff --git a/android-activity/src/game_activity/ffi_arm.rs b/android-activity/src/game_activity/ffi_arm.rs index 7504db8d..de717f5c 100644 --- a/android-activity/src/game_activity/ffi_arm.rs +++ b/android-activity/src/game_activity/ffi_arm.rs @@ -1,4 +1,4 @@ -/* automatically generated by rust-bindgen 0.59.2 */ +/* automatically generated by rust-bindgen 0.71.1 */ #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] @@ -16,10 +16,7 @@ where Storage: AsRef<[u8]> + AsMut<[u8]>, { #[inline] - pub fn get_bit(&self, index: usize) -> bool { - debug_assert!(index / 8 < self.storage.as_ref().len()); - let byte_index = index / 8; - let byte = self.storage.as_ref()[byte_index]; + fn extract_bit(byte: u8, index: usize) -> bool { let bit_index = if cfg!(target_endian = "big") { 7 - (index % 8) } else { @@ -29,10 +26,21 @@ where byte & mask == mask } #[inline] - pub fn set_bit(&mut self, index: usize, val: bool) { + pub fn get_bit(&self, index: usize) -> bool { debug_assert!(index / 8 < self.storage.as_ref().len()); let byte_index = index / 8; - let byte = &mut self.storage.as_mut()[byte_index]; + let byte = self.storage.as_ref()[byte_index]; + Self::extract_bit(byte, index) + } + #[inline] + pub unsafe fn raw_get_bit(this: *const Self, index: usize) -> bool { + debug_assert!(index / 8 < core::mem::size_of::()); + let byte_index = index / 8; + let byte = *(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize); + Self::extract_bit(byte, index) + } + #[inline] + fn change_bit(byte: u8, index: usize, val: bool) -> u8 { let bit_index = if cfg!(target_endian = "big") { 7 - (index % 8) } else { @@ -40,12 +48,27 @@ where }; let mask = 1 << bit_index; if val { - *byte |= mask; + byte | mask } else { - *byte &= !mask; + byte & !mask } } #[inline] + pub fn set_bit(&mut self, index: usize, val: bool) { + debug_assert!(index / 8 < self.storage.as_ref().len()); + let byte_index = index / 8; + let byte = &mut self.storage.as_mut()[byte_index]; + *byte = Self::change_bit(*byte, index, val); + } + #[inline] + pub unsafe fn raw_set_bit(this: *mut Self, index: usize, val: bool) { + debug_assert!(index / 8 < core::mem::size_of::()); + let byte_index = index / 8; + let byte = + (core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize); + *byte = Self::change_bit(*byte, index, val); + } + #[inline] pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); @@ -64,6 +87,24 @@ where val } #[inline] + pub unsafe fn raw_get(this: *const Self, bit_offset: usize, bit_width: u8) -> u64 { + debug_assert!(bit_width <= 64); + debug_assert!(bit_offset / 8 < core::mem::size_of::()); + debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::()); + let mut val = 0; + for i in 0..(bit_width as usize) { + if Self::raw_get_bit(this, i + bit_offset) { + let index = if cfg!(target_endian = "big") { + bit_width as usize - 1 - i + } else { + i + }; + val |= 1 << index; + } + } + val + } + #[inline] pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); @@ -79,6 +120,22 @@ where self.set_bit(index + bit_offset, val_bit_is_set); } } + #[inline] + pub unsafe fn raw_set(this: *mut Self, bit_offset: usize, bit_width: u8, val: u64) { + debug_assert!(bit_width <= 64); + debug_assert!(bit_offset / 8 < core::mem::size_of::()); + debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::()); + for i in 0..(bit_width as usize) { + let mask = 1 << i; + let val_bit_is_set = val & mask == mask; + let index = if cfg!(target_endian = "big") { + bit_width as usize - 1 - i + } else { + i + }; + Self::raw_set_bit(this, index + bit_offset, val_bit_is_set); + } + } } pub const __BIONIC__: u32 = 1; pub const __WORDSIZE: u32 = 32; @@ -101,10 +158,15 @@ pub const __ANDROID_API_O_MR1__: u32 = 27; pub const __ANDROID_API_P__: u32 = 28; pub const __ANDROID_API_Q__: u32 = 29; pub const __ANDROID_API_R__: u32 = 30; -pub const __NDK_MAJOR__: u32 = 21; +pub const __ANDROID_API_S__: u32 = 31; +pub const __ANDROID_API_T__: u32 = 33; +pub const __ANDROID_API_U__: u32 = 34; +pub const __ANDROID_API_V__: u32 = 35; +pub const __ANDROID_NDK__: u32 = 1; +pub const __NDK_MAJOR__: u32 = 26; pub const __NDK_MINOR__: u32 = 1; pub const __NDK_BETA__: u32 = 0; -pub const __NDK_BUILD__: u32 = 6352462; +pub const __NDK_BUILD__: u32 = 10909125; pub const __NDK_CANARY__: u32 = 0; pub const WCHAR_MIN: u8 = 0u8; pub const INT8_MIN: i32 = -128; @@ -144,135 +206,183 @@ pub const SIZE_MAX: u32 = 4294967295; pub const __BITS_PER_LONG: u32 = 32; pub const __FD_SETSIZE: u32 = 1024; pub const AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT: u32 = 8; -pub const __PRI_64_prefix: &[u8; 3usize] = b"ll\0"; -pub const PRId8: &[u8; 2usize] = b"d\0"; -pub const PRId16: &[u8; 2usize] = b"d\0"; -pub const PRId32: &[u8; 2usize] = b"d\0"; -pub const PRId64: &[u8; 4usize] = b"lld\0"; -pub const PRIdLEAST8: &[u8; 2usize] = b"d\0"; -pub const PRIdLEAST16: &[u8; 2usize] = b"d\0"; -pub const PRIdLEAST32: &[u8; 2usize] = b"d\0"; -pub const PRIdLEAST64: &[u8; 4usize] = b"lld\0"; -pub const PRIdFAST8: &[u8; 2usize] = b"d\0"; -pub const PRIdFAST64: &[u8; 4usize] = b"lld\0"; -pub const PRIdMAX: &[u8; 3usize] = b"jd\0"; -pub const PRIi8: &[u8; 2usize] = b"i\0"; -pub const PRIi16: &[u8; 2usize] = b"i\0"; -pub const PRIi32: &[u8; 2usize] = b"i\0"; -pub const PRIi64: &[u8; 4usize] = b"lli\0"; -pub const PRIiLEAST8: &[u8; 2usize] = b"i\0"; -pub const PRIiLEAST16: &[u8; 2usize] = b"i\0"; -pub const PRIiLEAST32: &[u8; 2usize] = b"i\0"; -pub const PRIiLEAST64: &[u8; 4usize] = b"lli\0"; -pub const PRIiFAST8: &[u8; 2usize] = b"i\0"; -pub const PRIiFAST64: &[u8; 4usize] = b"lli\0"; -pub const PRIiMAX: &[u8; 3usize] = b"ji\0"; -pub const PRIo8: &[u8; 2usize] = b"o\0"; -pub const PRIo16: &[u8; 2usize] = b"o\0"; -pub const PRIo32: &[u8; 2usize] = b"o\0"; -pub const PRIo64: &[u8; 4usize] = b"llo\0"; -pub const PRIoLEAST8: &[u8; 2usize] = b"o\0"; -pub const PRIoLEAST16: &[u8; 2usize] = b"o\0"; -pub const PRIoLEAST32: &[u8; 2usize] = b"o\0"; -pub const PRIoLEAST64: &[u8; 4usize] = b"llo\0"; -pub const PRIoFAST8: &[u8; 2usize] = b"o\0"; -pub const PRIoFAST64: &[u8; 4usize] = b"llo\0"; -pub const PRIoMAX: &[u8; 3usize] = b"jo\0"; -pub const PRIu8: &[u8; 2usize] = b"u\0"; -pub const PRIu16: &[u8; 2usize] = b"u\0"; -pub const PRIu32: &[u8; 2usize] = b"u\0"; -pub const PRIu64: &[u8; 4usize] = b"llu\0"; -pub const PRIuLEAST8: &[u8; 2usize] = b"u\0"; -pub const PRIuLEAST16: &[u8; 2usize] = b"u\0"; -pub const PRIuLEAST32: &[u8; 2usize] = b"u\0"; -pub const PRIuLEAST64: &[u8; 4usize] = b"llu\0"; -pub const PRIuFAST8: &[u8; 2usize] = b"u\0"; -pub const PRIuFAST64: &[u8; 4usize] = b"llu\0"; -pub const PRIuMAX: &[u8; 3usize] = b"ju\0"; -pub const PRIx8: &[u8; 2usize] = b"x\0"; -pub const PRIx16: &[u8; 2usize] = b"x\0"; -pub const PRIx32: &[u8; 2usize] = b"x\0"; -pub const PRIx64: &[u8; 4usize] = b"llx\0"; -pub const PRIxLEAST8: &[u8; 2usize] = b"x\0"; -pub const PRIxLEAST16: &[u8; 2usize] = b"x\0"; -pub const PRIxLEAST32: &[u8; 2usize] = b"x\0"; -pub const PRIxLEAST64: &[u8; 4usize] = b"llx\0"; -pub const PRIxFAST8: &[u8; 2usize] = b"x\0"; -pub const PRIxFAST64: &[u8; 4usize] = b"llx\0"; -pub const PRIxMAX: &[u8; 3usize] = b"jx\0"; -pub const PRIX8: &[u8; 2usize] = b"X\0"; -pub const PRIX16: &[u8; 2usize] = b"X\0"; -pub const PRIX32: &[u8; 2usize] = b"X\0"; -pub const PRIX64: &[u8; 4usize] = b"llX\0"; -pub const PRIXLEAST8: &[u8; 2usize] = b"X\0"; -pub const PRIXLEAST16: &[u8; 2usize] = b"X\0"; -pub const PRIXLEAST32: &[u8; 2usize] = b"X\0"; -pub const PRIXLEAST64: &[u8; 4usize] = b"llX\0"; -pub const PRIXFAST8: &[u8; 2usize] = b"X\0"; -pub const PRIXFAST64: &[u8; 4usize] = b"llX\0"; -pub const PRIXMAX: &[u8; 3usize] = b"jX\0"; -pub const SCNd8: &[u8; 4usize] = b"hhd\0"; -pub const SCNd16: &[u8; 3usize] = b"hd\0"; -pub const SCNd32: &[u8; 2usize] = b"d\0"; -pub const SCNd64: &[u8; 4usize] = b"lld\0"; -pub const SCNdLEAST8: &[u8; 4usize] = b"hhd\0"; -pub const SCNdLEAST16: &[u8; 3usize] = b"hd\0"; -pub const SCNdLEAST32: &[u8; 2usize] = b"d\0"; -pub const SCNdLEAST64: &[u8; 4usize] = b"lld\0"; -pub const SCNdFAST8: &[u8; 4usize] = b"hhd\0"; -pub const SCNdFAST64: &[u8; 4usize] = b"lld\0"; -pub const SCNdMAX: &[u8; 3usize] = b"jd\0"; -pub const SCNi8: &[u8; 4usize] = b"hhi\0"; -pub const SCNi16: &[u8; 3usize] = b"hi\0"; -pub const SCNi32: &[u8; 2usize] = b"i\0"; -pub const SCNi64: &[u8; 4usize] = b"lli\0"; -pub const SCNiLEAST8: &[u8; 4usize] = b"hhi\0"; -pub const SCNiLEAST16: &[u8; 3usize] = b"hi\0"; -pub const SCNiLEAST32: &[u8; 2usize] = b"i\0"; -pub const SCNiLEAST64: &[u8; 4usize] = b"lli\0"; -pub const SCNiFAST8: &[u8; 4usize] = b"hhi\0"; -pub const SCNiFAST64: &[u8; 4usize] = b"lli\0"; -pub const SCNiMAX: &[u8; 3usize] = b"ji\0"; -pub const SCNo8: &[u8; 4usize] = b"hho\0"; -pub const SCNo16: &[u8; 3usize] = b"ho\0"; -pub const SCNo32: &[u8; 2usize] = b"o\0"; -pub const SCNo64: &[u8; 4usize] = b"llo\0"; -pub const SCNoLEAST8: &[u8; 4usize] = b"hho\0"; -pub const SCNoLEAST16: &[u8; 3usize] = b"ho\0"; -pub const SCNoLEAST32: &[u8; 2usize] = b"o\0"; -pub const SCNoLEAST64: &[u8; 4usize] = b"llo\0"; -pub const SCNoFAST8: &[u8; 4usize] = b"hho\0"; -pub const SCNoFAST64: &[u8; 4usize] = b"llo\0"; -pub const SCNoMAX: &[u8; 3usize] = b"jo\0"; -pub const SCNu8: &[u8; 4usize] = b"hhu\0"; -pub const SCNu16: &[u8; 3usize] = b"hu\0"; -pub const SCNu32: &[u8; 2usize] = b"u\0"; -pub const SCNu64: &[u8; 4usize] = b"llu\0"; -pub const SCNuLEAST8: &[u8; 4usize] = b"hhu\0"; -pub const SCNuLEAST16: &[u8; 3usize] = b"hu\0"; -pub const SCNuLEAST32: &[u8; 2usize] = b"u\0"; -pub const SCNuLEAST64: &[u8; 4usize] = b"llu\0"; -pub const SCNuFAST8: &[u8; 4usize] = b"hhu\0"; -pub const SCNuFAST64: &[u8; 4usize] = b"llu\0"; -pub const SCNuMAX: &[u8; 3usize] = b"ju\0"; -pub const SCNx8: &[u8; 4usize] = b"hhx\0"; -pub const SCNx16: &[u8; 3usize] = b"hx\0"; -pub const SCNx32: &[u8; 2usize] = b"x\0"; -pub const SCNx64: &[u8; 4usize] = b"llx\0"; -pub const SCNxLEAST8: &[u8; 4usize] = b"hhx\0"; -pub const SCNxLEAST16: &[u8; 3usize] = b"hx\0"; -pub const SCNxLEAST32: &[u8; 2usize] = b"x\0"; -pub const SCNxLEAST64: &[u8; 4usize] = b"llx\0"; -pub const SCNxFAST8: &[u8; 4usize] = b"hhx\0"; -pub const SCNxFAST64: &[u8; 4usize] = b"llx\0"; -pub const SCNxMAX: &[u8; 3usize] = b"jx\0"; -pub const __GNUC_VA_LIST: u32 = 1; +pub const __bool_true_false_are_defined: u32 = 1; pub const true_: u32 = 1; pub const false_: u32 = 0; -pub const __bool_true_false_are_defined: u32 = 1; +pub const __PRI_64_prefix: &[u8; 3] = b"ll\0"; +pub const PRId8: &[u8; 2] = b"d\0"; +pub const PRId16: &[u8; 2] = b"d\0"; +pub const PRId32: &[u8; 2] = b"d\0"; +pub const PRId64: &[u8; 4] = b"lld\0"; +pub const PRIdLEAST8: &[u8; 2] = b"d\0"; +pub const PRIdLEAST16: &[u8; 2] = b"d\0"; +pub const PRIdLEAST32: &[u8; 2] = b"d\0"; +pub const PRIdLEAST64: &[u8; 4] = b"lld\0"; +pub const PRIdFAST8: &[u8; 2] = b"d\0"; +pub const PRIdFAST64: &[u8; 4] = b"lld\0"; +pub const PRIdMAX: &[u8; 3] = b"jd\0"; +pub const PRIi8: &[u8; 2] = b"i\0"; +pub const PRIi16: &[u8; 2] = b"i\0"; +pub const PRIi32: &[u8; 2] = b"i\0"; +pub const PRIi64: &[u8; 4] = b"lli\0"; +pub const PRIiLEAST8: &[u8; 2] = b"i\0"; +pub const PRIiLEAST16: &[u8; 2] = b"i\0"; +pub const PRIiLEAST32: &[u8; 2] = b"i\0"; +pub const PRIiLEAST64: &[u8; 4] = b"lli\0"; +pub const PRIiFAST8: &[u8; 2] = b"i\0"; +pub const PRIiFAST64: &[u8; 4] = b"lli\0"; +pub const PRIiMAX: &[u8; 3] = b"ji\0"; +pub const PRIb8: &[u8; 2] = b"b\0"; +pub const PRIb16: &[u8; 2] = b"b\0"; +pub const PRIb32: &[u8; 2] = b"b\0"; +pub const PRIb64: &[u8; 4] = b"llb\0"; +pub const PRIbLEAST8: &[u8; 2] = b"b\0"; +pub const PRIbLEAST16: &[u8; 2] = b"b\0"; +pub const PRIbLEAST32: &[u8; 2] = b"b\0"; +pub const PRIbLEAST64: &[u8; 4] = b"llb\0"; +pub const PRIbFAST8: &[u8; 2] = b"b\0"; +pub const PRIbFAST64: &[u8; 4] = b"llb\0"; +pub const PRIbMAX: &[u8; 3] = b"jb\0"; +pub const PRIB8: &[u8; 2] = b"B\0"; +pub const PRIB16: &[u8; 2] = b"B\0"; +pub const PRIB32: &[u8; 2] = b"B\0"; +pub const PRIB64: &[u8; 4] = b"llB\0"; +pub const PRIBLEAST8: &[u8; 2] = b"B\0"; +pub const PRIBLEAST16: &[u8; 2] = b"B\0"; +pub const PRIBLEAST32: &[u8; 2] = b"B\0"; +pub const PRIBLEAST64: &[u8; 4] = b"llB\0"; +pub const PRIBFAST8: &[u8; 2] = b"B\0"; +pub const PRIBFAST64: &[u8; 4] = b"llB\0"; +pub const PRIBMAX: &[u8; 3] = b"jB\0"; +pub const PRIo8: &[u8; 2] = b"o\0"; +pub const PRIo16: &[u8; 2] = b"o\0"; +pub const PRIo32: &[u8; 2] = b"o\0"; +pub const PRIo64: &[u8; 4] = b"llo\0"; +pub const PRIoLEAST8: &[u8; 2] = b"o\0"; +pub const PRIoLEAST16: &[u8; 2] = b"o\0"; +pub const PRIoLEAST32: &[u8; 2] = b"o\0"; +pub const PRIoLEAST64: &[u8; 4] = b"llo\0"; +pub const PRIoFAST8: &[u8; 2] = b"o\0"; +pub const PRIoFAST64: &[u8; 4] = b"llo\0"; +pub const PRIoMAX: &[u8; 3] = b"jo\0"; +pub const PRIu8: &[u8; 2] = b"u\0"; +pub const PRIu16: &[u8; 2] = b"u\0"; +pub const PRIu32: &[u8; 2] = b"u\0"; +pub const PRIu64: &[u8; 4] = b"llu\0"; +pub const PRIuLEAST8: &[u8; 2] = b"u\0"; +pub const PRIuLEAST16: &[u8; 2] = b"u\0"; +pub const PRIuLEAST32: &[u8; 2] = b"u\0"; +pub const PRIuLEAST64: &[u8; 4] = b"llu\0"; +pub const PRIuFAST8: &[u8; 2] = b"u\0"; +pub const PRIuFAST64: &[u8; 4] = b"llu\0"; +pub const PRIuMAX: &[u8; 3] = b"ju\0"; +pub const PRIx8: &[u8; 2] = b"x\0"; +pub const PRIx16: &[u8; 2] = b"x\0"; +pub const PRIx32: &[u8; 2] = b"x\0"; +pub const PRIx64: &[u8; 4] = b"llx\0"; +pub const PRIxLEAST8: &[u8; 2] = b"x\0"; +pub const PRIxLEAST16: &[u8; 2] = b"x\0"; +pub const PRIxLEAST32: &[u8; 2] = b"x\0"; +pub const PRIxLEAST64: &[u8; 4] = b"llx\0"; +pub const PRIxFAST8: &[u8; 2] = b"x\0"; +pub const PRIxFAST64: &[u8; 4] = b"llx\0"; +pub const PRIxMAX: &[u8; 3] = b"jx\0"; +pub const PRIX8: &[u8; 2] = b"X\0"; +pub const PRIX16: &[u8; 2] = b"X\0"; +pub const PRIX32: &[u8; 2] = b"X\0"; +pub const PRIX64: &[u8; 4] = b"llX\0"; +pub const PRIXLEAST8: &[u8; 2] = b"X\0"; +pub const PRIXLEAST16: &[u8; 2] = b"X\0"; +pub const PRIXLEAST32: &[u8; 2] = b"X\0"; +pub const PRIXLEAST64: &[u8; 4] = b"llX\0"; +pub const PRIXFAST8: &[u8; 2] = b"X\0"; +pub const PRIXFAST64: &[u8; 4] = b"llX\0"; +pub const PRIXMAX: &[u8; 3] = b"jX\0"; +pub const SCNd8: &[u8; 4] = b"hhd\0"; +pub const SCNd16: &[u8; 3] = b"hd\0"; +pub const SCNd32: &[u8; 2] = b"d\0"; +pub const SCNd64: &[u8; 4] = b"lld\0"; +pub const SCNdLEAST8: &[u8; 4] = b"hhd\0"; +pub const SCNdLEAST16: &[u8; 3] = b"hd\0"; +pub const SCNdLEAST32: &[u8; 2] = b"d\0"; +pub const SCNdLEAST64: &[u8; 4] = b"lld\0"; +pub const SCNdFAST8: &[u8; 4] = b"hhd\0"; +pub const SCNdFAST64: &[u8; 4] = b"lld\0"; +pub const SCNdMAX: &[u8; 3] = b"jd\0"; +pub const SCNi8: &[u8; 4] = b"hhi\0"; +pub const SCNi16: &[u8; 3] = b"hi\0"; +pub const SCNi32: &[u8; 2] = b"i\0"; +pub const SCNi64: &[u8; 4] = b"lli\0"; +pub const SCNiLEAST8: &[u8; 4] = b"hhi\0"; +pub const SCNiLEAST16: &[u8; 3] = b"hi\0"; +pub const SCNiLEAST32: &[u8; 2] = b"i\0"; +pub const SCNiLEAST64: &[u8; 4] = b"lli\0"; +pub const SCNiFAST8: &[u8; 4] = b"hhi\0"; +pub const SCNiFAST64: &[u8; 4] = b"lli\0"; +pub const SCNiMAX: &[u8; 3] = b"ji\0"; +pub const SCNb8: &[u8; 4] = b"hhb\0"; +pub const SCNb16: &[u8; 3] = b"hb\0"; +pub const SCNb32: &[u8; 2] = b"b\0"; +pub const SCNb64: &[u8; 4] = b"llb\0"; +pub const SCNbLEAST8: &[u8; 4] = b"hhb\0"; +pub const SCNbLEAST16: &[u8; 3] = b"hb\0"; +pub const SCNbLEAST32: &[u8; 2] = b"b\0"; +pub const SCNbLEAST64: &[u8; 4] = b"llb\0"; +pub const SCNbFAST8: &[u8; 4] = b"hhb\0"; +pub const SCNbFAST64: &[u8; 4] = b"llb\0"; +pub const SCNbMAX: &[u8; 3] = b"jb\0"; +pub const SCNB8: &[u8; 4] = b"hhB\0"; +pub const SCNB16: &[u8; 3] = b"hB\0"; +pub const SCNB32: &[u8; 2] = b"B\0"; +pub const SCNB64: &[u8; 4] = b"llB\0"; +pub const SCNBLEAST8: &[u8; 4] = b"hhB\0"; +pub const SCNBLEAST16: &[u8; 3] = b"hB\0"; +pub const SCNBLEAST32: &[u8; 2] = b"B\0"; +pub const SCNBLEAST64: &[u8; 4] = b"llB\0"; +pub const SCNBFAST8: &[u8; 4] = b"hhB\0"; +pub const SCNBFAST64: &[u8; 4] = b"llB\0"; +pub const SCNBMAX: &[u8; 3] = b"jB\0"; +pub const SCNo8: &[u8; 4] = b"hho\0"; +pub const SCNo16: &[u8; 3] = b"ho\0"; +pub const SCNo32: &[u8; 2] = b"o\0"; +pub const SCNo64: &[u8; 4] = b"llo\0"; +pub const SCNoLEAST8: &[u8; 4] = b"hho\0"; +pub const SCNoLEAST16: &[u8; 3] = b"ho\0"; +pub const SCNoLEAST32: &[u8; 2] = b"o\0"; +pub const SCNoLEAST64: &[u8; 4] = b"llo\0"; +pub const SCNoFAST8: &[u8; 4] = b"hho\0"; +pub const SCNoFAST64: &[u8; 4] = b"llo\0"; +pub const SCNoMAX: &[u8; 3] = b"jo\0"; +pub const SCNu8: &[u8; 4] = b"hhu\0"; +pub const SCNu16: &[u8; 3] = b"hu\0"; +pub const SCNu32: &[u8; 2] = b"u\0"; +pub const SCNu64: &[u8; 4] = b"llu\0"; +pub const SCNuLEAST8: &[u8; 4] = b"hhu\0"; +pub const SCNuLEAST16: &[u8; 3] = b"hu\0"; +pub const SCNuLEAST32: &[u8; 2] = b"u\0"; +pub const SCNuLEAST64: &[u8; 4] = b"llu\0"; +pub const SCNuFAST8: &[u8; 4] = b"hhu\0"; +pub const SCNuFAST64: &[u8; 4] = b"llu\0"; +pub const SCNuMAX: &[u8; 3] = b"ju\0"; +pub const SCNx8: &[u8; 4] = b"hhx\0"; +pub const SCNx16: &[u8; 3] = b"hx\0"; +pub const SCNx32: &[u8; 2] = b"x\0"; +pub const SCNx64: &[u8; 4] = b"llx\0"; +pub const SCNxLEAST8: &[u8; 4] = b"hhx\0"; +pub const SCNxLEAST16: &[u8; 3] = b"hx\0"; +pub const SCNxLEAST32: &[u8; 2] = b"x\0"; +pub const SCNxLEAST64: &[u8; 4] = b"llx\0"; +pub const SCNxFAST8: &[u8; 4] = b"hhx\0"; +pub const SCNxFAST64: &[u8; 4] = b"llx\0"; +pub const SCNxMAX: &[u8; 3] = b"jx\0"; pub const GAME_ACTIVITY_POINTER_INFO_AXIS_COUNT: u32 = 48; pub const GAMEACTIVITY_MAX_NUM_POINTERS_IN_MOTION_EVENT: u32 = 8; -pub const GAMEACTIVITY_MAX_NUM_HISTORICAL_IN_MOTION_EVENT: u32 = 8; +pub const GAMETEXTINPUT_MAJOR_VERSION: u32 = 4; +pub const GAMETEXTINPUT_MINOR_VERSION: u32 = 0; +pub const GAMETEXTINPUT_BUGFIX_VERSION: u32 = 0; +pub const GAMEACTIVITY_MAJOR_VERSION: u32 = 4; +pub const GAMEACTIVITY_MINOR_VERSION: u32 = 0; +pub const GAMEACTIVITY_BUGFIX_VERSION: u32 = 0; pub const POLLIN: u32 = 1; pub const POLLPRI: u32 = 2; pub const POLLOUT: u32 = 4; @@ -495,19 +605,21 @@ pub const SIGSYS: u32 = 31; pub const SIGUNUSED: u32 = 31; pub const __SIGRTMIN: u32 = 32; pub const SIGSWI: u32 = 32; +pub const SA_THIRTYTWO: u32 = 33554432; +pub const SA_RESTORER: u32 = 67108864; +pub const MINSIGSTKSZ: u32 = 2048; +pub const SIGSTKSZ: u32 = 8192; pub const SA_NOCLDSTOP: u32 = 1; pub const SA_NOCLDWAIT: u32 = 2; pub const SA_SIGINFO: u32 = 4; -pub const SA_THIRTYTWO: u32 = 33554432; -pub const SA_RESTORER: u32 = 67108864; +pub const SA_UNSUPPORTED: u32 = 1024; +pub const SA_EXPOSE_TAGBITS: u32 = 2048; pub const SA_ONSTACK: u32 = 134217728; pub const SA_RESTART: u32 = 268435456; pub const SA_NODEFER: u32 = 1073741824; pub const SA_RESETHAND: u32 = 2147483648; pub const SA_NOMASK: u32 = 1073741824; pub const SA_ONESHOT: u32 = 2147483648; -pub const MINSIGSTKSZ: u32 = 2048; -pub const SIGSTKSZ: u32 = 8192; pub const SIG_BLOCK: u32 = 0; pub const SIG_UNBLOCK: u32 = 1; pub const SIG_SETMASK: u32 = 2; @@ -557,7 +669,9 @@ pub const SEGV_PKUERR: u32 = 4; pub const SEGV_ACCADI: u32 = 5; pub const SEGV_ADIDERR: u32 = 6; pub const SEGV_ADIPERR: u32 = 7; -pub const NSIGSEGV: u32 = 7; +pub const SEGV_MTEAERR: u32 = 8; +pub const SEGV_MTESERR: u32 = 9; +pub const NSIGSEGV: u32 = 9; pub const BUS_ADRALN: u32 = 1; pub const BUS_ADRERR: u32 = 2; pub const BUS_OBJERR: u32 = 3; @@ -569,7 +683,9 @@ pub const TRAP_TRACE: u32 = 2; pub const TRAP_BRANCH: u32 = 3; pub const TRAP_HWBKPT: u32 = 4; pub const TRAP_UNK: u32 = 5; -pub const NSIGTRAP: u32 = 5; +pub const TRAP_PERF: u32 = 6; +pub const NSIGTRAP: u32 = 6; +pub const TRAP_PERF_FLAG_ASYNC: u32 = 1; pub const CLD_EXITED: u32 = 1; pub const CLD_KILLED: u32 = 2; pub const CLD_DUMPED: u32 = 3; @@ -585,7 +701,8 @@ pub const POLL_PRI: u32 = 5; pub const POLL_HUP: u32 = 6; pub const NSIGPOLL: u32 = 6; pub const SYS_SECCOMP: u32 = 1; -pub const NSIGSYS: u32 = 1; +pub const SYS_USER_DISPATCH: u32 = 2; +pub const NSIGSYS: u32 = 2; pub const EMT_TAGOVF: u32 = 1; pub const NSIGEMT: u32 = 1; pub const SIGEV_SIGNAL: u32 = 0; @@ -625,6 +742,9 @@ pub const TIMER_ABSTIME: u32 = 1; pub const FD_SETSIZE: u32 = 1024; pub const CLOCKS_PER_SEC: u32 = 1000000; pub const TIME_UTC: u32 = 1; +pub const TIME_MONOTONIC: u32 = 2; +pub const TIME_ACTIVE: u32 = 3; +pub const TIME_THREAD_ACTIVE: u32 = 4; pub const CSIGNAL: u32 = 255; pub const CLONE_VM: u32 = 256; pub const CLONE_FS: u32 = 512; @@ -650,6 +770,12 @@ pub const CLONE_NEWUSER: u32 = 268435456; pub const CLONE_NEWPID: u32 = 536870912; pub const CLONE_NEWNET: u32 = 1073741824; pub const CLONE_IO: u32 = 2147483648; +pub const CLONE_CLEAR_SIGHAND: u64 = 4294967296; +pub const CLONE_INTO_CGROUP: u64 = 8589934592; +pub const CLONE_NEWTIME: u32 = 128; +pub const CLONE_ARGS_SIZE_VER0: u32 = 64; +pub const CLONE_ARGS_SIZE_VER1: u32 = 80; +pub const CLONE_ARGS_SIZE_VER2: u32 = 88; pub const SCHED_NORMAL: u32 = 0; pub const SCHED_FIFO: u32 = 1; pub const SCHED_RR: u32 = 2; @@ -681,9 +807,6 @@ pub const PTHREAD_PROCESS_PRIVATE: u32 = 0; pub const PTHREAD_PROCESS_SHARED: u32 = 1; pub const PTHREAD_SCOPE_SYSTEM: u32 = 0; pub const PTHREAD_SCOPE_PROCESS: u32 = 1; -pub const NATIVE_APP_GLUE_MAX_NUM_MOTION_EVENTS: u32 = 16; -pub const NATIVE_APP_GLUE_MAX_HISTORICAL_POINTER_SAMPLES: u32 = 64; -pub const NATIVE_APP_GLUE_MAX_NUM_KEY_EVENTS: u32 = 4; pub const NATIVE_APP_GLUE_MAX_INPUT_BUFFERS: u32 = 2; extern "C" { pub fn android_get_application_target_sdk_version() -> ::std::os::raw::c_int; @@ -700,39 +823,27 @@ pub struct max_align_t { } #[test] fn bindgen_test_layout_max_align_t() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 16usize, - concat!("Size of: ", stringify!(max_align_t)) + "Size of max_align_t" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(max_align_t)) + "Alignment of max_align_t" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).__clang_max_align_nonce1 as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce1) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(max_align_t), - "::", - stringify!(__clang_max_align_nonce1) - ) + "Offset of field: max_align_t::__clang_max_align_nonce1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).__clang_max_align_nonce2 as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce2) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(max_align_t), - "::", - stringify!(__clang_max_align_nonce2) - ) + "Offset of field: max_align_t::__clang_max_align_nonce2" ); } pub type __int8_t = ::std::os::raw::c_schar; @@ -778,25 +889,22 @@ pub struct __kernel_fd_set { } #[test] fn bindgen_test_layout___kernel_fd_set() { + const UNINIT: ::std::mem::MaybeUninit<__kernel_fd_set> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__kernel_fd_set>(), 128usize, - concat!("Size of: ", stringify!(__kernel_fd_set)) + "Size of __kernel_fd_set" ); assert_eq!( ::std::mem::align_of::<__kernel_fd_set>(), 4usize, - concat!("Alignment of ", stringify!(__kernel_fd_set)) + "Alignment of __kernel_fd_set" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_fd_set>())).fds_bits as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fds_bits) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__kernel_fd_set), - "::", - stringify!(fds_bits) - ) + "Offset of field: __kernel_fd_set::fds_bits" ); } pub type __kernel_sighandler_t = @@ -828,29 +936,27 @@ pub struct __kernel_fsid_t { } #[test] fn bindgen_test_layout___kernel_fsid_t() { + const UNINIT: ::std::mem::MaybeUninit<__kernel_fsid_t> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__kernel_fsid_t>(), 8usize, - concat!("Size of: ", stringify!(__kernel_fsid_t)) + "Size of __kernel_fsid_t" ); assert_eq!( ::std::mem::align_of::<__kernel_fsid_t>(), 4usize, - concat!("Alignment of ", stringify!(__kernel_fsid_t)) + "Alignment of __kernel_fsid_t" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_fsid_t>())).val as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).val) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__kernel_fsid_t), - "::", - stringify!(val) - ) + "Offset of field: __kernel_fsid_t::val" ); } pub type __kernel_off_t = __kernel_long_t; pub type __kernel_loff_t = ::std::os::raw::c_longlong; +pub type __kernel_old_time_t = __kernel_long_t; pub type __kernel_time_t = __kernel_long_t; pub type __kernel_time64_t = ::std::os::raw::c_longlong; pub type __kernel_clock_t = __kernel_long_t; @@ -909,7 +1015,6 @@ pub type off64_t = loff_t; pub type __socklen_t = i32; pub type socklen_t = __socklen_t; pub type __va_list = u32; -pub type ssize_t = __kernel_ssize_t; pub type uint_t = ::std::os::raw::c_uint; pub type uint = ::std::os::raw::c_uint; pub type u_char = ::std::os::raw::c_uchar; @@ -920,483 +1025,622 @@ pub type u_int32_t = u32; pub type u_int16_t = u16; pub type u_int8_t = u8; pub type u_int64_t = u64; -pub const AASSET_MODE_UNKNOWN: ::std::os::raw::c_uint = 0; -pub const AASSET_MODE_RANDOM: ::std::os::raw::c_uint = 1; -pub const AASSET_MODE_STREAMING: ::std::os::raw::c_uint = 2; -pub const AASSET_MODE_BUFFER: ::std::os::raw::c_uint = 3; +pub const AASSET_MODE_UNKNOWN: _bindgen_ty_1 = 0; +pub const AASSET_MODE_RANDOM: _bindgen_ty_1 = 1; +pub const AASSET_MODE_STREAMING: _bindgen_ty_1 = 2; +pub const AASSET_MODE_BUFFER: _bindgen_ty_1 = 3; pub type _bindgen_ty_1 = ::std::os::raw::c_uint; -pub const AKEYCODE_UNKNOWN: ::std::os::raw::c_uint = 0; -pub const AKEYCODE_SOFT_LEFT: ::std::os::raw::c_uint = 1; -pub const AKEYCODE_SOFT_RIGHT: ::std::os::raw::c_uint = 2; -pub const AKEYCODE_HOME: ::std::os::raw::c_uint = 3; -pub const AKEYCODE_BACK: ::std::os::raw::c_uint = 4; -pub const AKEYCODE_CALL: ::std::os::raw::c_uint = 5; -pub const AKEYCODE_ENDCALL: ::std::os::raw::c_uint = 6; -pub const AKEYCODE_0: ::std::os::raw::c_uint = 7; -pub const AKEYCODE_1: ::std::os::raw::c_uint = 8; -pub const AKEYCODE_2: ::std::os::raw::c_uint = 9; -pub const AKEYCODE_3: ::std::os::raw::c_uint = 10; -pub const AKEYCODE_4: ::std::os::raw::c_uint = 11; -pub const AKEYCODE_5: ::std::os::raw::c_uint = 12; -pub const AKEYCODE_6: ::std::os::raw::c_uint = 13; -pub const AKEYCODE_7: ::std::os::raw::c_uint = 14; -pub const AKEYCODE_8: ::std::os::raw::c_uint = 15; -pub const AKEYCODE_9: ::std::os::raw::c_uint = 16; -pub const AKEYCODE_STAR: ::std::os::raw::c_uint = 17; -pub const AKEYCODE_POUND: ::std::os::raw::c_uint = 18; -pub const AKEYCODE_DPAD_UP: ::std::os::raw::c_uint = 19; -pub const AKEYCODE_DPAD_DOWN: ::std::os::raw::c_uint = 20; -pub const AKEYCODE_DPAD_LEFT: ::std::os::raw::c_uint = 21; -pub const AKEYCODE_DPAD_RIGHT: ::std::os::raw::c_uint = 22; -pub const AKEYCODE_DPAD_CENTER: ::std::os::raw::c_uint = 23; -pub const AKEYCODE_VOLUME_UP: ::std::os::raw::c_uint = 24; -pub const AKEYCODE_VOLUME_DOWN: ::std::os::raw::c_uint = 25; -pub const AKEYCODE_POWER: ::std::os::raw::c_uint = 26; -pub const AKEYCODE_CAMERA: ::std::os::raw::c_uint = 27; -pub const AKEYCODE_CLEAR: ::std::os::raw::c_uint = 28; -pub const AKEYCODE_A: ::std::os::raw::c_uint = 29; -pub const AKEYCODE_B: ::std::os::raw::c_uint = 30; -pub const AKEYCODE_C: ::std::os::raw::c_uint = 31; -pub const AKEYCODE_D: ::std::os::raw::c_uint = 32; -pub const AKEYCODE_E: ::std::os::raw::c_uint = 33; -pub const AKEYCODE_F: ::std::os::raw::c_uint = 34; -pub const AKEYCODE_G: ::std::os::raw::c_uint = 35; -pub const AKEYCODE_H: ::std::os::raw::c_uint = 36; -pub const AKEYCODE_I: ::std::os::raw::c_uint = 37; -pub const AKEYCODE_J: ::std::os::raw::c_uint = 38; -pub const AKEYCODE_K: ::std::os::raw::c_uint = 39; -pub const AKEYCODE_L: ::std::os::raw::c_uint = 40; -pub const AKEYCODE_M: ::std::os::raw::c_uint = 41; -pub const AKEYCODE_N: ::std::os::raw::c_uint = 42; -pub const AKEYCODE_O: ::std::os::raw::c_uint = 43; -pub const AKEYCODE_P: ::std::os::raw::c_uint = 44; -pub const AKEYCODE_Q: ::std::os::raw::c_uint = 45; -pub const AKEYCODE_R: ::std::os::raw::c_uint = 46; -pub const AKEYCODE_S: ::std::os::raw::c_uint = 47; -pub const AKEYCODE_T: ::std::os::raw::c_uint = 48; -pub const AKEYCODE_U: ::std::os::raw::c_uint = 49; -pub const AKEYCODE_V: ::std::os::raw::c_uint = 50; -pub const AKEYCODE_W: ::std::os::raw::c_uint = 51; -pub const AKEYCODE_X: ::std::os::raw::c_uint = 52; -pub const AKEYCODE_Y: ::std::os::raw::c_uint = 53; -pub const AKEYCODE_Z: ::std::os::raw::c_uint = 54; -pub const AKEYCODE_COMMA: ::std::os::raw::c_uint = 55; -pub const AKEYCODE_PERIOD: ::std::os::raw::c_uint = 56; -pub const AKEYCODE_ALT_LEFT: ::std::os::raw::c_uint = 57; -pub const AKEYCODE_ALT_RIGHT: ::std::os::raw::c_uint = 58; -pub const AKEYCODE_SHIFT_LEFT: ::std::os::raw::c_uint = 59; -pub const AKEYCODE_SHIFT_RIGHT: ::std::os::raw::c_uint = 60; -pub const AKEYCODE_TAB: ::std::os::raw::c_uint = 61; -pub const AKEYCODE_SPACE: ::std::os::raw::c_uint = 62; -pub const AKEYCODE_SYM: ::std::os::raw::c_uint = 63; -pub const AKEYCODE_EXPLORER: ::std::os::raw::c_uint = 64; -pub const AKEYCODE_ENVELOPE: ::std::os::raw::c_uint = 65; -pub const AKEYCODE_ENTER: ::std::os::raw::c_uint = 66; -pub const AKEYCODE_DEL: ::std::os::raw::c_uint = 67; -pub const AKEYCODE_GRAVE: ::std::os::raw::c_uint = 68; -pub const AKEYCODE_MINUS: ::std::os::raw::c_uint = 69; -pub const AKEYCODE_EQUALS: ::std::os::raw::c_uint = 70; -pub const AKEYCODE_LEFT_BRACKET: ::std::os::raw::c_uint = 71; -pub const AKEYCODE_RIGHT_BRACKET: ::std::os::raw::c_uint = 72; -pub const AKEYCODE_BACKSLASH: ::std::os::raw::c_uint = 73; -pub const AKEYCODE_SEMICOLON: ::std::os::raw::c_uint = 74; -pub const AKEYCODE_APOSTROPHE: ::std::os::raw::c_uint = 75; -pub const AKEYCODE_SLASH: ::std::os::raw::c_uint = 76; -pub const AKEYCODE_AT: ::std::os::raw::c_uint = 77; -pub const AKEYCODE_NUM: ::std::os::raw::c_uint = 78; -pub const AKEYCODE_HEADSETHOOK: ::std::os::raw::c_uint = 79; -pub const AKEYCODE_FOCUS: ::std::os::raw::c_uint = 80; -pub const AKEYCODE_PLUS: ::std::os::raw::c_uint = 81; -pub const AKEYCODE_MENU: ::std::os::raw::c_uint = 82; -pub const AKEYCODE_NOTIFICATION: ::std::os::raw::c_uint = 83; -pub const AKEYCODE_SEARCH: ::std::os::raw::c_uint = 84; -pub const AKEYCODE_MEDIA_PLAY_PAUSE: ::std::os::raw::c_uint = 85; -pub const AKEYCODE_MEDIA_STOP: ::std::os::raw::c_uint = 86; -pub const AKEYCODE_MEDIA_NEXT: ::std::os::raw::c_uint = 87; -pub const AKEYCODE_MEDIA_PREVIOUS: ::std::os::raw::c_uint = 88; -pub const AKEYCODE_MEDIA_REWIND: ::std::os::raw::c_uint = 89; -pub const AKEYCODE_MEDIA_FAST_FORWARD: ::std::os::raw::c_uint = 90; -pub const AKEYCODE_MUTE: ::std::os::raw::c_uint = 91; -pub const AKEYCODE_PAGE_UP: ::std::os::raw::c_uint = 92; -pub const AKEYCODE_PAGE_DOWN: ::std::os::raw::c_uint = 93; -pub const AKEYCODE_PICTSYMBOLS: ::std::os::raw::c_uint = 94; -pub const AKEYCODE_SWITCH_CHARSET: ::std::os::raw::c_uint = 95; -pub const AKEYCODE_BUTTON_A: ::std::os::raw::c_uint = 96; -pub const AKEYCODE_BUTTON_B: ::std::os::raw::c_uint = 97; -pub const AKEYCODE_BUTTON_C: ::std::os::raw::c_uint = 98; -pub const AKEYCODE_BUTTON_X: ::std::os::raw::c_uint = 99; -pub const AKEYCODE_BUTTON_Y: ::std::os::raw::c_uint = 100; -pub const AKEYCODE_BUTTON_Z: ::std::os::raw::c_uint = 101; -pub const AKEYCODE_BUTTON_L1: ::std::os::raw::c_uint = 102; -pub const AKEYCODE_BUTTON_R1: ::std::os::raw::c_uint = 103; -pub const AKEYCODE_BUTTON_L2: ::std::os::raw::c_uint = 104; -pub const AKEYCODE_BUTTON_R2: ::std::os::raw::c_uint = 105; -pub const AKEYCODE_BUTTON_THUMBL: ::std::os::raw::c_uint = 106; -pub const AKEYCODE_BUTTON_THUMBR: ::std::os::raw::c_uint = 107; -pub const AKEYCODE_BUTTON_START: ::std::os::raw::c_uint = 108; -pub const AKEYCODE_BUTTON_SELECT: ::std::os::raw::c_uint = 109; -pub const AKEYCODE_BUTTON_MODE: ::std::os::raw::c_uint = 110; -pub const AKEYCODE_ESCAPE: ::std::os::raw::c_uint = 111; -pub const AKEYCODE_FORWARD_DEL: ::std::os::raw::c_uint = 112; -pub const AKEYCODE_CTRL_LEFT: ::std::os::raw::c_uint = 113; -pub const AKEYCODE_CTRL_RIGHT: ::std::os::raw::c_uint = 114; -pub const AKEYCODE_CAPS_LOCK: ::std::os::raw::c_uint = 115; -pub const AKEYCODE_SCROLL_LOCK: ::std::os::raw::c_uint = 116; -pub const AKEYCODE_META_LEFT: ::std::os::raw::c_uint = 117; -pub const AKEYCODE_META_RIGHT: ::std::os::raw::c_uint = 118; -pub const AKEYCODE_FUNCTION: ::std::os::raw::c_uint = 119; -pub const AKEYCODE_SYSRQ: ::std::os::raw::c_uint = 120; -pub const AKEYCODE_BREAK: ::std::os::raw::c_uint = 121; -pub const AKEYCODE_MOVE_HOME: ::std::os::raw::c_uint = 122; -pub const AKEYCODE_MOVE_END: ::std::os::raw::c_uint = 123; -pub const AKEYCODE_INSERT: ::std::os::raw::c_uint = 124; -pub const AKEYCODE_FORWARD: ::std::os::raw::c_uint = 125; -pub const AKEYCODE_MEDIA_PLAY: ::std::os::raw::c_uint = 126; -pub const AKEYCODE_MEDIA_PAUSE: ::std::os::raw::c_uint = 127; -pub const AKEYCODE_MEDIA_CLOSE: ::std::os::raw::c_uint = 128; -pub const AKEYCODE_MEDIA_EJECT: ::std::os::raw::c_uint = 129; -pub const AKEYCODE_MEDIA_RECORD: ::std::os::raw::c_uint = 130; -pub const AKEYCODE_F1: ::std::os::raw::c_uint = 131; -pub const AKEYCODE_F2: ::std::os::raw::c_uint = 132; -pub const AKEYCODE_F3: ::std::os::raw::c_uint = 133; -pub const AKEYCODE_F4: ::std::os::raw::c_uint = 134; -pub const AKEYCODE_F5: ::std::os::raw::c_uint = 135; -pub const AKEYCODE_F6: ::std::os::raw::c_uint = 136; -pub const AKEYCODE_F7: ::std::os::raw::c_uint = 137; -pub const AKEYCODE_F8: ::std::os::raw::c_uint = 138; -pub const AKEYCODE_F9: ::std::os::raw::c_uint = 139; -pub const AKEYCODE_F10: ::std::os::raw::c_uint = 140; -pub const AKEYCODE_F11: ::std::os::raw::c_uint = 141; -pub const AKEYCODE_F12: ::std::os::raw::c_uint = 142; -pub const AKEYCODE_NUM_LOCK: ::std::os::raw::c_uint = 143; -pub const AKEYCODE_NUMPAD_0: ::std::os::raw::c_uint = 144; -pub const AKEYCODE_NUMPAD_1: ::std::os::raw::c_uint = 145; -pub const AKEYCODE_NUMPAD_2: ::std::os::raw::c_uint = 146; -pub const AKEYCODE_NUMPAD_3: ::std::os::raw::c_uint = 147; -pub const AKEYCODE_NUMPAD_4: ::std::os::raw::c_uint = 148; -pub const AKEYCODE_NUMPAD_5: ::std::os::raw::c_uint = 149; -pub const AKEYCODE_NUMPAD_6: ::std::os::raw::c_uint = 150; -pub const AKEYCODE_NUMPAD_7: ::std::os::raw::c_uint = 151; -pub const AKEYCODE_NUMPAD_8: ::std::os::raw::c_uint = 152; -pub const AKEYCODE_NUMPAD_9: ::std::os::raw::c_uint = 153; -pub const AKEYCODE_NUMPAD_DIVIDE: ::std::os::raw::c_uint = 154; -pub const AKEYCODE_NUMPAD_MULTIPLY: ::std::os::raw::c_uint = 155; -pub const AKEYCODE_NUMPAD_SUBTRACT: ::std::os::raw::c_uint = 156; -pub const AKEYCODE_NUMPAD_ADD: ::std::os::raw::c_uint = 157; -pub const AKEYCODE_NUMPAD_DOT: ::std::os::raw::c_uint = 158; -pub const AKEYCODE_NUMPAD_COMMA: ::std::os::raw::c_uint = 159; -pub const AKEYCODE_NUMPAD_ENTER: ::std::os::raw::c_uint = 160; -pub const AKEYCODE_NUMPAD_EQUALS: ::std::os::raw::c_uint = 161; -pub const AKEYCODE_NUMPAD_LEFT_PAREN: ::std::os::raw::c_uint = 162; -pub const AKEYCODE_NUMPAD_RIGHT_PAREN: ::std::os::raw::c_uint = 163; -pub const AKEYCODE_VOLUME_MUTE: ::std::os::raw::c_uint = 164; -pub const AKEYCODE_INFO: ::std::os::raw::c_uint = 165; -pub const AKEYCODE_CHANNEL_UP: ::std::os::raw::c_uint = 166; -pub const AKEYCODE_CHANNEL_DOWN: ::std::os::raw::c_uint = 167; -pub const AKEYCODE_ZOOM_IN: ::std::os::raw::c_uint = 168; -pub const AKEYCODE_ZOOM_OUT: ::std::os::raw::c_uint = 169; -pub const AKEYCODE_TV: ::std::os::raw::c_uint = 170; -pub const AKEYCODE_WINDOW: ::std::os::raw::c_uint = 171; -pub const AKEYCODE_GUIDE: ::std::os::raw::c_uint = 172; -pub const AKEYCODE_DVR: ::std::os::raw::c_uint = 173; -pub const AKEYCODE_BOOKMARK: ::std::os::raw::c_uint = 174; -pub const AKEYCODE_CAPTIONS: ::std::os::raw::c_uint = 175; -pub const AKEYCODE_SETTINGS: ::std::os::raw::c_uint = 176; -pub const AKEYCODE_TV_POWER: ::std::os::raw::c_uint = 177; -pub const AKEYCODE_TV_INPUT: ::std::os::raw::c_uint = 178; -pub const AKEYCODE_STB_POWER: ::std::os::raw::c_uint = 179; -pub const AKEYCODE_STB_INPUT: ::std::os::raw::c_uint = 180; -pub const AKEYCODE_AVR_POWER: ::std::os::raw::c_uint = 181; -pub const AKEYCODE_AVR_INPUT: ::std::os::raw::c_uint = 182; -pub const AKEYCODE_PROG_RED: ::std::os::raw::c_uint = 183; -pub const AKEYCODE_PROG_GREEN: ::std::os::raw::c_uint = 184; -pub const AKEYCODE_PROG_YELLOW: ::std::os::raw::c_uint = 185; -pub const AKEYCODE_PROG_BLUE: ::std::os::raw::c_uint = 186; -pub const AKEYCODE_APP_SWITCH: ::std::os::raw::c_uint = 187; -pub const AKEYCODE_BUTTON_1: ::std::os::raw::c_uint = 188; -pub const AKEYCODE_BUTTON_2: ::std::os::raw::c_uint = 189; -pub const AKEYCODE_BUTTON_3: ::std::os::raw::c_uint = 190; -pub const AKEYCODE_BUTTON_4: ::std::os::raw::c_uint = 191; -pub const AKEYCODE_BUTTON_5: ::std::os::raw::c_uint = 192; -pub const AKEYCODE_BUTTON_6: ::std::os::raw::c_uint = 193; -pub const AKEYCODE_BUTTON_7: ::std::os::raw::c_uint = 194; -pub const AKEYCODE_BUTTON_8: ::std::os::raw::c_uint = 195; -pub const AKEYCODE_BUTTON_9: ::std::os::raw::c_uint = 196; -pub const AKEYCODE_BUTTON_10: ::std::os::raw::c_uint = 197; -pub const AKEYCODE_BUTTON_11: ::std::os::raw::c_uint = 198; -pub const AKEYCODE_BUTTON_12: ::std::os::raw::c_uint = 199; -pub const AKEYCODE_BUTTON_13: ::std::os::raw::c_uint = 200; -pub const AKEYCODE_BUTTON_14: ::std::os::raw::c_uint = 201; -pub const AKEYCODE_BUTTON_15: ::std::os::raw::c_uint = 202; -pub const AKEYCODE_BUTTON_16: ::std::os::raw::c_uint = 203; -pub const AKEYCODE_LANGUAGE_SWITCH: ::std::os::raw::c_uint = 204; -pub const AKEYCODE_MANNER_MODE: ::std::os::raw::c_uint = 205; -pub const AKEYCODE_3D_MODE: ::std::os::raw::c_uint = 206; -pub const AKEYCODE_CONTACTS: ::std::os::raw::c_uint = 207; -pub const AKEYCODE_CALENDAR: ::std::os::raw::c_uint = 208; -pub const AKEYCODE_MUSIC: ::std::os::raw::c_uint = 209; -pub const AKEYCODE_CALCULATOR: ::std::os::raw::c_uint = 210; -pub const AKEYCODE_ZENKAKU_HANKAKU: ::std::os::raw::c_uint = 211; -pub const AKEYCODE_EISU: ::std::os::raw::c_uint = 212; -pub const AKEYCODE_MUHENKAN: ::std::os::raw::c_uint = 213; -pub const AKEYCODE_HENKAN: ::std::os::raw::c_uint = 214; -pub const AKEYCODE_KATAKANA_HIRAGANA: ::std::os::raw::c_uint = 215; -pub const AKEYCODE_YEN: ::std::os::raw::c_uint = 216; -pub const AKEYCODE_RO: ::std::os::raw::c_uint = 217; -pub const AKEYCODE_KANA: ::std::os::raw::c_uint = 218; -pub const AKEYCODE_ASSIST: ::std::os::raw::c_uint = 219; -pub const AKEYCODE_BRIGHTNESS_DOWN: ::std::os::raw::c_uint = 220; -pub const AKEYCODE_BRIGHTNESS_UP: ::std::os::raw::c_uint = 221; -pub const AKEYCODE_MEDIA_AUDIO_TRACK: ::std::os::raw::c_uint = 222; -pub const AKEYCODE_SLEEP: ::std::os::raw::c_uint = 223; -pub const AKEYCODE_WAKEUP: ::std::os::raw::c_uint = 224; -pub const AKEYCODE_PAIRING: ::std::os::raw::c_uint = 225; -pub const AKEYCODE_MEDIA_TOP_MENU: ::std::os::raw::c_uint = 226; -pub const AKEYCODE_11: ::std::os::raw::c_uint = 227; -pub const AKEYCODE_12: ::std::os::raw::c_uint = 228; -pub const AKEYCODE_LAST_CHANNEL: ::std::os::raw::c_uint = 229; -pub const AKEYCODE_TV_DATA_SERVICE: ::std::os::raw::c_uint = 230; -pub const AKEYCODE_VOICE_ASSIST: ::std::os::raw::c_uint = 231; -pub const AKEYCODE_TV_RADIO_SERVICE: ::std::os::raw::c_uint = 232; -pub const AKEYCODE_TV_TELETEXT: ::std::os::raw::c_uint = 233; -pub const AKEYCODE_TV_NUMBER_ENTRY: ::std::os::raw::c_uint = 234; -pub const AKEYCODE_TV_TERRESTRIAL_ANALOG: ::std::os::raw::c_uint = 235; -pub const AKEYCODE_TV_TERRESTRIAL_DIGITAL: ::std::os::raw::c_uint = 236; -pub const AKEYCODE_TV_SATELLITE: ::std::os::raw::c_uint = 237; -pub const AKEYCODE_TV_SATELLITE_BS: ::std::os::raw::c_uint = 238; -pub const AKEYCODE_TV_SATELLITE_CS: ::std::os::raw::c_uint = 239; -pub const AKEYCODE_TV_SATELLITE_SERVICE: ::std::os::raw::c_uint = 240; -pub const AKEYCODE_TV_NETWORK: ::std::os::raw::c_uint = 241; -pub const AKEYCODE_TV_ANTENNA_CABLE: ::std::os::raw::c_uint = 242; -pub const AKEYCODE_TV_INPUT_HDMI_1: ::std::os::raw::c_uint = 243; -pub const AKEYCODE_TV_INPUT_HDMI_2: ::std::os::raw::c_uint = 244; -pub const AKEYCODE_TV_INPUT_HDMI_3: ::std::os::raw::c_uint = 245; -pub const AKEYCODE_TV_INPUT_HDMI_4: ::std::os::raw::c_uint = 246; -pub const AKEYCODE_TV_INPUT_COMPOSITE_1: ::std::os::raw::c_uint = 247; -pub const AKEYCODE_TV_INPUT_COMPOSITE_2: ::std::os::raw::c_uint = 248; -pub const AKEYCODE_TV_INPUT_COMPONENT_1: ::std::os::raw::c_uint = 249; -pub const AKEYCODE_TV_INPUT_COMPONENT_2: ::std::os::raw::c_uint = 250; -pub const AKEYCODE_TV_INPUT_VGA_1: ::std::os::raw::c_uint = 251; -pub const AKEYCODE_TV_AUDIO_DESCRIPTION: ::std::os::raw::c_uint = 252; -pub const AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_UP: ::std::os::raw::c_uint = 253; -pub const AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_DOWN: ::std::os::raw::c_uint = 254; -pub const AKEYCODE_TV_ZOOM_MODE: ::std::os::raw::c_uint = 255; -pub const AKEYCODE_TV_CONTENTS_MENU: ::std::os::raw::c_uint = 256; -pub const AKEYCODE_TV_MEDIA_CONTEXT_MENU: ::std::os::raw::c_uint = 257; -pub const AKEYCODE_TV_TIMER_PROGRAMMING: ::std::os::raw::c_uint = 258; -pub const AKEYCODE_HELP: ::std::os::raw::c_uint = 259; -pub const AKEYCODE_NAVIGATE_PREVIOUS: ::std::os::raw::c_uint = 260; -pub const AKEYCODE_NAVIGATE_NEXT: ::std::os::raw::c_uint = 261; -pub const AKEYCODE_NAVIGATE_IN: ::std::os::raw::c_uint = 262; -pub const AKEYCODE_NAVIGATE_OUT: ::std::os::raw::c_uint = 263; -pub const AKEYCODE_STEM_PRIMARY: ::std::os::raw::c_uint = 264; -pub const AKEYCODE_STEM_1: ::std::os::raw::c_uint = 265; -pub const AKEYCODE_STEM_2: ::std::os::raw::c_uint = 266; -pub const AKEYCODE_STEM_3: ::std::os::raw::c_uint = 267; -pub const AKEYCODE_DPAD_UP_LEFT: ::std::os::raw::c_uint = 268; -pub const AKEYCODE_DPAD_DOWN_LEFT: ::std::os::raw::c_uint = 269; -pub const AKEYCODE_DPAD_UP_RIGHT: ::std::os::raw::c_uint = 270; -pub const AKEYCODE_DPAD_DOWN_RIGHT: ::std::os::raw::c_uint = 271; -pub const AKEYCODE_MEDIA_SKIP_FORWARD: ::std::os::raw::c_uint = 272; -pub const AKEYCODE_MEDIA_SKIP_BACKWARD: ::std::os::raw::c_uint = 273; -pub const AKEYCODE_MEDIA_STEP_FORWARD: ::std::os::raw::c_uint = 274; -pub const AKEYCODE_MEDIA_STEP_BACKWARD: ::std::os::raw::c_uint = 275; -pub const AKEYCODE_SOFT_SLEEP: ::std::os::raw::c_uint = 276; -pub const AKEYCODE_CUT: ::std::os::raw::c_uint = 277; -pub const AKEYCODE_COPY: ::std::os::raw::c_uint = 278; -pub const AKEYCODE_PASTE: ::std::os::raw::c_uint = 279; -pub const AKEYCODE_SYSTEM_NAVIGATION_UP: ::std::os::raw::c_uint = 280; -pub const AKEYCODE_SYSTEM_NAVIGATION_DOWN: ::std::os::raw::c_uint = 281; -pub const AKEYCODE_SYSTEM_NAVIGATION_LEFT: ::std::os::raw::c_uint = 282; -pub const AKEYCODE_SYSTEM_NAVIGATION_RIGHT: ::std::os::raw::c_uint = 283; -pub const AKEYCODE_ALL_APPS: ::std::os::raw::c_uint = 284; -pub const AKEYCODE_REFRESH: ::std::os::raw::c_uint = 285; -pub const AKEYCODE_THUMBS_UP: ::std::os::raw::c_uint = 286; -pub const AKEYCODE_THUMBS_DOWN: ::std::os::raw::c_uint = 287; -pub const AKEYCODE_PROFILE_SWITCH: ::std::os::raw::c_uint = 288; +pub const AKEYCODE_UNKNOWN: _bindgen_ty_2 = 0; +pub const AKEYCODE_SOFT_LEFT: _bindgen_ty_2 = 1; +pub const AKEYCODE_SOFT_RIGHT: _bindgen_ty_2 = 2; +pub const AKEYCODE_HOME: _bindgen_ty_2 = 3; +pub const AKEYCODE_BACK: _bindgen_ty_2 = 4; +pub const AKEYCODE_CALL: _bindgen_ty_2 = 5; +pub const AKEYCODE_ENDCALL: _bindgen_ty_2 = 6; +pub const AKEYCODE_0: _bindgen_ty_2 = 7; +pub const AKEYCODE_1: _bindgen_ty_2 = 8; +pub const AKEYCODE_2: _bindgen_ty_2 = 9; +pub const AKEYCODE_3: _bindgen_ty_2 = 10; +pub const AKEYCODE_4: _bindgen_ty_2 = 11; +pub const AKEYCODE_5: _bindgen_ty_2 = 12; +pub const AKEYCODE_6: _bindgen_ty_2 = 13; +pub const AKEYCODE_7: _bindgen_ty_2 = 14; +pub const AKEYCODE_8: _bindgen_ty_2 = 15; +pub const AKEYCODE_9: _bindgen_ty_2 = 16; +pub const AKEYCODE_STAR: _bindgen_ty_2 = 17; +pub const AKEYCODE_POUND: _bindgen_ty_2 = 18; +pub const AKEYCODE_DPAD_UP: _bindgen_ty_2 = 19; +pub const AKEYCODE_DPAD_DOWN: _bindgen_ty_2 = 20; +pub const AKEYCODE_DPAD_LEFT: _bindgen_ty_2 = 21; +pub const AKEYCODE_DPAD_RIGHT: _bindgen_ty_2 = 22; +pub const AKEYCODE_DPAD_CENTER: _bindgen_ty_2 = 23; +pub const AKEYCODE_VOLUME_UP: _bindgen_ty_2 = 24; +pub const AKEYCODE_VOLUME_DOWN: _bindgen_ty_2 = 25; +pub const AKEYCODE_POWER: _bindgen_ty_2 = 26; +pub const AKEYCODE_CAMERA: _bindgen_ty_2 = 27; +pub const AKEYCODE_CLEAR: _bindgen_ty_2 = 28; +pub const AKEYCODE_A: _bindgen_ty_2 = 29; +pub const AKEYCODE_B: _bindgen_ty_2 = 30; +pub const AKEYCODE_C: _bindgen_ty_2 = 31; +pub const AKEYCODE_D: _bindgen_ty_2 = 32; +pub const AKEYCODE_E: _bindgen_ty_2 = 33; +pub const AKEYCODE_F: _bindgen_ty_2 = 34; +pub const AKEYCODE_G: _bindgen_ty_2 = 35; +pub const AKEYCODE_H: _bindgen_ty_2 = 36; +pub const AKEYCODE_I: _bindgen_ty_2 = 37; +pub const AKEYCODE_J: _bindgen_ty_2 = 38; +pub const AKEYCODE_K: _bindgen_ty_2 = 39; +pub const AKEYCODE_L: _bindgen_ty_2 = 40; +pub const AKEYCODE_M: _bindgen_ty_2 = 41; +pub const AKEYCODE_N: _bindgen_ty_2 = 42; +pub const AKEYCODE_O: _bindgen_ty_2 = 43; +pub const AKEYCODE_P: _bindgen_ty_2 = 44; +pub const AKEYCODE_Q: _bindgen_ty_2 = 45; +pub const AKEYCODE_R: _bindgen_ty_2 = 46; +pub const AKEYCODE_S: _bindgen_ty_2 = 47; +pub const AKEYCODE_T: _bindgen_ty_2 = 48; +pub const AKEYCODE_U: _bindgen_ty_2 = 49; +pub const AKEYCODE_V: _bindgen_ty_2 = 50; +pub const AKEYCODE_W: _bindgen_ty_2 = 51; +pub const AKEYCODE_X: _bindgen_ty_2 = 52; +pub const AKEYCODE_Y: _bindgen_ty_2 = 53; +pub const AKEYCODE_Z: _bindgen_ty_2 = 54; +pub const AKEYCODE_COMMA: _bindgen_ty_2 = 55; +pub const AKEYCODE_PERIOD: _bindgen_ty_2 = 56; +pub const AKEYCODE_ALT_LEFT: _bindgen_ty_2 = 57; +pub const AKEYCODE_ALT_RIGHT: _bindgen_ty_2 = 58; +pub const AKEYCODE_SHIFT_LEFT: _bindgen_ty_2 = 59; +pub const AKEYCODE_SHIFT_RIGHT: _bindgen_ty_2 = 60; +pub const AKEYCODE_TAB: _bindgen_ty_2 = 61; +pub const AKEYCODE_SPACE: _bindgen_ty_2 = 62; +pub const AKEYCODE_SYM: _bindgen_ty_2 = 63; +pub const AKEYCODE_EXPLORER: _bindgen_ty_2 = 64; +pub const AKEYCODE_ENVELOPE: _bindgen_ty_2 = 65; +pub const AKEYCODE_ENTER: _bindgen_ty_2 = 66; +pub const AKEYCODE_DEL: _bindgen_ty_2 = 67; +pub const AKEYCODE_GRAVE: _bindgen_ty_2 = 68; +pub const AKEYCODE_MINUS: _bindgen_ty_2 = 69; +pub const AKEYCODE_EQUALS: _bindgen_ty_2 = 70; +pub const AKEYCODE_LEFT_BRACKET: _bindgen_ty_2 = 71; +pub const AKEYCODE_RIGHT_BRACKET: _bindgen_ty_2 = 72; +pub const AKEYCODE_BACKSLASH: _bindgen_ty_2 = 73; +pub const AKEYCODE_SEMICOLON: _bindgen_ty_2 = 74; +pub const AKEYCODE_APOSTROPHE: _bindgen_ty_2 = 75; +pub const AKEYCODE_SLASH: _bindgen_ty_2 = 76; +pub const AKEYCODE_AT: _bindgen_ty_2 = 77; +pub const AKEYCODE_NUM: _bindgen_ty_2 = 78; +pub const AKEYCODE_HEADSETHOOK: _bindgen_ty_2 = 79; +pub const AKEYCODE_FOCUS: _bindgen_ty_2 = 80; +pub const AKEYCODE_PLUS: _bindgen_ty_2 = 81; +pub const AKEYCODE_MENU: _bindgen_ty_2 = 82; +pub const AKEYCODE_NOTIFICATION: _bindgen_ty_2 = 83; +pub const AKEYCODE_SEARCH: _bindgen_ty_2 = 84; +pub const AKEYCODE_MEDIA_PLAY_PAUSE: _bindgen_ty_2 = 85; +pub const AKEYCODE_MEDIA_STOP: _bindgen_ty_2 = 86; +pub const AKEYCODE_MEDIA_NEXT: _bindgen_ty_2 = 87; +pub const AKEYCODE_MEDIA_PREVIOUS: _bindgen_ty_2 = 88; +pub const AKEYCODE_MEDIA_REWIND: _bindgen_ty_2 = 89; +pub const AKEYCODE_MEDIA_FAST_FORWARD: _bindgen_ty_2 = 90; +pub const AKEYCODE_MUTE: _bindgen_ty_2 = 91; +pub const AKEYCODE_PAGE_UP: _bindgen_ty_2 = 92; +pub const AKEYCODE_PAGE_DOWN: _bindgen_ty_2 = 93; +pub const AKEYCODE_PICTSYMBOLS: _bindgen_ty_2 = 94; +pub const AKEYCODE_SWITCH_CHARSET: _bindgen_ty_2 = 95; +pub const AKEYCODE_BUTTON_A: _bindgen_ty_2 = 96; +pub const AKEYCODE_BUTTON_B: _bindgen_ty_2 = 97; +pub const AKEYCODE_BUTTON_C: _bindgen_ty_2 = 98; +pub const AKEYCODE_BUTTON_X: _bindgen_ty_2 = 99; +pub const AKEYCODE_BUTTON_Y: _bindgen_ty_2 = 100; +pub const AKEYCODE_BUTTON_Z: _bindgen_ty_2 = 101; +pub const AKEYCODE_BUTTON_L1: _bindgen_ty_2 = 102; +pub const AKEYCODE_BUTTON_R1: _bindgen_ty_2 = 103; +pub const AKEYCODE_BUTTON_L2: _bindgen_ty_2 = 104; +pub const AKEYCODE_BUTTON_R2: _bindgen_ty_2 = 105; +pub const AKEYCODE_BUTTON_THUMBL: _bindgen_ty_2 = 106; +pub const AKEYCODE_BUTTON_THUMBR: _bindgen_ty_2 = 107; +pub const AKEYCODE_BUTTON_START: _bindgen_ty_2 = 108; +pub const AKEYCODE_BUTTON_SELECT: _bindgen_ty_2 = 109; +pub const AKEYCODE_BUTTON_MODE: _bindgen_ty_2 = 110; +pub const AKEYCODE_ESCAPE: _bindgen_ty_2 = 111; +pub const AKEYCODE_FORWARD_DEL: _bindgen_ty_2 = 112; +pub const AKEYCODE_CTRL_LEFT: _bindgen_ty_2 = 113; +pub const AKEYCODE_CTRL_RIGHT: _bindgen_ty_2 = 114; +pub const AKEYCODE_CAPS_LOCK: _bindgen_ty_2 = 115; +pub const AKEYCODE_SCROLL_LOCK: _bindgen_ty_2 = 116; +pub const AKEYCODE_META_LEFT: _bindgen_ty_2 = 117; +pub const AKEYCODE_META_RIGHT: _bindgen_ty_2 = 118; +pub const AKEYCODE_FUNCTION: _bindgen_ty_2 = 119; +pub const AKEYCODE_SYSRQ: _bindgen_ty_2 = 120; +pub const AKEYCODE_BREAK: _bindgen_ty_2 = 121; +pub const AKEYCODE_MOVE_HOME: _bindgen_ty_2 = 122; +pub const AKEYCODE_MOVE_END: _bindgen_ty_2 = 123; +pub const AKEYCODE_INSERT: _bindgen_ty_2 = 124; +pub const AKEYCODE_FORWARD: _bindgen_ty_2 = 125; +pub const AKEYCODE_MEDIA_PLAY: _bindgen_ty_2 = 126; +pub const AKEYCODE_MEDIA_PAUSE: _bindgen_ty_2 = 127; +pub const AKEYCODE_MEDIA_CLOSE: _bindgen_ty_2 = 128; +pub const AKEYCODE_MEDIA_EJECT: _bindgen_ty_2 = 129; +pub const AKEYCODE_MEDIA_RECORD: _bindgen_ty_2 = 130; +pub const AKEYCODE_F1: _bindgen_ty_2 = 131; +pub const AKEYCODE_F2: _bindgen_ty_2 = 132; +pub const AKEYCODE_F3: _bindgen_ty_2 = 133; +pub const AKEYCODE_F4: _bindgen_ty_2 = 134; +pub const AKEYCODE_F5: _bindgen_ty_2 = 135; +pub const AKEYCODE_F6: _bindgen_ty_2 = 136; +pub const AKEYCODE_F7: _bindgen_ty_2 = 137; +pub const AKEYCODE_F8: _bindgen_ty_2 = 138; +pub const AKEYCODE_F9: _bindgen_ty_2 = 139; +pub const AKEYCODE_F10: _bindgen_ty_2 = 140; +pub const AKEYCODE_F11: _bindgen_ty_2 = 141; +pub const AKEYCODE_F12: _bindgen_ty_2 = 142; +pub const AKEYCODE_NUM_LOCK: _bindgen_ty_2 = 143; +pub const AKEYCODE_NUMPAD_0: _bindgen_ty_2 = 144; +pub const AKEYCODE_NUMPAD_1: _bindgen_ty_2 = 145; +pub const AKEYCODE_NUMPAD_2: _bindgen_ty_2 = 146; +pub const AKEYCODE_NUMPAD_3: _bindgen_ty_2 = 147; +pub const AKEYCODE_NUMPAD_4: _bindgen_ty_2 = 148; +pub const AKEYCODE_NUMPAD_5: _bindgen_ty_2 = 149; +pub const AKEYCODE_NUMPAD_6: _bindgen_ty_2 = 150; +pub const AKEYCODE_NUMPAD_7: _bindgen_ty_2 = 151; +pub const AKEYCODE_NUMPAD_8: _bindgen_ty_2 = 152; +pub const AKEYCODE_NUMPAD_9: _bindgen_ty_2 = 153; +pub const AKEYCODE_NUMPAD_DIVIDE: _bindgen_ty_2 = 154; +pub const AKEYCODE_NUMPAD_MULTIPLY: _bindgen_ty_2 = 155; +pub const AKEYCODE_NUMPAD_SUBTRACT: _bindgen_ty_2 = 156; +pub const AKEYCODE_NUMPAD_ADD: _bindgen_ty_2 = 157; +pub const AKEYCODE_NUMPAD_DOT: _bindgen_ty_2 = 158; +pub const AKEYCODE_NUMPAD_COMMA: _bindgen_ty_2 = 159; +pub const AKEYCODE_NUMPAD_ENTER: _bindgen_ty_2 = 160; +pub const AKEYCODE_NUMPAD_EQUALS: _bindgen_ty_2 = 161; +pub const AKEYCODE_NUMPAD_LEFT_PAREN: _bindgen_ty_2 = 162; +pub const AKEYCODE_NUMPAD_RIGHT_PAREN: _bindgen_ty_2 = 163; +pub const AKEYCODE_VOLUME_MUTE: _bindgen_ty_2 = 164; +pub const AKEYCODE_INFO: _bindgen_ty_2 = 165; +pub const AKEYCODE_CHANNEL_UP: _bindgen_ty_2 = 166; +pub const AKEYCODE_CHANNEL_DOWN: _bindgen_ty_2 = 167; +pub const AKEYCODE_ZOOM_IN: _bindgen_ty_2 = 168; +pub const AKEYCODE_ZOOM_OUT: _bindgen_ty_2 = 169; +pub const AKEYCODE_TV: _bindgen_ty_2 = 170; +pub const AKEYCODE_WINDOW: _bindgen_ty_2 = 171; +pub const AKEYCODE_GUIDE: _bindgen_ty_2 = 172; +pub const AKEYCODE_DVR: _bindgen_ty_2 = 173; +pub const AKEYCODE_BOOKMARK: _bindgen_ty_2 = 174; +pub const AKEYCODE_CAPTIONS: _bindgen_ty_2 = 175; +pub const AKEYCODE_SETTINGS: _bindgen_ty_2 = 176; +pub const AKEYCODE_TV_POWER: _bindgen_ty_2 = 177; +pub const AKEYCODE_TV_INPUT: _bindgen_ty_2 = 178; +pub const AKEYCODE_STB_POWER: _bindgen_ty_2 = 179; +pub const AKEYCODE_STB_INPUT: _bindgen_ty_2 = 180; +pub const AKEYCODE_AVR_POWER: _bindgen_ty_2 = 181; +pub const AKEYCODE_AVR_INPUT: _bindgen_ty_2 = 182; +pub const AKEYCODE_PROG_RED: _bindgen_ty_2 = 183; +pub const AKEYCODE_PROG_GREEN: _bindgen_ty_2 = 184; +pub const AKEYCODE_PROG_YELLOW: _bindgen_ty_2 = 185; +pub const AKEYCODE_PROG_BLUE: _bindgen_ty_2 = 186; +pub const AKEYCODE_APP_SWITCH: _bindgen_ty_2 = 187; +pub const AKEYCODE_BUTTON_1: _bindgen_ty_2 = 188; +pub const AKEYCODE_BUTTON_2: _bindgen_ty_2 = 189; +pub const AKEYCODE_BUTTON_3: _bindgen_ty_2 = 190; +pub const AKEYCODE_BUTTON_4: _bindgen_ty_2 = 191; +pub const AKEYCODE_BUTTON_5: _bindgen_ty_2 = 192; +pub const AKEYCODE_BUTTON_6: _bindgen_ty_2 = 193; +pub const AKEYCODE_BUTTON_7: _bindgen_ty_2 = 194; +pub const AKEYCODE_BUTTON_8: _bindgen_ty_2 = 195; +pub const AKEYCODE_BUTTON_9: _bindgen_ty_2 = 196; +pub const AKEYCODE_BUTTON_10: _bindgen_ty_2 = 197; +pub const AKEYCODE_BUTTON_11: _bindgen_ty_2 = 198; +pub const AKEYCODE_BUTTON_12: _bindgen_ty_2 = 199; +pub const AKEYCODE_BUTTON_13: _bindgen_ty_2 = 200; +pub const AKEYCODE_BUTTON_14: _bindgen_ty_2 = 201; +pub const AKEYCODE_BUTTON_15: _bindgen_ty_2 = 202; +pub const AKEYCODE_BUTTON_16: _bindgen_ty_2 = 203; +pub const AKEYCODE_LANGUAGE_SWITCH: _bindgen_ty_2 = 204; +pub const AKEYCODE_MANNER_MODE: _bindgen_ty_2 = 205; +pub const AKEYCODE_3D_MODE: _bindgen_ty_2 = 206; +pub const AKEYCODE_CONTACTS: _bindgen_ty_2 = 207; +pub const AKEYCODE_CALENDAR: _bindgen_ty_2 = 208; +pub const AKEYCODE_MUSIC: _bindgen_ty_2 = 209; +pub const AKEYCODE_CALCULATOR: _bindgen_ty_2 = 210; +pub const AKEYCODE_ZENKAKU_HANKAKU: _bindgen_ty_2 = 211; +pub const AKEYCODE_EISU: _bindgen_ty_2 = 212; +pub const AKEYCODE_MUHENKAN: _bindgen_ty_2 = 213; +pub const AKEYCODE_HENKAN: _bindgen_ty_2 = 214; +pub const AKEYCODE_KATAKANA_HIRAGANA: _bindgen_ty_2 = 215; +pub const AKEYCODE_YEN: _bindgen_ty_2 = 216; +pub const AKEYCODE_RO: _bindgen_ty_2 = 217; +pub const AKEYCODE_KANA: _bindgen_ty_2 = 218; +pub const AKEYCODE_ASSIST: _bindgen_ty_2 = 219; +pub const AKEYCODE_BRIGHTNESS_DOWN: _bindgen_ty_2 = 220; +pub const AKEYCODE_BRIGHTNESS_UP: _bindgen_ty_2 = 221; +pub const AKEYCODE_MEDIA_AUDIO_TRACK: _bindgen_ty_2 = 222; +pub const AKEYCODE_SLEEP: _bindgen_ty_2 = 223; +pub const AKEYCODE_WAKEUP: _bindgen_ty_2 = 224; +pub const AKEYCODE_PAIRING: _bindgen_ty_2 = 225; +pub const AKEYCODE_MEDIA_TOP_MENU: _bindgen_ty_2 = 226; +pub const AKEYCODE_11: _bindgen_ty_2 = 227; +pub const AKEYCODE_12: _bindgen_ty_2 = 228; +pub const AKEYCODE_LAST_CHANNEL: _bindgen_ty_2 = 229; +pub const AKEYCODE_TV_DATA_SERVICE: _bindgen_ty_2 = 230; +pub const AKEYCODE_VOICE_ASSIST: _bindgen_ty_2 = 231; +pub const AKEYCODE_TV_RADIO_SERVICE: _bindgen_ty_2 = 232; +pub const AKEYCODE_TV_TELETEXT: _bindgen_ty_2 = 233; +pub const AKEYCODE_TV_NUMBER_ENTRY: _bindgen_ty_2 = 234; +pub const AKEYCODE_TV_TERRESTRIAL_ANALOG: _bindgen_ty_2 = 235; +pub const AKEYCODE_TV_TERRESTRIAL_DIGITAL: _bindgen_ty_2 = 236; +pub const AKEYCODE_TV_SATELLITE: _bindgen_ty_2 = 237; +pub const AKEYCODE_TV_SATELLITE_BS: _bindgen_ty_2 = 238; +pub const AKEYCODE_TV_SATELLITE_CS: _bindgen_ty_2 = 239; +pub const AKEYCODE_TV_SATELLITE_SERVICE: _bindgen_ty_2 = 240; +pub const AKEYCODE_TV_NETWORK: _bindgen_ty_2 = 241; +pub const AKEYCODE_TV_ANTENNA_CABLE: _bindgen_ty_2 = 242; +pub const AKEYCODE_TV_INPUT_HDMI_1: _bindgen_ty_2 = 243; +pub const AKEYCODE_TV_INPUT_HDMI_2: _bindgen_ty_2 = 244; +pub const AKEYCODE_TV_INPUT_HDMI_3: _bindgen_ty_2 = 245; +pub const AKEYCODE_TV_INPUT_HDMI_4: _bindgen_ty_2 = 246; +pub const AKEYCODE_TV_INPUT_COMPOSITE_1: _bindgen_ty_2 = 247; +pub const AKEYCODE_TV_INPUT_COMPOSITE_2: _bindgen_ty_2 = 248; +pub const AKEYCODE_TV_INPUT_COMPONENT_1: _bindgen_ty_2 = 249; +pub const AKEYCODE_TV_INPUT_COMPONENT_2: _bindgen_ty_2 = 250; +pub const AKEYCODE_TV_INPUT_VGA_1: _bindgen_ty_2 = 251; +pub const AKEYCODE_TV_AUDIO_DESCRIPTION: _bindgen_ty_2 = 252; +pub const AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_UP: _bindgen_ty_2 = 253; +pub const AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_DOWN: _bindgen_ty_2 = 254; +pub const AKEYCODE_TV_ZOOM_MODE: _bindgen_ty_2 = 255; +pub const AKEYCODE_TV_CONTENTS_MENU: _bindgen_ty_2 = 256; +pub const AKEYCODE_TV_MEDIA_CONTEXT_MENU: _bindgen_ty_2 = 257; +pub const AKEYCODE_TV_TIMER_PROGRAMMING: _bindgen_ty_2 = 258; +pub const AKEYCODE_HELP: _bindgen_ty_2 = 259; +pub const AKEYCODE_NAVIGATE_PREVIOUS: _bindgen_ty_2 = 260; +pub const AKEYCODE_NAVIGATE_NEXT: _bindgen_ty_2 = 261; +pub const AKEYCODE_NAVIGATE_IN: _bindgen_ty_2 = 262; +pub const AKEYCODE_NAVIGATE_OUT: _bindgen_ty_2 = 263; +pub const AKEYCODE_STEM_PRIMARY: _bindgen_ty_2 = 264; +pub const AKEYCODE_STEM_1: _bindgen_ty_2 = 265; +pub const AKEYCODE_STEM_2: _bindgen_ty_2 = 266; +pub const AKEYCODE_STEM_3: _bindgen_ty_2 = 267; +pub const AKEYCODE_DPAD_UP_LEFT: _bindgen_ty_2 = 268; +pub const AKEYCODE_DPAD_DOWN_LEFT: _bindgen_ty_2 = 269; +pub const AKEYCODE_DPAD_UP_RIGHT: _bindgen_ty_2 = 270; +pub const AKEYCODE_DPAD_DOWN_RIGHT: _bindgen_ty_2 = 271; +pub const AKEYCODE_MEDIA_SKIP_FORWARD: _bindgen_ty_2 = 272; +pub const AKEYCODE_MEDIA_SKIP_BACKWARD: _bindgen_ty_2 = 273; +pub const AKEYCODE_MEDIA_STEP_FORWARD: _bindgen_ty_2 = 274; +pub const AKEYCODE_MEDIA_STEP_BACKWARD: _bindgen_ty_2 = 275; +pub const AKEYCODE_SOFT_SLEEP: _bindgen_ty_2 = 276; +pub const AKEYCODE_CUT: _bindgen_ty_2 = 277; +pub const AKEYCODE_COPY: _bindgen_ty_2 = 278; +pub const AKEYCODE_PASTE: _bindgen_ty_2 = 279; +pub const AKEYCODE_SYSTEM_NAVIGATION_UP: _bindgen_ty_2 = 280; +pub const AKEYCODE_SYSTEM_NAVIGATION_DOWN: _bindgen_ty_2 = 281; +pub const AKEYCODE_SYSTEM_NAVIGATION_LEFT: _bindgen_ty_2 = 282; +pub const AKEYCODE_SYSTEM_NAVIGATION_RIGHT: _bindgen_ty_2 = 283; +pub const AKEYCODE_ALL_APPS: _bindgen_ty_2 = 284; +pub const AKEYCODE_REFRESH: _bindgen_ty_2 = 285; +pub const AKEYCODE_THUMBS_UP: _bindgen_ty_2 = 286; +pub const AKEYCODE_THUMBS_DOWN: _bindgen_ty_2 = 287; +pub const AKEYCODE_PROFILE_SWITCH: _bindgen_ty_2 = 288; +pub const AKEYCODE_VIDEO_APP_1: _bindgen_ty_2 = 289; +pub const AKEYCODE_VIDEO_APP_2: _bindgen_ty_2 = 290; +pub const AKEYCODE_VIDEO_APP_3: _bindgen_ty_2 = 291; +pub const AKEYCODE_VIDEO_APP_4: _bindgen_ty_2 = 292; +pub const AKEYCODE_VIDEO_APP_5: _bindgen_ty_2 = 293; +pub const AKEYCODE_VIDEO_APP_6: _bindgen_ty_2 = 294; +pub const AKEYCODE_VIDEO_APP_7: _bindgen_ty_2 = 295; +pub const AKEYCODE_VIDEO_APP_8: _bindgen_ty_2 = 296; +pub const AKEYCODE_FEATURED_APP_1: _bindgen_ty_2 = 297; +pub const AKEYCODE_FEATURED_APP_2: _bindgen_ty_2 = 298; +pub const AKEYCODE_FEATURED_APP_3: _bindgen_ty_2 = 299; +pub const AKEYCODE_FEATURED_APP_4: _bindgen_ty_2 = 300; +pub const AKEYCODE_DEMO_APP_1: _bindgen_ty_2 = 301; +pub const AKEYCODE_DEMO_APP_2: _bindgen_ty_2 = 302; +pub const AKEYCODE_DEMO_APP_3: _bindgen_ty_2 = 303; +pub const AKEYCODE_DEMO_APP_4: _bindgen_ty_2 = 304; pub type _bindgen_ty_2 = ::std::os::raw::c_uint; -pub const ALOOPER_PREPARE_ALLOW_NON_CALLBACKS: ::std::os::raw::c_uint = 1; +pub const ALOOPER_PREPARE_ALLOW_NON_CALLBACKS: _bindgen_ty_3 = 1; pub type _bindgen_ty_3 = ::std::os::raw::c_uint; -pub const ALOOPER_POLL_WAKE: ::std::os::raw::c_int = -1; -pub const ALOOPER_POLL_CALLBACK: ::std::os::raw::c_int = -2; -pub const ALOOPER_POLL_TIMEOUT: ::std::os::raw::c_int = -3; -pub const ALOOPER_POLL_ERROR: ::std::os::raw::c_int = -4; +pub const ALOOPER_POLL_WAKE: _bindgen_ty_4 = -1; +pub const ALOOPER_POLL_CALLBACK: _bindgen_ty_4 = -2; +pub const ALOOPER_POLL_TIMEOUT: _bindgen_ty_4 = -3; +pub const ALOOPER_POLL_ERROR: _bindgen_ty_4 = -4; pub type _bindgen_ty_4 = ::std::os::raw::c_int; -pub const ALOOPER_EVENT_INPUT: ::std::os::raw::c_uint = 1; -pub const ALOOPER_EVENT_OUTPUT: ::std::os::raw::c_uint = 2; -pub const ALOOPER_EVENT_ERROR: ::std::os::raw::c_uint = 4; -pub const ALOOPER_EVENT_HANGUP: ::std::os::raw::c_uint = 8; -pub const ALOOPER_EVENT_INVALID: ::std::os::raw::c_uint = 16; +pub const ALOOPER_EVENT_INPUT: _bindgen_ty_5 = 1; +pub const ALOOPER_EVENT_OUTPUT: _bindgen_ty_5 = 2; +pub const ALOOPER_EVENT_ERROR: _bindgen_ty_5 = 4; +pub const ALOOPER_EVENT_HANGUP: _bindgen_ty_5 = 8; +pub const ALOOPER_EVENT_INVALID: _bindgen_ty_5 = 16; pub type _bindgen_ty_5 = ::std::os::raw::c_uint; -pub const AKEY_STATE_UNKNOWN: ::std::os::raw::c_int = -1; -pub const AKEY_STATE_UP: ::std::os::raw::c_int = 0; -pub const AKEY_STATE_DOWN: ::std::os::raw::c_int = 1; -pub const AKEY_STATE_VIRTUAL: ::std::os::raw::c_int = 2; +pub type __gnuc_va_list = u32; +pub type va_list = u32; +#[repr(C)] +pub struct JavaVMAttachArgs { + pub version: jint, + pub name: *const ::std::os::raw::c_char, + pub group: jobject, +} +#[test] +fn bindgen_test_layout_JavaVMAttachArgs() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 12usize, + "Size of JavaVMAttachArgs" + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + "Alignment of JavaVMAttachArgs" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).version) as usize - ptr as usize }, + 0usize, + "Offset of field: JavaVMAttachArgs::version" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize }, + 4usize, + "Offset of field: JavaVMAttachArgs::name" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).group) as usize - ptr as usize }, + 8usize, + "Offset of field: JavaVMAttachArgs::group" + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct JavaVMOption { + pub optionString: *const ::std::os::raw::c_char, + pub extraInfo: *mut ::std::os::raw::c_void, +} +#[test] +fn bindgen_test_layout_JavaVMOption() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 8usize, + "Size of JavaVMOption" + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + "Alignment of JavaVMOption" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).optionString) as usize - ptr as usize }, + 0usize, + "Offset of field: JavaVMOption::optionString" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).extraInfo) as usize - ptr as usize }, + 4usize, + "Offset of field: JavaVMOption::extraInfo" + ); +} +#[repr(C)] +pub struct JavaVMInitArgs { + pub version: jint, + pub nOptions: jint, + pub options: *mut JavaVMOption, + pub ignoreUnrecognized: jboolean, +} +#[test] +fn bindgen_test_layout_JavaVMInitArgs() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 16usize, + "Size of JavaVMInitArgs" + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + "Alignment of JavaVMInitArgs" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).version) as usize - ptr as usize }, + 0usize, + "Offset of field: JavaVMInitArgs::version" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).nOptions) as usize - ptr as usize }, + 4usize, + "Offset of field: JavaVMInitArgs::nOptions" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).options) as usize - ptr as usize }, + 8usize, + "Offset of field: JavaVMInitArgs::options" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ignoreUnrecognized) as usize - ptr as usize }, + 12usize, + "Offset of field: JavaVMInitArgs::ignoreUnrecognized" + ); +} +pub const AKEY_STATE_UNKNOWN: _bindgen_ty_6 = -1; +pub const AKEY_STATE_UP: _bindgen_ty_6 = 0; +pub const AKEY_STATE_DOWN: _bindgen_ty_6 = 1; +pub const AKEY_STATE_VIRTUAL: _bindgen_ty_6 = 2; pub type _bindgen_ty_6 = ::std::os::raw::c_int; -pub const AMETA_NONE: ::std::os::raw::c_uint = 0; -pub const AMETA_ALT_ON: ::std::os::raw::c_uint = 2; -pub const AMETA_ALT_LEFT_ON: ::std::os::raw::c_uint = 16; -pub const AMETA_ALT_RIGHT_ON: ::std::os::raw::c_uint = 32; -pub const AMETA_SHIFT_ON: ::std::os::raw::c_uint = 1; -pub const AMETA_SHIFT_LEFT_ON: ::std::os::raw::c_uint = 64; -pub const AMETA_SHIFT_RIGHT_ON: ::std::os::raw::c_uint = 128; -pub const AMETA_SYM_ON: ::std::os::raw::c_uint = 4; -pub const AMETA_FUNCTION_ON: ::std::os::raw::c_uint = 8; -pub const AMETA_CTRL_ON: ::std::os::raw::c_uint = 4096; -pub const AMETA_CTRL_LEFT_ON: ::std::os::raw::c_uint = 8192; -pub const AMETA_CTRL_RIGHT_ON: ::std::os::raw::c_uint = 16384; -pub const AMETA_META_ON: ::std::os::raw::c_uint = 65536; -pub const AMETA_META_LEFT_ON: ::std::os::raw::c_uint = 131072; -pub const AMETA_META_RIGHT_ON: ::std::os::raw::c_uint = 262144; -pub const AMETA_CAPS_LOCK_ON: ::std::os::raw::c_uint = 1048576; -pub const AMETA_NUM_LOCK_ON: ::std::os::raw::c_uint = 2097152; -pub const AMETA_SCROLL_LOCK_ON: ::std::os::raw::c_uint = 4194304; +pub const AMETA_NONE: _bindgen_ty_7 = 0; +pub const AMETA_ALT_ON: _bindgen_ty_7 = 2; +pub const AMETA_ALT_LEFT_ON: _bindgen_ty_7 = 16; +pub const AMETA_ALT_RIGHT_ON: _bindgen_ty_7 = 32; +pub const AMETA_SHIFT_ON: _bindgen_ty_7 = 1; +pub const AMETA_SHIFT_LEFT_ON: _bindgen_ty_7 = 64; +pub const AMETA_SHIFT_RIGHT_ON: _bindgen_ty_7 = 128; +pub const AMETA_SYM_ON: _bindgen_ty_7 = 4; +pub const AMETA_FUNCTION_ON: _bindgen_ty_7 = 8; +pub const AMETA_CTRL_ON: _bindgen_ty_7 = 4096; +pub const AMETA_CTRL_LEFT_ON: _bindgen_ty_7 = 8192; +pub const AMETA_CTRL_RIGHT_ON: _bindgen_ty_7 = 16384; +pub const AMETA_META_ON: _bindgen_ty_7 = 65536; +pub const AMETA_META_LEFT_ON: _bindgen_ty_7 = 131072; +pub const AMETA_META_RIGHT_ON: _bindgen_ty_7 = 262144; +pub const AMETA_CAPS_LOCK_ON: _bindgen_ty_7 = 1048576; +pub const AMETA_NUM_LOCK_ON: _bindgen_ty_7 = 2097152; +pub const AMETA_SCROLL_LOCK_ON: _bindgen_ty_7 = 4194304; pub type _bindgen_ty_7 = ::std::os::raw::c_uint; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct AInputEvent { _unused: [u8; 0], } -pub const AINPUT_EVENT_TYPE_KEY: ::std::os::raw::c_uint = 1; -pub const AINPUT_EVENT_TYPE_MOTION: ::std::os::raw::c_uint = 2; +pub const AINPUT_EVENT_TYPE_KEY: _bindgen_ty_8 = 1; +pub const AINPUT_EVENT_TYPE_MOTION: _bindgen_ty_8 = 2; +pub const AINPUT_EVENT_TYPE_FOCUS: _bindgen_ty_8 = 3; +pub const AINPUT_EVENT_TYPE_CAPTURE: _bindgen_ty_8 = 4; +pub const AINPUT_EVENT_TYPE_DRAG: _bindgen_ty_8 = 5; +pub const AINPUT_EVENT_TYPE_TOUCH_MODE: _bindgen_ty_8 = 6; pub type _bindgen_ty_8 = ::std::os::raw::c_uint; -pub const AKEY_EVENT_ACTION_DOWN: ::std::os::raw::c_uint = 0; -pub const AKEY_EVENT_ACTION_UP: ::std::os::raw::c_uint = 1; -pub const AKEY_EVENT_ACTION_MULTIPLE: ::std::os::raw::c_uint = 2; +pub const AKEY_EVENT_ACTION_DOWN: _bindgen_ty_9 = 0; +pub const AKEY_EVENT_ACTION_UP: _bindgen_ty_9 = 1; +pub const AKEY_EVENT_ACTION_MULTIPLE: _bindgen_ty_9 = 2; pub type _bindgen_ty_9 = ::std::os::raw::c_uint; -pub const AKEY_EVENT_FLAG_WOKE_HERE: ::std::os::raw::c_uint = 1; -pub const AKEY_EVENT_FLAG_SOFT_KEYBOARD: ::std::os::raw::c_uint = 2; -pub const AKEY_EVENT_FLAG_KEEP_TOUCH_MODE: ::std::os::raw::c_uint = 4; -pub const AKEY_EVENT_FLAG_FROM_SYSTEM: ::std::os::raw::c_uint = 8; -pub const AKEY_EVENT_FLAG_EDITOR_ACTION: ::std::os::raw::c_uint = 16; -pub const AKEY_EVENT_FLAG_CANCELED: ::std::os::raw::c_uint = 32; -pub const AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY: ::std::os::raw::c_uint = 64; -pub const AKEY_EVENT_FLAG_LONG_PRESS: ::std::os::raw::c_uint = 128; -pub const AKEY_EVENT_FLAG_CANCELED_LONG_PRESS: ::std::os::raw::c_uint = 256; -pub const AKEY_EVENT_FLAG_TRACKING: ::std::os::raw::c_uint = 512; -pub const AKEY_EVENT_FLAG_FALLBACK: ::std::os::raw::c_uint = 1024; +pub const AKEY_EVENT_FLAG_WOKE_HERE: _bindgen_ty_10 = 1; +pub const AKEY_EVENT_FLAG_SOFT_KEYBOARD: _bindgen_ty_10 = 2; +pub const AKEY_EVENT_FLAG_KEEP_TOUCH_MODE: _bindgen_ty_10 = 4; +pub const AKEY_EVENT_FLAG_FROM_SYSTEM: _bindgen_ty_10 = 8; +pub const AKEY_EVENT_FLAG_EDITOR_ACTION: _bindgen_ty_10 = 16; +pub const AKEY_EVENT_FLAG_CANCELED: _bindgen_ty_10 = 32; +pub const AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY: _bindgen_ty_10 = 64; +pub const AKEY_EVENT_FLAG_LONG_PRESS: _bindgen_ty_10 = 128; +pub const AKEY_EVENT_FLAG_CANCELED_LONG_PRESS: _bindgen_ty_10 = 256; +pub const AKEY_EVENT_FLAG_TRACKING: _bindgen_ty_10 = 512; +pub const AKEY_EVENT_FLAG_FALLBACK: _bindgen_ty_10 = 1024; pub type _bindgen_ty_10 = ::std::os::raw::c_uint; -pub const AMOTION_EVENT_ACTION_MASK: ::std::os::raw::c_uint = 255; -pub const AMOTION_EVENT_ACTION_POINTER_INDEX_MASK: ::std::os::raw::c_uint = 65280; -pub const AMOTION_EVENT_ACTION_DOWN: ::std::os::raw::c_uint = 0; -pub const AMOTION_EVENT_ACTION_UP: ::std::os::raw::c_uint = 1; -pub const AMOTION_EVENT_ACTION_MOVE: ::std::os::raw::c_uint = 2; -pub const AMOTION_EVENT_ACTION_CANCEL: ::std::os::raw::c_uint = 3; -pub const AMOTION_EVENT_ACTION_OUTSIDE: ::std::os::raw::c_uint = 4; -pub const AMOTION_EVENT_ACTION_POINTER_DOWN: ::std::os::raw::c_uint = 5; -pub const AMOTION_EVENT_ACTION_POINTER_UP: ::std::os::raw::c_uint = 6; -pub const AMOTION_EVENT_ACTION_HOVER_MOVE: ::std::os::raw::c_uint = 7; -pub const AMOTION_EVENT_ACTION_SCROLL: ::std::os::raw::c_uint = 8; -pub const AMOTION_EVENT_ACTION_HOVER_ENTER: ::std::os::raw::c_uint = 9; -pub const AMOTION_EVENT_ACTION_HOVER_EXIT: ::std::os::raw::c_uint = 10; -pub const AMOTION_EVENT_ACTION_BUTTON_PRESS: ::std::os::raw::c_uint = 11; -pub const AMOTION_EVENT_ACTION_BUTTON_RELEASE: ::std::os::raw::c_uint = 12; +pub const AMOTION_EVENT_ACTION_MASK: _bindgen_ty_11 = 255; +pub const AMOTION_EVENT_ACTION_POINTER_INDEX_MASK: _bindgen_ty_11 = 65280; +pub const AMOTION_EVENT_ACTION_DOWN: _bindgen_ty_11 = 0; +pub const AMOTION_EVENT_ACTION_UP: _bindgen_ty_11 = 1; +pub const AMOTION_EVENT_ACTION_MOVE: _bindgen_ty_11 = 2; +pub const AMOTION_EVENT_ACTION_CANCEL: _bindgen_ty_11 = 3; +pub const AMOTION_EVENT_ACTION_OUTSIDE: _bindgen_ty_11 = 4; +pub const AMOTION_EVENT_ACTION_POINTER_DOWN: _bindgen_ty_11 = 5; +pub const AMOTION_EVENT_ACTION_POINTER_UP: _bindgen_ty_11 = 6; +pub const AMOTION_EVENT_ACTION_HOVER_MOVE: _bindgen_ty_11 = 7; +pub const AMOTION_EVENT_ACTION_SCROLL: _bindgen_ty_11 = 8; +pub const AMOTION_EVENT_ACTION_HOVER_ENTER: _bindgen_ty_11 = 9; +pub const AMOTION_EVENT_ACTION_HOVER_EXIT: _bindgen_ty_11 = 10; +pub const AMOTION_EVENT_ACTION_BUTTON_PRESS: _bindgen_ty_11 = 11; +pub const AMOTION_EVENT_ACTION_BUTTON_RELEASE: _bindgen_ty_11 = 12; pub type _bindgen_ty_11 = ::std::os::raw::c_uint; -pub const AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED: ::std::os::raw::c_uint = 1; +pub const AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED: _bindgen_ty_12 = 1; pub type _bindgen_ty_12 = ::std::os::raw::c_uint; -pub const AMOTION_EVENT_EDGE_FLAG_NONE: ::std::os::raw::c_uint = 0; -pub const AMOTION_EVENT_EDGE_FLAG_TOP: ::std::os::raw::c_uint = 1; -pub const AMOTION_EVENT_EDGE_FLAG_BOTTOM: ::std::os::raw::c_uint = 2; -pub const AMOTION_EVENT_EDGE_FLAG_LEFT: ::std::os::raw::c_uint = 4; -pub const AMOTION_EVENT_EDGE_FLAG_RIGHT: ::std::os::raw::c_uint = 8; +pub const AMOTION_EVENT_EDGE_FLAG_NONE: _bindgen_ty_13 = 0; +pub const AMOTION_EVENT_EDGE_FLAG_TOP: _bindgen_ty_13 = 1; +pub const AMOTION_EVENT_EDGE_FLAG_BOTTOM: _bindgen_ty_13 = 2; +pub const AMOTION_EVENT_EDGE_FLAG_LEFT: _bindgen_ty_13 = 4; +pub const AMOTION_EVENT_EDGE_FLAG_RIGHT: _bindgen_ty_13 = 8; pub type _bindgen_ty_13 = ::std::os::raw::c_uint; -pub const AMOTION_EVENT_AXIS_X: ::std::os::raw::c_uint = 0; -pub const AMOTION_EVENT_AXIS_Y: ::std::os::raw::c_uint = 1; -pub const AMOTION_EVENT_AXIS_PRESSURE: ::std::os::raw::c_uint = 2; -pub const AMOTION_EVENT_AXIS_SIZE: ::std::os::raw::c_uint = 3; -pub const AMOTION_EVENT_AXIS_TOUCH_MAJOR: ::std::os::raw::c_uint = 4; -pub const AMOTION_EVENT_AXIS_TOUCH_MINOR: ::std::os::raw::c_uint = 5; -pub const AMOTION_EVENT_AXIS_TOOL_MAJOR: ::std::os::raw::c_uint = 6; -pub const AMOTION_EVENT_AXIS_TOOL_MINOR: ::std::os::raw::c_uint = 7; -pub const AMOTION_EVENT_AXIS_ORIENTATION: ::std::os::raw::c_uint = 8; -pub const AMOTION_EVENT_AXIS_VSCROLL: ::std::os::raw::c_uint = 9; -pub const AMOTION_EVENT_AXIS_HSCROLL: ::std::os::raw::c_uint = 10; -pub const AMOTION_EVENT_AXIS_Z: ::std::os::raw::c_uint = 11; -pub const AMOTION_EVENT_AXIS_RX: ::std::os::raw::c_uint = 12; -pub const AMOTION_EVENT_AXIS_RY: ::std::os::raw::c_uint = 13; -pub const AMOTION_EVENT_AXIS_RZ: ::std::os::raw::c_uint = 14; -pub const AMOTION_EVENT_AXIS_HAT_X: ::std::os::raw::c_uint = 15; -pub const AMOTION_EVENT_AXIS_HAT_Y: ::std::os::raw::c_uint = 16; -pub const AMOTION_EVENT_AXIS_LTRIGGER: ::std::os::raw::c_uint = 17; -pub const AMOTION_EVENT_AXIS_RTRIGGER: ::std::os::raw::c_uint = 18; -pub const AMOTION_EVENT_AXIS_THROTTLE: ::std::os::raw::c_uint = 19; -pub const AMOTION_EVENT_AXIS_RUDDER: ::std::os::raw::c_uint = 20; -pub const AMOTION_EVENT_AXIS_WHEEL: ::std::os::raw::c_uint = 21; -pub const AMOTION_EVENT_AXIS_GAS: ::std::os::raw::c_uint = 22; -pub const AMOTION_EVENT_AXIS_BRAKE: ::std::os::raw::c_uint = 23; -pub const AMOTION_EVENT_AXIS_DISTANCE: ::std::os::raw::c_uint = 24; -pub const AMOTION_EVENT_AXIS_TILT: ::std::os::raw::c_uint = 25; -pub const AMOTION_EVENT_AXIS_SCROLL: ::std::os::raw::c_uint = 26; -pub const AMOTION_EVENT_AXIS_RELATIVE_X: ::std::os::raw::c_uint = 27; -pub const AMOTION_EVENT_AXIS_RELATIVE_Y: ::std::os::raw::c_uint = 28; -pub const AMOTION_EVENT_AXIS_GENERIC_1: ::std::os::raw::c_uint = 32; -pub const AMOTION_EVENT_AXIS_GENERIC_2: ::std::os::raw::c_uint = 33; -pub const AMOTION_EVENT_AXIS_GENERIC_3: ::std::os::raw::c_uint = 34; -pub const AMOTION_EVENT_AXIS_GENERIC_4: ::std::os::raw::c_uint = 35; -pub const AMOTION_EVENT_AXIS_GENERIC_5: ::std::os::raw::c_uint = 36; -pub const AMOTION_EVENT_AXIS_GENERIC_6: ::std::os::raw::c_uint = 37; -pub const AMOTION_EVENT_AXIS_GENERIC_7: ::std::os::raw::c_uint = 38; -pub const AMOTION_EVENT_AXIS_GENERIC_8: ::std::os::raw::c_uint = 39; -pub const AMOTION_EVENT_AXIS_GENERIC_9: ::std::os::raw::c_uint = 40; -pub const AMOTION_EVENT_AXIS_GENERIC_10: ::std::os::raw::c_uint = 41; -pub const AMOTION_EVENT_AXIS_GENERIC_11: ::std::os::raw::c_uint = 42; -pub const AMOTION_EVENT_AXIS_GENERIC_12: ::std::os::raw::c_uint = 43; -pub const AMOTION_EVENT_AXIS_GENERIC_13: ::std::os::raw::c_uint = 44; -pub const AMOTION_EVENT_AXIS_GENERIC_14: ::std::os::raw::c_uint = 45; -pub const AMOTION_EVENT_AXIS_GENERIC_15: ::std::os::raw::c_uint = 46; -pub const AMOTION_EVENT_AXIS_GENERIC_16: ::std::os::raw::c_uint = 47; +pub const AMOTION_EVENT_AXIS_X: _bindgen_ty_14 = 0; +pub const AMOTION_EVENT_AXIS_Y: _bindgen_ty_14 = 1; +pub const AMOTION_EVENT_AXIS_PRESSURE: _bindgen_ty_14 = 2; +pub const AMOTION_EVENT_AXIS_SIZE: _bindgen_ty_14 = 3; +pub const AMOTION_EVENT_AXIS_TOUCH_MAJOR: _bindgen_ty_14 = 4; +pub const AMOTION_EVENT_AXIS_TOUCH_MINOR: _bindgen_ty_14 = 5; +pub const AMOTION_EVENT_AXIS_TOOL_MAJOR: _bindgen_ty_14 = 6; +pub const AMOTION_EVENT_AXIS_TOOL_MINOR: _bindgen_ty_14 = 7; +pub const AMOTION_EVENT_AXIS_ORIENTATION: _bindgen_ty_14 = 8; +pub const AMOTION_EVENT_AXIS_VSCROLL: _bindgen_ty_14 = 9; +pub const AMOTION_EVENT_AXIS_HSCROLL: _bindgen_ty_14 = 10; +pub const AMOTION_EVENT_AXIS_Z: _bindgen_ty_14 = 11; +pub const AMOTION_EVENT_AXIS_RX: _bindgen_ty_14 = 12; +pub const AMOTION_EVENT_AXIS_RY: _bindgen_ty_14 = 13; +pub const AMOTION_EVENT_AXIS_RZ: _bindgen_ty_14 = 14; +pub const AMOTION_EVENT_AXIS_HAT_X: _bindgen_ty_14 = 15; +pub const AMOTION_EVENT_AXIS_HAT_Y: _bindgen_ty_14 = 16; +pub const AMOTION_EVENT_AXIS_LTRIGGER: _bindgen_ty_14 = 17; +pub const AMOTION_EVENT_AXIS_RTRIGGER: _bindgen_ty_14 = 18; +pub const AMOTION_EVENT_AXIS_THROTTLE: _bindgen_ty_14 = 19; +pub const AMOTION_EVENT_AXIS_RUDDER: _bindgen_ty_14 = 20; +pub const AMOTION_EVENT_AXIS_WHEEL: _bindgen_ty_14 = 21; +pub const AMOTION_EVENT_AXIS_GAS: _bindgen_ty_14 = 22; +pub const AMOTION_EVENT_AXIS_BRAKE: _bindgen_ty_14 = 23; +pub const AMOTION_EVENT_AXIS_DISTANCE: _bindgen_ty_14 = 24; +pub const AMOTION_EVENT_AXIS_TILT: _bindgen_ty_14 = 25; +pub const AMOTION_EVENT_AXIS_SCROLL: _bindgen_ty_14 = 26; +pub const AMOTION_EVENT_AXIS_RELATIVE_X: _bindgen_ty_14 = 27; +pub const AMOTION_EVENT_AXIS_RELATIVE_Y: _bindgen_ty_14 = 28; +pub const AMOTION_EVENT_AXIS_GENERIC_1: _bindgen_ty_14 = 32; +pub const AMOTION_EVENT_AXIS_GENERIC_2: _bindgen_ty_14 = 33; +pub const AMOTION_EVENT_AXIS_GENERIC_3: _bindgen_ty_14 = 34; +pub const AMOTION_EVENT_AXIS_GENERIC_4: _bindgen_ty_14 = 35; +pub const AMOTION_EVENT_AXIS_GENERIC_5: _bindgen_ty_14 = 36; +pub const AMOTION_EVENT_AXIS_GENERIC_6: _bindgen_ty_14 = 37; +pub const AMOTION_EVENT_AXIS_GENERIC_7: _bindgen_ty_14 = 38; +pub const AMOTION_EVENT_AXIS_GENERIC_8: _bindgen_ty_14 = 39; +pub const AMOTION_EVENT_AXIS_GENERIC_9: _bindgen_ty_14 = 40; +pub const AMOTION_EVENT_AXIS_GENERIC_10: _bindgen_ty_14 = 41; +pub const AMOTION_EVENT_AXIS_GENERIC_11: _bindgen_ty_14 = 42; +pub const AMOTION_EVENT_AXIS_GENERIC_12: _bindgen_ty_14 = 43; +pub const AMOTION_EVENT_AXIS_GENERIC_13: _bindgen_ty_14 = 44; +pub const AMOTION_EVENT_AXIS_GENERIC_14: _bindgen_ty_14 = 45; +pub const AMOTION_EVENT_AXIS_GENERIC_15: _bindgen_ty_14 = 46; +pub const AMOTION_EVENT_AXIS_GENERIC_16: _bindgen_ty_14 = 47; pub type _bindgen_ty_14 = ::std::os::raw::c_uint; -pub const AMOTION_EVENT_BUTTON_PRIMARY: ::std::os::raw::c_uint = 1; -pub const AMOTION_EVENT_BUTTON_SECONDARY: ::std::os::raw::c_uint = 2; -pub const AMOTION_EVENT_BUTTON_TERTIARY: ::std::os::raw::c_uint = 4; -pub const AMOTION_EVENT_BUTTON_BACK: ::std::os::raw::c_uint = 8; -pub const AMOTION_EVENT_BUTTON_FORWARD: ::std::os::raw::c_uint = 16; -pub const AMOTION_EVENT_BUTTON_STYLUS_PRIMARY: ::std::os::raw::c_uint = 32; -pub const AMOTION_EVENT_BUTTON_STYLUS_SECONDARY: ::std::os::raw::c_uint = 64; +pub const AMOTION_EVENT_BUTTON_PRIMARY: _bindgen_ty_15 = 1; +pub const AMOTION_EVENT_BUTTON_SECONDARY: _bindgen_ty_15 = 2; +pub const AMOTION_EVENT_BUTTON_TERTIARY: _bindgen_ty_15 = 4; +pub const AMOTION_EVENT_BUTTON_BACK: _bindgen_ty_15 = 8; +pub const AMOTION_EVENT_BUTTON_FORWARD: _bindgen_ty_15 = 16; +pub const AMOTION_EVENT_BUTTON_STYLUS_PRIMARY: _bindgen_ty_15 = 32; +pub const AMOTION_EVENT_BUTTON_STYLUS_SECONDARY: _bindgen_ty_15 = 64; pub type _bindgen_ty_15 = ::std::os::raw::c_uint; -pub const AMOTION_EVENT_TOOL_TYPE_UNKNOWN: ::std::os::raw::c_uint = 0; -pub const AMOTION_EVENT_TOOL_TYPE_FINGER: ::std::os::raw::c_uint = 1; -pub const AMOTION_EVENT_TOOL_TYPE_STYLUS: ::std::os::raw::c_uint = 2; -pub const AMOTION_EVENT_TOOL_TYPE_MOUSE: ::std::os::raw::c_uint = 3; -pub const AMOTION_EVENT_TOOL_TYPE_ERASER: ::std::os::raw::c_uint = 4; +pub const AMOTION_EVENT_TOOL_TYPE_UNKNOWN: _bindgen_ty_16 = 0; +pub const AMOTION_EVENT_TOOL_TYPE_FINGER: _bindgen_ty_16 = 1; +pub const AMOTION_EVENT_TOOL_TYPE_STYLUS: _bindgen_ty_16 = 2; +pub const AMOTION_EVENT_TOOL_TYPE_MOUSE: _bindgen_ty_16 = 3; +pub const AMOTION_EVENT_TOOL_TYPE_ERASER: _bindgen_ty_16 = 4; +pub const AMOTION_EVENT_TOOL_TYPE_PALM: _bindgen_ty_16 = 5; pub type _bindgen_ty_16 = ::std::os::raw::c_uint; -pub const AINPUT_SOURCE_CLASS_MASK: ::std::os::raw::c_uint = 255; -pub const AINPUT_SOURCE_CLASS_NONE: ::std::os::raw::c_uint = 0; -pub const AINPUT_SOURCE_CLASS_BUTTON: ::std::os::raw::c_uint = 1; -pub const AINPUT_SOURCE_CLASS_POINTER: ::std::os::raw::c_uint = 2; -pub const AINPUT_SOURCE_CLASS_NAVIGATION: ::std::os::raw::c_uint = 4; -pub const AINPUT_SOURCE_CLASS_POSITION: ::std::os::raw::c_uint = 8; -pub const AINPUT_SOURCE_CLASS_JOYSTICK: ::std::os::raw::c_uint = 16; +pub const AMotionClassification_AMOTION_EVENT_CLASSIFICATION_NONE: AMotionClassification = 0; +pub const AMotionClassification_AMOTION_EVENT_CLASSIFICATION_AMBIGUOUS_GESTURE: + AMotionClassification = 1; +pub const AMotionClassification_AMOTION_EVENT_CLASSIFICATION_DEEP_PRESS: AMotionClassification = 2; +pub type AMotionClassification = u32; +pub const AINPUT_SOURCE_CLASS_MASK: _bindgen_ty_17 = 255; +pub const AINPUT_SOURCE_CLASS_NONE: _bindgen_ty_17 = 0; +pub const AINPUT_SOURCE_CLASS_BUTTON: _bindgen_ty_17 = 1; +pub const AINPUT_SOURCE_CLASS_POINTER: _bindgen_ty_17 = 2; +pub const AINPUT_SOURCE_CLASS_NAVIGATION: _bindgen_ty_17 = 4; +pub const AINPUT_SOURCE_CLASS_POSITION: _bindgen_ty_17 = 8; +pub const AINPUT_SOURCE_CLASS_JOYSTICK: _bindgen_ty_17 = 16; pub type _bindgen_ty_17 = ::std::os::raw::c_uint; -pub const AINPUT_SOURCE_UNKNOWN: ::std::os::raw::c_uint = 0; -pub const AINPUT_SOURCE_KEYBOARD: ::std::os::raw::c_uint = 257; -pub const AINPUT_SOURCE_DPAD: ::std::os::raw::c_uint = 513; -pub const AINPUT_SOURCE_GAMEPAD: ::std::os::raw::c_uint = 1025; -pub const AINPUT_SOURCE_TOUCHSCREEN: ::std::os::raw::c_uint = 4098; -pub const AINPUT_SOURCE_MOUSE: ::std::os::raw::c_uint = 8194; -pub const AINPUT_SOURCE_STYLUS: ::std::os::raw::c_uint = 16386; -pub const AINPUT_SOURCE_BLUETOOTH_STYLUS: ::std::os::raw::c_uint = 49154; -pub const AINPUT_SOURCE_TRACKBALL: ::std::os::raw::c_uint = 65540; -pub const AINPUT_SOURCE_MOUSE_RELATIVE: ::std::os::raw::c_uint = 131076; -pub const AINPUT_SOURCE_TOUCHPAD: ::std::os::raw::c_uint = 1048584; -pub const AINPUT_SOURCE_TOUCH_NAVIGATION: ::std::os::raw::c_uint = 2097152; -pub const AINPUT_SOURCE_JOYSTICK: ::std::os::raw::c_uint = 16777232; -pub const AINPUT_SOURCE_ROTARY_ENCODER: ::std::os::raw::c_uint = 4194304; -pub const AINPUT_SOURCE_ANY: ::std::os::raw::c_uint = 4294967040; +pub const AINPUT_SOURCE_UNKNOWN: _bindgen_ty_18 = 0; +pub const AINPUT_SOURCE_KEYBOARD: _bindgen_ty_18 = 257; +pub const AINPUT_SOURCE_DPAD: _bindgen_ty_18 = 513; +pub const AINPUT_SOURCE_GAMEPAD: _bindgen_ty_18 = 1025; +pub const AINPUT_SOURCE_TOUCHSCREEN: _bindgen_ty_18 = 4098; +pub const AINPUT_SOURCE_MOUSE: _bindgen_ty_18 = 8194; +pub const AINPUT_SOURCE_STYLUS: _bindgen_ty_18 = 16386; +pub const AINPUT_SOURCE_BLUETOOTH_STYLUS: _bindgen_ty_18 = 49154; +pub const AINPUT_SOURCE_TRACKBALL: _bindgen_ty_18 = 65540; +pub const AINPUT_SOURCE_MOUSE_RELATIVE: _bindgen_ty_18 = 131076; +pub const AINPUT_SOURCE_TOUCHPAD: _bindgen_ty_18 = 1048584; +pub const AINPUT_SOURCE_TOUCH_NAVIGATION: _bindgen_ty_18 = 2097152; +pub const AINPUT_SOURCE_JOYSTICK: _bindgen_ty_18 = 16777232; +pub const AINPUT_SOURCE_HDMI: _bindgen_ty_18 = 33554433; +pub const AINPUT_SOURCE_SENSOR: _bindgen_ty_18 = 67108864; +pub const AINPUT_SOURCE_ROTARY_ENCODER: _bindgen_ty_18 = 4194304; +pub const AINPUT_SOURCE_ANY: _bindgen_ty_18 = 4294967040; pub type _bindgen_ty_18 = ::std::os::raw::c_uint; -pub const AINPUT_KEYBOARD_TYPE_NONE: ::std::os::raw::c_uint = 0; -pub const AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC: ::std::os::raw::c_uint = 1; -pub const AINPUT_KEYBOARD_TYPE_ALPHABETIC: ::std::os::raw::c_uint = 2; +pub const AINPUT_KEYBOARD_TYPE_NONE: _bindgen_ty_19 = 0; +pub const AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC: _bindgen_ty_19 = 1; +pub const AINPUT_KEYBOARD_TYPE_ALPHABETIC: _bindgen_ty_19 = 2; pub type _bindgen_ty_19 = ::std::os::raw::c_uint; -pub const AINPUT_MOTION_RANGE_X: ::std::os::raw::c_uint = 0; -pub const AINPUT_MOTION_RANGE_Y: ::std::os::raw::c_uint = 1; -pub const AINPUT_MOTION_RANGE_PRESSURE: ::std::os::raw::c_uint = 2; -pub const AINPUT_MOTION_RANGE_SIZE: ::std::os::raw::c_uint = 3; -pub const AINPUT_MOTION_RANGE_TOUCH_MAJOR: ::std::os::raw::c_uint = 4; -pub const AINPUT_MOTION_RANGE_TOUCH_MINOR: ::std::os::raw::c_uint = 5; -pub const AINPUT_MOTION_RANGE_TOOL_MAJOR: ::std::os::raw::c_uint = 6; -pub const AINPUT_MOTION_RANGE_TOOL_MINOR: ::std::os::raw::c_uint = 7; -pub const AINPUT_MOTION_RANGE_ORIENTATION: ::std::os::raw::c_uint = 8; +pub const AINPUT_MOTION_RANGE_X: _bindgen_ty_20 = 0; +pub const AINPUT_MOTION_RANGE_Y: _bindgen_ty_20 = 1; +pub const AINPUT_MOTION_RANGE_PRESSURE: _bindgen_ty_20 = 2; +pub const AINPUT_MOTION_RANGE_SIZE: _bindgen_ty_20 = 3; +pub const AINPUT_MOTION_RANGE_TOUCH_MAJOR: _bindgen_ty_20 = 4; +pub const AINPUT_MOTION_RANGE_TOUCH_MINOR: _bindgen_ty_20 = 5; +pub const AINPUT_MOTION_RANGE_TOOL_MAJOR: _bindgen_ty_20 = 6; +pub const AINPUT_MOTION_RANGE_TOOL_MINOR: _bindgen_ty_20 = 7; +pub const AINPUT_MOTION_RANGE_ORIENTATION: _bindgen_ty_20 = 8; pub type _bindgen_ty_20 = ::std::os::raw::c_uint; extern "C" { pub fn AInputEvent_getType(event: *const AInputEvent) -> i32; @@ -1407,6 +1651,9 @@ extern "C" { extern "C" { pub fn AInputEvent_getSource(event: *const AInputEvent) -> i32; } +extern "C" { + pub fn AInputEvent_release(event: *const AInputEvent); +} extern "C" { pub fn AKeyEvent_getAction(key_event: *const AInputEvent) -> i32; } @@ -1431,6 +1678,9 @@ extern "C" { extern "C" { pub fn AKeyEvent_getEventTime(key_event: *const AInputEvent) -> i64; } +extern "C" { + pub fn AKeyEvent_fromJava(env: *mut JNIEnv, keyEvent: jobject) -> *const AInputEvent; +} extern "C" { pub fn AMotionEvent_getAction(motion_event: *const AInputEvent) -> i32; } @@ -1465,168 +1715,169 @@ extern "C" { pub fn AMotionEvent_getYPrecision(motion_event: *const AInputEvent) -> f32; } extern "C" { - pub fn AMotionEvent_getPointerCount(motion_event: *const AInputEvent) -> size_t; + pub fn AMotionEvent_getPointerCount(motion_event: *const AInputEvent) -> usize; } extern "C" { - pub fn AMotionEvent_getPointerId( - motion_event: *const AInputEvent, - pointer_index: size_t, - ) -> i32; + pub fn AMotionEvent_getPointerId(motion_event: *const AInputEvent, pointer_index: usize) + -> i32; } extern "C" { - pub fn AMotionEvent_getToolType(motion_event: *const AInputEvent, pointer_index: size_t) - -> i32; + pub fn AMotionEvent_getToolType(motion_event: *const AInputEvent, pointer_index: usize) -> i32; } extern "C" { - pub fn AMotionEvent_getRawX(motion_event: *const AInputEvent, pointer_index: size_t) -> f32; + pub fn AMotionEvent_getRawX(motion_event: *const AInputEvent, pointer_index: usize) -> f32; } extern "C" { - pub fn AMotionEvent_getRawY(motion_event: *const AInputEvent, pointer_index: size_t) -> f32; + pub fn AMotionEvent_getRawY(motion_event: *const AInputEvent, pointer_index: usize) -> f32; } extern "C" { - pub fn AMotionEvent_getX(motion_event: *const AInputEvent, pointer_index: size_t) -> f32; + pub fn AMotionEvent_getX(motion_event: *const AInputEvent, pointer_index: usize) -> f32; } extern "C" { - pub fn AMotionEvent_getY(motion_event: *const AInputEvent, pointer_index: size_t) -> f32; + pub fn AMotionEvent_getY(motion_event: *const AInputEvent, pointer_index: usize) -> f32; } extern "C" { - pub fn AMotionEvent_getPressure(motion_event: *const AInputEvent, pointer_index: size_t) - -> f32; + pub fn AMotionEvent_getPressure(motion_event: *const AInputEvent, pointer_index: usize) -> f32; } extern "C" { - pub fn AMotionEvent_getSize(motion_event: *const AInputEvent, pointer_index: size_t) -> f32; + pub fn AMotionEvent_getSize(motion_event: *const AInputEvent, pointer_index: usize) -> f32; } extern "C" { pub fn AMotionEvent_getTouchMajor( motion_event: *const AInputEvent, - pointer_index: size_t, + pointer_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getTouchMinor( motion_event: *const AInputEvent, - pointer_index: size_t, + pointer_index: usize, ) -> f32; } extern "C" { - pub fn AMotionEvent_getToolMajor( - motion_event: *const AInputEvent, - pointer_index: size_t, - ) -> f32; + pub fn AMotionEvent_getToolMajor(motion_event: *const AInputEvent, pointer_index: usize) + -> f32; } extern "C" { - pub fn AMotionEvent_getToolMinor( - motion_event: *const AInputEvent, - pointer_index: size_t, - ) -> f32; + pub fn AMotionEvent_getToolMinor(motion_event: *const AInputEvent, pointer_index: usize) + -> f32; } extern "C" { pub fn AMotionEvent_getOrientation( motion_event: *const AInputEvent, - pointer_index: size_t, + pointer_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getAxisValue( motion_event: *const AInputEvent, axis: i32, - pointer_index: size_t, + pointer_index: usize, ) -> f32; } extern "C" { - pub fn AMotionEvent_getHistorySize(motion_event: *const AInputEvent) -> size_t; + pub fn AMotionEvent_getHistorySize(motion_event: *const AInputEvent) -> usize; } extern "C" { pub fn AMotionEvent_getHistoricalEventTime( motion_event: *const AInputEvent, - history_index: size_t, + history_index: usize, ) -> i64; } extern "C" { pub fn AMotionEvent_getHistoricalRawX( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalRawY( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalX( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalY( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalPressure( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalSize( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalTouchMajor( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalTouchMinor( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalToolMajor( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalToolMinor( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalOrientation( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalAxisValue( motion_event: *const AInputEvent, axis: i32, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } +extern "C" { + pub fn AMotionEvent_getActionButton(motion_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AMotionEvent_getClassification(motion_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AMotionEvent_fromJava(env: *mut JNIEnv, motionEvent: jobject) -> *const AInputEvent; +} #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct AInputQueue { @@ -1660,6 +1911,9 @@ extern "C" { handled: ::std::os::raw::c_int, ); } +extern "C" { + pub fn AInputQueue_fromJava(env: *mut JNIEnv, inputQueue: jobject) -> *mut AInputQueue; +} #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct imaxdiv_t { @@ -1668,35 +1922,27 @@ pub struct imaxdiv_t { } #[test] fn bindgen_test_layout_imaxdiv_t() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 16usize, - concat!("Size of: ", stringify!(imaxdiv_t)) + "Size of imaxdiv_t" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(imaxdiv_t)) + "Alignment of imaxdiv_t" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).quot as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).quot) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(imaxdiv_t), - "::", - stringify!(quot) - ) + "Offset of field: imaxdiv_t::quot" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rem as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rem) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(imaxdiv_t), - "::", - stringify!(rem) - ) + "Offset of field: imaxdiv_t::rem" ); } extern "C" { @@ -1734,11 +1980,52 @@ extern "C" { ) -> uintmax_t; } pub const ADataSpace_ADATASPACE_UNKNOWN: ADataSpace = 0; +pub const ADataSpace_STANDARD_MASK: ADataSpace = 4128768; +pub const ADataSpace_STANDARD_UNSPECIFIED: ADataSpace = 0; +pub const ADataSpace_STANDARD_BT709: ADataSpace = 65536; +pub const ADataSpace_STANDARD_BT601_625: ADataSpace = 131072; +pub const ADataSpace_STANDARD_BT601_625_UNADJUSTED: ADataSpace = 196608; +pub const ADataSpace_STANDARD_BT601_525: ADataSpace = 262144; +pub const ADataSpace_STANDARD_BT601_525_UNADJUSTED: ADataSpace = 327680; +pub const ADataSpace_STANDARD_BT2020: ADataSpace = 393216; +pub const ADataSpace_STANDARD_BT2020_CONSTANT_LUMINANCE: ADataSpace = 458752; +pub const ADataSpace_STANDARD_BT470M: ADataSpace = 524288; +pub const ADataSpace_STANDARD_FILM: ADataSpace = 589824; +pub const ADataSpace_STANDARD_DCI_P3: ADataSpace = 655360; +pub const ADataSpace_STANDARD_ADOBE_RGB: ADataSpace = 720896; +pub const ADataSpace_TRANSFER_MASK: ADataSpace = 130023424; +pub const ADataSpace_TRANSFER_UNSPECIFIED: ADataSpace = 0; +pub const ADataSpace_TRANSFER_LINEAR: ADataSpace = 4194304; +pub const ADataSpace_TRANSFER_SRGB: ADataSpace = 8388608; +pub const ADataSpace_TRANSFER_SMPTE_170M: ADataSpace = 12582912; +pub const ADataSpace_TRANSFER_GAMMA2_2: ADataSpace = 16777216; +pub const ADataSpace_TRANSFER_GAMMA2_6: ADataSpace = 20971520; +pub const ADataSpace_TRANSFER_GAMMA2_8: ADataSpace = 25165824; +pub const ADataSpace_TRANSFER_ST2084: ADataSpace = 29360128; +pub const ADataSpace_TRANSFER_HLG: ADataSpace = 33554432; +pub const ADataSpace_RANGE_MASK: ADataSpace = 939524096; +pub const ADataSpace_RANGE_UNSPECIFIED: ADataSpace = 0; +pub const ADataSpace_RANGE_FULL: ADataSpace = 134217728; +pub const ADataSpace_RANGE_LIMITED: ADataSpace = 268435456; +pub const ADataSpace_RANGE_EXTENDED: ADataSpace = 402653184; pub const ADataSpace_ADATASPACE_SCRGB_LINEAR: ADataSpace = 406913024; pub const ADataSpace_ADATASPACE_SRGB: ADataSpace = 142671872; pub const ADataSpace_ADATASPACE_SCRGB: ADataSpace = 411107328; pub const ADataSpace_ADATASPACE_DISPLAY_P3: ADataSpace = 143261696; pub const ADataSpace_ADATASPACE_BT2020_PQ: ADataSpace = 163971072; +pub const ADataSpace_ADATASPACE_BT2020_ITU_PQ: ADataSpace = 298188800; +pub const ADataSpace_ADATASPACE_ADOBE_RGB: ADataSpace = 151715840; +pub const ADataSpace_ADATASPACE_JFIF: ADataSpace = 146931712; +pub const ADataSpace_ADATASPACE_BT601_625: ADataSpace = 281149440; +pub const ADataSpace_ADATASPACE_BT601_525: ADataSpace = 281280512; +pub const ADataSpace_ADATASPACE_BT2020: ADataSpace = 147193856; +pub const ADataSpace_ADATASPACE_BT709: ADataSpace = 281083904; +pub const ADataSpace_ADATASPACE_DCI_P3: ADataSpace = 155844608; +pub const ADataSpace_ADATASPACE_SRGB_LINEAR: ADataSpace = 138477568; +pub const ADataSpace_ADATASPACE_BT2020_HLG: ADataSpace = 168165376; +pub const ADataSpace_ADATASPACE_BT2020_ITU_HLG: ADataSpace = 302383104; +pub const ADataSpace_DEPTH: ADataSpace = 4096; +pub const ADataSpace_DYNAMIC_DEPTH: ADataSpace = 4098; pub type ADataSpace = ::std::os::raw::c_uint; pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM: AHardwareBuffer_Format = 1; pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM: AHardwareBuffer_Format = 2; @@ -1758,6 +2045,12 @@ pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_D32_FLOAT_S8_UINT: AHard 52; pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_S8_UINT: AHardwareBuffer_Format = 53; pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_Y8Cb8Cr8_420: AHardwareBuffer_Format = 35; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_YCbCr_P010: AHardwareBuffer_Format = 54; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8_UNORM: AHardwareBuffer_Format = 56; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R16_UINT: AHardwareBuffer_Format = 57; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R16G16_UINT: AHardwareBuffer_Format = 58; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R10G10B10A10_UNORM: AHardwareBuffer_Format = + 59; pub type AHardwareBuffer_Format = ::std::os::raw::c_uint; pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_READ_NEVER: AHardwareBuffer_UsageFlags = 0; @@ -1795,6 +2088,8 @@ pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_GPU_CUBE_MAP: AHardwareBuffer_UsageFlags = 33554432; pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_GPU_MIPMAP_COMPLETE: AHardwareBuffer_UsageFlags = 67108864; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_FRONT_BUFFER: + AHardwareBuffer_UsageFlags = 2147483648; pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_0: AHardwareBuffer_UsageFlags = 268435456; pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_1: AHardwareBuffer_UsageFlags = @@ -1850,95 +2145,57 @@ pub struct AHardwareBuffer_Desc { } #[test] fn bindgen_test_layout_AHardwareBuffer_Desc() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 40usize, - concat!("Size of: ", stringify!(AHardwareBuffer_Desc)) + "Size of AHardwareBuffer_Desc" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(AHardwareBuffer_Desc)) + "Alignment of AHardwareBuffer_Desc" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).width as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).width) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Desc), - "::", - stringify!(width) - ) + "Offset of field: AHardwareBuffer_Desc::width" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).height as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).height) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Desc), - "::", - stringify!(height) - ) + "Offset of field: AHardwareBuffer_Desc::height" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).layers as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).layers) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Desc), - "::", - stringify!(layers) - ) + "Offset of field: AHardwareBuffer_Desc::layers" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).format as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).format) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Desc), - "::", - stringify!(format) - ) + "Offset of field: AHardwareBuffer_Desc::format" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).usage as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).usage) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Desc), - "::", - stringify!(usage) - ) + "Offset of field: AHardwareBuffer_Desc::usage" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).stride as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).stride) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Desc), - "::", - stringify!(stride) - ) + "Offset of field: AHardwareBuffer_Desc::stride" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rfu0 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rfu0) as usize - ptr as usize }, 28usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Desc), - "::", - stringify!(rfu0) - ) + "Offset of field: AHardwareBuffer_Desc::rfu0" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rfu1 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rfu1) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Desc), - "::", - stringify!(rfu1) - ) + "Offset of field: AHardwareBuffer_Desc::rfu1" ); } #[repr(C)] @@ -1950,47 +2207,33 @@ pub struct AHardwareBuffer_Plane { } #[test] fn bindgen_test_layout_AHardwareBuffer_Plane() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 12usize, - concat!("Size of: ", stringify!(AHardwareBuffer_Plane)) + "Size of AHardwareBuffer_Plane" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(AHardwareBuffer_Plane)) + "Alignment of AHardwareBuffer_Plane" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Plane), - "::", - stringify!(data) - ) + "Offset of field: AHardwareBuffer_Plane::data" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).pixelStride as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).pixelStride) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Plane), - "::", - stringify!(pixelStride) - ) + "Offset of field: AHardwareBuffer_Plane::pixelStride" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rowStride as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rowStride) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Plane), - "::", - stringify!(rowStride) - ) + "Offset of field: AHardwareBuffer_Plane::rowStride" ); } #[repr(C)] @@ -2001,37 +2244,28 @@ pub struct AHardwareBuffer_Planes { } #[test] fn bindgen_test_layout_AHardwareBuffer_Planes() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 52usize, - concat!("Size of: ", stringify!(AHardwareBuffer_Planes)) + "Size of AHardwareBuffer_Planes" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(AHardwareBuffer_Planes)) + "Alignment of AHardwareBuffer_Planes" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).planeCount as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).planeCount) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Planes), - "::", - stringify!(planeCount) - ) + "Offset of field: AHardwareBuffer_Planes::planeCount" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).planes as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).planes) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Planes), - "::", - stringify!(planes) - ) + "Offset of field: AHardwareBuffer_Planes::planes" ); } #[repr(C)] @@ -2066,15 +2300,6 @@ extern "C" { outVirtualAddress: *mut *mut ::std::os::raw::c_void, ) -> ::std::os::raw::c_int; } -extern "C" { - pub fn AHardwareBuffer_lockPlanes( - buffer: *mut AHardwareBuffer, - usage: u64, - fence: i32, - rect: *const ARect, - outPlanes: *mut AHardwareBuffer_Planes, - ) -> ::std::os::raw::c_int; -} extern "C" { pub fn AHardwareBuffer_unlock( buffer: *mut AHardwareBuffer, @@ -2093,6 +2318,15 @@ extern "C" { outBuffer: *mut *mut AHardwareBuffer, ) -> ::std::os::raw::c_int; } +extern "C" { + pub fn AHardwareBuffer_lockPlanes( + buffer: *mut AHardwareBuffer, + usage: u64, + fence: i32, + rect: *const ARect, + outPlanes: *mut AHardwareBuffer_Planes, + ) -> ::std::os::raw::c_int; +} extern "C" { pub fn AHardwareBuffer_isSupported(desc: *const AHardwareBuffer_Desc) -> ::std::os::raw::c_int; } @@ -2107,176 +2341,312 @@ extern "C" { outBytesPerStride: *mut i32, ) -> ::std::os::raw::c_int; } -pub type va_list = u32; -pub type __gnuc_va_list = u32; +extern "C" { + pub fn AHardwareBuffer_getId( + buffer: *const AHardwareBuffer, + outId: *mut u64, + ) -> ::std::os::raw::c_int; +} +#[doc = " \\brief Describe information about a pointer, found in a\n GameActivityMotionEvent.\n\n You can read values directly from this structure, or use helper functions\n (`GameActivityPointerAxes_getX`, `GameActivityPointerAxes_getY` and\n `GameActivityPointerAxes_getAxisValue`).\n\n The X axis and Y axis are enabled by default but any other axis that you want\n to read **must** be enabled first, using\n `GameActivityPointerAxes_enableAxis`.\n\n \\see GameActivityMotionEvent"] #[repr(C)] -pub struct JavaVMAttachArgs { - pub version: jint, - pub name: *const ::std::os::raw::c_char, - pub group: jobject, +#[derive(Debug, Copy, Clone)] +pub struct GameActivityPointerAxes { + pub id: i32, + pub toolType: i32, + pub axisValues: [f32; 48usize], + pub rawX: f32, + pub rawY: f32, } #[test] -fn bindgen_test_layout_JavaVMAttachArgs() { +fn bindgen_test_layout_GameActivityPointerAxes() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - ::std::mem::size_of::(), - 12usize, - concat!("Size of: ", stringify!(JavaVMAttachArgs)) + ::std::mem::size_of::(), + 208usize, + "Size of GameActivityPointerAxes" ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(JavaVMAttachArgs)) + "Alignment of GameActivityPointerAxes" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).version as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).id) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(JavaVMAttachArgs), - "::", - stringify!(version) - ) + "Offset of field: GameActivityPointerAxes::id" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).name as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).toolType) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(JavaVMAttachArgs), - "::", - stringify!(name) - ) + "Offset of field: GameActivityPointerAxes::toolType" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).group as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).axisValues) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(JavaVMAttachArgs), - "::", - stringify!(group) - ) + "Offset of field: GameActivityPointerAxes::axisValues" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).rawX) as usize - ptr as usize }, + 200usize, + "Offset of field: GameActivityPointerAxes::rawX" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).rawY) as usize - ptr as usize }, + 204usize, + "Offset of field: GameActivityPointerAxes::rawY" ); } +extern "C" { + #[doc = " \\brief Enable the specified axis, so that its value is reported in the\n GameActivityPointerAxes structures stored in a motion event.\n\n You must enable any axis that you want to read, apart from\n `AMOTION_EVENT_AXIS_X` and `AMOTION_EVENT_AXIS_Y` that are enabled by\n default.\n\n If the axis index is out of range, nothing is done."] + pub fn GameActivityPointerAxes_enableAxis(axis: i32); +} +extern "C" { + #[doc = " \\brief Disable the specified axis. Its value won't be reported in the\n GameActivityPointerAxes structures stored in a motion event anymore.\n\n Apart from X and Y, any axis that you want to read **must** be enabled first,\n using `GameActivityPointerAxes_enableAxis`.\n\n If the axis index is out of range, nothing is done."] + pub fn GameActivityPointerAxes_disableAxis(axis: i32); +} +extern "C" { + #[doc = " \\brief Get the value of the requested axis.\n\n Apart from X and Y, any axis that you want to read **must** be enabled first,\n using `GameActivityPointerAxes_enableAxis`.\n\n Find the valid enums for the axis (`AMOTION_EVENT_AXIS_X`,\n `AMOTION_EVENT_AXIS_Y`, `AMOTION_EVENT_AXIS_PRESSURE`...)\n in https://developer.android.com/ndk/reference/group/input.\n\n @param pointerInfo The structure containing information about the pointer,\n obtained from GameActivityMotionEvent.\n @param axis The axis to get the value from\n @return The value of the axis, or 0 if the axis is invalid or was not\n enabled."] + pub fn GameActivityPointerAxes_getAxisValue( + pointerInfo: *const GameActivityPointerAxes, + axis: i32, + ) -> f32; +} +#[doc = " \\brief Describe a motion event that happened on the GameActivity SurfaceView.\n\n This is 1:1 mapping to the information contained in a Java `MotionEvent`\n (see https://developer.android.com/reference/android/view/MotionEvent)."] #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct JavaVMOption { - pub optionString: *const ::std::os::raw::c_char, - pub extraInfo: *mut ::std::os::raw::c_void, +pub struct GameActivityMotionEvent { + pub deviceId: i32, + pub source: i32, + pub action: i32, + pub eventTime: i64, + pub downTime: i64, + pub flags: i32, + pub metaState: i32, + pub actionButton: i32, + pub buttonState: i32, + pub classification: i32, + pub edgeFlags: i32, + pub pointerCount: u32, + pub pointers: [GameActivityPointerAxes; 8usize], + pub historySize: ::std::os::raw::c_int, + pub historicalEventTimesMillis: *mut i64, + pub historicalEventTimesNanos: *mut i64, + pub historicalAxisValues: *mut f32, + pub precisionX: f32, + pub precisionY: f32, } #[test] -fn bindgen_test_layout_JavaVMOption() { +fn bindgen_test_layout_GameActivityMotionEvent() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(JavaVMOption)) + ::std::mem::size_of::(), + 1752usize, + "Size of GameActivityMotionEvent" ); assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(JavaVMOption)) + ::std::mem::align_of::(), + 8usize, + "Alignment of GameActivityMotionEvent" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).optionString as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).deviceId) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(JavaVMOption), - "::", - stringify!(optionString) - ) + "Offset of field: GameActivityMotionEvent::deviceId" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).extraInfo as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).source) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(JavaVMOption), - "::", - stringify!(extraInfo) - ) + "Offset of field: GameActivityMotionEvent::source" ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).action) as usize - ptr as usize }, + 8usize, + "Offset of field: GameActivityMotionEvent::action" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).eventTime) as usize - ptr as usize }, + 16usize, + "Offset of field: GameActivityMotionEvent::eventTime" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).downTime) as usize - ptr as usize }, + 24usize, + "Offset of field: GameActivityMotionEvent::downTime" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, + 32usize, + "Offset of field: GameActivityMotionEvent::flags" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).metaState) as usize - ptr as usize }, + 36usize, + "Offset of field: GameActivityMotionEvent::metaState" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).actionButton) as usize - ptr as usize }, + 40usize, + "Offset of field: GameActivityMotionEvent::actionButton" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).buttonState) as usize - ptr as usize }, + 44usize, + "Offset of field: GameActivityMotionEvent::buttonState" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).classification) as usize - ptr as usize }, + 48usize, + "Offset of field: GameActivityMotionEvent::classification" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).edgeFlags) as usize - ptr as usize }, + 52usize, + "Offset of field: GameActivityMotionEvent::edgeFlags" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pointerCount) as usize - ptr as usize }, + 56usize, + "Offset of field: GameActivityMotionEvent::pointerCount" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pointers) as usize - ptr as usize }, + 60usize, + "Offset of field: GameActivityMotionEvent::pointers" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).historySize) as usize - ptr as usize }, + 1724usize, + "Offset of field: GameActivityMotionEvent::historySize" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).historicalEventTimesMillis) as usize - ptr as usize }, + 1728usize, + "Offset of field: GameActivityMotionEvent::historicalEventTimesMillis" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).historicalEventTimesNanos) as usize - ptr as usize }, + 1732usize, + "Offset of field: GameActivityMotionEvent::historicalEventTimesNanos" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).historicalAxisValues) as usize - ptr as usize }, + 1736usize, + "Offset of field: GameActivityMotionEvent::historicalAxisValues" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).precisionX) as usize - ptr as usize }, + 1740usize, + "Offset of field: GameActivityMotionEvent::precisionX" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).precisionY) as usize - ptr as usize }, + 1744usize, + "Offset of field: GameActivityMotionEvent::precisionY" + ); +} +extern "C" { + pub fn GameActivityMotionEvent_getHistoricalAxisValue( + event: *const GameActivityMotionEvent, + axis: ::std::os::raw::c_int, + pointerIndex: ::std::os::raw::c_int, + historyPos: ::std::os::raw::c_int, + ) -> f32; } +extern "C" { + #[doc = " \\brief Handle the freeing of the GameActivityMotionEvent struct."] + pub fn GameActivityMotionEvent_destroy(c_event: *mut GameActivityMotionEvent); +} +#[doc = " \\brief Describe a key event that happened on the GameActivity SurfaceView.\n\n This is 1:1 mapping to the information contained in a Java `KeyEvent`\n (see https://developer.android.com/reference/android/view/KeyEvent).\n The only exception is the event times, which are reported as\n nanoseconds in this struct."] #[repr(C)] -pub struct JavaVMInitArgs { - pub version: jint, - pub nOptions: jint, - pub options: *mut JavaVMOption, - pub ignoreUnrecognized: jboolean, +#[derive(Debug, Copy, Clone)] +pub struct GameActivityKeyEvent { + pub deviceId: i32, + pub source: i32, + pub action: i32, + pub eventTime: i64, + pub downTime: i64, + pub flags: i32, + pub metaState: i32, + pub modifiers: i32, + pub repeatCount: i32, + pub keyCode: i32, + pub scanCode: i32, } #[test] -fn bindgen_test_layout_JavaVMInitArgs() { +fn bindgen_test_layout_GameActivityKeyEvent() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(JavaVMInitArgs)) + ::std::mem::size_of::(), + 56usize, + "Size of GameActivityKeyEvent" ); assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(JavaVMInitArgs)) + ::std::mem::align_of::(), + 8usize, + "Alignment of GameActivityKeyEvent" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).version as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).deviceId) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(JavaVMInitArgs), - "::", - stringify!(version) - ) + "Offset of field: GameActivityKeyEvent::deviceId" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).nOptions as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).source) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(JavaVMInitArgs), - "::", - stringify!(nOptions) - ) + "Offset of field: GameActivityKeyEvent::source" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).options as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).action) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(JavaVMInitArgs), - "::", - stringify!(options) - ) + "Offset of field: GameActivityKeyEvent::action" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).ignoreUnrecognized as *const _ as usize - }, - 12usize, - concat!( - "Offset of field: ", - stringify!(JavaVMInitArgs), - "::", - stringify!(ignoreUnrecognized) - ) + unsafe { ::std::ptr::addr_of!((*ptr).eventTime) as usize - ptr as usize }, + 16usize, + "Offset of field: GameActivityKeyEvent::eventTime" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).downTime) as usize - ptr as usize }, + 24usize, + "Offset of field: GameActivityKeyEvent::downTime" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, + 32usize, + "Offset of field: GameActivityKeyEvent::flags" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).metaState) as usize - ptr as usize }, + 36usize, + "Offset of field: GameActivityKeyEvent::metaState" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).modifiers) as usize - ptr as usize }, + 40usize, + "Offset of field: GameActivityKeyEvent::modifiers" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).repeatCount) as usize - ptr as usize }, + 44usize, + "Offset of field: GameActivityKeyEvent::repeatCount" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).keyCode) as usize - ptr as usize }, + 48usize, + "Offset of field: GameActivityKeyEvent::keyCode" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).scanCode) as usize - ptr as usize }, + 52usize, + "Offset of field: GameActivityKeyEvent::scanCode" ); } -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_CAPTION_BAR: GameCommonInsetsType = 0; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_DISPLAY_CUTOUT: GameCommonInsetsType = 1; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_IME: GameCommonInsetsType = 2; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_MANDATORY_SYSTEM_GESTURES: - GameCommonInsetsType = 3; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_NAVIGATION_BARS: GameCommonInsetsType = 4; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_STATUS_BARS: GameCommonInsetsType = 5; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_SYSTEM_BARS: GameCommonInsetsType = 6; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_SYSTEM_GESTURES: GameCommonInsetsType = 7; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_TAPABLE_ELEMENT: GameCommonInsetsType = 8; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_WATERFALL: GameCommonInsetsType = 9; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_COUNT: GameCommonInsetsType = 10; -#[doc = " The type of a component for which to retrieve insets. See"] -#[doc = " https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat.Type"] -pub type GameCommonInsetsType = ::std::os::raw::c_uint; -#[doc = " This struct holds a span within a region of text from start (inclusive) to"] -#[doc = " end (exclusive). An empty span or cursor position is specified with"] -#[doc = " start==end. An undefined span is specified with start = end = SPAN_UNDEFINED."] +#[doc = " This struct holds a span within a region of text from start (inclusive) to\n end (exclusive). An empty span or cursor position is specified with\n start==end. An undefined span is specified with start = end = SPAN_UNDEFINED."] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct GameTextInputSpan { @@ -2287,50 +2657,37 @@ pub struct GameTextInputSpan { } #[test] fn bindgen_test_layout_GameTextInputSpan() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 8usize, - concat!("Size of: ", stringify!(GameTextInputSpan)) + "Size of GameTextInputSpan" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(GameTextInputSpan)) + "Alignment of GameTextInputSpan" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).start as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).start) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(GameTextInputSpan), - "::", - stringify!(start) - ) + "Offset of field: GameTextInputSpan::start" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).end as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).end) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(GameTextInputSpan), - "::", - stringify!(end) - ) + "Offset of field: GameTextInputSpan::end" ); } pub const GameTextInputSpanFlag_SPAN_UNDEFINED: GameTextInputSpanFlag = -1; #[doc = " Values with special meaning in a GameTextInputSpan."] -pub type GameTextInputSpanFlag = ::std::os::raw::c_int; -#[doc = " This struct holds the state of an editable section of text."] -#[doc = " The text can have a selection and a composing region defined on it."] -#[doc = " A composing region is used by IMEs that allow input using multiple steps to"] -#[doc = " compose a glyph or word. Use functions GameTextInput_getState and"] -#[doc = " GameTextInput_setState to read and modify the state that an IME is editing."] +pub type GameTextInputSpanFlag = i32; +#[doc = " This struct holds the state of an editable section of text.\n The text can have a selection and a composing region defined on it.\n A composing region is used by IMEs that allow input using multiple steps to\n compose a glyph or word. Use functions GameTextInput_getState and\n GameTextInput_setState to read and modify the state that an IME is editing."] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct GameTextInputState { - #[doc = " Text owned by the state, as a modified UTF-8 string. Null-terminated."] - #[doc = " https://en.wikipedia.org/wiki/UTF-8#Modified_UTF-8"] + #[doc = " Text owned by the state, as a modified UTF-8 string. Null-terminated.\n https://en.wikipedia.org/wiki/UTF-8#Modified_UTF-8"] pub text_UTF8: *const ::std::os::raw::c_char, #[doc = " Length in bytes of text_UTF8, *not* including the null at end."] pub text_length: i32, @@ -2341,63 +2698,40 @@ pub struct GameTextInputState { } #[test] fn bindgen_test_layout_GameTextInputState() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 24usize, - concat!("Size of: ", stringify!(GameTextInputState)) + "Size of GameTextInputState" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(GameTextInputState)) + "Alignment of GameTextInputState" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).text_UTF8 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).text_UTF8) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(GameTextInputState), - "::", - stringify!(text_UTF8) - ) + "Offset of field: GameTextInputState::text_UTF8" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).text_length as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).text_length) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(GameTextInputState), - "::", - stringify!(text_length) - ) + "Offset of field: GameTextInputState::text_length" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).selection as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).selection) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(GameTextInputState), - "::", - stringify!(selection) - ) + "Offset of field: GameTextInputState::selection" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).composingRegion as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).composingRegion) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(GameTextInputState), - "::", - stringify!(composingRegion) - ) - ); -} -#[doc = " A callback called by GameTextInput_getState."] -#[doc = " @param context User-defined context."] -#[doc = " @param state State, owned by the library, that will be valid for the duration"] -#[doc = " of the callback."] + "Offset of field: GameTextInputState::composingRegion" + ); +} +#[doc = " A callback called by GameTextInput_getState.\n @param context User-defined context.\n @param state State, owned by the library, that will be valid for the duration\n of the callback."] pub type GameTextInputGetStateCallback = ::std::option::Option< unsafe extern "C" fn(context: *mut ::std::os::raw::c_void, state: *const GameTextInputState), >; @@ -2407,74 +2741,45 @@ pub struct GameTextInput { _unused: [u8; 0], } extern "C" { - #[doc = " Initialize the GameTextInput library."] - #[doc = " If called twice without GameTextInput_destroy being called, the same pointer"] - #[doc = " will be returned and a warning will be issued."] - #[doc = " @param env A JNI env valid on the calling thread."] - #[doc = " @param max_string_size The maximum length of a string that can be edited. If"] - #[doc = " zero, the maximum defaults to 65536 bytes. A buffer of this size is allocated"] - #[doc = " at initialization."] - #[doc = " @return A handle to the library."] + #[doc = " Initialize the GameTextInput library.\n If called twice without GameTextInput_destroy being called, the same pointer\n will be returned and a warning will be issued.\n @param env A JNI env valid on the calling thread.\n @param max_string_size The maximum length of a string that can be edited. If\n zero, the maximum defaults to 65536 bytes. A buffer of this size is allocated\n at initialization.\n @return A handle to the library."] pub fn GameTextInput_init(env: *mut JNIEnv, max_string_size: u32) -> *mut GameTextInput; } extern "C" { - #[doc = " When using GameTextInput, you need to create a gametextinput.InputConnection"] - #[doc = " on the Java side and pass it using this function to the library, unless using"] - #[doc = " GameActivity in which case this will be done for you. See the GameActivity"] - #[doc = " source code or GameTextInput samples for examples of usage."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param inputConnection A gametextinput.InputConnection object."] + #[doc = " When using GameTextInput, you need to create a gametextinput.InputConnection\n on the Java side and pass it using this function to the library, unless using\n GameActivity in which case this will be done for you. See the GameActivity\n source code or GameTextInput samples for examples of usage.\n @param input A valid GameTextInput library handle.\n @param inputConnection A gametextinput.InputConnection object."] pub fn GameTextInput_setInputConnection(input: *mut GameTextInput, inputConnection: jobject); } extern "C" { - #[doc = " Unless using GameActivity, it is required to call this function from your"] - #[doc = " Java gametextinput.Listener.stateChanged method to convert eventState and"] - #[doc = " trigger any event callbacks. When using GameActivity, this does not need to"] - #[doc = " be called as event processing is handled by the Activity."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param eventState A Java gametextinput.State object."] + #[doc = " Unless using GameActivity, it is required to call this function from your\n Java gametextinput.Listener.stateChanged method to convert eventState and\n trigger any event callbacks. When using GameActivity, this does not need to\n be called as event processing is handled by the Activity.\n @param input A valid GameTextInput library handle.\n @param eventState A Java gametextinput.State object."] pub fn GameTextInput_processEvent(input: *mut GameTextInput, eventState: jobject); } extern "C" { - #[doc = " Free any resources owned by the GameTextInput library."] - #[doc = " Any subsequent calls to the library will fail until GameTextInput_init is"] - #[doc = " called again."] - #[doc = " @param input A valid GameTextInput library handle."] + #[doc = " Free any resources owned by the GameTextInput library.\n Any subsequent calls to the library will fail until GameTextInput_init is\n called again.\n @param input A valid GameTextInput library handle."] pub fn GameTextInput_destroy(input: *mut GameTextInput); } pub const ShowImeFlags_SHOW_IME_UNDEFINED: ShowImeFlags = 0; pub const ShowImeFlags_SHOW_IMPLICIT: ShowImeFlags = 1; pub const ShowImeFlags_SHOW_FORCED: ShowImeFlags = 2; #[doc = " Flags to be passed to GameTextInput_showIme."] -pub type ShowImeFlags = ::std::os::raw::c_uint; +pub type ShowImeFlags = u32; extern "C" { - #[doc = " Show the IME. Calls InputMethodManager.showSoftInput()."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param flags Defined in ShowImeFlags above. For more information see:"] - #[doc = " https://developer.android.com/reference/android/view/inputmethod/InputMethodManager"] + #[doc = " Show the IME. Calls InputMethodManager.showSoftInput().\n @param input A valid GameTextInput library handle.\n @param flags Defined in ShowImeFlags above. For more information see:\n https://developer.android.com/reference/android/view/inputmethod/InputMethodManager"] pub fn GameTextInput_showIme(input: *mut GameTextInput, flags: u32); } pub const HideImeFlags_HIDE_IME_UNDEFINED: HideImeFlags = 0; pub const HideImeFlags_HIDE_IMPLICIT_ONLY: HideImeFlags = 1; pub const HideImeFlags_HIDE_NOT_ALWAYS: HideImeFlags = 2; #[doc = " Flags to be passed to GameTextInput_hideIme."] -pub type HideImeFlags = ::std::os::raw::c_uint; +pub type HideImeFlags = u32; extern "C" { - #[doc = " Show the IME. Calls InputMethodManager.hideSoftInputFromWindow()."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param flags Defined in HideImeFlags above. For more information see:"] - #[doc = " https://developer.android.com/reference/android/view/inputmethod/InputMethodManager"] + #[doc = " Hide the IME. Calls InputMethodManager.hideSoftInputFromWindow().\n @param input A valid GameTextInput library handle.\n @param flags Defined in HideImeFlags above. For more information see:\n https://developer.android.com/reference/android/view/inputmethod/InputMethodManager"] pub fn GameTextInput_hideIme(input: *mut GameTextInput, flags: u32); } extern "C" { - #[doc = " Call a callback with the current GameTextInput state, which may have been"] - #[doc = " modified by changes in the IME and calls to GameTextInput_setState. We use a"] - #[doc = " callback rather than returning the state in order to simplify ownership of"] - #[doc = " text_UTF8 strings. These strings are only valid during the calling of the"] - #[doc = " callback."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param callback A function that will be called with valid state."] - #[doc = " @param context Context used by the callback."] + #[doc = " Restarts the input method. Calls InputMethodManager.restartInput().\n @param input A valid GameTextInput library handle."] + pub fn GameTextInput_restartInput(input: *mut GameTextInput); +} +extern "C" { + #[doc = " Call a callback with the current GameTextInput state, which may have been\n modified by changes in the IME and calls to GameTextInput_setState. We use a\n callback rather than returning the state in order to simplify ownership of\n text_UTF8 strings. These strings are only valid during the calling of the\n callback.\n @param input A valid GameTextInput library handle.\n @param callback A function that will be called with valid state.\n @param context Context used by the callback."] pub fn GameTextInput_getState( input: *mut GameTextInput, callback: GameTextInputGetStateCallback, @@ -2482,18 +2787,10 @@ extern "C" { ); } extern "C" { - #[doc = " Set the current GameTextInput state. This state is reflected to any active"] - #[doc = " IME."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param state The state to set. Ownership is maintained by the caller and must"] - #[doc = " remain valid for the duration of the call."] + #[doc = " Set the current GameTextInput state. This state is reflected to any active\n IME.\n @param input A valid GameTextInput library handle.\n @param state The state to set. Ownership is maintained by the caller and must\n remain valid for the duration of the call."] pub fn GameTextInput_setState(input: *mut GameTextInput, state: *const GameTextInputState); } -#[doc = " Type of the callback needed by GameTextInput_setEventCallback that will be"] -#[doc = " called every time the IME state changes."] -#[doc = " @param context User-defined context set in GameTextInput_setEventCallback."] -#[doc = " @param current_state Current IME state, owned by the library and valid during"] -#[doc = " the callback."] +#[doc = " Type of the callback needed by GameTextInput_setEventCallback that will be\n called every time the IME state changes.\n @param context User-defined context set in GameTextInput_setEventCallback.\n @param current_state Current IME state, owned by the library and valid during\n the callback."] pub type GameTextInputEventCallback = ::std::option::Option< unsafe extern "C" fn( context: *mut ::std::os::raw::c_void, @@ -2501,34 +2798,19 @@ pub type GameTextInputEventCallback = ::std::option::Option< ), >; extern "C" { - #[doc = " Optionally set a callback to be called whenever the IME state changes."] - #[doc = " Not necessary if you are using GameActivity, which handles these callbacks"] - #[doc = " for you."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param callback Called by the library when the IME state changes."] - #[doc = " @param context Context passed as first argument to the callback."] + #[doc = " Optionally set a callback to be called whenever the IME state changes.\n Not necessary if you are using GameActivity, which handles these callbacks\n for you.\n @param input A valid GameTextInput library handle.\n @param callback Called by the library when the IME state changes.\n @param context Context passed as first argument to the callback.\n This function is deprecated. Don't perform any complex processing inside\n the callback other than copying the state variable. Using any synchronization\n primitives inside this callback may cause a deadlock."] pub fn GameTextInput_setEventCallback( input: *mut GameTextInput, callback: GameTextInputEventCallback, context: *mut ::std::os::raw::c_void, ); } -#[doc = " Type of the callback needed by GameTextInput_setImeInsetsCallback that will"] -#[doc = " be called every time the IME window insets change."] -#[doc = " @param context User-defined context set in"] -#[doc = " GameTextInput_setImeWIndowInsetsCallback."] -#[doc = " @param current_insets Current IME insets, owned by the library and valid"] -#[doc = " during the callback."] +#[doc = " Type of the callback needed by GameTextInput_setImeInsetsCallback that will\n be called every time the IME window insets change.\n @param context User-defined context set in\n GameTextInput_setImeWIndowInsetsCallback.\n @param current_insets Current IME insets, owned by the library and valid\n during the callback."] pub type GameTextInputImeInsetsCallback = ::std::option::Option< unsafe extern "C" fn(context: *mut ::std::os::raw::c_void, current_insets: *const ARect), >; extern "C" { - #[doc = " Optionally set a callback to be called whenever the IME insets change."] - #[doc = " Not necessary if you are using GameActivity, which handles these callbacks"] - #[doc = " for you."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param callback Called by the library when the IME insets change."] - #[doc = " @param context Context passed as first argument to the callback."] + #[doc = " Optionally set a callback to be called whenever the IME insets change.\n Not necessary if you are using GameActivity, which handles these callbacks\n for you.\n @param input A valid GameTextInput library handle.\n @param callback Called by the library when the IME insets change.\n @param context Context passed as first argument to the callback."] pub fn GameTextInput_setImeInsetsCallback( input: *mut GameTextInput, callback: GameTextInputImeInsetsCallback, @@ -2536,40 +2818,22 @@ extern "C" { ); } extern "C" { - #[doc = " Get the current window insets for the IME."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param insets Filled with the current insets by this function."] + #[doc = " Get the current window insets for the IME.\n @param input A valid GameTextInput library handle.\n @param insets Filled with the current insets by this function."] pub fn GameTextInput_getImeInsets(input: *const GameTextInput, insets: *mut ARect); } extern "C" { - #[doc = " Unless using GameActivity, it is required to call this function from your"] - #[doc = " Java gametextinput.Listener.onImeInsetsChanged method to"] - #[doc = " trigger any event callbacks. When using GameActivity, this does not need to"] - #[doc = " be called as insets processing is handled by the Activity."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param eventState A Java gametextinput.State object."] + #[doc = " Unless using GameActivity, it is required to call this function from your\n Java gametextinput.Listener.onImeInsetsChanged method to\n trigger any event callbacks. When using GameActivity, this does not need to\n be called as insets processing is handled by the Activity.\n @param input A valid GameTextInput library handle.\n @param eventState A Java gametextinput.State object."] pub fn GameTextInput_processImeInsets(input: *mut GameTextInput, insets: *const ARect); } extern "C" { - #[doc = " Convert a GameTextInputState struct to a Java gametextinput.State object."] - #[doc = " Don't forget to delete the returned Java local ref when you're done."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param state Input state to convert."] - #[doc = " @return A Java object of class gametextinput.State. The caller is required to"] - #[doc = " delete this local reference."] + #[doc = " Convert a GameTextInputState struct to a Java gametextinput.State object.\n Don't forget to delete the returned Java local ref when you're done.\n @param input A valid GameTextInput library handle.\n @param state Input state to convert.\n @return A Java object of class gametextinput.State. The caller is required to\n delete this local reference."] pub fn GameTextInputState_toJava( input: *const GameTextInput, state: *const GameTextInputState, ) -> jobject; } extern "C" { - #[doc = " Convert from a Java gametextinput.State object into a C GameTextInputState"] - #[doc = " struct."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param state A Java gametextinput.State object."] - #[doc = " @param callback A function called with the C struct, valid for the duration"] - #[doc = " of the call."] - #[doc = " @param context Context passed to the callback."] + #[doc = " Convert from a Java gametextinput.State object into a C GameTextInputState\n struct.\n @param input A valid GameTextInput library handle.\n @param state A Java gametextinput.State object.\n @param callback A function called with the C struct, valid for the duration\n of the call.\n @param context Context passed to the callback."] pub fn GameTextInputState_fromJava( input: *const GameTextInput, state: jobject, @@ -2577,713 +2841,234 @@ extern "C" { context: *mut ::std::os::raw::c_void, ); } -#[doc = " This structure defines the native side of an android.app.GameActivity."] -#[doc = " It is created by the framework, and handed to the application's native"] -#[doc = " code as it is being launched."] -#[repr(C)] -pub struct GameActivity { - #[doc = " Pointer to the callback function table of the native application."] - #[doc = " You can set the functions here to your own callbacks. The callbacks"] - #[doc = " pointer itself here should not be changed; it is allocated and managed"] - #[doc = " for you by the framework."] - pub callbacks: *mut GameActivityCallbacks, - #[doc = " The global handle on the process's Java VM."] - pub vm: *mut JavaVM, - #[doc = " JNI context for the main thread of the app. Note that this field"] - #[doc = " can ONLY be used from the main thread of the process; that is, the"] - #[doc = " thread that calls into the GameActivityCallbacks."] - pub env: *mut JNIEnv, - #[doc = " The GameActivity object handle."] - pub javaGameActivity: jobject, - #[doc = " Path to this application's internal data directory."] - pub internalDataPath: *const ::std::os::raw::c_char, - #[doc = " Path to this application's external (removable/mountable) data directory."] - pub externalDataPath: *const ::std::os::raw::c_char, - #[doc = " The platform's SDK version code."] - pub sdkVersion: i32, - #[doc = " This is the native instance of the application. It is not used by"] - #[doc = " the framework, but can be set by the application to its own instance"] - #[doc = " state."] - pub instance: *mut ::std::os::raw::c_void, - #[doc = " Pointer to the Asset Manager instance for the application. The"] - #[doc = " application uses this to access binary assets bundled inside its own .apk"] - #[doc = " file."] - pub assetManager: *mut AAssetManager, - #[doc = " Available starting with Honeycomb: path to the directory containing"] - #[doc = " the application's OBB files (if any). If the app doesn't have any"] - #[doc = " OBB files, this directory may not exist."] - pub obbPath: *const ::std::os::raw::c_char, -} -#[test] -fn bindgen_test_layout_GameActivity() { - assert_eq!( - ::std::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(GameActivity)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(GameActivity)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).callbacks as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(callbacks) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).vm as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(vm) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).env as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(env) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).javaGameActivity as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(javaGameActivity) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).internalDataPath as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(internalDataPath) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).externalDataPath as *const _ as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(externalDataPath) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).sdkVersion as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(sdkVersion) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).instance as *const _ as usize }, - 28usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(instance) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).assetManager as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(assetManager) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).obbPath as *const _ as usize }, - 36usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(obbPath) - ) - ); -} -#[doc = " \\brief Describe information about a pointer, found in a"] -#[doc = " GameActivityMotionEvent."] -#[doc = ""] -#[doc = " You can read values directly from this structure, or use helper functions"] -#[doc = " (`GameActivityPointerAxes_getX`, `GameActivityPointerAxes_getY` and"] -#[doc = " `GameActivityPointerAxes_getAxisValue`)."] -#[doc = ""] -#[doc = " The X axis and Y axis are enabled by default but any other axis that you want"] -#[doc = " to read **must** be enabled first, using"] -#[doc = " `GameActivityPointerAxes_enableAxis`."] -#[doc = ""] -#[doc = " \\see GameActivityMotionEvent"] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct GameActivityPointerAxes { - pub id: i32, - pub toolType: i32, - pub axisValues: [f32; 48usize], - pub rawX: f32, - pub rawY: f32, -} -#[test] -fn bindgen_test_layout_GameActivityPointerAxes() { - assert_eq!( - ::std::mem::size_of::(), - 208usize, - concat!("Size of: ", stringify!(GameActivityPointerAxes)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(GameActivityPointerAxes)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).id as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(GameActivityPointerAxes), - "::", - stringify!(id) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).toolType as *const _ as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(GameActivityPointerAxes), - "::", - stringify!(toolType) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).axisValues as *const _ as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(GameActivityPointerAxes), - "::", - stringify!(axisValues) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).rawX as *const _ as usize }, - 200usize, - concat!( - "Offset of field: ", - stringify!(GameActivityPointerAxes), - "::", - stringify!(rawX) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).rawY as *const _ as usize }, - 204usize, - concat!( - "Offset of field: ", - stringify!(GameActivityPointerAxes), - "::", - stringify!(rawY) - ) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct GameActivityHistoricalPointerAxes { - pub eventTime: i64, - pub axisValues: [f32; 48usize], -} -#[test] -fn bindgen_test_layout_GameActivityHistoricalPointerAxes() { - assert_eq!( - ::std::mem::size_of::(), - 200usize, - concat!("Size of: ", stringify!(GameActivityHistoricalPointerAxes)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!( - "Alignment of ", - stringify!(GameActivityHistoricalPointerAxes) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).eventTime as *const _ - as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(GameActivityHistoricalPointerAxes), - "::", - stringify!(eventTime) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).axisValues as *const _ - as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(GameActivityHistoricalPointerAxes), - "::", - stringify!(axisValues) - ) - ); -} -extern "C" { - #[doc = " \\brief Enable the specified axis, so that its value is reported in the"] - #[doc = " GameActivityPointerAxes structures stored in a motion event."] - #[doc = ""] - #[doc = " You must enable any axis that you want to read, apart from"] - #[doc = " `AMOTION_EVENT_AXIS_X` and `AMOTION_EVENT_AXIS_Y` that are enabled by"] - #[doc = " default."] - #[doc = ""] - #[doc = " If the axis index is out of range, nothing is done."] - pub fn GameActivityPointerAxes_enableAxis(axis: i32); -} -extern "C" { - #[doc = " \\brief Disable the specified axis. Its value won't be reported in the"] - #[doc = " GameActivityPointerAxes structures stored in a motion event anymore."] - #[doc = ""] - #[doc = " Apart from X and Y, any axis that you want to read **must** be enabled first,"] - #[doc = " using `GameActivityPointerAxes_enableAxis`."] - #[doc = ""] - #[doc = " If the axis index is out of range, nothing is done."] - pub fn GameActivityPointerAxes_disableAxis(axis: i32); -} -extern "C" { - #[doc = " \\brief Enable the specified axis, so that its value is reported in the"] - #[doc = " GameActivityHistoricalPointerAxes structures associated with a motion event."] - #[doc = ""] - #[doc = " You must enable any axis that you want to read (no axes are enabled by"] - #[doc = " default)."] - #[doc = ""] - #[doc = " If the axis index is out of range, nothing is done."] - pub fn GameActivityHistoricalPointerAxes_enableAxis(axis: i32); -} -extern "C" { - #[doc = " \\brief Disable the specified axis. Its value won't be reported in the"] - #[doc = " GameActivityHistoricalPointerAxes structures associated with motion events"] - #[doc = " anymore."] - #[doc = ""] - #[doc = " If the axis index is out of range, nothing is done."] - pub fn GameActivityHistoricalPointerAxes_disableAxis(axis: i32); -} -#[doc = " \\brief Describe a motion event that happened on the GameActivity SurfaceView."] -#[doc = ""] -#[doc = " This is 1:1 mapping to the information contained in a Java `MotionEvent`"] -#[doc = " (see https://developer.android.com/reference/android/view/MotionEvent)."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct GameActivityMotionEvent { - pub deviceId: i32, - pub source: i32, - pub action: i32, - pub eventTime: i64, - pub downTime: i64, - pub flags: i32, - pub metaState: i32, - pub actionButton: i32, - pub buttonState: i32, - pub classification: i32, - pub edgeFlags: i32, - pub pointerCount: u32, - pub pointers: [GameActivityPointerAxes; 8usize], - pub precisionX: f32, - pub precisionY: f32, - pub historicalStart: i16, - pub historicalCount: i16, -} -#[test] -fn bindgen_test_layout_GameActivityMotionEvent() { - assert_eq!( - ::std::mem::size_of::(), - 1736usize, - concat!("Size of: ", stringify!(GameActivityMotionEvent)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(GameActivityMotionEvent)) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).deviceId as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(deviceId) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).source as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(source) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).action as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(action) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).eventTime as *const _ as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(eventTime) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).downTime as *const _ as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(downTime) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(flags) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).metaState as *const _ as usize - }, - 36usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(metaState) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).actionButton as *const _ as usize - }, - 40usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(actionButton) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).buttonState as *const _ as usize - }, - 44usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(buttonState) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).classification as *const _ as usize - }, - 48usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(classification) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).edgeFlags as *const _ as usize - }, - 52usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(edgeFlags) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).pointerCount as *const _ as usize - }, - 56usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(pointerCount) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).pointers as *const _ as usize - }, - 60usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(pointers) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).precisionX as *const _ as usize - }, - 1724usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(precisionX) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).precisionY as *const _ as usize - }, - 1728usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(precisionY) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).historicalStart as *const _ as usize - }, - 1732usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(historicalStart) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).historicalCount as *const _ as usize - }, - 1734usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(historicalCount) - ) - ); -} -#[doc = " \\brief Describe a key event that happened on the GameActivity SurfaceView."] -#[doc = ""] -#[doc = " This is 1:1 mapping to the information contained in a Java `KeyEvent`"] -#[doc = " (see https://developer.android.com/reference/android/view/KeyEvent)."] +#[doc = " Mask of bits that determine the overall class\n of text being given. Currently supported classes are:\n {@link #TYPE_CLASS_TEXT}, {@link #TYPE_CLASS_NUMBER},\n {@link #TYPE_CLASS_PHONE}, {@link #TYPE_CLASS_DATETIME}.\n

IME authors: If the class is not one you\n understand, assume {@link #TYPE_CLASS_TEXT} with NO variation\n or flags.

"] +pub const GameTextInputType_TYPE_MASK_CLASS: GameTextInputType = 15; +#[doc = " Mask of bits that determine the variation of\n the base content class."] +pub const GameTextInputType_TYPE_MASK_VARIATION: GameTextInputType = 4080; +#[doc = " Mask of bits that provide addition bit flags\n of options."] +pub const GameTextInputType_TYPE_MASK_FLAGS: GameTextInputType = 16773120; +#[doc = " Special content type for when no explicit type has been specified.\n This should be interpreted to mean that the target input connection\n is not rich, it can not process and show things like candidate text nor\n retrieve the current text, so the input method will need to run in a\n limited \"generate key events\" mode, if it supports it. Note that some\n input methods may not support it, for example a voice-based input\n method will likely not be able to generate key events even if this\n flag is set."] +pub const GameTextInputType_TYPE_NULL: GameTextInputType = 0; +#[doc = " Class for normal text. This class supports the following flags (only\n one of which should be set):\n {@link #TYPE_TEXT_FLAG_CAP_CHARACTERS},\n {@link #TYPE_TEXT_FLAG_CAP_WORDS}, and.\n {@link #TYPE_TEXT_FLAG_CAP_SENTENCES}. It also supports the\n following variations:\n {@link #TYPE_TEXT_VARIATION_NORMAL}, and\n {@link #TYPE_TEXT_VARIATION_URI}. If you do not recognize the\n variation, normal should be assumed."] +pub const GameTextInputType_TYPE_CLASS_TEXT: GameTextInputType = 1; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: capitalize all characters. Overrides\n {@link #TYPE_TEXT_FLAG_CAP_WORDS} and\n {@link #TYPE_TEXT_FLAG_CAP_SENTENCES}. This value is explicitly defined\n to be the same as {@link TextUtils#CAP_MODE_CHARACTERS}. Of course,\n this only affects languages where there are upper-case and lower-case\n letters."] +pub const GameTextInputType_TYPE_TEXT_FLAG_CAP_CHARACTERS: GameTextInputType = 4096; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: capitalize the first character of\n every word. Overrides {@link #TYPE_TEXT_FLAG_CAP_SENTENCES}. This\n value is explicitly defined\n to be the same as {@link TextUtils#CAP_MODE_WORDS}. Of course,\n this only affects languages where there are upper-case and lower-case\n letters."] +pub const GameTextInputType_TYPE_TEXT_FLAG_CAP_WORDS: GameTextInputType = 8192; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: capitalize the first character of\n each sentence. This value is explicitly defined\n to be the same as {@link TextUtils#CAP_MODE_SENTENCES}. For example\n in English it means to capitalize after a period and a space (note that\n other languages may have different characters for period, or not use\n spaces, or use different grammatical rules). Of course, this only affects\n languages where there are upper-case and lower-case letters."] +pub const GameTextInputType_TYPE_TEXT_FLAG_CAP_SENTENCES: GameTextInputType = 16384; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: the user is entering free-form\n text that should have auto-correction applied to it. Without this flag,\n the IME will not try to correct typos. You should always set this flag\n unless you really expect users to type non-words in this field, for\n example to choose a name for a character in a game.\n Contrast this with {@link #TYPE_TEXT_FLAG_AUTO_COMPLETE} and\n {@link #TYPE_TEXT_FLAG_NO_SUGGESTIONS}:\n {@code TYPE_TEXT_FLAG_AUTO_CORRECT} means that the IME will try to\n auto-correct typos as the user is typing, but does not define whether\n the IME offers an interface to show suggestions."] +pub const GameTextInputType_TYPE_TEXT_FLAG_AUTO_CORRECT: GameTextInputType = 32768; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: the text editor (which means\n the application) is performing auto-completion of the text being entered\n based on its own semantics, which it will present to the user as they type.\n This generally means that the input method should not be showing\n candidates itself, but can expect the editor to supply its own\n completions/candidates from\n {@link android.view.inputmethod.InputMethodSession#displayCompletions\n InputMethodSession.displayCompletions()} as a result of the editor calling\n {@link android.view.inputmethod.InputMethodManager#displayCompletions\n InputMethodManager.displayCompletions()}.\n Note the contrast with {@link #TYPE_TEXT_FLAG_AUTO_CORRECT} and\n {@link #TYPE_TEXT_FLAG_NO_SUGGESTIONS}:\n {@code TYPE_TEXT_FLAG_AUTO_COMPLETE} means the editor should show an\n interface for displaying suggestions, but instead of supplying its own\n it will rely on the Editor to pass completions/corrections."] +pub const GameTextInputType_TYPE_TEXT_FLAG_AUTO_COMPLETE: GameTextInputType = 65536; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: multiple lines of text can be\n entered into the field. If this flag is not set, the text field\n will be constrained to a single line. The IME may also choose not to\n display an enter key when this flag is not set, as there should be no\n need to create new lines."] +pub const GameTextInputType_TYPE_TEXT_FLAG_MULTI_LINE: GameTextInputType = 131072; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: the regular text view associated\n with this should not be multi-line, but when a fullscreen input method\n is providing text it should use multiple lines if it can."] +pub const GameTextInputType_TYPE_TEXT_FLAG_IME_MULTI_LINE: GameTextInputType = 262144; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: the input method does not need to\n display any dictionary-based candidates. This is useful for text views that\n do not contain words from the language and do not benefit from any\n dictionary-based completions or corrections. It overrides the\n {@link #TYPE_TEXT_FLAG_AUTO_CORRECT} value when set.\n Please avoid using this unless you are certain this is what you want.\n Many input methods need suggestions to work well, for example the ones\n based on gesture typing. Consider clearing\n {@link #TYPE_TEXT_FLAG_AUTO_CORRECT} instead if you just do not\n want the IME to correct typos.\n Note the contrast with {@link #TYPE_TEXT_FLAG_AUTO_CORRECT} and\n {@link #TYPE_TEXT_FLAG_AUTO_COMPLETE}:\n {@code TYPE_TEXT_FLAG_NO_SUGGESTIONS} means the IME does not need to\n show an interface to display suggestions. Most IMEs will also take this to\n mean they do not need to try to auto-correct what the user is typing."] +pub const GameTextInputType_TYPE_TEXT_FLAG_NO_SUGGESTIONS: GameTextInputType = 524288; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: Let the IME know the text conversion\n suggestions are required by the application. Text conversion suggestion is\n for the transliteration languages which has pronunciation characters and\n target characters. When the user is typing the pronunciation charactes, the\n IME could provide the possible target characters to the user. When this\n flag is set, the IME should insert the text conversion suggestions through\n {@link Builder#setTextConversionSuggestions(List)} and\n the {@link TextAttribute} with initialized with the text conversion\n suggestions is provided by the IME to the application. To receive the\n additional information, the application needs to implement {@link\n InputConnection#setComposingText(CharSequence, int, TextAttribute)},\n {@link InputConnection#setComposingRegion(int, int, TextAttribute)}, and\n {@link InputConnection#commitText(CharSequence, int, TextAttribute)}."] +pub const GameTextInputType_TYPE_TEXT_FLAG_ENABLE_TEXT_CONVERSION_SUGGESTIONS: GameTextInputType = + 1048576; +#[doc = " Default variation of {@link #TYPE_CLASS_TEXT}: plain old normal text."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_NORMAL: GameTextInputType = 0; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering a URI."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_URI: GameTextInputType = 16; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering an e-mail address."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_EMAIL_ADDRESS: GameTextInputType = 32; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering the subject line of\n an e-mail."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_EMAIL_SUBJECT: GameTextInputType = 48; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering a short, possibly informal\n message such as an instant message or a text message."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_SHORT_MESSAGE: GameTextInputType = 64; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering the content of a long,\n possibly formal message such as the body of an e-mail."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_LONG_MESSAGE: GameTextInputType = 80; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering the name of a person."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_PERSON_NAME: GameTextInputType = 96; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering a postal mailing address."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_POSTAL_ADDRESS: GameTextInputType = 112; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering a password."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_PASSWORD: GameTextInputType = 128; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering a password, which should\n be visible to the user."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_VISIBLE_PASSWORD: GameTextInputType = 144; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering text inside of a web form."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_WEB_EDIT_TEXT: GameTextInputType = 160; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering text to filter contents\n of a list etc."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_FILTER: GameTextInputType = 176; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering text for phonetic\n pronunciation, such as a phonetic name field in contacts. This is mostly\n useful for languages where one spelling may have several phonetic\n readings, like Japanese."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_PHONETIC: GameTextInputType = 192; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering e-mail address inside\n of a web form. This was added in\n {@link android.os.Build.VERSION_CODES#HONEYCOMB}. An IME must target\n this API version or later to see this input type; if it doesn't, a request\n for this type will be seen as {@link #TYPE_TEXT_VARIATION_EMAIL_ADDRESS}\n when passed through {@link\n android.view.inputmethod.EditorInfo#makeCompatible(int)\n EditorInfo.makeCompatible(int)}."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS: GameTextInputType = 208; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering password inside\n of a web form. This was added in\n {@link android.os.Build.VERSION_CODES#HONEYCOMB}. An IME must target\n this API version or later to see this input type; if it doesn't, a request\n for this type will be seen as {@link #TYPE_TEXT_VARIATION_PASSWORD}\n when passed through {@link\n android.view.inputmethod.EditorInfo#makeCompatible(int)\n EditorInfo.makeCompatible(int)}."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_WEB_PASSWORD: GameTextInputType = 224; +#[doc = " Class for numeric text. This class supports the following flags:\n {@link #TYPE_NUMBER_FLAG_SIGNED} and\n {@link #TYPE_NUMBER_FLAG_DECIMAL}. It also supports the following\n variations: {@link #TYPE_NUMBER_VARIATION_NORMAL} and\n {@link #TYPE_NUMBER_VARIATION_PASSWORD}.\n

IME authors: If you do not recognize\n the variation, normal should be assumed.

"] +pub const GameTextInputType_TYPE_CLASS_NUMBER: GameTextInputType = 2; +#[doc = " Flag of {@link #TYPE_CLASS_NUMBER}: the number is signed, allowing\n a positive or negative sign at the start."] +pub const GameTextInputType_TYPE_NUMBER_FLAG_SIGNED: GameTextInputType = 4096; +#[doc = " Flag of {@link #TYPE_CLASS_NUMBER}: the number is decimal, allowing\n a decimal point to provide fractional values."] +pub const GameTextInputType_TYPE_NUMBER_FLAG_DECIMAL: GameTextInputType = 8192; +#[doc = " Default variation of {@link #TYPE_CLASS_NUMBER}: plain normal\n numeric text. This was added in\n {@link android.os.Build.VERSION_CODES#HONEYCOMB}. An IME must target\n this API version or later to see this input type; if it doesn't, a request\n for this type will be dropped when passed through\n {@link android.view.inputmethod.EditorInfo#makeCompatible(int)\n EditorInfo.makeCompatible(int)}."] +pub const GameTextInputType_TYPE_NUMBER_VARIATION_NORMAL: GameTextInputType = 0; +#[doc = " Variation of {@link #TYPE_CLASS_NUMBER}: entering a numeric password.\n This was added in {@link android.os.Build.VERSION_CODES#HONEYCOMB}. An\n IME must target this API version or later to see this input type; if it\n doesn't, a request for this type will be dropped when passed\n through {@link android.view.inputmethod.EditorInfo#makeCompatible(int)\n EditorInfo.makeCompatible(int)}."] +pub const GameTextInputType_TYPE_NUMBER_VARIATION_PASSWORD: GameTextInputType = 16; +#[doc = " Class for a phone number. This class currently supports no variations\n or flags."] +pub const GameTextInputType_TYPE_CLASS_PHONE: GameTextInputType = 3; +#[doc = " Class for dates and times. It supports the\n following variations:\n {@link #TYPE_DATETIME_VARIATION_NORMAL}\n {@link #TYPE_DATETIME_VARIATION_DATE}, and\n {@link #TYPE_DATETIME_VARIATION_TIME}."] +pub const GameTextInputType_TYPE_CLASS_DATETIME: GameTextInputType = 4; +#[doc = " Default variation of {@link #TYPE_CLASS_DATETIME}: allows entering\n both a date and time."] +pub const GameTextInputType_TYPE_DATETIME_VARIATION_NORMAL: GameTextInputType = 0; +#[doc = " Default variation of {@link #TYPE_CLASS_DATETIME}: allows entering\n only a date."] +pub const GameTextInputType_TYPE_DATETIME_VARIATION_DATE: GameTextInputType = 16; +#[doc = " Default variation of {@link #TYPE_CLASS_DATETIME}: allows entering\n only a time."] +pub const GameTextInputType_TYPE_DATETIME_VARIATION_TIME: GameTextInputType = 32; +#[doc = " Definitions for inputType argument of GameActivity_setImeEditorInfo()\n\n
\n |-------|-------|-------|-------|\n                              1111 TYPE_MASK_CLASS\n                      11111111     TYPE_MASK_VARIATION\n          111111111111             TYPE_MASK_FLAGS\n |-------|-------|-------|-------|\n                                   TYPE_NULL\n |-------|-------|-------|-------|\n                                 1 TYPE_CLASS_TEXT\n                             1     TYPE_TEXT_VARIATION_URI\n                            1      TYPE_TEXT_VARIATION_EMAIL_ADDRESS\n                            11     TYPE_TEXT_VARIATION_EMAIL_SUBJECT\n                           1       TYPE_TEXT_VARIATION_SHORT_MESSAGE\n                           1 1     TYPE_TEXT_VARIATION_LONG_MESSAGE\n                           11      TYPE_TEXT_VARIATION_PERSON_NAME\n                           111     TYPE_TEXT_VARIATION_POSTAL_ADDRESS\n                          1        TYPE_TEXT_VARIATION_PASSWORD\n                          1  1     TYPE_TEXT_VARIATION_VISIBLE_PASSWORD\n                          1 1      TYPE_TEXT_VARIATION_WEB_EDIT_TEXT\n                          1 11     TYPE_TEXT_VARIATION_FILTER\n                          11       TYPE_TEXT_VARIATION_PHONETIC\n                          11 1     TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS\n                          111      TYPE_TEXT_VARIATION_WEB_PASSWORD\n                     1             TYPE_TEXT_FLAG_CAP_CHARACTERS\n                    1              TYPE_TEXT_FLAG_CAP_WORDS\n                   1               TYPE_TEXT_FLAG_CAP_SENTENCES\n                  1                TYPE_TEXT_FLAG_AUTO_CORRECT\n                 1                 TYPE_TEXT_FLAG_AUTO_COMPLETE\n                1                  TYPE_TEXT_FLAG_MULTI_LINE\n               1                   TYPE_TEXT_FLAG_IME_MULTI_LINE\n              1                    TYPE_TEXT_FLAG_NO_SUGGESTIONS\n             1 TYPE_TEXT_FLAG_ENABLE_TEXT_CONVERSION_SUGGESTIONS\n |-------|-------|-------|-------|\n                                1  TYPE_CLASS_NUMBER\n                             1     TYPE_NUMBER_VARIATION_PASSWORD\n                     1             TYPE_NUMBER_FLAG_SIGNED\n                    1              TYPE_NUMBER_FLAG_DECIMAL\n |-------|-------|-------|-------|\n                                11 TYPE_CLASS_PHONE\n |-------|-------|-------|-------|\n                               1   TYPE_CLASS_DATETIME\n                             1     TYPE_DATETIME_VARIATION_DATE\n                            1      TYPE_DATETIME_VARIATION_TIME\n |-------|-------|-------|-------|
"] +pub type GameTextInputType = u32; +#[doc = " Set of bits in {@link #imeOptions} that provide alternative actions\n associated with the \"enter\" key. This both helps the IME provide\n better feedback about what the enter key will do, and also allows it\n to provide alternative mechanisms for providing that command."] +pub const GameTextInputActionType_IME_MASK_ACTION: GameTextInputActionType = 255; +#[doc = " Bits of {@link #IME_MASK_ACTION}: no specific action has been\n associated with this editor, let the editor come up with its own if\n it can."] +pub const GameTextInputActionType_IME_ACTION_UNSPECIFIED: GameTextInputActionType = 0; +#[doc = " Bits of {@link #IME_MASK_ACTION}: there is no available action."] +pub const GameTextInputActionType_IME_ACTION_NONE: GameTextInputActionType = 1; +#[doc = " Bits of {@link #IME_MASK_ACTION}: the action key performs a \"go\"\n operation to take the user to the target of the text they typed.\n Typically used, for example, when entering a URL."] +pub const GameTextInputActionType_IME_ACTION_GO: GameTextInputActionType = 2; +#[doc = " Bits of {@link #IME_MASK_ACTION}: the action key performs a \"search\"\n operation, taking the user to the results of searching for the text\n they have typed (in whatever context is appropriate)."] +pub const GameTextInputActionType_IME_ACTION_SEARCH: GameTextInputActionType = 3; +#[doc = " Bits of {@link #IME_MASK_ACTION}: the action key performs a \"send\"\n operation, delivering the text to its target. This is typically used\n when composing a message in IM or SMS where sending is immediate."] +pub const GameTextInputActionType_IME_ACTION_SEND: GameTextInputActionType = 4; +#[doc = " Bits of {@link #IME_MASK_ACTION}: the action key performs a \"next\"\n operation, taking the user to the next field that will accept text."] +pub const GameTextInputActionType_IME_ACTION_NEXT: GameTextInputActionType = 5; +#[doc = " Bits of {@link #IME_MASK_ACTION}: the action key performs a \"done\"\n operation, typically meaning there is nothing more to input and the\n IME will be closed."] +pub const GameTextInputActionType_IME_ACTION_DONE: GameTextInputActionType = 6; +#[doc = " Bits of {@link #IME_MASK_ACTION}: like {@link #IME_ACTION_NEXT}, but\n for moving to the previous field. This will normally not be used to\n specify an action (since it precludes {@link #IME_ACTION_NEXT}), but\n can be returned to the app if it sets {@link #IME_FLAG_NAVIGATE_PREVIOUS}."] +pub const GameTextInputActionType_IME_ACTION_PREVIOUS: GameTextInputActionType = 7; +#[doc = " actionId and imeOptions argument of GameActivity_setImeEditorInfo().\n\n
\n |-------|-------|-------|-------|\n                              1111 IME_MASK_ACTION\n |-------|-------|-------|-------|\n                                   IME_ACTION_UNSPECIFIED\n                                 1 IME_ACTION_NONE\n                                1  IME_ACTION_GO\n                                11 IME_ACTION_SEARCH\n                               1   IME_ACTION_SEND\n                               1 1 IME_ACTION_NEXT\n                               11  IME_ACTION_DONE\n                               111 IME_ACTION_PREVIOUS\n         1                         IME_FLAG_NO_PERSONALIZED_LEARNING\n        1                          IME_FLAG_NO_FULLSCREEN\n       1                           IME_FLAG_NAVIGATE_PREVIOUS\n      1                            IME_FLAG_NAVIGATE_NEXT\n     1                             IME_FLAG_NO_EXTRACT_UI\n    1                              IME_FLAG_NO_ACCESSORY_ACTION\n   1                               IME_FLAG_NO_ENTER_ACTION\n  1                                IME_FLAG_FORCE_ASCII\n |-------|-------|-------|-------|
"] +pub type GameTextInputActionType = u32; +#[doc = " Flag of {@link #imeOptions}: used to request that the IME should not update\n any personalized data such as typing history and personalized language\n model based on what the user typed on this text editing object. Typical\n use cases are:
  • When the application is in a special mode, where\n user's activities are expected to be not recorded in the application's\n history. Some web browsers and chat applications may have this kind of\n modes.
  • When storing typing history does not make much sense.\n Specifying this flag in typing games may help to avoid typing history from\n being filled up with words that the user is less likely to type in their\n daily life. Another example is that when the application already knows\n that the expected input is not a valid word (e.g. a promotion code that is\n not a valid word in any natural language).
  • \n
\n\n

Applications need to be aware that the flag is not a guarantee, and some\n IMEs may not respect it.

"] +pub const GameTextInputImeOptions_IME_FLAG_NO_PERSONALIZED_LEARNING: GameTextInputImeOptions = + 16777216; +#[doc = " Flag of {@link #imeOptions}: used to request that the IME never go\n into fullscreen mode.\n By default, IMEs may go into full screen mode when they think\n it's appropriate, for example on small screens in landscape\n orientation where displaying a software keyboard may occlude\n such a large portion of the screen that the remaining part is\n too small to meaningfully display the application UI.\n If this flag is set, compliant IMEs will never go into full screen mode,\n and always leave some space to display the application UI.\n Applications need to be aware that the flag is not a guarantee, and\n some IMEs may ignore it."] +pub const GameTextInputImeOptions_IME_FLAG_NO_FULLSCREEN: GameTextInputImeOptions = 33554432; +#[doc = " Flag of {@link #imeOptions}: like {@link #IME_FLAG_NAVIGATE_NEXT}, but\n specifies there is something interesting that a backward navigation\n can focus on. If the user selects the IME's facility to backward\n navigate, this will show up in the application as an {@link\n #IME_ACTION_PREVIOUS} at {@link InputConnection#performEditorAction(int)\n InputConnection.performEditorAction(int)}."] +pub const GameTextInputImeOptions_IME_FLAG_NAVIGATE_PREVIOUS: GameTextInputImeOptions = 67108864; +#[doc = " Flag of {@link #imeOptions}: used to specify that there is something\n interesting that a forward navigation can focus on. This is like using\n {@link #IME_ACTION_NEXT}, except allows the IME to be multiline (with\n an enter key) as well as provide forward navigation. Note that some\n IMEs may not be able to do this, especially when running on a small\n screen where there is little space. In that case it does not need to\n present a UI for this option. Like {@link #IME_ACTION_NEXT}, if the\n user selects the IME's facility to forward navigate, this will show up\n in the application at {@link InputConnection#performEditorAction(int)\n InputConnection.performEditorAction(int)}."] +pub const GameTextInputImeOptions_IME_FLAG_NAVIGATE_NEXT: GameTextInputImeOptions = 134217728; +#[doc = " Flag of {@link #imeOptions}: used to specify that the IME does not need\n to show its extracted text UI. For input methods that may be fullscreen,\n often when in landscape mode, this allows them to be smaller and let part\n of the application be shown behind, through transparent UI parts in the\n fullscreen IME. The part of the UI visible to the user may not be\n responsive to touch because the IME will receive touch events, which may\n confuse the user; use {@link #IME_FLAG_NO_FULLSCREEN} instead for a better\n experience. Using this flag is discouraged and it may become deprecated in\n the future. Its meaning is unclear in some situations and it may not work\n appropriately on older versions of the platform."] +pub const GameTextInputImeOptions_IME_FLAG_NO_EXTRACT_UI: GameTextInputImeOptions = 268435456; +#[doc = " Flag of {@link #imeOptions}: used in conjunction with one of the actions\n masked by {@link #IME_MASK_ACTION}, this indicates that the action\n should not be available as an accessory button on the right of the\n extracted text when the input method is full-screen. Note that by setting\n this flag, there can be cases where the action is simply never available to\n the user. Setting this generally means that you think that in fullscreen\n mode, where there is little space to show the text, it's not worth taking\n some screen real estate to display the action and it should be used instead\n to show more text."] +pub const GameTextInputImeOptions_IME_FLAG_NO_ACCESSORY_ACTION: GameTextInputImeOptions = 536870912; +#[doc = " Flag of {@link #imeOptions}: used in conjunction with one of the actions\n masked by {@link #IME_MASK_ACTION}. If this flag is not set, IMEs will\n normally replace the \"enter\" key with the action supplied. This flag\n indicates that the action should not be available in-line as a replacement\n for the \"enter\" key. Typically this is because the action has such a\n significant impact or is not recoverable enough that accidentally hitting\n it should be avoided, such as sending a message. Note that\n {@link android.widget.TextView} will automatically set this flag for you\n on multi-line text views."] +pub const GameTextInputImeOptions_IME_FLAG_NO_ENTER_ACTION: GameTextInputImeOptions = 1073741824; +#[doc = " Flag of {@link #imeOptions}: used to request an IME that is capable of\n inputting ASCII characters. The intention of this flag is to ensure that\n the user can type Roman alphabet characters in a {@link\n android.widget.TextView}. It is typically used for an account ID or\n password input. A lot of the time, IMEs are already able to input ASCII\n even without being told so (such IMEs already respect this flag in a\n sense), but there are cases when this is not the default. For instance,\n users of languages using a different script like Arabic, Greek, Hebrew or\n Russian typically have a keyboard that can't input ASCII characters by\n default. Applications need to be aware that the flag is not a guarantee,\n and some IMEs may not respect it. However, it is strongly recommended for\n IME authors to respect this flag especially when their IME could end up\n with a state where only languages using non-ASCII are enabled."] +pub const GameTextInputImeOptions_IME_FLAG_FORCE_ASCII: GameTextInputImeOptions = 2147483648; +#[doc = " Flag of {@link #internalImeOptions}: flag is set when app window containing\n this\n {@link EditorInfo} is using {@link Configuration#ORIENTATION_PORTRAIT}\n mode.\n @hide"] +pub const GameTextInputImeOptions_IME_INTERNAL_FLAG_APP_WINDOW_PORTRAIT: GameTextInputImeOptions = + 1; +#[doc = " Generic unspecified type for {@link #imeOptions}."] +pub const GameTextInputImeOptions_IME_NULL: GameTextInputImeOptions = 0; +pub type GameTextInputImeOptions = u32; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_CAPTION_BAR: GameCommonInsetsType = 0; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_DISPLAY_CUTOUT: GameCommonInsetsType = 1; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_IME: GameCommonInsetsType = 2; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_MANDATORY_SYSTEM_GESTURES: + GameCommonInsetsType = 3; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_NAVIGATION_BARS: GameCommonInsetsType = 4; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_STATUS_BARS: GameCommonInsetsType = 5; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_SYSTEM_BARS: GameCommonInsetsType = 6; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_SYSTEM_GESTURES: GameCommonInsetsType = 7; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_TAPABLE_ELEMENT: GameCommonInsetsType = 8; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_WATERFALL: GameCommonInsetsType = 9; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_COUNT: GameCommonInsetsType = 10; +#[doc = " The type of a component for which to retrieve insets. See\n https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat.Type"] +pub type GameCommonInsetsType = u8; +#[doc = " This structure defines the native side of an android.app.GameActivity.\n It is created by the framework, and handed to the application's native\n code as it is being launched."] #[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct GameActivityKeyEvent { - pub deviceId: i32, - pub source: i32, - pub action: i32, - pub eventTime: i64, - pub downTime: i64, - pub flags: i32, - pub metaState: i32, - pub modifiers: i32, - pub repeatCount: i32, - pub keyCode: i32, - pub scanCode: i32, +pub struct GameActivity { + #[doc = " Pointer to the callback function table of the native application.\n You can set the functions here to your own callbacks. The callbacks\n pointer itself here should not be changed; it is allocated and managed\n for you by the framework."] + pub callbacks: *mut GameActivityCallbacks, + #[doc = " The global handle on the process's Java VM."] + pub vm: *mut JavaVM, + #[doc = " JNI context for the main thread of the app. Note that this field\n can ONLY be used from the main thread of the process; that is, the\n thread that calls into the GameActivityCallbacks."] + pub env: *mut JNIEnv, + #[doc = " The GameActivity object handle."] + pub javaGameActivity: jobject, + #[doc = " Path to this application's internal data directory."] + pub internalDataPath: *const ::std::os::raw::c_char, + #[doc = " Path to this application's external (removable/mountable) data directory."] + pub externalDataPath: *const ::std::os::raw::c_char, + #[doc = " The platform's SDK version code."] + pub sdkVersion: i32, + #[doc = " This is the native instance of the application. It is not used by\n the framework, but can be set by the application to its own instance\n state."] + pub instance: *mut ::std::os::raw::c_void, + #[doc = " Pointer to the Asset Manager instance for the application. The\n application uses this to access binary assets bundled inside its own .apk\n file."] + pub assetManager: *mut AAssetManager, + #[doc = " Available starting with Honeycomb: path to the directory containing\n the application's OBB files (if any). If the app doesn't have any\n OBB files, this directory may not exist."] + pub obbPath: *const ::std::os::raw::c_char, } #[test] -fn bindgen_test_layout_GameActivityKeyEvent() { +fn bindgen_test_layout_GameActivity() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - ::std::mem::size_of::(), - 56usize, - concat!("Size of: ", stringify!(GameActivityKeyEvent)) + ::std::mem::size_of::(), + 40usize, + "Size of GameActivity" ); assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(GameActivityKeyEvent)) + ::std::mem::align_of::(), + 4usize, + "Alignment of GameActivity" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).deviceId as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).callbacks) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(deviceId) - ) + "Offset of field: GameActivity::callbacks" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).source as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).vm) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(source) - ) + "Offset of field: GameActivity::vm" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).action as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).env) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(action) - ) + "Offset of field: GameActivity::env" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).eventTime as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(eventTime) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).downTime as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(downTime) - ) + unsafe { ::std::ptr::addr_of!((*ptr).javaGameActivity) as usize - ptr as usize }, + 12usize, + "Offset of field: GameActivity::javaGameActivity" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(flags) - ) + unsafe { ::std::ptr::addr_of!((*ptr).internalDataPath) as usize - ptr as usize }, + 16usize, + "Offset of field: GameActivity::internalDataPath" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).metaState as *const _ as usize }, - 36usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(metaState) - ) + unsafe { ::std::ptr::addr_of!((*ptr).externalDataPath) as usize - ptr as usize }, + 20usize, + "Offset of field: GameActivity::externalDataPath" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).modifiers as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(modifiers) - ) + unsafe { ::std::ptr::addr_of!((*ptr).sdkVersion) as usize - ptr as usize }, + 24usize, + "Offset of field: GameActivity::sdkVersion" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).repeatCount as *const _ as usize - }, - 44usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(repeatCount) - ) + unsafe { ::std::ptr::addr_of!((*ptr).instance) as usize - ptr as usize }, + 28usize, + "Offset of field: GameActivity::instance" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).keyCode as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(keyCode) - ) + unsafe { ::std::ptr::addr_of!((*ptr).assetManager) as usize - ptr as usize }, + 32usize, + "Offset of field: GameActivity::assetManager" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).scanCode as *const _ as usize }, - 52usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(scanCode) - ) + unsafe { ::std::ptr::addr_of!((*ptr).obbPath) as usize - ptr as usize }, + 36usize, + "Offset of field: GameActivity::obbPath" ); } -#[doc = " A function the user should call from their callback with the data, its length"] -#[doc = " and the library- supplied context."] +#[doc = " A function the user should call from their callback with the data, its length\n and the library- supplied context."] pub type SaveInstanceStateRecallback = ::std::option::Option< unsafe extern "C" fn( bytes: *const ::std::os::raw::c_char, @@ -3295,18 +3080,11 @@ pub type SaveInstanceStateRecallback = ::std::option::Option< #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct GameActivityCallbacks { - #[doc = " GameActivity has started. See Java documentation for Activity.onStart()"] - #[doc = " for more information."] + #[doc = " GameActivity has started. See Java documentation for Activity.onStart()\n for more information."] pub onStart: ::std::option::Option, - #[doc = " GameActivity has resumed. See Java documentation for Activity.onResume()"] - #[doc = " for more information."] + #[doc = " GameActivity has resumed. See Java documentation for Activity.onResume()\n for more information."] pub onResume: ::std::option::Option, - #[doc = " The framework is asking GameActivity to save its current instance state."] - #[doc = " See the Java documentation for Activity.onSaveInstanceState() for more"] - #[doc = " information. The user should call the recallback with their data, its"] - #[doc = " length and the provided context; they retain ownership of the data. Note"] - #[doc = " that the saved state will be persisted, so it can not contain any active"] - #[doc = " entities (pointers to memory, file descriptors, etc)."] + #[doc = " The framework is asking GameActivity to save its current instance state.\n See the Java documentation for Activity.onSaveInstanceState() for more\n information. The user should call the recallback with their data, its\n length and the provided context; they retain ownership of the data. Note\n that the saved state will be persisted, so it can not contain any active\n entities (pointers to memory, file descriptors, etc)."] pub onSaveInstanceState: ::std::option::Option< unsafe extern "C" fn( activity: *mut GameActivity, @@ -3314,27 +3092,20 @@ pub struct GameActivityCallbacks { context: *mut ::std::os::raw::c_void, ), >, - #[doc = " GameActivity has paused. See Java documentation for Activity.onPause()"] - #[doc = " for more information."] + #[doc = " GameActivity has paused. See Java documentation for Activity.onPause()\n for more information."] pub onPause: ::std::option::Option, - #[doc = " GameActivity has stopped. See Java documentation for Activity.onStop()"] - #[doc = " for more information."] + #[doc = " GameActivity has stopped. See Java documentation for Activity.onStop()\n for more information."] pub onStop: ::std::option::Option, - #[doc = " GameActivity is being destroyed. See Java documentation for"] - #[doc = " Activity.onDestroy() for more information."] + #[doc = " GameActivity is being destroyed. See Java documentation for\n Activity.onDestroy() for more information."] pub onDestroy: ::std::option::Option, - #[doc = " Focus has changed in this GameActivity's window. This is often used,"] - #[doc = " for example, to pause a game when it loses input focus."] + #[doc = " Focus has changed in this GameActivity's window. This is often used,\n for example, to pause a game when it loses input focus."] pub onWindowFocusChanged: ::std::option::Option, - #[doc = " The drawing window for this native activity has been created. You"] - #[doc = " can use the given native window object to start drawing."] + #[doc = " The drawing window for this native activity has been created. You\n can use the given native window object to start drawing."] pub onNativeWindowCreated: ::std::option::Option< unsafe extern "C" fn(activity: *mut GameActivity, window: *mut ANativeWindow), >, - #[doc = " The drawing window for this native activity has been resized. You should"] - #[doc = " retrieve the new size from the window and ensure that your rendering in"] - #[doc = " it now matches."] + #[doc = " The drawing window for this native activity has been resized. You should\n retrieve the new size from the window and ensure that your rendering in\n it now matches."] pub onNativeWindowResized: ::std::option::Option< unsafe extern "C" fn( activity: *mut GameActivity, @@ -3343,557 +3114,295 @@ pub struct GameActivityCallbacks { newHeight: i32, ), >, - #[doc = " The drawing window for this native activity needs to be redrawn. To"] - #[doc = " avoid transient artifacts during screen changes (such resizing after"] - #[doc = " rotation), applications should not return from this function until they"] - #[doc = " have finished drawing their window in its current state."] + #[doc = " The drawing window for this native activity needs to be redrawn. To\n avoid transient artifacts during screen changes (such resizing after\n rotation), applications should not return from this function until they\n have finished drawing their window in its current state."] pub onNativeWindowRedrawNeeded: ::std::option::Option< unsafe extern "C" fn(activity: *mut GameActivity, window: *mut ANativeWindow), >, - #[doc = " The drawing window for this native activity is going to be destroyed."] - #[doc = " You MUST ensure that you do not touch the window object after returning"] - #[doc = " from this function: in the common case of drawing to the window from"] - #[doc = " another thread, that means the implementation of this callback must"] - #[doc = " properly synchronize with the other thread to stop its drawing before"] - #[doc = " returning from here."] + #[doc = " The drawing window for this native activity is going to be destroyed.\n You MUST ensure that you do not touch the window object after returning\n from this function: in the common case of drawing to the window from\n another thread, that means the implementation of this callback must\n properly synchronize with the other thread to stop its drawing before\n returning from here."] pub onNativeWindowDestroyed: ::std::option::Option< unsafe extern "C" fn(activity: *mut GameActivity, window: *mut ANativeWindow), >, - #[doc = " The current device AConfiguration has changed. The new configuration can"] - #[doc = " be retrieved from assetManager."] + #[doc = " The current device AConfiguration has changed. The new configuration can\n be retrieved from assetManager."] pub onConfigurationChanged: ::std::option::Option, - #[doc = " The system is running low on memory. Use this callback to release"] - #[doc = " resources you do not need, to help the system avoid killing more"] - #[doc = " important processes."] + #[doc = " The system is running low on memory. Use this callback to release\n resources you do not need, to help the system avoid killing more\n important processes."] pub onTrimMemory: ::std::option::Option< unsafe extern "C" fn(activity: *mut GameActivity, level: ::std::os::raw::c_int), >, - #[doc = " Callback called for every MotionEvent done on the GameActivity"] - #[doc = " SurfaceView. Ownership of `event` is maintained by the library and it is"] - #[doc = " only valid during the callback."] + #[doc = " Callback called for every MotionEvent done on the GameActivity\n SurfaceView. Ownership of `event` is maintained by the library and it is\n only valid during the callback."] pub onTouchEvent: ::std::option::Option< unsafe extern "C" fn( activity: *mut GameActivity, event: *const GameActivityMotionEvent, - historical: *const GameActivityHistoricalPointerAxes, - historicalLen: ::std::os::raw::c_int, ) -> bool, >, - #[doc = " Callback called for every key down event on the GameActivity SurfaceView."] - #[doc = " Ownership of `event` is maintained by the library and it is only valid"] - #[doc = " during the callback."] + #[doc = " Callback called for every key down event on the GameActivity SurfaceView.\n Ownership of `event` is maintained by the library and it is only valid\n during the callback."] pub onKeyDown: ::std::option::Option< unsafe extern "C" fn( activity: *mut GameActivity, event: *const GameActivityKeyEvent, ) -> bool, >, - #[doc = " Callback called for every key up event on the GameActivity SurfaceView."] - #[doc = " Ownership of `event` is maintained by the library and it is only valid"] - #[doc = " during the callback."] + #[doc = " Callback called for every key up event on the GameActivity SurfaceView.\n Ownership of `event` is maintained by the library and it is only valid\n during the callback."] pub onKeyUp: ::std::option::Option< unsafe extern "C" fn( activity: *mut GameActivity, event: *const GameActivityKeyEvent, ) -> bool, >, - #[doc = " Callback called for every soft-keyboard text input event."] - #[doc = " Ownership of `state` is maintained by the library and it is only valid"] - #[doc = " during the callback."] + #[doc = " Callback called for every soft-keyboard text input event.\n Ownership of `state` is maintained by the library and it is only valid\n during the callback."] pub onTextInputEvent: ::std::option::Option< unsafe extern "C" fn(activity: *mut GameActivity, state: *const GameTextInputState), >, - #[doc = " Callback called when WindowInsets of the main app window have changed."] - #[doc = " Call GameActivity_getWindowInsets to retrieve the insets themselves."] + #[doc = " Callback called when WindowInsets of the main app window have changed.\n Call GameActivity_getWindowInsets to retrieve the insets themselves."] pub onWindowInsetsChanged: ::std::option::Option, + #[doc = " Callback called when the rectangle in the window where the content\n should be placed has changed."] + pub onContentRectChanged: ::std::option::Option< + unsafe extern "C" fn(activity: *mut GameActivity, rect: *const ARect), + >, + #[doc = " Callback called when the software keyboard is shown or hidden."] + pub onSoftwareKeyboardVisibilityChanged: + ::std::option::Option, + #[doc = " Callback called when the software keyboard is shown or hidden."] + pub onEditorAction: ::std::option::Option< + unsafe extern "C" fn(activity: *mut GameActivity, action: ::std::os::raw::c_int) -> bool, + >, } #[test] fn bindgen_test_layout_GameActivityCallbacks() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), - 72usize, - concat!("Size of: ", stringify!(GameActivityCallbacks)) + 84usize, + "Size of GameActivityCallbacks" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(GameActivityCallbacks)) + "Alignment of GameActivityCallbacks" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).onStart as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).onStart) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onStart) - ) + "Offset of field: GameActivityCallbacks::onStart" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).onResume as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).onResume) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onResume) - ) + "Offset of field: GameActivityCallbacks::onResume" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onSaveInstanceState as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onSaveInstanceState) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onSaveInstanceState) - ) + "Offset of field: GameActivityCallbacks::onSaveInstanceState" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).onPause as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).onPause) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onPause) - ) + "Offset of field: GameActivityCallbacks::onPause" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).onStop as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).onStop) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onStop) - ) + "Offset of field: GameActivityCallbacks::onStop" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).onDestroy as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).onDestroy) as usize - ptr as usize }, 20usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onDestroy) - ) + "Offset of field: GameActivityCallbacks::onDestroy" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onWindowFocusChanged as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onWindowFocusChanged) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onWindowFocusChanged) - ) + "Offset of field: GameActivityCallbacks::onWindowFocusChanged" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onNativeWindowCreated as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onNativeWindowCreated) as usize - ptr as usize }, 28usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onNativeWindowCreated) - ) + "Offset of field: GameActivityCallbacks::onNativeWindowCreated" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onNativeWindowResized as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onNativeWindowResized) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onNativeWindowResized) - ) + "Offset of field: GameActivityCallbacks::onNativeWindowResized" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onNativeWindowRedrawNeeded as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onNativeWindowRedrawNeeded) as usize - ptr as usize }, 36usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onNativeWindowRedrawNeeded) - ) + "Offset of field: GameActivityCallbacks::onNativeWindowRedrawNeeded" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onNativeWindowDestroyed as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onNativeWindowDestroyed) as usize - ptr as usize }, 40usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onNativeWindowDestroyed) - ) + "Offset of field: GameActivityCallbacks::onNativeWindowDestroyed" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onConfigurationChanged as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onConfigurationChanged) as usize - ptr as usize }, 44usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onConfigurationChanged) - ) + "Offset of field: GameActivityCallbacks::onConfigurationChanged" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onTrimMemory as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onTrimMemory) as usize - ptr as usize }, 48usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onTrimMemory) - ) + "Offset of field: GameActivityCallbacks::onTrimMemory" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onTouchEvent as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onTouchEvent) as usize - ptr as usize }, 52usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onTouchEvent) - ) + "Offset of field: GameActivityCallbacks::onTouchEvent" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).onKeyDown as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).onKeyDown) as usize - ptr as usize }, 56usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onKeyDown) - ) + "Offset of field: GameActivityCallbacks::onKeyDown" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).onKeyUp as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).onKeyUp) as usize - ptr as usize }, 60usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onKeyUp) - ) + "Offset of field: GameActivityCallbacks::onKeyUp" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onTextInputEvent as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onTextInputEvent) as usize - ptr as usize }, 64usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onTextInputEvent) - ) + "Offset of field: GameActivityCallbacks::onTextInputEvent" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).onWindowInsetsChanged) as usize - ptr as usize }, + 68usize, + "Offset of field: GameActivityCallbacks::onWindowInsetsChanged" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).onContentRectChanged) as usize - ptr as usize }, + 72usize, + "Offset of field: GameActivityCallbacks::onContentRectChanged" ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).onWindowInsetsChanged as *const _ - as usize + ::std::ptr::addr_of!((*ptr).onSoftwareKeyboardVisibilityChanged) as usize - ptr as usize }, - 68usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onWindowInsetsChanged) - ) - ); -} -extern "C" { - #[doc = " \\brief Convert a Java `MotionEvent` to a `GameActivityMotionEvent`."] - #[doc = ""] - #[doc = " This is done automatically by the GameActivity: see `onTouchEvent` to set"] - #[doc = " a callback to consume the received events."] - #[doc = " This function can be used if you re-implement events handling in your own"] - #[doc = " activity. On return, the out_event->historicalStart will be zero, and should"] - #[doc = " be updated to index into whatever buffer out_historical is copied."] - #[doc = " On return the length of out_historical is"] - #[doc = " (out_event->pointerCount x out_event->historicalCount) and is in a"] - #[doc = " pointer-major order (i.e. all axis for a pointer are contiguous)"] - #[doc = " Ownership of out_event is maintained by the caller."] - pub fn GameActivityMotionEvent_fromJava( - env: *mut JNIEnv, - motionEvent: jobject, - out_event: *mut GameActivityMotionEvent, - out_historical: *mut GameActivityHistoricalPointerAxes, - ) -> ::std::os::raw::c_int; + 76usize, + "Offset of field: GameActivityCallbacks::onSoftwareKeyboardVisibilityChanged" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).onEditorAction) as usize - ptr as usize }, + 80usize, + "Offset of field: GameActivityCallbacks::onEditorAction" + ); } -extern "C" { - #[doc = " \\brief Convert a Java `KeyEvent` to a `GameActivityKeyEvent`."] - #[doc = ""] - #[doc = " This is done automatically by the GameActivity: see `onKeyUp` and `onKeyDown`"] - #[doc = " to set a callback to consume the received events."] - #[doc = " This function can be used if you re-implement events handling in your own"] - #[doc = " activity."] - #[doc = " Ownership of out_event is maintained by the caller."] - pub fn GameActivityKeyEvent_fromJava( - env: *mut JNIEnv, - motionEvent: jobject, - out_event: *mut GameActivityKeyEvent, - ); -} -#[doc = " This is the function that must be in the native code to instantiate the"] -#[doc = " application's native activity. It is called with the activity instance (see"] -#[doc = " above); if the code is being instantiated from a previously saved instance,"] -#[doc = " the savedState will be non-NULL and point to the saved data. You must make"] -#[doc = " any copy of this data you need -- it will be released after you return from"] -#[doc = " this function."] +#[doc = " This is the function that must be in the native code to instantiate the\n application's native activity. It is called with the activity instance (see\n above); if the code is being instantiated from a previously saved instance,\n the savedState will be non-NULL and point to the saved data. You must make\n any copy of this data you need -- it will be released after you return from\n this function."] pub type GameActivity_createFunc = ::std::option::Option< unsafe extern "C" fn( activity: *mut GameActivity, savedState: *mut ::std::os::raw::c_void, - savedStateSize: size_t, + savedStateSize: usize, ), >; extern "C" { - #[doc = " Finish the given activity. Its finish() method will be called, causing it"] - #[doc = " to be stopped and destroyed. Note that this method can be called from"] - #[doc = " *any* thread; it will send a message to the main thread of the process"] - #[doc = " where the Java finish call will take place."] + #[doc = " Finish the given activity. Its finish() method will be called, causing it\n to be stopped and destroyed. Note that this method can be called from\n *any* thread; it will send a message to the main thread of the process\n where the Java finish call will take place."] pub fn GameActivity_finish(activity: *mut GameActivity); } -#[doc = " As long as this window is visible to the user, allow the lock"] -#[doc = " screen to activate while the screen is on. This can be used"] -#[doc = " independently, or in combination with {@link"] -#[doc = " GAMEACTIVITY_FLAG_KEEP_SCREEN_ON} and/or {@link"] -#[doc = " GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED}"] +#[doc = " As long as this window is visible to the user, allow the lock\n screen to activate while the screen is on. This can be used\n independently, or in combination with {@link\n GAMEACTIVITY_FLAG_KEEP_SCREEN_ON} and/or {@link\n GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED}"] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_ALLOW_LOCK_WHILE_SCREEN_ON: GameActivitySetWindowFlags = 1; #[doc = " Everything behind this window will be dimmed."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_DIM_BEHIND: GameActivitySetWindowFlags = 2; -#[doc = " Blur everything behind this window."] -#[doc = " @deprecated Blurring is no longer supported."] +#[doc = " Blur everything behind this window.\n @deprecated Blurring is no longer supported."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_BLUR_BEHIND: GameActivitySetWindowFlags = 4; -#[doc = " This window won't ever get key input focus, so the"] -#[doc = " user can not send key or other button events to it. Those will"] -#[doc = " instead go to whatever focusable window is behind it. This flag"] -#[doc = " will also enable {@link GAMEACTIVITY_FLAG_NOT_TOUCH_MODAL} whether or not"] -#[doc = " that is explicitly set."] -#[doc = ""] -#[doc = " Setting this flag also implies that the window will not need to"] -#[doc = " interact with"] -#[doc = " a soft input method, so it will be Z-ordered and positioned"] -#[doc = " independently of any active input method (typically this means it"] -#[doc = " gets Z-ordered on top of the input method, so it can use the full"] -#[doc = " screen for its content and cover the input method if needed. You"] -#[doc = " can use {@link GAMEACTIVITY_FLAG_ALT_FOCUSABLE_IM} to modify this"] -#[doc = " behavior."] +#[doc = " This window won't ever get key input focus, so the\n user can not send key or other button events to it. Those will\n instead go to whatever focusable window is behind it. This flag\n will also enable {@link GAMEACTIVITY_FLAG_NOT_TOUCH_MODAL} whether or not\n that is explicitly set.\n\n Setting this flag also implies that the window will not need to\n interact with\n a soft input method, so it will be Z-ordered and positioned\n independently of any active input method (typically this means it\n gets Z-ordered on top of the input method, so it can use the full\n screen for its content and cover the input method if needed. You\n can use {@link GAMEACTIVITY_FLAG_ALT_FOCUSABLE_IM} to modify this\n behavior."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_NOT_FOCUSABLE: GameActivitySetWindowFlags = 8; #[doc = " This window can never receive touch events."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_NOT_TOUCHABLE: GameActivitySetWindowFlags = 16; -#[doc = " Even when this window is focusable (its"] -#[doc = " {@link GAMEACTIVITY_FLAG_NOT_FOCUSABLE} is not set), allow any pointer"] -#[doc = " events outside of the window to be sent to the windows behind it."] -#[doc = " Otherwise it will consume all pointer events itself, regardless of"] -#[doc = " whether they are inside of the window."] +#[doc = " Even when this window is focusable (its\n {@link GAMEACTIVITY_FLAG_NOT_FOCUSABLE} is not set), allow any pointer\n events outside of the window to be sent to the windows behind it.\n Otherwise it will consume all pointer events itself, regardless of\n whether they are inside of the window."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_NOT_TOUCH_MODAL: GameActivitySetWindowFlags = 32; -#[doc = " When set, if the device is asleep when the touch"] -#[doc = " screen is pressed, you will receive this first touch event. Usually"] -#[doc = " the first touch event is consumed by the system since the user can"] -#[doc = " not see what they are pressing on."] -#[doc = ""] -#[doc = " @deprecated This flag has no effect."] +#[doc = " When set, if the device is asleep when the touch\n screen is pressed, you will receive this first touch event. Usually\n the first touch event is consumed by the system since the user can\n not see what they are pressing on.\n\n @deprecated This flag has no effect."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_TOUCHABLE_WHEN_WAKING: GameActivitySetWindowFlags = 64; -#[doc = " As long as this window is visible to the user, keep"] -#[doc = " the device's screen turned on and bright."] +#[doc = " As long as this window is visible to the user, keep\n the device's screen turned on and bright."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_KEEP_SCREEN_ON: GameActivitySetWindowFlags = 128; -#[doc = " Place the window within the entire screen, ignoring"] -#[doc = " decorations around the border (such as the status bar). The"] -#[doc = " window must correctly position its contents to take the screen"] -#[doc = " decoration into account."] +#[doc = " Place the window within the entire screen, ignoring\n decorations around the border (such as the status bar). The\n window must correctly position its contents to take the screen\n decoration into account."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_LAYOUT_IN_SCREEN: GameActivitySetWindowFlags = 256; #[doc = " Allows the window to extend outside of the screen."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_LAYOUT_NO_LIMITS: GameActivitySetWindowFlags = 512; -#[doc = " Hide all screen decorations (such as the status"] -#[doc = " bar) while this window is displayed. This allows the window to"] -#[doc = " use the entire display space for itself -- the status bar will"] -#[doc = " be hidden when an app window with this flag set is on the top"] -#[doc = " layer. A fullscreen window will ignore a value of {@link"] -#[doc = " GAMEACTIVITY_SOFT_INPUT_ADJUST_RESIZE}; the window will stay"] -#[doc = " fullscreen and will not resize."] +#[doc = " Hide all screen decorations (such as the status\n bar) while this window is displayed. This allows the window to\n use the entire display space for itself -- the status bar will\n be hidden when an app window with this flag set is on the top\n layer. A fullscreen window will ignore a value of {@link\n GAMEACTIVITY_SOFT_INPUT_ADJUST_RESIZE}; the window will stay\n fullscreen and will not resize."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_FULLSCREEN: GameActivitySetWindowFlags = 1024; -#[doc = " Override {@link GAMEACTIVITY_FLAG_FULLSCREEN} and force the"] -#[doc = " screen decorations (such as the status bar) to be shown."] +#[doc = " Override {@link GAMEACTIVITY_FLAG_FULLSCREEN} and force the\n screen decorations (such as the status bar) to be shown."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_FORCE_NOT_FULLSCREEN: GameActivitySetWindowFlags = 2048; -#[doc = " Turn on dithering when compositing this window to"] -#[doc = " the screen."] -#[doc = " @deprecated This flag is no longer used."] +#[doc = " Turn on dithering when compositing this window to\n the screen.\n @deprecated This flag is no longer used."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_DITHER: GameActivitySetWindowFlags = 4096; -#[doc = " Treat the content of the window as secure, preventing"] -#[doc = " it from appearing in screenshots or from being viewed on non-secure"] -#[doc = " displays."] +#[doc = " Treat the content of the window as secure, preventing\n it from appearing in screenshots or from being viewed on non-secure\n displays."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_SECURE: GameActivitySetWindowFlags = 8192; -#[doc = " A special mode where the layout parameters are used"] -#[doc = " to perform scaling of the surface when it is composited to the"] -#[doc = " screen."] +#[doc = " A special mode where the layout parameters are used\n to perform scaling of the surface when it is composited to the\n screen."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_SCALED: GameActivitySetWindowFlags = 16384; -#[doc = " Intended for windows that will often be used when the user is"] -#[doc = " holding the screen against their face, it will aggressively"] -#[doc = " filter the event stream to prevent unintended presses in this"] -#[doc = " situation that may not be desired for a particular window, when"] -#[doc = " such an event stream is detected, the application will receive"] -#[doc = " a {@link AMOTION_EVENT_ACTION_CANCEL} to indicate this so"] -#[doc = " applications can handle this accordingly by taking no action on"] -#[doc = " the event until the finger is released."] +#[doc = " Intended for windows that will often be used when the user is\n holding the screen against their face, it will aggressively\n filter the event stream to prevent unintended presses in this\n situation that may not be desired for a particular window, when\n such an event stream is detected, the application will receive\n a {@link AMOTION_EVENT_ACTION_CANCEL} to indicate this so\n applications can handle this accordingly by taking no action on\n the event until the finger is released."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_IGNORE_CHEEK_PRESSES: GameActivitySetWindowFlags = 32768; -#[doc = " A special option only for use in combination with"] -#[doc = " {@link GAMEACTIVITY_FLAG_LAYOUT_IN_SCREEN}. When requesting layout in"] -#[doc = " the screen your window may appear on top of or behind screen decorations"] -#[doc = " such as the status bar. By also including this flag, the window"] -#[doc = " manager will report the inset rectangle needed to ensure your"] -#[doc = " content is not covered by screen decorations."] +#[doc = " A special option only for use in combination with\n {@link GAMEACTIVITY_FLAG_LAYOUT_IN_SCREEN}. When requesting layout in\n the screen your window may appear on top of or behind screen decorations\n such as the status bar. By also including this flag, the window\n manager will report the inset rectangle needed to ensure your\n content is not covered by screen decorations."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_LAYOUT_INSET_DECOR: GameActivitySetWindowFlags = 65536; -#[doc = " Invert the state of {@link GAMEACTIVITY_FLAG_NOT_FOCUSABLE} with"] -#[doc = " respect to how this window interacts with the current method."] -#[doc = " That is, if FLAG_NOT_FOCUSABLE is set and this flag is set,"] -#[doc = " then the window will behave as if it needs to interact with the"] -#[doc = " input method and thus be placed behind/away from it; if {@link"] -#[doc = " GAMEACTIVITY_FLAG_NOT_FOCUSABLE} is not set and this flag is set,"] -#[doc = " then the window will behave as if it doesn't need to interact"] -#[doc = " with the input method and can be placed to use more space and"] -#[doc = " cover the input method."] +#[doc = " Invert the state of {@link GAMEACTIVITY_FLAG_NOT_FOCUSABLE} with\n respect to how this window interacts with the current method.\n That is, if FLAG_NOT_FOCUSABLE is set and this flag is set,\n then the window will behave as if it needs to interact with the\n input method and thus be placed behind/away from it; if {@link\n GAMEACTIVITY_FLAG_NOT_FOCUSABLE} is not set and this flag is set,\n then the window will behave as if it doesn't need to interact\n with the input method and can be placed to use more space and\n cover the input method."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_ALT_FOCUSABLE_IM: GameActivitySetWindowFlags = 131072; -#[doc = " If you have set {@link GAMEACTIVITY_FLAG_NOT_TOUCH_MODAL}, you"] -#[doc = " can set this flag to receive a single special MotionEvent with"] -#[doc = " the action"] -#[doc = " {@link AMOTION_EVENT_ACTION_OUTSIDE} for"] -#[doc = " touches that occur outside of your window. Note that you will not"] -#[doc = " receive the full down/move/up gesture, only the location of the"] -#[doc = " first down as an {@link AMOTION_EVENT_ACTION_OUTSIDE}."] +#[doc = " If you have set {@link GAMEACTIVITY_FLAG_NOT_TOUCH_MODAL}, you\n can set this flag to receive a single special MotionEvent with\n the action\n {@link AMOTION_EVENT_ACTION_OUTSIDE} for\n touches that occur outside of your window. Note that you will not\n receive the full down/move/up gesture, only the location of the\n first down as an {@link AMOTION_EVENT_ACTION_OUTSIDE}."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_WATCH_OUTSIDE_TOUCH: GameActivitySetWindowFlags = 262144; -#[doc = " Special flag to let windows be shown when the screen"] -#[doc = " is locked. This will let application windows take precedence over"] -#[doc = " key guard or any other lock screens. Can be used with"] -#[doc = " {@link GAMEACTIVITY_FLAG_KEEP_SCREEN_ON} to turn screen on and display"] -#[doc = " windows directly before showing the key guard window. Can be used with"] -#[doc = " {@link GAMEACTIVITY_FLAG_DISMISS_KEYGUARD} to automatically fully"] -#[doc = " dismisss non-secure keyguards. This flag only applies to the top-most"] -#[doc = " full-screen window."] +#[doc = " Special flag to let windows be shown when the screen\n is locked. This will let application windows take precedence over\n key guard or any other lock screens. Can be used with\n {@link GAMEACTIVITY_FLAG_KEEP_SCREEN_ON} to turn screen on and display\n windows directly before showing the key guard window. Can be used with\n {@link GAMEACTIVITY_FLAG_DISMISS_KEYGUARD} to automatically fully\n dismisss non-secure keyguards. This flag only applies to the top-most\n full-screen window."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED: GameActivitySetWindowFlags = 524288; -#[doc = " Ask that the system wallpaper be shown behind"] -#[doc = " your window. The window surface must be translucent to be able"] -#[doc = " to actually see the wallpaper behind it; this flag just ensures"] -#[doc = " that the wallpaper surface will be there if this window actually"] -#[doc = " has translucent regions."] +#[doc = " Ask that the system wallpaper be shown behind\n your window. The window surface must be translucent to be able\n to actually see the wallpaper behind it; this flag just ensures\n that the wallpaper surface will be there if this window actually\n has translucent regions."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_SHOW_WALLPAPER: GameActivitySetWindowFlags = 1048576; -#[doc = " When set as a window is being added or made"] -#[doc = " visible, once the window has been shown then the system will"] -#[doc = " poke the power manager's user activity (as if the user had woken"] -#[doc = " up the device) to turn the screen on."] +#[doc = " When set as a window is being added or made\n visible, once the window has been shown then the system will\n poke the power manager's user activity (as if the user had woken\n up the device) to turn the screen on."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_TURN_SCREEN_ON: GameActivitySetWindowFlags = 2097152; -#[doc = " When set the window will cause the keyguard to"] -#[doc = " be dismissed, only if it is not a secure lock keyguard. Because such"] -#[doc = " a keyguard is not needed for security, it will never re-appear if"] -#[doc = " the user navigates to another window (in contrast to"] -#[doc = " {@link GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED}, which will only temporarily"] -#[doc = " hide both secure and non-secure keyguards but ensure they reappear"] -#[doc = " when the user moves to another UI that doesn't hide them)."] -#[doc = " If the keyguard is currently active and is secure (requires an"] -#[doc = " unlock pattern) than the user will still need to confirm it before"] -#[doc = " seeing this window, unless {@link GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED} has"] -#[doc = " also been set."] +#[doc = " When set the window will cause the keyguard to\n be dismissed, only if it is not a secure lock keyguard. Because such\n a keyguard is not needed for security, it will never re-appear if\n the user navigates to another window (in contrast to\n {@link GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED}, which will only temporarily\n hide both secure and non-secure keyguards but ensure they reappear\n when the user moves to another UI that doesn't hide them).\n If the keyguard is currently active and is secure (requires an\n unlock pattern) than the user will still need to confirm it before\n seeing this window, unless {@link GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED} has\n also been set."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_DISMISS_KEYGUARD: GameActivitySetWindowFlags = 4194304; -#[doc = " Flags for GameActivity_setWindowFlags,"] -#[doc = " as per the Java API at android.view.WindowManager.LayoutParams."] -pub type GameActivitySetWindowFlags = ::std::os::raw::c_uint; -extern "C" { - #[doc = " Change the window flags of the given activity. Calls getWindow().setFlags()"] - #[doc = " of the given activity."] - #[doc = " Note that some flags must be set before the window decoration is created,"] - #[doc = " see"] - #[doc = " https://developer.android.com/reference/android/view/Window#setFlags(int,%20int)."] - #[doc = " Note also that this method can be called from"] - #[doc = " *any* thread; it will send a message to the main thread of the process"] - #[doc = " where the Java finish call will take place."] +#[doc = " Flags for GameActivity_setWindowFlags,\n as per the Java API at android.view.WindowManager.LayoutParams."] +pub type GameActivitySetWindowFlags = u32; +extern "C" { + #[doc = " Change the window flags of the given activity. Calls getWindow().setFlags()\n of the given activity.\n Note that some flags must be set before the window decoration is created,\n see\n https://developer.android.com/reference/android/view/Window#setFlags(int,%20int).\n Note also that this method can be called from\n *any* thread; it will send a message to the main thread of the process\n where the Java finish call will take place."] pub fn GameActivity_setWindowFlags( activity: *mut GameActivity, addFlags: u32, removeFlags: u32, ); } -#[doc = " Implicit request to show the input window, not as the result"] -#[doc = " of a direct request by the user."] +#[doc = " Implicit request to show the input window, not as the result\n of a direct request by the user."] pub const GameActivityShowSoftInputFlags_GAMEACTIVITY_SHOW_SOFT_INPUT_IMPLICIT: GameActivityShowSoftInputFlags = 1; -#[doc = " The user has forced the input method open (such as by"] -#[doc = " long-pressing menu) so it should not be closed until they"] -#[doc = " explicitly do so."] +#[doc = " The user has forced the input method open (such as by\n long-pressing menu) so it should not be closed until they\n explicitly do so."] pub const GameActivityShowSoftInputFlags_GAMEACTIVITY_SHOW_SOFT_INPUT_FORCED: GameActivityShowSoftInputFlags = 2; -#[doc = " Flags for GameActivity_showSoftInput; see the Java InputMethodManager"] -#[doc = " API for documentation."] -pub type GameActivityShowSoftInputFlags = ::std::os::raw::c_uint; -extern "C" { - #[doc = " Show the IME while in the given activity. Calls"] - #[doc = " InputMethodManager.showSoftInput() for the given activity. Note that this"] - #[doc = " method can be called from *any* thread; it will send a message to the main"] - #[doc = " thread of the process where the Java call will take place."] +#[doc = " Flags for GameActivity_showSoftInput; see the Java InputMethodManager\n API for documentation."] +pub type GameActivityShowSoftInputFlags = u8; +extern "C" { + #[doc = " Show the IME while in the given activity. Calls\n InputMethodManager.showSoftInput() for the given activity. Note that this\n method can be called from *any* thread; it will send a message to the main\n thread of the process where the Java call will take place."] pub fn GameActivity_showSoftInput(activity: *mut GameActivity, flags: u32); } extern "C" { - #[doc = " Set the text entry state (see documentation of the GameTextInputState struct"] - #[doc = " in the Game Text Input library reference)."] - #[doc = ""] - #[doc = " Ownership of the state is maintained by the caller."] + #[doc = " Restarts the input method. Calls InputMethodManager.restartInput().\n Note that this method can be called from *any* thread; it will send a message\n to the main thread of the process where the Java call will take place."] + pub fn GameActivity_restartInput(activity: *mut GameActivity); +} +extern "C" { + #[doc = " Set the text entry state (see documentation of the GameTextInputState struct\n in the Game Text Input library reference).\n\n Ownership of the state is maintained by the caller."] pub fn GameActivity_setTextInputState( activity: *mut GameActivity, state: *const GameTextInputState, ); } extern "C" { - #[doc = " Get the last-received text entry state (see documentation of the"] - #[doc = " GameTextInputState struct in the Game Text Input library reference)."] - #[doc = ""] + #[doc = " Get the last-received text entry state (see documentation of the\n GameTextInputState struct in the Game Text Input library reference).\n"] pub fn GameActivity_getTextInputState( activity: *mut GameActivity, callback: GameTextInputGetStateCallback, @@ -3904,29 +3413,20 @@ extern "C" { #[doc = " Get a pointer to the GameTextInput library instance."] pub fn GameActivity_getTextInput(activity: *const GameActivity) -> *mut GameTextInput; } -#[doc = " The soft input window should only be hidden if it was not"] -#[doc = " explicitly shown by the user."] +#[doc = " The soft input window should only be hidden if it was not\n explicitly shown by the user."] pub const GameActivityHideSoftInputFlags_GAMEACTIVITY_HIDE_SOFT_INPUT_IMPLICIT_ONLY: GameActivityHideSoftInputFlags = 1; -#[doc = " The soft input window should normally be hidden, unless it was"] -#[doc = " originally shown with {@link GAMEACTIVITY_SHOW_SOFT_INPUT_FORCED}."] +#[doc = " The soft input window should normally be hidden, unless it was\n originally shown with {@link GAMEACTIVITY_SHOW_SOFT_INPUT_FORCED}."] pub const GameActivityHideSoftInputFlags_GAMEACTIVITY_HIDE_SOFT_INPUT_NOT_ALWAYS: GameActivityHideSoftInputFlags = 2; -#[doc = " Flags for GameActivity_hideSoftInput; see the Java InputMethodManager"] -#[doc = " API for documentation."] -pub type GameActivityHideSoftInputFlags = ::std::os::raw::c_uint; -extern "C" { - #[doc = " Hide the IME while in the given activity. Calls"] - #[doc = " InputMethodManager.hideSoftInput() for the given activity. Note that this"] - #[doc = " method can be called from *any* thread; it will send a message to the main"] - #[doc = " thread of the process where the Java finish call will take place."] +#[doc = " Flags for GameActivity_hideSoftInput; see the Java InputMethodManager\n API for documentation."] +pub type GameActivityHideSoftInputFlags = u16; +extern "C" { + #[doc = " Hide the IME while in the given activity. Calls\n InputMethodManager.hideSoftInput() for the given activity. Note that this\n method can be called from *any* thread; it will send a message to the main\n thread of the process where the Java finish call will take place."] pub fn GameActivity_hideSoftInput(activity: *mut GameActivity, flags: u32); } extern "C" { - #[doc = " Get the current window insets of the particular component. See"] - #[doc = " https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat.Type"] - #[doc = " for more details."] - #[doc = " You can use these insets to influence what you show on the screen."] + #[doc = " Get the current window insets of the particular component. See\n https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat.Type\n for more details.\n You can use these insets to influence what you show on the screen."] pub fn GameActivity_getWindowInsets( activity: *mut GameActivity, type_: GameCommonInsetsType, @@ -3934,107 +3434,200 @@ extern "C" { ); } extern "C" { - #[doc = " Set options on how the IME behaves when it is requested for text input."] - #[doc = " See"] - #[doc = " https://developer.android.com/reference/android/view/inputmethod/EditorInfo"] - #[doc = " for the meaning of inputType, actionId and imeOptions."] - #[doc = ""] - #[doc = " Note that this function will attach the current thread to the JVM if it is"] - #[doc = " not already attached, so the caller must detach the thread from the JVM"] - #[doc = " before the thread is destroyed using DetachCurrentThread."] + #[doc = " Tells whether the software keyboard is visible or not."] + pub fn GameActivity_isSoftwareKeyboardVisible(activity: *mut GameActivity) -> bool; +} +extern "C" { + #[doc = " Set options on how the IME behaves when it is requested for text input.\n See\n https://developer.android.com/reference/android/view/inputmethod/EditorInfo\n for the meaning of inputType, actionId and imeOptions.\n\n Note: currently only TYPE_NULL AND TYPE_CLASS_NUMBER are supported."] pub fn GameActivity_setImeEditorInfo( activity: *mut GameActivity, - inputType: ::std::os::raw::c_int, - actionId: ::std::os::raw::c_int, - imeOptions: ::std::os::raw::c_int, - ); -} -pub const ACONFIGURATION_ORIENTATION_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_ORIENTATION_PORT: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_ORIENTATION_LAND: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_ORIENTATION_SQUARE: ::std::os::raw::c_uint = 3; -pub const ACONFIGURATION_TOUCHSCREEN_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_TOUCHSCREEN_NOTOUCH: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_TOUCHSCREEN_STYLUS: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_TOUCHSCREEN_FINGER: ::std::os::raw::c_uint = 3; -pub const ACONFIGURATION_DENSITY_DEFAULT: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_DENSITY_LOW: ::std::os::raw::c_uint = 120; -pub const ACONFIGURATION_DENSITY_MEDIUM: ::std::os::raw::c_uint = 160; -pub const ACONFIGURATION_DENSITY_TV: ::std::os::raw::c_uint = 213; -pub const ACONFIGURATION_DENSITY_HIGH: ::std::os::raw::c_uint = 240; -pub const ACONFIGURATION_DENSITY_XHIGH: ::std::os::raw::c_uint = 320; -pub const ACONFIGURATION_DENSITY_XXHIGH: ::std::os::raw::c_uint = 480; -pub const ACONFIGURATION_DENSITY_XXXHIGH: ::std::os::raw::c_uint = 640; -pub const ACONFIGURATION_DENSITY_ANY: ::std::os::raw::c_uint = 65534; -pub const ACONFIGURATION_DENSITY_NONE: ::std::os::raw::c_uint = 65535; -pub const ACONFIGURATION_KEYBOARD_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_KEYBOARD_NOKEYS: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_KEYBOARD_QWERTY: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_KEYBOARD_12KEY: ::std::os::raw::c_uint = 3; -pub const ACONFIGURATION_NAVIGATION_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_NAVIGATION_NONAV: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_NAVIGATION_DPAD: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_NAVIGATION_TRACKBALL: ::std::os::raw::c_uint = 3; -pub const ACONFIGURATION_NAVIGATION_WHEEL: ::std::os::raw::c_uint = 4; -pub const ACONFIGURATION_KEYSHIDDEN_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_KEYSHIDDEN_NO: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_KEYSHIDDEN_YES: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_KEYSHIDDEN_SOFT: ::std::os::raw::c_uint = 3; -pub const ACONFIGURATION_NAVHIDDEN_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_NAVHIDDEN_NO: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_NAVHIDDEN_YES: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_SCREENSIZE_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_SCREENSIZE_SMALL: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_SCREENSIZE_NORMAL: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_SCREENSIZE_LARGE: ::std::os::raw::c_uint = 3; -pub const ACONFIGURATION_SCREENSIZE_XLARGE: ::std::os::raw::c_uint = 4; -pub const ACONFIGURATION_SCREENLONG_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_SCREENLONG_NO: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_SCREENLONG_YES: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_SCREENROUND_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_SCREENROUND_NO: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_SCREENROUND_YES: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_WIDE_COLOR_GAMUT_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_WIDE_COLOR_GAMUT_NO: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_WIDE_COLOR_GAMUT_YES: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_HDR_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_HDR_NO: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_HDR_YES: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_UI_MODE_TYPE_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_UI_MODE_TYPE_NORMAL: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_UI_MODE_TYPE_DESK: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_UI_MODE_TYPE_CAR: ::std::os::raw::c_uint = 3; -pub const ACONFIGURATION_UI_MODE_TYPE_TELEVISION: ::std::os::raw::c_uint = 4; -pub const ACONFIGURATION_UI_MODE_TYPE_APPLIANCE: ::std::os::raw::c_uint = 5; -pub const ACONFIGURATION_UI_MODE_TYPE_WATCH: ::std::os::raw::c_uint = 6; -pub const ACONFIGURATION_UI_MODE_TYPE_VR_HEADSET: ::std::os::raw::c_uint = 7; -pub const ACONFIGURATION_UI_MODE_NIGHT_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_UI_MODE_NIGHT_NO: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_UI_MODE_NIGHT_YES: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_SCREEN_WIDTH_DP_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_SCREEN_HEIGHT_DP_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_LAYOUTDIR_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_LAYOUTDIR_LTR: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_LAYOUTDIR_RTL: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_MCC: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_MNC: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_LOCALE: ::std::os::raw::c_uint = 4; -pub const ACONFIGURATION_TOUCHSCREEN: ::std::os::raw::c_uint = 8; -pub const ACONFIGURATION_KEYBOARD: ::std::os::raw::c_uint = 16; -pub const ACONFIGURATION_KEYBOARD_HIDDEN: ::std::os::raw::c_uint = 32; -pub const ACONFIGURATION_NAVIGATION: ::std::os::raw::c_uint = 64; -pub const ACONFIGURATION_ORIENTATION: ::std::os::raw::c_uint = 128; -pub const ACONFIGURATION_DENSITY: ::std::os::raw::c_uint = 256; -pub const ACONFIGURATION_SCREEN_SIZE: ::std::os::raw::c_uint = 512; -pub const ACONFIGURATION_VERSION: ::std::os::raw::c_uint = 1024; -pub const ACONFIGURATION_SCREEN_LAYOUT: ::std::os::raw::c_uint = 2048; -pub const ACONFIGURATION_UI_MODE: ::std::os::raw::c_uint = 4096; -pub const ACONFIGURATION_SMALLEST_SCREEN_SIZE: ::std::os::raw::c_uint = 8192; -pub const ACONFIGURATION_LAYOUTDIR: ::std::os::raw::c_uint = 16384; -pub const ACONFIGURATION_SCREEN_ROUND: ::std::os::raw::c_uint = 32768; -pub const ACONFIGURATION_COLOR_MODE: ::std::os::raw::c_uint = 65536; -pub const ACONFIGURATION_MNC_ZERO: ::std::os::raw::c_uint = 65535; + inputType: GameTextInputType, + actionId: GameTextInputActionType, + imeOptions: GameTextInputImeOptions, + ); +} +extern "C" { + #[doc = " These are getters for Configuration class members. They may be called from\n any thread."] + pub fn GameActivity_getOrientation(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getColorMode(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getDensityDpi(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getFontScale(activity: *mut GameActivity) -> f32; +} +extern "C" { + pub fn GameActivity_getFontWeightAdjustment( + activity: *mut GameActivity, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getHardKeyboardHidden(activity: *mut GameActivity) + -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getKeyboard(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getKeyboardHidden(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getLocalesCount(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getMcc(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getMnc(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getNavigation(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getNavigationHidden(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getScreenHeightDp(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getScreenLayout(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getScreenWidthDp(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getSmallestScreenWidthDp( + activity: *mut GameActivity, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getTouchscreen(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getUIMode(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " The functions below return Java locale information.\n\n In simple cases there will be just one locale, but it's possible tha\n there are more than one locale objects. Users are encouraged to write code\n that handles all locales and not just the first one.\n\n The functions in the block below return string values in the provided buffer.\n Return value is zero if there were no errors, otherwise it's non-zero.\n If the return value is zero, `dst` will contain a null-terminated string:\n strlen(dst) <= dst_size - 1.\n If the return value is non-zero, the content of dst is undefined.\n\n Parameters:\n\n dst, dst_size: define a receiver buffer. Locale string can be something\n short like \"EN/EN\", but it may be longer. You should be safe with a buffer\n size of 256 bytes.\n\n If the buffer is too small, ENOBUFS is returned. Try allocating a larger\n buffer in this case.\n\n localeIdx must be between 0 and the value of GameActivity_getLocalesCount().\n If localeIdx is out of range, EINVAL is returned.\n\n Refer to Java documentation of locales for more information."] + pub fn GameActivity_getLocaleLanguage( + dst: *mut ::std::os::raw::c_char, + dst_size: usize, + activity: *mut GameActivity, + localeIdx: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getLocaleScript( + dst: *mut ::std::os::raw::c_char, + dst_size: usize, + activity: *mut GameActivity, + localeIdx: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getLocaleCountry( + dst: *mut ::std::os::raw::c_char, + dst_size: usize, + activity: *mut GameActivity, + localeIdx: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getLocaleVariant( + dst: *mut ::std::os::raw::c_char, + dst_size: usize, + activity: *mut GameActivity, + localeIdx: usize, + ) -> ::std::os::raw::c_int; +} +pub const ACONFIGURATION_ORIENTATION_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_ORIENTATION_PORT: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_ORIENTATION_LAND: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_ORIENTATION_SQUARE: _bindgen_ty_21 = 3; +pub const ACONFIGURATION_TOUCHSCREEN_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_TOUCHSCREEN_NOTOUCH: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_TOUCHSCREEN_STYLUS: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_TOUCHSCREEN_FINGER: _bindgen_ty_21 = 3; +pub const ACONFIGURATION_DENSITY_DEFAULT: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_DENSITY_LOW: _bindgen_ty_21 = 120; +pub const ACONFIGURATION_DENSITY_MEDIUM: _bindgen_ty_21 = 160; +pub const ACONFIGURATION_DENSITY_TV: _bindgen_ty_21 = 213; +pub const ACONFIGURATION_DENSITY_HIGH: _bindgen_ty_21 = 240; +pub const ACONFIGURATION_DENSITY_XHIGH: _bindgen_ty_21 = 320; +pub const ACONFIGURATION_DENSITY_XXHIGH: _bindgen_ty_21 = 480; +pub const ACONFIGURATION_DENSITY_XXXHIGH: _bindgen_ty_21 = 640; +pub const ACONFIGURATION_DENSITY_ANY: _bindgen_ty_21 = 65534; +pub const ACONFIGURATION_DENSITY_NONE: _bindgen_ty_21 = 65535; +pub const ACONFIGURATION_KEYBOARD_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_KEYBOARD_NOKEYS: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_KEYBOARD_QWERTY: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_KEYBOARD_12KEY: _bindgen_ty_21 = 3; +pub const ACONFIGURATION_NAVIGATION_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_NAVIGATION_NONAV: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_NAVIGATION_DPAD: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_NAVIGATION_TRACKBALL: _bindgen_ty_21 = 3; +pub const ACONFIGURATION_NAVIGATION_WHEEL: _bindgen_ty_21 = 4; +pub const ACONFIGURATION_KEYSHIDDEN_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_KEYSHIDDEN_NO: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_KEYSHIDDEN_YES: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_KEYSHIDDEN_SOFT: _bindgen_ty_21 = 3; +pub const ACONFIGURATION_NAVHIDDEN_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_NAVHIDDEN_NO: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_NAVHIDDEN_YES: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_SCREENSIZE_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_SCREENSIZE_SMALL: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_SCREENSIZE_NORMAL: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_SCREENSIZE_LARGE: _bindgen_ty_21 = 3; +pub const ACONFIGURATION_SCREENSIZE_XLARGE: _bindgen_ty_21 = 4; +pub const ACONFIGURATION_SCREENLONG_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_SCREENLONG_NO: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_SCREENLONG_YES: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_SCREENROUND_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_SCREENROUND_NO: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_SCREENROUND_YES: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_WIDE_COLOR_GAMUT_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_WIDE_COLOR_GAMUT_NO: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_WIDE_COLOR_GAMUT_YES: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_HDR_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_HDR_NO: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_HDR_YES: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_UI_MODE_TYPE_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_UI_MODE_TYPE_NORMAL: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_UI_MODE_TYPE_DESK: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_UI_MODE_TYPE_CAR: _bindgen_ty_21 = 3; +pub const ACONFIGURATION_UI_MODE_TYPE_TELEVISION: _bindgen_ty_21 = 4; +pub const ACONFIGURATION_UI_MODE_TYPE_APPLIANCE: _bindgen_ty_21 = 5; +pub const ACONFIGURATION_UI_MODE_TYPE_WATCH: _bindgen_ty_21 = 6; +pub const ACONFIGURATION_UI_MODE_TYPE_VR_HEADSET: _bindgen_ty_21 = 7; +pub const ACONFIGURATION_UI_MODE_NIGHT_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_UI_MODE_NIGHT_NO: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_UI_MODE_NIGHT_YES: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_SCREEN_WIDTH_DP_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_SCREEN_HEIGHT_DP_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_LAYOUTDIR_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_LAYOUTDIR_LTR: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_LAYOUTDIR_RTL: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_MCC: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_MNC: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_LOCALE: _bindgen_ty_21 = 4; +pub const ACONFIGURATION_TOUCHSCREEN: _bindgen_ty_21 = 8; +pub const ACONFIGURATION_KEYBOARD: _bindgen_ty_21 = 16; +pub const ACONFIGURATION_KEYBOARD_HIDDEN: _bindgen_ty_21 = 32; +pub const ACONFIGURATION_NAVIGATION: _bindgen_ty_21 = 64; +pub const ACONFIGURATION_ORIENTATION: _bindgen_ty_21 = 128; +pub const ACONFIGURATION_DENSITY: _bindgen_ty_21 = 256; +pub const ACONFIGURATION_SCREEN_SIZE: _bindgen_ty_21 = 512; +pub const ACONFIGURATION_VERSION: _bindgen_ty_21 = 1024; +pub const ACONFIGURATION_SCREEN_LAYOUT: _bindgen_ty_21 = 2048; +pub const ACONFIGURATION_UI_MODE: _bindgen_ty_21 = 4096; +pub const ACONFIGURATION_SMALLEST_SCREEN_SIZE: _bindgen_ty_21 = 8192; +pub const ACONFIGURATION_LAYOUTDIR: _bindgen_ty_21 = 16384; +pub const ACONFIGURATION_SCREEN_ROUND: _bindgen_ty_21 = 32768; +pub const ACONFIGURATION_COLOR_MODE: _bindgen_ty_21 = 65536; +pub const ACONFIGURATION_MNC_ZERO: _bindgen_ty_21 = 65535; pub type _bindgen_ty_21 = ::std::os::raw::c_uint; #[repr(C)] #[derive(Debug, Copy, Clone)] @@ -4045,45 +3638,28 @@ pub struct pollfd { } #[test] fn bindgen_test_layout_pollfd() { - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(pollfd)) - ); + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!(::std::mem::size_of::(), 8usize, "Size of pollfd"); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(pollfd)) + "Alignment of pollfd" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fd as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fd) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(pollfd), - "::", - stringify!(fd) - ) + "Offset of field: pollfd::fd" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).events as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).events) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(pollfd), - "::", - stringify!(events) - ) + "Offset of field: pollfd::events" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).revents as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).revents) as usize - ptr as usize }, 6usize, - concat!( - "Offset of field: ", - stringify!(pollfd), - "::", - stringify!(revents) - ) + "Offset of field: pollfd::revents" ); } #[repr(C)] @@ -4113,225 +3689,122 @@ pub struct sigcontext { } #[test] fn bindgen_test_layout_sigcontext() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 84usize, - concat!("Size of: ", stringify!(sigcontext)) + "Size of sigcontext" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(sigcontext)) + "Alignment of sigcontext" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).trap_no as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).trap_no) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(trap_no) - ) + "Offset of field: sigcontext::trap_no" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).error_code as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).error_code) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(error_code) - ) + "Offset of field: sigcontext::error_code" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).oldmask as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).oldmask) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(oldmask) - ) + "Offset of field: sigcontext::oldmask" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).arm_r0 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).arm_r0) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(arm_r0) - ) + "Offset of field: sigcontext::arm_r0" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).arm_r1 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).arm_r1) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(arm_r1) - ) + "Offset of field: sigcontext::arm_r1" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).arm_r2 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).arm_r2) as usize - ptr as usize }, 20usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(arm_r2) - ) + "Offset of field: sigcontext::arm_r2" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).arm_r3 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).arm_r3) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(arm_r3) - ) + "Offset of field: sigcontext::arm_r3" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).arm_r4 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).arm_r4) as usize - ptr as usize }, 28usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(arm_r4) - ) + "Offset of field: sigcontext::arm_r4" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).arm_r5 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).arm_r5) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(arm_r5) - ) + "Offset of field: sigcontext::arm_r5" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).arm_r6 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).arm_r6) as usize - ptr as usize }, 36usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(arm_r6) - ) + "Offset of field: sigcontext::arm_r6" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).arm_r7 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).arm_r7) as usize - ptr as usize }, 40usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(arm_r7) - ) + "Offset of field: sigcontext::arm_r7" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).arm_r8 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).arm_r8) as usize - ptr as usize }, 44usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(arm_r8) - ) + "Offset of field: sigcontext::arm_r8" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).arm_r9 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).arm_r9) as usize - ptr as usize }, 48usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(arm_r9) - ) + "Offset of field: sigcontext::arm_r9" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).arm_r10 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).arm_r10) as usize - ptr as usize }, 52usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(arm_r10) - ) + "Offset of field: sigcontext::arm_r10" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).arm_fp as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).arm_fp) as usize - ptr as usize }, 56usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(arm_fp) - ) + "Offset of field: sigcontext::arm_fp" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).arm_ip as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).arm_ip) as usize - ptr as usize }, 60usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(arm_ip) - ) + "Offset of field: sigcontext::arm_ip" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).arm_sp as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).arm_sp) as usize - ptr as usize }, 64usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(arm_sp) - ) + "Offset of field: sigcontext::arm_sp" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).arm_lr as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).arm_lr) as usize - ptr as usize }, 68usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(arm_lr) - ) + "Offset of field: sigcontext::arm_lr" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).arm_pc as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).arm_pc) as usize - ptr as usize }, 72usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(arm_pc) - ) + "Offset of field: sigcontext::arm_pc" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).arm_cpsr as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).arm_cpsr) as usize - ptr as usize }, 76usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(arm_cpsr) - ) + "Offset of field: sigcontext::arm_cpsr" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fault_address as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fault_address) as usize - ptr as usize }, 80usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(fault_address) - ) + "Offset of field: sigcontext::fault_address" ); } pub type sigset_t = ::std::os::raw::c_ulong; @@ -4361,146 +3834,100 @@ pub union __kernel_sigaction__bindgen_ty_1 { } #[test] fn bindgen_test_layout___kernel_sigaction__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit<__kernel_sigaction__bindgen_ty_1> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__kernel_sigaction__bindgen_ty_1>(), 4usize, - concat!("Size of: ", stringify!(__kernel_sigaction__bindgen_ty_1)) + "Size of __kernel_sigaction__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::<__kernel_sigaction__bindgen_ty_1>(), 4usize, - concat!( - "Alignment of ", - stringify!(__kernel_sigaction__bindgen_ty_1) - ) + "Alignment of __kernel_sigaction__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__kernel_sigaction__bindgen_ty_1>()))._sa_handler as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._sa_handler) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__kernel_sigaction__bindgen_ty_1), - "::", - stringify!(_sa_handler) - ) + "Offset of field: __kernel_sigaction__bindgen_ty_1::_sa_handler" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__kernel_sigaction__bindgen_ty_1>()))._sa_sigaction as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._sa_sigaction) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__kernel_sigaction__bindgen_ty_1), - "::", - stringify!(_sa_sigaction) - ) + "Offset of field: __kernel_sigaction__bindgen_ty_1::_sa_sigaction" ); } #[test] fn bindgen_test_layout___kernel_sigaction() { + const UNINIT: ::std::mem::MaybeUninit<__kernel_sigaction> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__kernel_sigaction>(), 16usize, - concat!("Size of: ", stringify!(__kernel_sigaction)) + "Size of __kernel_sigaction" ); assert_eq!( ::std::mem::align_of::<__kernel_sigaction>(), 4usize, - concat!("Alignment of ", stringify!(__kernel_sigaction)) + "Alignment of __kernel_sigaction" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_sigaction>()))._u as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._u) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__kernel_sigaction), - "::", - stringify!(_u) - ) + "Offset of field: __kernel_sigaction::_u" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_sigaction>())).sa_mask as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_mask) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(__kernel_sigaction), - "::", - stringify!(sa_mask) - ) + "Offset of field: __kernel_sigaction::sa_mask" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_sigaction>())).sa_flags as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_flags) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__kernel_sigaction), - "::", - stringify!(sa_flags) - ) + "Offset of field: __kernel_sigaction::sa_flags" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_sigaction>())).sa_restorer as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_restorer) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(__kernel_sigaction), - "::", - stringify!(sa_restorer) - ) + "Offset of field: __kernel_sigaction::sa_restorer" ); } #[repr(C)] +#[derive(Debug, Copy, Clone)] pub struct sigaltstack { pub ss_sp: *mut ::std::os::raw::c_void, pub ss_flags: ::std::os::raw::c_int, - pub ss_size: size_t, + pub ss_size: __kernel_size_t, } #[test] fn bindgen_test_layout_sigaltstack() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 12usize, - concat!("Size of: ", stringify!(sigaltstack)) + "Size of sigaltstack" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(sigaltstack)) + "Alignment of sigaltstack" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ss_sp as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ss_sp) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigaltstack), - "::", - stringify!(ss_sp) - ) + "Offset of field: sigaltstack::ss_sp" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ss_flags as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ss_flags) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(sigaltstack), - "::", - stringify!(ss_flags) - ) + "Offset of field: sigaltstack::ss_flags" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ss_size as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ss_size) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(sigaltstack), - "::", - stringify!(ss_size) - ) + "Offset of field: sigaltstack::ss_size" ); } pub type stack_t = sigaltstack; @@ -4512,35 +3939,23 @@ pub union sigval { } #[test] fn bindgen_test_layout_sigval() { - assert_eq!( - ::std::mem::size_of::(), - 4usize, - concat!("Size of: ", stringify!(sigval)) - ); + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!(::std::mem::size_of::(), 4usize, "Size of sigval"); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(sigval)) + "Alignment of sigval" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sival_int as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sival_int) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigval), - "::", - stringify!(sival_int) - ) + "Offset of field: sigval::sival_int" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sival_ptr as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sival_ptr) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigval), - "::", - stringify!(sival_ptr) - ) + "Offset of field: sigval::sival_ptr" ); } pub type sigval_t = sigval; @@ -4563,35 +3978,28 @@ pub struct __sifields__bindgen_ty_1 { } #[test] fn bindgen_test_layout___sifields__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_1> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_1>(), 8usize, - concat!("Size of: ", stringify!(__sifields__bindgen_ty_1)) + "Size of __sifields__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_1>(), 4usize, - concat!("Alignment of ", stringify!(__sifields__bindgen_ty_1)) + "Alignment of __sifields__bindgen_ty_1" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_1>()))._pid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._pid) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_1), - "::", - stringify!(_pid) - ) + "Offset of field: __sifields__bindgen_ty_1::_pid" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_1>()))._uid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._uid) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_1), - "::", - stringify!(_uid) - ) + "Offset of field: __sifields__bindgen_ty_1::_uid" ); } #[repr(C)] @@ -4604,61 +4012,38 @@ pub struct __sifields__bindgen_ty_2 { } #[test] fn bindgen_test_layout___sifields__bindgen_ty_2() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_2> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_2>(), 16usize, - concat!("Size of: ", stringify!(__sifields__bindgen_ty_2)) + "Size of __sifields__bindgen_ty_2" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_2>(), 4usize, - concat!("Alignment of ", stringify!(__sifields__bindgen_ty_2)) + "Alignment of __sifields__bindgen_ty_2" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_2>()))._tid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._tid) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_2), - "::", - stringify!(_tid) - ) + "Offset of field: __sifields__bindgen_ty_2::_tid" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_2>()))._overrun as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._overrun) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_2), - "::", - stringify!(_overrun) - ) + "Offset of field: __sifields__bindgen_ty_2::_overrun" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_2>()))._sigval as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._sigval) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_2), - "::", - stringify!(_sigval) - ) + "Offset of field: __sifields__bindgen_ty_2::_sigval" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_2>()))._sys_private as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._sys_private) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_2), - "::", - stringify!(_sys_private) - ) + "Offset of field: __sifields__bindgen_ty_2::_sys_private" ); } #[repr(C)] @@ -4670,47 +4055,33 @@ pub struct __sifields__bindgen_ty_3 { } #[test] fn bindgen_test_layout___sifields__bindgen_ty_3() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_3> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_3>(), 12usize, - concat!("Size of: ", stringify!(__sifields__bindgen_ty_3)) + "Size of __sifields__bindgen_ty_3" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_3>(), 4usize, - concat!("Alignment of ", stringify!(__sifields__bindgen_ty_3)) + "Alignment of __sifields__bindgen_ty_3" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_3>()))._pid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._pid) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_3), - "::", - stringify!(_pid) - ) + "Offset of field: __sifields__bindgen_ty_3::_pid" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_3>()))._uid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._uid) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_3), - "::", - stringify!(_uid) - ) + "Offset of field: __sifields__bindgen_ty_3::_uid" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_3>()))._sigval as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._sigval) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_3), - "::", - stringify!(_sigval) - ) + "Offset of field: __sifields__bindgen_ty_3::_sigval" ); } #[repr(C)] @@ -4724,67 +4095,43 @@ pub struct __sifields__bindgen_ty_4 { } #[test] fn bindgen_test_layout___sifields__bindgen_ty_4() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_4> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_4>(), 20usize, - concat!("Size of: ", stringify!(__sifields__bindgen_ty_4)) + "Size of __sifields__bindgen_ty_4" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_4>(), 4usize, - concat!("Alignment of ", stringify!(__sifields__bindgen_ty_4)) + "Alignment of __sifields__bindgen_ty_4" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_4>()))._pid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._pid) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_4), - "::", - stringify!(_pid) - ) + "Offset of field: __sifields__bindgen_ty_4::_pid" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_4>()))._uid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._uid) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_4), - "::", - stringify!(_uid) - ) + "Offset of field: __sifields__bindgen_ty_4::_uid" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_4>()))._status as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._status) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_4), - "::", - stringify!(_status) - ) + "Offset of field: __sifields__bindgen_ty_4::_status" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_4>()))._utime as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._utime) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_4), - "::", - stringify!(_utime) - ) + "Offset of field: __sifields__bindgen_ty_4::_utime" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_4>()))._stime as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._stime) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_4), - "::", - stringify!(_stime) - ) + "Offset of field: __sifields__bindgen_ty_4::_stime" ); } #[repr(C)] @@ -4796,9 +4143,11 @@ pub struct __sifields__bindgen_ty_5 { #[repr(C)] #[derive(Copy, Clone)] pub union __sifields__bindgen_ty_5__bindgen_ty_1 { + pub _trapno: ::std::os::raw::c_int, pub _addr_lsb: ::std::os::raw::c_short, pub _addr_bnd: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1, pub _addr_pkey: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2, + pub _perf: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3, } #[repr(C)] #[derive(Debug, Copy, Clone)] @@ -4809,60 +4158,33 @@ pub struct __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1 { } #[test] fn bindgen_test_layout___sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1>(), 12usize, - concat!( - "Size of: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1) - ) + "Size of __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1>(), 4usize, - concat!( - "Alignment of ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1) - ) + "Alignment of __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1>())) - ._dummy_bnd as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._dummy_bnd) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(_dummy_bnd) - ) + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1::_dummy_bnd" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1>()))._lower - as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._lower) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(_lower) - ) + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1::_lower" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1>()))._upper - as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._upper) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(_upper) - ) + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1::_upper" ); } #[repr(C)] @@ -4873,128 +4195,128 @@ pub struct __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2 { } #[test] fn bindgen_test_layout___sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2>(), 8usize, - concat!( - "Size of: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2) - ) + "Size of __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2>(), 4usize, - concat!( - "Alignment of ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2) - ) + "Alignment of __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2>())) - ._dummy_pkey as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._dummy_pkey) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2), - "::", - stringify!(_dummy_pkey) - ) + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2::_dummy_pkey" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2>()))._pkey - as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._pkey) as usize - ptr as usize }, + 4usize, + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2::_pkey" + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3 { + pub _data: ::std::os::raw::c_ulong, + pub _type: __u32, + pub _flags: __u32, +} +#[test] +fn bindgen_test_layout___sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3>(), + 12usize, + "Size of __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3" + ); + assert_eq!( + ::std::mem::align_of::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3>(), + 4usize, + "Alignment of __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._data) as usize - ptr as usize }, + 0usize, + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3::_data" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._type) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2), - "::", - stringify!(_pkey) - ) + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3::_type" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._flags) as usize - ptr as usize }, + 8usize, + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3::_flags" ); } #[test] fn bindgen_test_layout___sifields__bindgen_ty_5__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_5__bindgen_ty_1> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_5__bindgen_ty_1>(), 12usize, - concat!( - "Size of: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1) - ) + "Size of __sifields__bindgen_ty_5__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_5__bindgen_ty_1>(), 4usize, - concat!( - "Alignment of ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1) - ) + "Alignment of __sifields__bindgen_ty_5__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_5__bindgen_ty_1>()))._addr_lsb as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._trapno) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1), - "::", - stringify!(_addr_lsb) - ) + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1::_trapno" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_5__bindgen_ty_1>()))._addr_bnd as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._addr_lsb) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1), - "::", - stringify!(_addr_bnd) - ) + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1::_addr_lsb" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_5__bindgen_ty_1>()))._addr_pkey - as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._addr_bnd) as usize - ptr as usize }, + 0usize, + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1::_addr_bnd" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._addr_pkey) as usize - ptr as usize }, + 0usize, + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1::_addr_pkey" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._perf) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1), - "::", - stringify!(_addr_pkey) - ) + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1::_perf" ); } #[test] fn bindgen_test_layout___sifields__bindgen_ty_5() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_5> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_5>(), 16usize, - concat!("Size of: ", stringify!(__sifields__bindgen_ty_5)) + "Size of __sifields__bindgen_ty_5" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_5>(), 4usize, - concat!("Alignment of ", stringify!(__sifields__bindgen_ty_5)) + "Alignment of __sifields__bindgen_ty_5" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_5>()))._addr as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._addr) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5), - "::", - stringify!(_addr) - ) + "Offset of field: __sifields__bindgen_ty_5::_addr" ); } #[repr(C)] @@ -5005,35 +4327,28 @@ pub struct __sifields__bindgen_ty_6 { } #[test] fn bindgen_test_layout___sifields__bindgen_ty_6() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_6> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_6>(), 8usize, - concat!("Size of: ", stringify!(__sifields__bindgen_ty_6)) + "Size of __sifields__bindgen_ty_6" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_6>(), 4usize, - concat!("Alignment of ", stringify!(__sifields__bindgen_ty_6)) + "Alignment of __sifields__bindgen_ty_6" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_6>()))._band as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._band) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_6), - "::", - stringify!(_band) - ) + "Offset of field: __sifields__bindgen_ty_6::_band" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_6>()))._fd as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._fd) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_6), - "::", - stringify!(_fd) - ) + "Offset of field: __sifields__bindgen_ty_6::_fd" ); } #[repr(C)] @@ -5045,132 +4360,83 @@ pub struct __sifields__bindgen_ty_7 { } #[test] fn bindgen_test_layout___sifields__bindgen_ty_7() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_7> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_7>(), 12usize, - concat!("Size of: ", stringify!(__sifields__bindgen_ty_7)) + "Size of __sifields__bindgen_ty_7" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_7>(), 4usize, - concat!("Alignment of ", stringify!(__sifields__bindgen_ty_7)) + "Alignment of __sifields__bindgen_ty_7" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_7>()))._call_addr as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._call_addr) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_7), - "::", - stringify!(_call_addr) - ) + "Offset of field: __sifields__bindgen_ty_7::_call_addr" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_7>()))._syscall as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._syscall) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_7), - "::", - stringify!(_syscall) - ) + "Offset of field: __sifields__bindgen_ty_7::_syscall" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_7>()))._arch as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._arch) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_7), - "::", - stringify!(_arch) - ) + "Offset of field: __sifields__bindgen_ty_7::_arch" ); } #[test] fn bindgen_test_layout___sifields() { + const UNINIT: ::std::mem::MaybeUninit<__sifields> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields>(), 20usize, - concat!("Size of: ", stringify!(__sifields)) + "Size of __sifields" ); assert_eq!( ::std::mem::align_of::<__sifields>(), 4usize, - concat!("Alignment of ", stringify!(__sifields)) + "Alignment of __sifields" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields>()))._kill as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._kill) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields), - "::", - stringify!(_kill) - ) + "Offset of field: __sifields::_kill" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields>()))._timer as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._timer) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields), - "::", - stringify!(_timer) - ) + "Offset of field: __sifields::_timer" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields>()))._rt as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._rt) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields), - "::", - stringify!(_rt) - ) + "Offset of field: __sifields::_rt" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields>()))._sigchld as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._sigchld) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields), - "::", - stringify!(_sigchld) - ) + "Offset of field: __sifields::_sigchld" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields>()))._sigfault as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._sigfault) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields), - "::", - stringify!(_sigfault) - ) + "Offset of field: __sifields::_sigfault" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields>()))._sigpoll as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._sigpoll) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields), - "::", - stringify!(_sigpoll) - ) + "Offset of field: __sifields::_sigpoll" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields>()))._sigsys as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._sigsys) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields), - "::", - stringify!(_sigsys) - ) + "Offset of field: __sifields::_sigsys" ); } #[repr(C)] @@ -5194,93 +4460,59 @@ pub struct siginfo__bindgen_ty_1__bindgen_ty_1 { } #[test] fn bindgen_test_layout_siginfo__bindgen_ty_1__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 32usize, - concat!("Size of: ", stringify!(siginfo__bindgen_ty_1__bindgen_ty_1)) + "Size of siginfo__bindgen_ty_1__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!( - "Alignment of ", - stringify!(siginfo__bindgen_ty_1__bindgen_ty_1) - ) + "Alignment of siginfo__bindgen_ty_1__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).si_signo as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).si_signo) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(siginfo__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(si_signo) - ) + "Offset of field: siginfo__bindgen_ty_1__bindgen_ty_1::si_signo" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).si_errno as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).si_errno) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(siginfo__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(si_errno) - ) + "Offset of field: siginfo__bindgen_ty_1__bindgen_ty_1::si_errno" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).si_code as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).si_code) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(siginfo__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(si_code) - ) + "Offset of field: siginfo__bindgen_ty_1__bindgen_ty_1::si_code" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::()))._sifields as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._sifields) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(siginfo__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(_sifields) - ) + "Offset of field: siginfo__bindgen_ty_1__bindgen_ty_1::_sifields" ); } #[test] fn bindgen_test_layout_siginfo__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 128usize, - concat!("Size of: ", stringify!(siginfo__bindgen_ty_1)) + "Size of siginfo__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(siginfo__bindgen_ty_1)) + "Alignment of siginfo__bindgen_ty_1" ); assert_eq!( - unsafe { &(*(::std::ptr::null::()))._si_pad as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._si_pad) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(siginfo__bindgen_ty_1), - "::", - stringify!(_si_pad) - ) + "Offset of field: siginfo__bindgen_ty_1::_si_pad" ); } #[test] @@ -5288,12 +4520,12 @@ fn bindgen_test_layout_siginfo() { assert_eq!( ::std::mem::size_of::(), 128usize, - concat!("Size of: ", stringify!(siginfo)) + "Size of siginfo" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(siginfo)) + "Alignment of siginfo" ); } pub type siginfo_t = siginfo; @@ -5320,145 +4552,94 @@ pub struct sigevent__bindgen_ty_1__bindgen_ty_1 { } #[test] fn bindgen_test_layout_sigevent__bindgen_ty_1__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 8usize, - concat!( - "Size of: ", - stringify!(sigevent__bindgen_ty_1__bindgen_ty_1) - ) + "Size of sigevent__bindgen_ty_1__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!( - "Alignment of ", - stringify!(sigevent__bindgen_ty_1__bindgen_ty_1) - ) + "Alignment of sigevent__bindgen_ty_1__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::()))._function as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._function) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigevent__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(_function) - ) + "Offset of field: sigevent__bindgen_ty_1__bindgen_ty_1::_function" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::()))._attribute as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._attribute) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(sigevent__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(_attribute) - ) + "Offset of field: sigevent__bindgen_ty_1__bindgen_ty_1::_attribute" ); } #[test] fn bindgen_test_layout_sigevent__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 52usize, - concat!("Size of: ", stringify!(sigevent__bindgen_ty_1)) + "Size of sigevent__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(sigevent__bindgen_ty_1)) + "Alignment of sigevent__bindgen_ty_1" ); assert_eq!( - unsafe { &(*(::std::ptr::null::()))._pad as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._pad) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigevent__bindgen_ty_1), - "::", - stringify!(_pad) - ) + "Offset of field: sigevent__bindgen_ty_1::_pad" ); assert_eq!( - unsafe { &(*(::std::ptr::null::()))._tid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._tid) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigevent__bindgen_ty_1), - "::", - stringify!(_tid) - ) + "Offset of field: sigevent__bindgen_ty_1::_tid" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::()))._sigev_thread as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._sigev_thread) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigevent__bindgen_ty_1), - "::", - stringify!(_sigev_thread) - ) + "Offset of field: sigevent__bindgen_ty_1::_sigev_thread" ); } #[test] fn bindgen_test_layout_sigevent() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 64usize, - concat!("Size of: ", stringify!(sigevent)) + "Size of sigevent" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(sigevent)) + "Alignment of sigevent" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sigev_value as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sigev_value) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigevent), - "::", - stringify!(sigev_value) - ) + "Offset of field: sigevent::sigev_value" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sigev_signo as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sigev_signo) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(sigevent), - "::", - stringify!(sigev_signo) - ) + "Offset of field: sigevent::sigev_signo" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sigev_notify as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sigev_notify) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(sigevent), - "::", - stringify!(sigev_notify) - ) + "Offset of field: sigevent::sigev_notify" ); assert_eq!( - unsafe { &(*(::std::ptr::null::()))._sigev_un as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._sigev_un) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(sigevent), - "::", - stringify!(_sigev_un) - ) + "Offset of field: sigevent::_sigev_un" ); } pub type sigevent_t = sigevent; @@ -5472,25 +4653,22 @@ pub struct sigset64_t { } #[test] fn bindgen_test_layout_sigset64_t() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 8usize, - concat!("Size of: ", stringify!(sigset64_t)) + "Size of sigset64_t" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(sigset64_t)) + "Alignment of sigset64_t" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).__bits as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).__bits) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigset64_t), - "::", - stringify!(__bits) - ) + "Offset of field: sigset64_t::__bits" ); } #[repr(C)] @@ -5515,82 +4693,58 @@ pub union sigaction__bindgen_ty_1 { } #[test] fn bindgen_test_layout_sigaction__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 4usize, - concat!("Size of: ", stringify!(sigaction__bindgen_ty_1)) + "Size of sigaction__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(sigaction__bindgen_ty_1)) + "Alignment of sigaction__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).sa_handler as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_handler) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigaction__bindgen_ty_1), - "::", - stringify!(sa_handler) - ) + "Offset of field: sigaction__bindgen_ty_1::sa_handler" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).sa_sigaction as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_sigaction) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigaction__bindgen_ty_1), - "::", - stringify!(sa_sigaction) - ) + "Offset of field: sigaction__bindgen_ty_1::sa_sigaction" ); } #[test] fn bindgen_test_layout_sigaction() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 16usize, - concat!("Size of: ", stringify!(sigaction)) + "Size of sigaction" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(sigaction)) + "Alignment of sigaction" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sa_mask as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_mask) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(sigaction), - "::", - stringify!(sa_mask) - ) + "Offset of field: sigaction::sa_mask" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sa_flags as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_flags) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(sigaction), - "::", - stringify!(sa_flags) - ) + "Offset of field: sigaction::sa_flags" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sa_restorer as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_restorer) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(sigaction), - "::", - stringify!(sa_restorer) - ) + "Offset of field: sigaction::sa_restorer" ); } #[repr(C)] @@ -5615,82 +4769,58 @@ pub union sigaction64__bindgen_ty_1 { } #[test] fn bindgen_test_layout_sigaction64__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 4usize, - concat!("Size of: ", stringify!(sigaction64__bindgen_ty_1)) + "Size of sigaction64__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(sigaction64__bindgen_ty_1)) + "Alignment of sigaction64__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).sa_handler as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_handler) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigaction64__bindgen_ty_1), - "::", - stringify!(sa_handler) - ) + "Offset of field: sigaction64__bindgen_ty_1::sa_handler" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).sa_sigaction as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_sigaction) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigaction64__bindgen_ty_1), - "::", - stringify!(sa_sigaction) - ) + "Offset of field: sigaction64__bindgen_ty_1::sa_sigaction" ); } #[test] fn bindgen_test_layout_sigaction64() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 20usize, - concat!("Size of: ", stringify!(sigaction64)) + "Size of sigaction64" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(sigaction64)) + "Alignment of sigaction64" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sa_flags as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_flags) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(sigaction64), - "::", - stringify!(sa_flags) - ) + "Offset of field: sigaction64::sa_flags" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sa_restorer as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_restorer) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(sigaction64), - "::", - stringify!(sa_restorer) - ) + "Offset of field: sigaction64::sa_restorer" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sa_mask as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_mask) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(sigaction64), - "::", - stringify!(sa_mask) - ) + "Offset of field: sigaction64::sa_mask" ); } #[repr(C)] @@ -5701,35 +4831,27 @@ pub struct timespec { } #[test] fn bindgen_test_layout_timespec() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 8usize, - concat!("Size of: ", stringify!(timespec)) + "Size of timespec" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(timespec)) + "Alignment of timespec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tv_sec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tv_sec) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(timespec), - "::", - stringify!(tv_sec) - ) + "Offset of field: timespec::tv_sec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tv_nsec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tv_nsec) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(timespec), - "::", - stringify!(tv_nsec) - ) + "Offset of field: timespec::tv_nsec" ); } #[repr(C)] @@ -5742,7 +4864,6 @@ pub struct user_fpregs { pub init_flag: ::std::os::raw::c_uint, } #[repr(C)] -#[repr(align(4))] #[derive(Debug, Copy, Clone)] pub struct user_fpregs_fp_reg { pub _bitfield_align_1: [u32; 0], @@ -5753,12 +4874,12 @@ fn bindgen_test_layout_user_fpregs_fp_reg() { assert_eq!( ::std::mem::size_of::(), 12usize, - concat!("Size of: ", stringify!(user_fpregs_fp_reg)) + "Size of user_fpregs_fp_reg" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(user_fpregs_fp_reg)) + "Alignment of user_fpregs_fp_reg" ); } impl user_fpregs_fp_reg { @@ -5774,6 +4895,28 @@ impl user_fpregs_fp_reg { } } #[inline] + pub unsafe fn sign1_raw(this: *const Self) -> ::std::os::raw::c_uint { + unsafe { + ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 12usize]>>::raw_get( + ::std::ptr::addr_of!((*this)._bitfield_1), + 0usize, + 1u8, + ) as u32) + } + } + #[inline] + pub unsafe fn set_sign1_raw(this: *mut Self, val: ::std::os::raw::c_uint) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + <__BindgenBitfieldUnit<[u8; 12usize]>>::raw_set( + ::std::ptr::addr_of_mut!((*this)._bitfield_1), + 0usize, + 1u8, + val as u64, + ) + } + } + #[inline] pub fn unused(&self) -> ::std::os::raw::c_uint { unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 15u8) as u32) } } @@ -5785,6 +4928,28 @@ impl user_fpregs_fp_reg { } } #[inline] + pub unsafe fn unused_raw(this: *const Self) -> ::std::os::raw::c_uint { + unsafe { + ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 12usize]>>::raw_get( + ::std::ptr::addr_of!((*this)._bitfield_1), + 1usize, + 15u8, + ) as u32) + } + } + #[inline] + pub unsafe fn set_unused_raw(this: *mut Self, val: ::std::os::raw::c_uint) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + <__BindgenBitfieldUnit<[u8; 12usize]>>::raw_set( + ::std::ptr::addr_of_mut!((*this)._bitfield_1), + 1usize, + 15u8, + val as u64, + ) + } + } + #[inline] pub fn sign2(&self) -> ::std::os::raw::c_uint { unsafe { ::std::mem::transmute(self._bitfield_1.get(16usize, 1u8) as u32) } } @@ -5796,6 +4961,28 @@ impl user_fpregs_fp_reg { } } #[inline] + pub unsafe fn sign2_raw(this: *const Self) -> ::std::os::raw::c_uint { + unsafe { + ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 12usize]>>::raw_get( + ::std::ptr::addr_of!((*this)._bitfield_1), + 16usize, + 1u8, + ) as u32) + } + } + #[inline] + pub unsafe fn set_sign2_raw(this: *mut Self, val: ::std::os::raw::c_uint) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + <__BindgenBitfieldUnit<[u8; 12usize]>>::raw_set( + ::std::ptr::addr_of_mut!((*this)._bitfield_1), + 16usize, + 1u8, + val as u64, + ) + } + } + #[inline] pub fn exponent(&self) -> ::std::os::raw::c_uint { unsafe { ::std::mem::transmute(self._bitfield_1.get(17usize, 14u8) as u32) } } @@ -5807,6 +4994,28 @@ impl user_fpregs_fp_reg { } } #[inline] + pub unsafe fn exponent_raw(this: *const Self) -> ::std::os::raw::c_uint { + unsafe { + ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 12usize]>>::raw_get( + ::std::ptr::addr_of!((*this)._bitfield_1), + 17usize, + 14u8, + ) as u32) + } + } + #[inline] + pub unsafe fn set_exponent_raw(this: *mut Self, val: ::std::os::raw::c_uint) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + <__BindgenBitfieldUnit<[u8; 12usize]>>::raw_set( + ::std::ptr::addr_of_mut!((*this)._bitfield_1), + 17usize, + 14u8, + val as u64, + ) + } + } + #[inline] pub fn j(&self) -> ::std::os::raw::c_uint { unsafe { ::std::mem::transmute(self._bitfield_1.get(31usize, 1u8) as u32) } } @@ -5818,6 +5027,28 @@ impl user_fpregs_fp_reg { } } #[inline] + pub unsafe fn j_raw(this: *const Self) -> ::std::os::raw::c_uint { + unsafe { + ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 12usize]>>::raw_get( + ::std::ptr::addr_of!((*this)._bitfield_1), + 31usize, + 1u8, + ) as u32) + } + } + #[inline] + pub unsafe fn set_j_raw(this: *mut Self, val: ::std::os::raw::c_uint) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + <__BindgenBitfieldUnit<[u8; 12usize]>>::raw_set( + ::std::ptr::addr_of_mut!((*this)._bitfield_1), + 31usize, + 1u8, + val as u64, + ) + } + } + #[inline] pub fn mantissa1(&self) -> ::std::os::raw::c_uint { unsafe { ::std::mem::transmute(self._bitfield_1.get(32usize, 31u8) as u32) } } @@ -5829,6 +5060,28 @@ impl user_fpregs_fp_reg { } } #[inline] + pub unsafe fn mantissa1_raw(this: *const Self) -> ::std::os::raw::c_uint { + unsafe { + ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 12usize]>>::raw_get( + ::std::ptr::addr_of!((*this)._bitfield_1), + 32usize, + 31u8, + ) as u32) + } + } + #[inline] + pub unsafe fn set_mantissa1_raw(this: *mut Self, val: ::std::os::raw::c_uint) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + <__BindgenBitfieldUnit<[u8; 12usize]>>::raw_set( + ::std::ptr::addr_of_mut!((*this)._bitfield_1), + 32usize, + 31u8, + val as u64, + ) + } + } + #[inline] pub fn mantissa0(&self) -> ::std::os::raw::c_uint { unsafe { ::std::mem::transmute(self._bitfield_1.get(64usize, 32u8) as u32) } } @@ -5840,6 +5093,28 @@ impl user_fpregs_fp_reg { } } #[inline] + pub unsafe fn mantissa0_raw(this: *const Self) -> ::std::os::raw::c_uint { + unsafe { + ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 12usize]>>::raw_get( + ::std::ptr::addr_of!((*this)._bitfield_1), + 64usize, + 32u8, + ) as u32) + } + } + #[inline] + pub unsafe fn set_mantissa0_raw(this: *mut Self, val: ::std::os::raw::c_uint) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + <__BindgenBitfieldUnit<[u8; 12usize]>>::raw_set( + ::std::ptr::addr_of_mut!((*this)._bitfield_1), + 64usize, + 32u8, + val as u64, + ) + } + } + #[inline] pub fn new_bitfield_1( sign1: ::std::os::raw::c_uint, unused: ::std::os::raw::c_uint, @@ -5883,45 +5158,32 @@ impl user_fpregs_fp_reg { } #[test] fn bindgen_test_layout_user_fpregs() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 116usize, - concat!("Size of: ", stringify!(user_fpregs)) + "Size of user_fpregs" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(user_fpregs)) + "Alignment of user_fpregs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fpregs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fpregs) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(user_fpregs), - "::", - stringify!(fpregs) - ) + "Offset of field: user_fpregs::fpregs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ftype as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ftype) as usize - ptr as usize }, 104usize, - concat!( - "Offset of field: ", - stringify!(user_fpregs), - "::", - stringify!(ftype) - ) + "Offset of field: user_fpregs::ftype" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).init_flag as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).init_flag) as usize - ptr as usize }, 112usize, - concat!( - "Offset of field: ", - stringify!(user_fpregs), - "::", - stringify!(init_flag) - ) + "Offset of field: user_fpregs::init_flag" ); } impl user_fpregs { @@ -5937,6 +5199,28 @@ impl user_fpregs { } } #[inline] + pub unsafe fn fpsr_raw(this: *const Self) -> ::std::os::raw::c_uint { + unsafe { + ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 8usize]>>::raw_get( + ::std::ptr::addr_of!((*this)._bitfield_1), + 0usize, + 32u8, + ) as u32) + } + } + #[inline] + pub unsafe fn set_fpsr_raw(this: *mut Self, val: ::std::os::raw::c_uint) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + <__BindgenBitfieldUnit<[u8; 8usize]>>::raw_set( + ::std::ptr::addr_of_mut!((*this)._bitfield_1), + 0usize, + 32u8, + val as u64, + ) + } + } + #[inline] pub fn fpcr(&self) -> ::std::os::raw::c_uint { unsafe { ::std::mem::transmute(self._bitfield_1.get(32usize, 32u8) as u32) } } @@ -5948,6 +5232,28 @@ impl user_fpregs { } } #[inline] + pub unsafe fn fpcr_raw(this: *const Self) -> ::std::os::raw::c_uint { + unsafe { + ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 8usize]>>::raw_get( + ::std::ptr::addr_of!((*this)._bitfield_1), + 32usize, + 32u8, + ) as u32) + } + } + #[inline] + pub unsafe fn set_fpcr_raw(this: *mut Self, val: ::std::os::raw::c_uint) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + <__BindgenBitfieldUnit<[u8; 8usize]>>::raw_set( + ::std::ptr::addr_of_mut!((*this)._bitfield_1), + 32usize, + 32u8, + val as u64, + ) + } + } + #[inline] pub fn new_bitfield_1( fpsr: ::std::os::raw::c_uint, fpcr: ::std::os::raw::c_uint, @@ -5971,25 +5277,22 @@ pub struct user_regs { } #[test] fn bindgen_test_layout_user_regs() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 72usize, - concat!("Size of: ", stringify!(user_regs)) + "Size of user_regs" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(user_regs)) + "Alignment of user_regs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).uregs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).uregs) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(user_regs), - "::", - stringify!(uregs) - ) + "Offset of field: user_regs::uregs" ); } #[repr(C)] @@ -6000,35 +5303,27 @@ pub struct user_vfp { } #[test] fn bindgen_test_layout_user_vfp() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 264usize, - concat!("Size of: ", stringify!(user_vfp)) + "Size of user_vfp" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(user_vfp)) + "Alignment of user_vfp" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fpregs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fpregs) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(user_vfp), - "::", - stringify!(fpregs) - ) + "Offset of field: user_vfp::fpregs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fpscr as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fpscr) as usize - ptr as usize }, 256usize, - concat!( - "Offset of field: ", - stringify!(user_vfp), - "::", - stringify!(fpscr) - ) + "Offset of field: user_vfp::fpscr" ); } #[repr(C)] @@ -6040,45 +5335,32 @@ pub struct user_vfp_exc { } #[test] fn bindgen_test_layout_user_vfp_exc() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 12usize, - concat!("Size of: ", stringify!(user_vfp_exc)) + "Size of user_vfp_exc" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(user_vfp_exc)) + "Alignment of user_vfp_exc" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fpexc as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fpexc) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(user_vfp_exc), - "::", - stringify!(fpexc) - ) + "Offset of field: user_vfp_exc::fpexc" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fpinst as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fpinst) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(user_vfp_exc), - "::", - stringify!(fpinst) - ) + "Offset of field: user_vfp_exc::fpinst" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fpinst2 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fpinst2) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(user_vfp_exc), - "::", - stringify!(fpinst2) - ) + "Offset of field: user_vfp_exc::fpinst2" ); } #[repr(C)] @@ -6102,183 +5384,102 @@ pub struct user { } #[test] fn bindgen_test_layout_user() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!(::std::mem::size_of::(), 296usize, "Size of user"); + assert_eq!(::std::mem::align_of::(), 4usize, "Alignment of user"); assert_eq!( - ::std::mem::size_of::(), - 296usize, - concat!("Size of: ", stringify!(user)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(user)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).regs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).regs) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(regs) - ) + "Offset of field: user::regs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).u_fpvalid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).u_fpvalid) as usize - ptr as usize }, 72usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(u_fpvalid) - ) + "Offset of field: user::u_fpvalid" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).u_tsize as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).u_tsize) as usize - ptr as usize }, 76usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(u_tsize) - ) + "Offset of field: user::u_tsize" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).u_dsize as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).u_dsize) as usize - ptr as usize }, 80usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(u_dsize) - ) + "Offset of field: user::u_dsize" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).u_ssize as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).u_ssize) as usize - ptr as usize }, 84usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(u_ssize) - ) + "Offset of field: user::u_ssize" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).start_code as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).start_code) as usize - ptr as usize }, 88usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(start_code) - ) + "Offset of field: user::start_code" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).start_stack as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).start_stack) as usize - ptr as usize }, 92usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(start_stack) - ) + "Offset of field: user::start_stack" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).signal as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).signal) as usize - ptr as usize }, 96usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(signal) - ) + "Offset of field: user::signal" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).reserved) as usize - ptr as usize }, 100usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(reserved) - ) + "Offset of field: user::reserved" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).u_ar0 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).u_ar0) as usize - ptr as usize }, 104usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(u_ar0) - ) + "Offset of field: user::u_ar0" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).magic as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).magic) as usize - ptr as usize }, 108usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(magic) - ) + "Offset of field: user::magic" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).u_comm as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).u_comm) as usize - ptr as usize }, 112usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(u_comm) - ) + "Offset of field: user::u_comm" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).u_debugreg as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).u_debugreg) as usize - ptr as usize }, 144usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(u_debugreg) - ) + "Offset of field: user::u_debugreg" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).u_fp as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).u_fp) as usize - ptr as usize }, 176usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(u_fp) - ) + "Offset of field: user::u_fp" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).u_fp0 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).u_fp0) as usize - ptr as usize }, 292usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(u_fp0) - ) - ); -} -pub const REG_R0: ::std::os::raw::c_uint = 0; -pub const REG_R1: ::std::os::raw::c_uint = 1; -pub const REG_R2: ::std::os::raw::c_uint = 2; -pub const REG_R3: ::std::os::raw::c_uint = 3; -pub const REG_R4: ::std::os::raw::c_uint = 4; -pub const REG_R5: ::std::os::raw::c_uint = 5; -pub const REG_R6: ::std::os::raw::c_uint = 6; -pub const REG_R7: ::std::os::raw::c_uint = 7; -pub const REG_R8: ::std::os::raw::c_uint = 8; -pub const REG_R9: ::std::os::raw::c_uint = 9; -pub const REG_R10: ::std::os::raw::c_uint = 10; -pub const REG_R11: ::std::os::raw::c_uint = 11; -pub const REG_R12: ::std::os::raw::c_uint = 12; -pub const REG_R13: ::std::os::raw::c_uint = 13; -pub const REG_R14: ::std::os::raw::c_uint = 14; -pub const REG_R15: ::std::os::raw::c_uint = 15; + "Offset of field: user::u_fp0" + ); +} +pub const REG_R0: _bindgen_ty_22 = 0; +pub const REG_R1: _bindgen_ty_22 = 1; +pub const REG_R2: _bindgen_ty_22 = 2; +pub const REG_R3: _bindgen_ty_22 = 3; +pub const REG_R4: _bindgen_ty_22 = 4; +pub const REG_R5: _bindgen_ty_22 = 5; +pub const REG_R6: _bindgen_ty_22 = 6; +pub const REG_R7: _bindgen_ty_22 = 7; +pub const REG_R8: _bindgen_ty_22 = 8; +pub const REG_R9: _bindgen_ty_22 = 9; +pub const REG_R10: _bindgen_ty_22 = 10; +pub const REG_R11: _bindgen_ty_22 = 11; +pub const REG_R12: _bindgen_ty_22 = 12; +pub const REG_R13: _bindgen_ty_22 = 13; +pub const REG_R14: _bindgen_ty_22 = 14; +pub const REG_R15: _bindgen_ty_22 = 15; pub type _bindgen_ty_22 = ::std::os::raw::c_uint; pub type greg_t = ::std::os::raw::c_int; pub type gregset_t = [greg_t; 18usize]; @@ -6286,6 +5487,7 @@ pub type fpregset_t = user_fpregs; pub type mcontext_t = sigcontext; #[repr(C)] #[repr(align(8))] +#[derive(Copy, Clone)] pub struct ucontext { pub uc_flags: ::std::os::raw::c_ulong, pub uc_link: *mut ucontext, @@ -6309,145 +5511,94 @@ pub struct ucontext__bindgen_ty_1__bindgen_ty_1 { } #[test] fn bindgen_test_layout_ucontext__bindgen_ty_1__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 8usize, - concat!( - "Size of: ", - stringify!(ucontext__bindgen_ty_1__bindgen_ty_1) - ) + "Size of ucontext__bindgen_ty_1__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!( - "Alignment of ", - stringify!(ucontext__bindgen_ty_1__bindgen_ty_1) - ) + "Alignment of ucontext__bindgen_ty_1__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).uc_sigmask as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).uc_sigmask) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(ucontext__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(uc_sigmask) - ) + "Offset of field: ucontext__bindgen_ty_1__bindgen_ty_1::uc_sigmask" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).__padding_rt_sigset - as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).__padding_rt_sigset) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(ucontext__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(__padding_rt_sigset) - ) + "Offset of field: ucontext__bindgen_ty_1__bindgen_ty_1::__padding_rt_sigset" ); } #[test] fn bindgen_test_layout_ucontext__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 8usize, - concat!("Size of: ", stringify!(ucontext__bindgen_ty_1)) + "Size of ucontext__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(ucontext__bindgen_ty_1)) + "Alignment of ucontext__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).uc_sigmask64 as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).uc_sigmask64) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(ucontext__bindgen_ty_1), - "::", - stringify!(uc_sigmask64) - ) + "Offset of field: ucontext__bindgen_ty_1::uc_sigmask64" ); } #[test] fn bindgen_test_layout_ucontext() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 744usize, - concat!("Size of: ", stringify!(ucontext)) + "Size of ucontext" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(ucontext)) + "Alignment of ucontext" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).uc_flags as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).uc_flags) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(ucontext), - "::", - stringify!(uc_flags) - ) + "Offset of field: ucontext::uc_flags" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).uc_link as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).uc_link) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(ucontext), - "::", - stringify!(uc_link) - ) + "Offset of field: ucontext::uc_link" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).uc_stack as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).uc_stack) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(ucontext), - "::", - stringify!(uc_stack) - ) + "Offset of field: ucontext::uc_stack" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).uc_mcontext as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).uc_mcontext) as usize - ptr as usize }, 20usize, - concat!( - "Offset of field: ", - stringify!(ucontext), - "::", - stringify!(uc_mcontext) - ) + "Offset of field: ucontext::uc_mcontext" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).__padding as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).__padding) as usize - ptr as usize }, 112usize, - concat!( - "Offset of field: ", - stringify!(ucontext), - "::", - stringify!(__padding) - ) + "Offset of field: ucontext::__padding" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).uc_regspace as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).uc_regspace) as usize - ptr as usize }, 232usize, - concat!( - "Offset of field: ", - stringify!(ucontext), - "::", - stringify!(uc_regspace) - ) + "Offset of field: ucontext::uc_regspace" ); } pub type ucontext_t = ucontext; @@ -6654,35 +5805,27 @@ pub struct __kernel_timespec { } #[test] fn bindgen_test_layout___kernel_timespec() { + const UNINIT: ::std::mem::MaybeUninit<__kernel_timespec> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__kernel_timespec>(), 16usize, - concat!("Size of: ", stringify!(__kernel_timespec)) + "Size of __kernel_timespec" ); assert_eq!( ::std::mem::align_of::<__kernel_timespec>(), 8usize, - concat!("Alignment of ", stringify!(__kernel_timespec)) + "Alignment of __kernel_timespec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_timespec>())).tv_sec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tv_sec) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__kernel_timespec), - "::", - stringify!(tv_sec) - ) + "Offset of field: __kernel_timespec::tv_sec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_timespec>())).tv_nsec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tv_nsec) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__kernel_timespec), - "::", - stringify!(tv_nsec) - ) + "Offset of field: __kernel_timespec::tv_nsec" ); } #[repr(C)] @@ -6693,74 +5836,59 @@ pub struct __kernel_itimerspec { } #[test] fn bindgen_test_layout___kernel_itimerspec() { + const UNINIT: ::std::mem::MaybeUninit<__kernel_itimerspec> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__kernel_itimerspec>(), 32usize, - concat!("Size of: ", stringify!(__kernel_itimerspec)) + "Size of __kernel_itimerspec" ); assert_eq!( ::std::mem::align_of::<__kernel_itimerspec>(), 8usize, - concat!("Alignment of ", stringify!(__kernel_itimerspec)) + "Alignment of __kernel_itimerspec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_itimerspec>())).it_interval as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).it_interval) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__kernel_itimerspec), - "::", - stringify!(it_interval) - ) + "Offset of field: __kernel_itimerspec::it_interval" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_itimerspec>())).it_value as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).it_value) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(__kernel_itimerspec), - "::", - stringify!(it_value) - ) + "Offset of field: __kernel_itimerspec::it_value" ); } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct __kernel_old_timeval { - pub tv_sec: __kernel_long_t, - pub tv_usec: __kernel_long_t, +pub struct __kernel_old_timespec { + pub tv_sec: __kernel_old_time_t, + pub tv_nsec: ::std::os::raw::c_long, } #[test] -fn bindgen_test_layout___kernel_old_timeval() { +fn bindgen_test_layout___kernel_old_timespec() { + const UNINIT: ::std::mem::MaybeUninit<__kernel_old_timespec> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - ::std::mem::size_of::<__kernel_old_timeval>(), + ::std::mem::size_of::<__kernel_old_timespec>(), 8usize, - concat!("Size of: ", stringify!(__kernel_old_timeval)) + "Size of __kernel_old_timespec" ); assert_eq!( - ::std::mem::align_of::<__kernel_old_timeval>(), + ::std::mem::align_of::<__kernel_old_timespec>(), 4usize, - concat!("Alignment of ", stringify!(__kernel_old_timeval)) + "Alignment of __kernel_old_timespec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_old_timeval>())).tv_sec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tv_sec) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__kernel_old_timeval), - "::", - stringify!(tv_sec) - ) + "Offset of field: __kernel_old_timespec::tv_sec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_old_timeval>())).tv_usec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tv_nsec) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(__kernel_old_timeval), - "::", - stringify!(tv_usec) - ) + "Offset of field: __kernel_old_timespec::tv_nsec" ); } #[repr(C)] @@ -6771,191 +5899,148 @@ pub struct __kernel_sock_timeval { } #[test] fn bindgen_test_layout___kernel_sock_timeval() { + const UNINIT: ::std::mem::MaybeUninit<__kernel_sock_timeval> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__kernel_sock_timeval>(), 16usize, - concat!("Size of: ", stringify!(__kernel_sock_timeval)) + "Size of __kernel_sock_timeval" ); assert_eq!( ::std::mem::align_of::<__kernel_sock_timeval>(), 8usize, - concat!("Alignment of ", stringify!(__kernel_sock_timeval)) + "Alignment of __kernel_sock_timeval" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_sock_timeval>())).tv_sec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tv_sec) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__kernel_sock_timeval), - "::", - stringify!(tv_sec) - ) + "Offset of field: __kernel_sock_timeval::tv_sec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_sock_timeval>())).tv_usec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tv_usec) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__kernel_sock_timeval), - "::", - stringify!(tv_usec) - ) + "Offset of field: __kernel_sock_timeval::tv_usec" ); } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct timeval { - pub tv_sec: __kernel_time_t, + pub tv_sec: __kernel_old_time_t, pub tv_usec: __kernel_suseconds_t, } #[test] fn bindgen_test_layout_timeval() { - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(timeval)) - ); + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!(::std::mem::size_of::(), 8usize, "Size of timeval"); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(timeval)) + "Alignment of timeval" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tv_sec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tv_sec) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(timeval), - "::", - stringify!(tv_sec) - ) + "Offset of field: timeval::tv_sec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tv_usec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tv_usec) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(timeval), - "::", - stringify!(tv_usec) - ) + "Offset of field: timeval::tv_usec" ); } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct timezone { - pub tz_minuteswest: ::std::os::raw::c_int, - pub tz_dsttime: ::std::os::raw::c_int, +pub struct itimerspec { + pub it_interval: timespec, + pub it_value: timespec, } #[test] -fn bindgen_test_layout_timezone() { +fn bindgen_test_layout_itimerspec() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(timezone)) + ::std::mem::size_of::(), + 16usize, + "Size of itimerspec" ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(timezone)) + "Alignment of itimerspec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tz_minuteswest as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).it_interval) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(timezone), - "::", - stringify!(tz_minuteswest) - ) + "Offset of field: itimerspec::it_interval" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tz_dsttime as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(timezone), - "::", - stringify!(tz_dsttime) - ) + unsafe { ::std::ptr::addr_of!((*ptr).it_value) as usize - ptr as usize }, + 8usize, + "Offset of field: itimerspec::it_value" ); } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct itimerspec { - pub it_interval: timespec, - pub it_value: timespec, +pub struct itimerval { + pub it_interval: timeval, + pub it_value: timeval, } #[test] -fn bindgen_test_layout_itimerspec() { +fn bindgen_test_layout_itimerval() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - ::std::mem::size_of::(), + ::std::mem::size_of::(), 16usize, - concat!("Size of: ", stringify!(itimerspec)) + "Size of itimerval" ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(itimerspec)) + "Alignment of itimerval" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).it_interval as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).it_interval) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(itimerspec), - "::", - stringify!(it_interval) - ) + "Offset of field: itimerval::it_interval" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).it_value as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).it_value) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(itimerspec), - "::", - stringify!(it_value) - ) + "Offset of field: itimerval::it_value" ); } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct itimerval { - pub it_interval: timeval, - pub it_value: timeval, +pub struct timezone { + pub tz_minuteswest: ::std::os::raw::c_int, + pub tz_dsttime: ::std::os::raw::c_int, } #[test] -fn bindgen_test_layout_itimerval() { +fn bindgen_test_layout_timezone() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(itimerval)) + ::std::mem::size_of::(), + 8usize, + "Size of timezone" ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(itimerval)) + "Alignment of timezone" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).it_interval as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tz_minuteswest) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(itimerval), - "::", - stringify!(it_interval) - ) + "Offset of field: timezone::tz_minuteswest" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).it_value as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(itimerval), - "::", - stringify!(it_value) - ) + unsafe { ::std::ptr::addr_of!((*ptr).tz_dsttime) as usize - ptr as usize }, + 4usize, + "Offset of field: timezone::tz_dsttime" ); } pub type fd_mask = ::std::os::raw::c_ulong; @@ -6966,43 +6051,36 @@ pub struct fd_set { } #[test] fn bindgen_test_layout_fd_set() { - assert_eq!( - ::std::mem::size_of::(), - 128usize, - concat!("Size of: ", stringify!(fd_set)) - ); + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!(::std::mem::size_of::(), 128usize, "Size of fd_set"); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(fd_set)) + "Alignment of fd_set" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fds_bits as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fds_bits) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(fd_set), - "::", - stringify!(fds_bits) - ) + "Offset of field: fd_set::fds_bits" ); } extern "C" { - pub fn __FD_CLR_chk(arg1: ::std::os::raw::c_int, arg2: *mut fd_set, arg3: size_t); + pub fn __FD_CLR_chk(arg1: ::std::os::raw::c_int, arg2: *mut fd_set, arg3: usize); } extern "C" { - pub fn __FD_SET_chk(arg1: ::std::os::raw::c_int, arg2: *mut fd_set, arg3: size_t); + pub fn __FD_SET_chk(arg1: ::std::os::raw::c_int, arg2: *mut fd_set, arg3: usize); } extern "C" { pub fn __FD_ISSET_chk( arg1: ::std::os::raw::c_int, arg2: *const fd_set, - arg3: size_t, + arg3: usize, ) -> ::std::os::raw::c_int; } extern "C" { pub fn select( - __fd_count: ::std::os::raw::c_int, + __max_fd_plus_one: ::std::os::raw::c_int, __read_fds: *mut fd_set, __write_fds: *mut fd_set, __exception_fds: *mut fd_set, @@ -7011,7 +6089,7 @@ extern "C" { } extern "C" { pub fn pselect( - __fd_count: ::std::os::raw::c_int, + __max_fd_plus_one: ::std::os::raw::c_int, __read_fds: *mut fd_set, __write_fds: *mut fd_set, __exception_fds: *mut fd_set, @@ -7021,7 +6099,7 @@ extern "C" { } extern "C" { pub fn pselect64( - __fd_count: ::std::os::raw::c_int, + __max_fd_plus_one: ::std::os::raw::c_int, __read_fds: *mut fd_set, __write_fds: *mut fd_set, __exception_fds: *mut fd_set, @@ -7086,125 +6164,64 @@ pub struct tm { } #[test] fn bindgen_test_layout_tm() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!(::std::mem::size_of::(), 44usize, "Size of tm"); + assert_eq!(::std::mem::align_of::(), 4usize, "Alignment of tm"); assert_eq!( - ::std::mem::size_of::(), - 44usize, - concat!("Size of: ", stringify!(tm)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(tm)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_sec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_sec) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_sec) - ) + "Offset of field: tm::tm_sec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_min as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_min) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_min) - ) + "Offset of field: tm::tm_min" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_hour as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_hour) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_hour) - ) + "Offset of field: tm::tm_hour" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_mday as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_mday) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_mday) - ) + "Offset of field: tm::tm_mday" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_mon as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_mon) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_mon) - ) + "Offset of field: tm::tm_mon" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_year as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_year) as usize - ptr as usize }, 20usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_year) - ) + "Offset of field: tm::tm_year" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_wday as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_wday) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_wday) - ) + "Offset of field: tm::tm_wday" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_yday as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_yday) as usize - ptr as usize }, 28usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_yday) - ) + "Offset of field: tm::tm_yday" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_isdst as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_isdst) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_isdst) - ) + "Offset of field: tm::tm_isdst" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_gmtoff as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_gmtoff) as usize - ptr as usize }, 36usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_gmtoff) - ) + "Offset of field: tm::tm_gmtoff" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_zone as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_zone) as usize - ptr as usize }, 40usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_zone) - ) + "Offset of field: tm::tm_zone" ); } extern "C" { @@ -7237,12 +6254,18 @@ extern "C" { extern "C" { pub fn localtime_r(__t: *const time_t, __tm: *mut tm) -> *mut tm; } +extern "C" { + pub fn timelocal(__tm: *mut tm) -> time_t; +} extern "C" { pub fn gmtime(__t: *const time_t) -> *mut tm; } extern "C" { pub fn gmtime_r(__t: *const time_t, __tm: *mut tm) -> *mut tm; } +extern "C" { + pub fn timegm(__tm: *mut tm) -> time_t; +} extern "C" { pub fn strptime( __s: *const ::std::os::raw::c_char, @@ -7261,19 +6284,19 @@ extern "C" { extern "C" { pub fn strftime( __buf: *mut ::std::os::raw::c_char, - __n: size_t, + __n: usize, __fmt: *const ::std::os::raw::c_char, __tm: *const tm, - ) -> size_t; + ) -> usize; } extern "C" { pub fn strftime_l( __buf: *mut ::std::os::raw::c_char, - __n: size_t, + __n: usize, __fmt: *const ::std::os::raw::c_char, __tm: *const tm, __l: locale_t, - ) -> size_t; + ) -> usize; } extern "C" { pub fn ctime(__t: *const time_t) -> *mut ::std::os::raw::c_char; @@ -7329,19 +6352,19 @@ extern "C" { ) -> ::std::os::raw::c_int; } extern "C" { - pub fn timer_gettime(__timer: timer_t, __ts: *mut itimerspec) -> ::std::os::raw::c_int; + pub fn timer_gettime(_timer: timer_t, __ts: *mut itimerspec) -> ::std::os::raw::c_int; } extern "C" { pub fn timer_getoverrun(__timer: timer_t) -> ::std::os::raw::c_int; } extern "C" { - pub fn timelocal(__tm: *mut tm) -> time_t; -} -extern "C" { - pub fn timegm(__tm: *mut tm) -> time_t; + pub fn timespec_get( + __ts: *mut timespec, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; } extern "C" { - pub fn timespec_get( + pub fn timespec_getres( __ts: *mut timespec, __base: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; @@ -7381,98 +6404,78 @@ pub struct clone_args { pub stack: __u64, pub stack_size: __u64, pub tls: __u64, + pub set_tid: __u64, + pub set_tid_size: __u64, + pub cgroup: __u64, } #[test] fn bindgen_test_layout_clone_args() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), - 64usize, - concat!("Size of: ", stringify!(clone_args)) + 88usize, + "Size of clone_args" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(clone_args)) + "Alignment of clone_args" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(clone_args), - "::", - stringify!(flags) - ) + "Offset of field: clone_args::flags" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).pidfd as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).pidfd) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(clone_args), - "::", - stringify!(pidfd) - ) + "Offset of field: clone_args::pidfd" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).child_tid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).child_tid) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(clone_args), - "::", - stringify!(child_tid) - ) + "Offset of field: clone_args::child_tid" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).parent_tid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).parent_tid) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(clone_args), - "::", - stringify!(parent_tid) - ) + "Offset of field: clone_args::parent_tid" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).exit_signal as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).exit_signal) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(clone_args), - "::", - stringify!(exit_signal) - ) + "Offset of field: clone_args::exit_signal" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).stack as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).stack) as usize - ptr as usize }, 40usize, - concat!( - "Offset of field: ", - stringify!(clone_args), - "::", - stringify!(stack) - ) + "Offset of field: clone_args::stack" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).stack_size as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).stack_size) as usize - ptr as usize }, 48usize, - concat!( - "Offset of field: ", - stringify!(clone_args), - "::", - stringify!(stack_size) - ) + "Offset of field: clone_args::stack_size" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tls as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tls) as usize - ptr as usize }, 56usize, - concat!( - "Offset of field: ", - stringify!(clone_args), - "::", - stringify!(tls) - ) + "Offset of field: clone_args::tls" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).set_tid) as usize - ptr as usize }, + 64usize, + "Offset of field: clone_args::set_tid" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).set_tid_size) as usize - ptr as usize }, + 72usize, + "Offset of field: clone_args::set_tid_size" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).cgroup) as usize - ptr as usize }, + 80usize, + "Offset of field: clone_args::cgroup" ); } #[repr(C)] @@ -7482,25 +6485,22 @@ pub struct sched_param { } #[test] fn bindgen_test_layout_sched_param() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 4usize, - concat!("Size of: ", stringify!(sched_param)) + "Size of sched_param" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(sched_param)) + "Alignment of sched_param" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sched_priority as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sched_priority) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sched_param), - "::", - stringify!(sched_priority) - ) + "Offset of field: sched_param::sched_priority" ); } extern "C" { @@ -7531,356 +6531,207 @@ extern "C" { extern "C" { pub fn sched_rr_get_interval(__pid: pid_t, __quantum: *mut timespec) -> ::std::os::raw::c_int; } -pub const PTHREAD_MUTEX_NORMAL: ::std::os::raw::c_uint = 0; -pub const PTHREAD_MUTEX_RECURSIVE: ::std::os::raw::c_uint = 1; -pub const PTHREAD_MUTEX_ERRORCHECK: ::std::os::raw::c_uint = 2; -pub const PTHREAD_MUTEX_ERRORCHECK_NP: ::std::os::raw::c_uint = 2; -pub const PTHREAD_MUTEX_RECURSIVE_NP: ::std::os::raw::c_uint = 1; -pub const PTHREAD_MUTEX_DEFAULT: ::std::os::raw::c_uint = 0; +pub const PTHREAD_MUTEX_NORMAL: _bindgen_ty_23 = 0; +pub const PTHREAD_MUTEX_RECURSIVE: _bindgen_ty_23 = 1; +pub const PTHREAD_MUTEX_ERRORCHECK: _bindgen_ty_23 = 2; +pub const PTHREAD_MUTEX_ERRORCHECK_NP: _bindgen_ty_23 = 2; +pub const PTHREAD_MUTEX_RECURSIVE_NP: _bindgen_ty_23 = 1; +pub const PTHREAD_MUTEX_DEFAULT: _bindgen_ty_23 = 0; pub type _bindgen_ty_23 = ::std::os::raw::c_uint; -pub const PTHREAD_RWLOCK_PREFER_READER_NP: ::std::os::raw::c_uint = 0; -pub const PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP: ::std::os::raw::c_uint = 1; +pub const PTHREAD_RWLOCK_PREFER_READER_NP: _bindgen_ty_24 = 0; +pub const PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP: _bindgen_ty_24 = 1; pub type _bindgen_ty_24 = ::std::os::raw::c_uint; -pub type __pthread_cleanup_func_t = - ::std::option::Option; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct __pthread_cleanup_t { pub __cleanup_prev: *mut __pthread_cleanup_t, - pub __cleanup_routine: __pthread_cleanup_func_t, + pub __cleanup_routine: + ::std::option::Option, pub __cleanup_arg: *mut ::std::os::raw::c_void, } #[test] fn bindgen_test_layout___pthread_cleanup_t() { + const UNINIT: ::std::mem::MaybeUninit<__pthread_cleanup_t> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__pthread_cleanup_t>(), 12usize, - concat!("Size of: ", stringify!(__pthread_cleanup_t)) + "Size of __pthread_cleanup_t" ); assert_eq!( ::std::mem::align_of::<__pthread_cleanup_t>(), 4usize, - concat!("Alignment of ", stringify!(__pthread_cleanup_t)) + "Alignment of __pthread_cleanup_t" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__pthread_cleanup_t>())).__cleanup_prev as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).__cleanup_prev) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__pthread_cleanup_t), - "::", - stringify!(__cleanup_prev) - ) + "Offset of field: __pthread_cleanup_t::__cleanup_prev" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__pthread_cleanup_t>())).__cleanup_routine as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).__cleanup_routine) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(__pthread_cleanup_t), - "::", - stringify!(__cleanup_routine) - ) + "Offset of field: __pthread_cleanup_t::__cleanup_routine" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__pthread_cleanup_t>())).__cleanup_arg as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).__cleanup_arg) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__pthread_cleanup_t), - "::", - stringify!(__cleanup_arg) - ) + "Offset of field: __pthread_cleanup_t::__cleanup_arg" ); } extern "C" { pub fn __pthread_cleanup_push( c: *mut __pthread_cleanup_t, - arg1: __pthread_cleanup_func_t, + arg1: ::std::option::Option, arg2: *mut ::std::os::raw::c_void, ); } extern "C" { pub fn __pthread_cleanup_pop(arg1: *mut __pthread_cleanup_t, arg2: ::std::os::raw::c_int); } -#[doc = " Data associated with an ALooper fd that will be returned as the \"outData\""] -#[doc = " when that source has data ready."] +#[doc = " Data associated with an ALooper fd that will be returned as the \"outData\"\n when that source has data ready."] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct android_poll_source { - #[doc = " The identifier of this source. May be LOOPER_ID_MAIN or"] - #[doc = " LOOPER_ID_INPUT."] + #[doc = " The identifier of this source. May be LOOPER_ID_MAIN or\n LOOPER_ID_INPUT."] pub id: i32, #[doc = " The android_app this ident is associated with."] pub app: *mut android_app, - #[doc = " Function to call to perform the standard processing of data from"] - #[doc = " this source."] + #[doc = " Function to call to perform the standard processing of data from\n this source."] pub process: ::std::option::Option< unsafe extern "C" fn(app: *mut android_app, source: *mut android_poll_source), >, } #[test] fn bindgen_test_layout_android_poll_source() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 12usize, - concat!("Size of: ", stringify!(android_poll_source)) + "Size of android_poll_source" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(android_poll_source)) + "Alignment of android_poll_source" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).id as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).id) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(android_poll_source), - "::", - stringify!(id) - ) + "Offset of field: android_poll_source::id" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).app as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).app) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(android_poll_source), - "::", - stringify!(app) - ) + "Offset of field: android_poll_source::app" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).process as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).process) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(android_poll_source), - "::", - stringify!(process) - ) + "Offset of field: android_poll_source::process" ); } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct android_input_buffer { - #[doc = " Pointer to a read-only array of pointers to GameActivityMotionEvent."] - #[doc = " Only the first motionEventsCount events are valid."] - pub motionEvents: [GameActivityMotionEvent; 16usize], + #[doc = " Pointer to a read-only array of GameActivityMotionEvent.\n Only the first motionEventsCount events are valid."] + pub motionEvents: *mut GameActivityMotionEvent, #[doc = " The number of valid motion events in `motionEvents`."] pub motionEventsCount: u64, - #[doc = " Pointer to a read-only array of pointers to GameActivityHistoricalPointerAxes."] - #[doc = ""] - #[doc = " Only the first historicalSamplesCount samples are valid."] - #[doc = " Refer to event->historicalStart, event->pointerCount and event->historicalCount"] - #[doc = " to access the specific samples that relate to an event."] - #[doc = ""] - #[doc = " Each slice of samples for one event has a length of"] - #[doc = " (event->pointerCount and event->historicalCount) and is in pointer-major"] - #[doc = " order so the historic samples for each pointer are contiguous."] - #[doc = " E.g. you would access historic sample index 3 for pointer 2 of an event with:"] - #[doc = ""] - #[doc = " historicalAxisSamples[event->historicalStart + (event->historicalCount * 2) + 3];"] - pub historicalAxisSamples: [GameActivityHistoricalPointerAxes; 64usize], - #[doc = " The number of valid historical samples in `historicalAxisSamples`."] - pub historicalSamplesCount: u64, - #[doc = " Pointer to a read-only array of pointers to GameActivityKeyEvent."] - #[doc = " Only the first keyEventsCount events are valid."] - pub keyEvents: [GameActivityKeyEvent; 4usize], + #[doc = " The size of the `motionEvents` buffer."] + pub motionEventsBufferSize: u64, + #[doc = " Pointer to a read-only array of GameActivityKeyEvent.\n Only the first keyEventsCount events are valid."] + pub keyEvents: *mut GameActivityKeyEvent, #[doc = " The number of valid \"Key\" events in `keyEvents`."] pub keyEventsCount: u64, + #[doc = " The size of the `keyEvents` buffer."] + pub keyEventsBufferSize: u64, } #[test] fn bindgen_test_layout_android_input_buffer() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), - 40824usize, - concat!("Size of: ", stringify!(android_input_buffer)) + 48usize, + "Size of android_input_buffer" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(android_input_buffer)) + "Alignment of android_input_buffer" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).motionEvents as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).motionEvents) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(android_input_buffer), - "::", - stringify!(motionEvents) - ) + "Offset of field: android_input_buffer::motionEvents" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).motionEventsCount as *const _ as usize - }, - 27776usize, - concat!( - "Offset of field: ", - stringify!(android_input_buffer), - "::", - stringify!(motionEventsCount) - ) + unsafe { ::std::ptr::addr_of!((*ptr).motionEventsCount) as usize - ptr as usize }, + 8usize, + "Offset of field: android_input_buffer::motionEventsCount" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).historicalAxisSamples as *const _ - as usize - }, - 27784usize, - concat!( - "Offset of field: ", - stringify!(android_input_buffer), - "::", - stringify!(historicalAxisSamples) - ) + unsafe { ::std::ptr::addr_of!((*ptr).motionEventsBufferSize) as usize - ptr as usize }, + 16usize, + "Offset of field: android_input_buffer::motionEventsBufferSize" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).historicalSamplesCount as *const _ - as usize - }, - 40584usize, - concat!( - "Offset of field: ", - stringify!(android_input_buffer), - "::", - stringify!(historicalSamplesCount) - ) + unsafe { ::std::ptr::addr_of!((*ptr).keyEvents) as usize - ptr as usize }, + 24usize, + "Offset of field: android_input_buffer::keyEvents" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).keyEvents as *const _ as usize }, - 40592usize, - concat!( - "Offset of field: ", - stringify!(android_input_buffer), - "::", - stringify!(keyEvents) - ) + unsafe { ::std::ptr::addr_of!((*ptr).keyEventsCount) as usize - ptr as usize }, + 32usize, + "Offset of field: android_input_buffer::keyEventsCount" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).keyEventsCount as *const _ as usize - }, - 40816usize, - concat!( - "Offset of field: ", - stringify!(android_input_buffer), - "::", - stringify!(keyEventsCount) - ) - ); -} -#[doc = " Function pointer declaration for the filtering of key events."] -#[doc = " A function with this signature should be passed to"] -#[doc = " android_app_set_key_event_filter and return false for any events that should"] -#[doc = " not be handled by android_native_app_glue. These events will be handled by"] -#[doc = " the system instead."] + unsafe { ::std::ptr::addr_of!((*ptr).keyEventsBufferSize) as usize - ptr as usize }, + 40usize, + "Offset of field: android_input_buffer::keyEventsBufferSize" + ); +} +#[doc = " Function pointer declaration for the filtering of key events.\n A function with this signature should be passed to\n android_app_set_key_event_filter and return false for any events that should\n not be handled by android_native_app_glue. These events will be handled by\n the system instead."] pub type android_key_event_filter = ::std::option::Option bool>; -#[doc = " Function pointer definition for the filtering of motion events."] -#[doc = " A function with this signature should be passed to"] -#[doc = " android_app_set_motion_event_filter and return false for any events that"] -#[doc = " should not be handled by android_native_app_glue. These events will be"] -#[doc = " handled by the system instead."] +#[doc = " Function pointer definition for the filtering of motion events.\n A function with this signature should be passed to\n android_app_set_motion_event_filter and return false for any events that\n should not be handled by android_native_app_glue. These events will be\n handled by the system instead."] pub type android_motion_event_filter = ::std::option::Option bool>; -#[doc = " The GameActivity interface provided by "] -#[doc = " is based on a set of application-provided callbacks that will be called"] -#[doc = " by the Activity's main thread when certain events occur."] -#[doc = ""] -#[doc = " This means that each one of this callbacks _should_ _not_ block, or they"] -#[doc = " risk having the system force-close the application. This programming"] -#[doc = " model is direct, lightweight, but constraining."] -#[doc = ""] -#[doc = " The 'android_native_app_glue' static library is used to provide a different"] -#[doc = " execution model where the application can implement its own main event"] -#[doc = " loop in a different thread instead. Here's how it works:"] -#[doc = ""] -#[doc = " 1/ The application must provide a function named \"android_main()\" that"] -#[doc = " will be called when the activity is created, in a new thread that is"] -#[doc = " distinct from the activity's main thread."] -#[doc = ""] -#[doc = " 2/ android_main() receives a pointer to a valid \"android_app\" structure"] -#[doc = " that contains references to other important objects, e.g. the"] -#[doc = " GameActivity obejct instance the application is running in."] -#[doc = ""] -#[doc = " 3/ the \"android_app\" object holds an ALooper instance that already"] -#[doc = " listens to activity lifecycle events (e.g. \"pause\", \"resume\")."] -#[doc = " See APP_CMD_XXX declarations below."] -#[doc = ""] -#[doc = " This corresponds to an ALooper identifier returned by"] -#[doc = " ALooper_pollOnce with value LOOPER_ID_MAIN."] -#[doc = ""] -#[doc = " Your application can use the same ALooper to listen to additional"] -#[doc = " file-descriptors. They can either be callback based, or with return"] -#[doc = " identifiers starting with LOOPER_ID_USER."] -#[doc = ""] -#[doc = " 4/ Whenever you receive a LOOPER_ID_MAIN event,"] -#[doc = " the returned data will point to an android_poll_source structure. You"] -#[doc = " can call the process() function on it, and fill in android_app->onAppCmd"] -#[doc = " to be called for your own processing of the event."] -#[doc = ""] -#[doc = " Alternatively, you can call the low-level functions to read and process"] -#[doc = " the data directly... look at the process_cmd() and process_input()"] -#[doc = " implementations in the glue to see how to do this."] -#[doc = ""] -#[doc = " See the sample named \"native-activity\" that comes with the NDK with a"] -#[doc = " full usage example. Also look at the documentation of GameActivity."] +#[doc = " The GameActivity interface provided by \n is based on a set of application-provided callbacks that will be called\n by the Activity's main thread when certain events occur.\n\n This means that each one of this callbacks _should_ _not_ block, or they\n risk having the system force-close the application. This programming\n model is direct, lightweight, but constraining.\n\n The 'android_native_app_glue' static library is used to provide a different\n execution model where the application can implement its own main event\n loop in a different thread instead. Here's how it works:\n\n 1/ The application must provide a function named \"android_main()\" that\n will be called when the activity is created, in a new thread that is\n distinct from the activity's main thread.\n\n 2/ android_main() receives a pointer to a valid \"android_app\" structure\n that contains references to other important objects, e.g. the\n GameActivity obejct instance the application is running in.\n\n 3/ the \"android_app\" object holds an ALooper instance that already\n listens to activity lifecycle events (e.g. \"pause\", \"resume\").\n See APP_CMD_XXX declarations below.\n\n This corresponds to an ALooper identifier returned by\n ALooper_pollOnce with value LOOPER_ID_MAIN.\n\n Your application can use the same ALooper to listen to additional\n file-descriptors. They can either be callback based, or with return\n identifiers starting with LOOPER_ID_USER.\n\n 4/ Whenever you receive a LOOPER_ID_MAIN event,\n the returned data will point to an android_poll_source structure. You\n can call the process() function on it, and fill in android_app->onAppCmd\n to be called for your own processing of the event.\n\n Alternatively, you can call the low-level functions to read and process\n the data directly... look at the process_cmd() and process_input()\n implementations in the glue to see how to do this.\n\n See the sample named \"native-activity\" that comes with the NDK with a\n full usage example. Also look at the documentation of GameActivity."] #[repr(C)] pub struct android_app { #[doc = " An optional pointer to application-defined state."] pub userData: *mut ::std::os::raw::c_void, - #[doc = " A required callback for processing main app commands (`APP_CMD_*`)."] - #[doc = " This is called each frame if there are app commands that need processing."] + #[doc = " A required callback for processing main app commands (`APP_CMD_*`).\n This is called each frame if there are app commands that need processing."] pub onAppCmd: ::std::option::Option, #[doc = " The GameActivity object instance that this app is running in."] pub activity: *mut GameActivity, #[doc = " The current configuration the app is running in."] pub config: *mut AConfiguration, - #[doc = " The last activity saved state, as provided at creation time."] - #[doc = " It is NULL if there was no state. You can use this as you need; the"] - #[doc = " memory will remain around until you call android_app_exec_cmd() for"] - #[doc = " APP_CMD_RESUME, at which point it will be freed and savedState set to"] - #[doc = " NULL. These variables should only be changed when processing a"] - #[doc = " APP_CMD_SAVE_STATE, at which point they will be initialized to NULL and"] - #[doc = " you can malloc your state and place the information here. In that case"] - #[doc = " the memory will be freed for you later."] + #[doc = " The last activity saved state, as provided at creation time.\n It is NULL if there was no state. You can use this as you need; the\n memory will remain around until you call android_app_exec_cmd() for\n APP_CMD_RESUME, at which point it will be freed and savedState set to\n NULL. These variables should only be changed when processing a\n APP_CMD_SAVE_STATE, at which point they will be initialized to NULL and\n you can malloc your state and place the information here. In that case\n the memory will be freed for you later."] pub savedState: *mut ::std::os::raw::c_void, #[doc = " The size of the activity saved state. It is 0 if `savedState` is NULL."] - pub savedStateSize: size_t, + pub savedStateSize: usize, #[doc = " The ALooper associated with the app's thread."] pub looper: *mut ALooper, #[doc = " When non-NULL, this is the window surface that the app can draw in."] pub window: *mut ANativeWindow, - #[doc = " Current content rectangle of the window; this is the area where the"] - #[doc = " window's content should be placed to be seen by the user."] + #[doc = " Current content rectangle of the window; this is the area where the\n window's content should be placed to be seen by the user."] pub contentRect: ARect, - #[doc = " Current state of the app's activity. May be either APP_CMD_START,"] - #[doc = " APP_CMD_RESUME, APP_CMD_PAUSE, or APP_CMD_STOP."] + #[doc = " Whether the software keyboard is visible or not."] + 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 = " 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"] - #[doc = " destroyed and waiting for the app thread to complete."] + #[doc = " This is non-zero when the application's GameActivity is being\n destroyed and waiting for the app thread to complete."] pub destroyRequested: ::std::os::raw::c_int, - #[doc = " This is used for buffering input from GameActivity. Once ready, the"] - #[doc = " application thread switches the buffers and processes what was"] - #[doc = " accumulated."] + #[doc = " This is used for buffering input from GameActivity. Once ready, the\n application thread switches the buffers and processes what was\n accumulated."] pub inputBuffers: [android_input_buffer; 2usize], pub currentInputBuffer: ::std::os::raw::c_int, - #[doc = " 0 if no text input event is outstanding, 1 if it is."] - #[doc = " Use `GameActivity_getTextInputState` to get information"] - #[doc = " about the text entered by the user."] + #[doc = " 0 if no text input event is outstanding, 1 if it is.\n Use `GameActivity_getTextInputState` to get information\n about the text entered by the user."] pub textInputState: ::std::os::raw::c_int, #[doc = " @cond INTERNAL"] pub mutex: pthread_mutex_t, @@ -7902,457 +6753,273 @@ pub struct android_app { } #[test] fn bindgen_test_layout_android_app() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), - 81792usize, - concat!("Size of: ", stringify!(android_app)) + 248usize, + "Size of android_app" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(android_app)) + "Alignment of android_app" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).userData as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).userData) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(userData) - ) + "Offset of field: android_app::userData" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).onAppCmd as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).onAppCmd) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(onAppCmd) - ) + "Offset of field: android_app::onAppCmd" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).activity as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).activity) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(activity) - ) + "Offset of field: android_app::activity" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).config as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).config) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(config) - ) + "Offset of field: android_app::config" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).savedState as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).savedState) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(savedState) - ) + "Offset of field: android_app::savedState" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).savedStateSize as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).savedStateSize) as usize - ptr as usize }, 20usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(savedStateSize) - ) + "Offset of field: android_app::savedStateSize" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).looper as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).looper) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(looper) - ) + "Offset of field: android_app::looper" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).window as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).window) as usize - ptr as usize }, 28usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(window) - ) + "Offset of field: android_app::window" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).contentRect as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).contentRect) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(contentRect) - ) + "Offset of field: android_app::contentRect" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).activityState as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).softwareKeyboardVisible) as usize - ptr as usize }, 48usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(activityState) - ) + "Offset of field: android_app::softwareKeyboardVisible" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).destroyRequested as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).editorAction) as usize - ptr as usize }, 52usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(destroyRequested) - ) + "Offset of field: android_app::editorAction" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).inputBuffers as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).activityState) as usize - ptr as usize }, 56usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(inputBuffers) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).currentInputBuffer as *const _ as usize }, - 81704usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(currentInputBuffer) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).textInputState as *const _ as usize }, - 81708usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(textInputState) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).mutex as *const _ as usize }, - 81712usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(mutex) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).cond as *const _ as usize }, - 81716usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(cond) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).msgread as *const _ as usize }, - 81720usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(msgread) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).msgwrite as *const _ as usize }, - 81724usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(msgwrite) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).thread as *const _ as usize }, - 81728usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(thread) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).cmdPollSource as *const _ as usize }, - 81732usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(cmdPollSource) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).running as *const _ as usize }, - 81744usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(running) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).stateSaved as *const _ as usize }, - 81748usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(stateSaved) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).destroyed as *const _ as usize }, - 81752usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(destroyed) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).redrawNeeded as *const _ as usize }, - 81756usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(redrawNeeded) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).pendingWindow as *const _ as usize }, - 81760usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(pendingWindow) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).pendingContentRect as *const _ as usize }, - 81764usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(pendingContentRect) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).keyEventFilter as *const _ as usize }, - 81780usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(keyEventFilter) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).motionEventFilter as *const _ as usize }, - 81784usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(motionEventFilter) - ) + "Offset of field: android_app::activityState" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).inputAvailableWakeUp as *const _ as usize - }, - 81788usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(inputAvailableWakeUp) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).inputSwapPending as *const _ as usize }, - 81789usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(inputSwapPending) - ) - ); -} -#[doc = " Looper data ID of commands coming from the app's main thread, which"] -#[doc = " is returned as an identifier from ALooper_pollOnce(). The data for this"] -#[doc = " identifier is a pointer to an android_poll_source structure."] -#[doc = " These can be retrieved and processed with android_app_read_cmd()"] -#[doc = " and android_app_exec_cmd()."] + unsafe { ::std::ptr::addr_of!((*ptr).destroyRequested) as usize - ptr as usize }, + 60usize, + "Offset of field: android_app::destroyRequested" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).inputBuffers) as usize - ptr as usize }, + 64usize, + "Offset of field: android_app::inputBuffers" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).currentInputBuffer) as usize - ptr as usize }, + 160usize, + "Offset of field: android_app::currentInputBuffer" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).textInputState) as usize - ptr as usize }, + 164usize, + "Offset of field: android_app::textInputState" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mutex) as usize - ptr as usize }, + 168usize, + "Offset of field: android_app::mutex" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).cond) as usize - ptr as usize }, + 172usize, + "Offset of field: android_app::cond" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).msgread) as usize - ptr as usize }, + 176usize, + "Offset of field: android_app::msgread" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).msgwrite) as usize - ptr as usize }, + 180usize, + "Offset of field: android_app::msgwrite" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).thread) as usize - ptr as usize }, + 184usize, + "Offset of field: android_app::thread" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).cmdPollSource) as usize - ptr as usize }, + 188usize, + "Offset of field: android_app::cmdPollSource" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).running) as usize - ptr as usize }, + 200usize, + "Offset of field: android_app::running" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).stateSaved) as usize - ptr as usize }, + 204usize, + "Offset of field: android_app::stateSaved" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).destroyed) as usize - ptr as usize }, + 208usize, + "Offset of field: android_app::destroyed" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).redrawNeeded) as usize - ptr as usize }, + 212usize, + "Offset of field: android_app::redrawNeeded" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pendingWindow) as usize - ptr as usize }, + 216usize, + "Offset of field: android_app::pendingWindow" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pendingContentRect) as usize - ptr as usize }, + 220usize, + "Offset of field: android_app::pendingContentRect" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).keyEventFilter) as usize - ptr as usize }, + 236usize, + "Offset of field: android_app::keyEventFilter" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).motionEventFilter) as usize - ptr as usize }, + 240usize, + "Offset of field: android_app::motionEventFilter" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).inputAvailableWakeUp) as usize - ptr as usize }, + 244usize, + "Offset of field: android_app::inputAvailableWakeUp" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).inputSwapPending) as usize - ptr as usize }, + 245usize, + "Offset of field: android_app::inputSwapPending" + ); +} +#[doc = " Looper data ID of commands coming from the app's main thread, which\n is returned as an identifier from ALooper_pollOnce(). The data for this\n identifier is a pointer to an android_poll_source structure.\n These can be retrieved and processed with android_app_read_cmd()\n and android_app_exec_cmd()."] pub const NativeAppGlueLooperId_LOOPER_ID_MAIN: NativeAppGlueLooperId = 1; -#[doc = " Unused. Reserved for future use when usage of AInputQueue will be"] -#[doc = " supported."] +#[doc = " Unused. Reserved for future use when usage of AInputQueue will be\n supported."] pub const NativeAppGlueLooperId_LOOPER_ID_INPUT: NativeAppGlueLooperId = 2; #[doc = " Start of user-defined ALooper identifiers."] pub const NativeAppGlueLooperId_LOOPER_ID_USER: NativeAppGlueLooperId = 3; -#[doc = " Looper ID of commands coming from the app's main thread, an AInputQueue or"] -#[doc = " user-defined sources."] -pub type NativeAppGlueLooperId = ::std::os::raw::c_uint; -#[doc = " Unused. Reserved for future use when usage of AInputQueue will be"] -#[doc = " supported."] +#[doc = " Looper ID of commands coming from the app's main thread, an AInputQueue or\n user-defined sources."] +pub type NativeAppGlueLooperId = i8; +#[doc = " Unused. Reserved for future use when usage of AInputQueue will be\n supported."] pub const NativeAppGlueAppCmd_UNUSED_APP_CMD_INPUT_CHANGED: NativeAppGlueAppCmd = 0; -#[doc = " Command from main thread: a new ANativeWindow is ready for use. Upon"] -#[doc = " receiving this command, android_app->window will contain the new window"] -#[doc = " surface."] +#[doc = " Command from main thread: a new ANativeWindow is ready for use. Upon\n receiving this command, android_app->window will contain the new window\n surface."] pub const NativeAppGlueAppCmd_APP_CMD_INIT_WINDOW: NativeAppGlueAppCmd = 1; -#[doc = " Command from main thread: the existing ANativeWindow needs to be"] -#[doc = " terminated. Upon receiving this command, android_app->window still"] -#[doc = " contains the existing window; after calling android_app_exec_cmd"] -#[doc = " it will be set to NULL."] +#[doc = " Command from main thread: the existing ANativeWindow needs to be\n terminated. Upon receiving this command, android_app->window still\n contains the existing window; after calling android_app_exec_cmd\n it will be set to NULL."] pub const NativeAppGlueAppCmd_APP_CMD_TERM_WINDOW: NativeAppGlueAppCmd = 2; -#[doc = " Command from main thread: the current ANativeWindow has been resized."] -#[doc = " Please redraw with its new size."] +#[doc = " Command from main thread: the current ANativeWindow has been resized.\n Please redraw with its new size."] pub const NativeAppGlueAppCmd_APP_CMD_WINDOW_RESIZED: NativeAppGlueAppCmd = 3; -#[doc = " Command from main thread: the system needs that the current ANativeWindow"] -#[doc = " be redrawn. You should redraw the window before handing this to"] -#[doc = " android_app_exec_cmd() in order to avoid transient drawing glitches."] +#[doc = " Command from main thread: the system needs that the current ANativeWindow\n be redrawn. You should redraw the window before handing this to\n android_app_exec_cmd() in order to avoid transient drawing glitches."] pub const NativeAppGlueAppCmd_APP_CMD_WINDOW_REDRAW_NEEDED: NativeAppGlueAppCmd = 4; -#[doc = " Command from main thread: the content area of the window has changed,"] -#[doc = " such as from the soft input window being shown or hidden. You can"] -#[doc = " find the new content rect in android_app::contentRect."] +#[doc = " Command from main thread: the content area of the window has changed,\n such as from the soft input window being shown or hidden. You can\n find the new content rect in android_app::contentRect."] pub const NativeAppGlueAppCmd_APP_CMD_CONTENT_RECT_CHANGED: NativeAppGlueAppCmd = 5; -#[doc = " Command from main thread: the app's activity window has gained"] -#[doc = " input focus."] -pub const NativeAppGlueAppCmd_APP_CMD_GAINED_FOCUS: NativeAppGlueAppCmd = 6; -#[doc = " Command from main thread: the app's activity window has lost"] -#[doc = " input focus."] -pub const NativeAppGlueAppCmd_APP_CMD_LOST_FOCUS: NativeAppGlueAppCmd = 7; +#[doc = " Command from main thread: the software keyboard was shown or hidden."] +pub const NativeAppGlueAppCmd_APP_CMD_SOFTWARE_KB_VIS_CHANGED: NativeAppGlueAppCmd = 6; +#[doc = " Command from main thread: the app's activity window has gained\n input focus."] +pub const NativeAppGlueAppCmd_APP_CMD_GAINED_FOCUS: NativeAppGlueAppCmd = 7; +#[doc = " Command from main thread: the app's activity window has lost\n input focus."] +pub const NativeAppGlueAppCmd_APP_CMD_LOST_FOCUS: NativeAppGlueAppCmd = 8; #[doc = " Command from main thread: the current device configuration has changed."] -pub const NativeAppGlueAppCmd_APP_CMD_CONFIG_CHANGED: NativeAppGlueAppCmd = 8; -#[doc = " Command from main thread: the system is running low on memory."] -#[doc = " Try to reduce your memory use."] -pub const NativeAppGlueAppCmd_APP_CMD_LOW_MEMORY: NativeAppGlueAppCmd = 9; +pub const NativeAppGlueAppCmd_APP_CMD_CONFIG_CHANGED: NativeAppGlueAppCmd = 9; +#[doc = " Command from main thread: the system is running low on memory.\n Try to reduce your memory use."] +pub const NativeAppGlueAppCmd_APP_CMD_LOW_MEMORY: NativeAppGlueAppCmd = 10; #[doc = " Command from main thread: the app's activity has been started."] -pub const NativeAppGlueAppCmd_APP_CMD_START: NativeAppGlueAppCmd = 10; +pub const NativeAppGlueAppCmd_APP_CMD_START: NativeAppGlueAppCmd = 11; #[doc = " Command from main thread: the app's activity has been resumed."] -pub const NativeAppGlueAppCmd_APP_CMD_RESUME: NativeAppGlueAppCmd = 11; -#[doc = " Command from main thread: the app should generate a new saved state"] -#[doc = " for itself, to restore from later if needed. If you have saved state,"] -#[doc = " allocate it with malloc and place it in android_app.savedState with"] -#[doc = " the size in android_app.savedStateSize. The will be freed for you"] -#[doc = " later."] -pub const NativeAppGlueAppCmd_APP_CMD_SAVE_STATE: NativeAppGlueAppCmd = 12; +pub const NativeAppGlueAppCmd_APP_CMD_RESUME: NativeAppGlueAppCmd = 12; +#[doc = " Command from main thread: the app should generate a new saved state\n for itself, to restore from later if needed. If you have saved state,\n allocate it with malloc and place it in android_app.savedState with\n the size in android_app.savedStateSize. The will be freed for you\n later."] +pub const NativeAppGlueAppCmd_APP_CMD_SAVE_STATE: NativeAppGlueAppCmd = 13; #[doc = " Command from main thread: the app's activity has been paused."] -pub const NativeAppGlueAppCmd_APP_CMD_PAUSE: NativeAppGlueAppCmd = 13; +pub const NativeAppGlueAppCmd_APP_CMD_PAUSE: NativeAppGlueAppCmd = 14; #[doc = " Command from main thread: the app's activity has been stopped."] -pub const NativeAppGlueAppCmd_APP_CMD_STOP: NativeAppGlueAppCmd = 14; -#[doc = " Command from main thread: the app's activity is being destroyed,"] -#[doc = " and waiting for the app thread to clean up and exit before proceeding."] -pub const NativeAppGlueAppCmd_APP_CMD_DESTROY: NativeAppGlueAppCmd = 15; +pub const NativeAppGlueAppCmd_APP_CMD_STOP: NativeAppGlueAppCmd = 15; +#[doc = " Command from main thread: the app's activity is being destroyed,\n and waiting for the app thread to clean up and exit before proceeding."] +pub const NativeAppGlueAppCmd_APP_CMD_DESTROY: NativeAppGlueAppCmd = 16; #[doc = " Command from main thread: the app's insets have changed."] -pub const NativeAppGlueAppCmd_APP_CMD_WINDOW_INSETS_CHANGED: NativeAppGlueAppCmd = 16; -#[doc = " Commands passed from the application's main Java thread to the game's thread."] -pub type NativeAppGlueAppCmd = ::std::os::raw::c_uint; +pub const NativeAppGlueAppCmd_APP_CMD_WINDOW_INSETS_CHANGED: NativeAppGlueAppCmd = 17; +#[doc = " Commands passed from the application's main Java thread to the game's thread.\n\n Values from 0 to 127 are reserved for this library; values from -128 to -1\n can be used for custom user's events."] +pub type NativeAppGlueAppCmd = i8; extern "C" { - #[doc = " Call when ALooper_pollAll() returns LOOPER_ID_MAIN, reading the next"] - #[doc = " app command message."] + #[doc = " Call when ALooper_pollAll() returns LOOPER_ID_MAIN, reading the next\n app command message."] pub fn android_app_read_cmd(android_app: *mut android_app) -> i8; } extern "C" { - #[doc = " Call with the command returned by android_app_read_cmd() to do the"] - #[doc = " initial pre-processing of the given command. You can perform your own"] - #[doc = " actions for the command after calling this function."] + #[doc = " Call with the command returned by android_app_read_cmd() to do the\n initial pre-processing of the given command. You can perform your own\n actions for the command after calling this function."] pub fn android_app_pre_exec_cmd(android_app: *mut android_app, cmd: i8); } extern "C" { - #[doc = " Call with the command returned by android_app_read_cmd() to do the"] - #[doc = " final post-processing of the given command. You must have done your own"] - #[doc = " actions for the command before calling this function."] + #[doc = " Call with the command returned by android_app_read_cmd() to do the\n final post-processing of the given command. You must have done your own\n actions for the command before calling this function."] pub fn android_app_post_exec_cmd(android_app: *mut android_app, cmd: i8); } extern "C" { - #[doc = " Call this before processing input events to get the events buffer."] - #[doc = " The function returns NULL if there are no events to process."] + #[doc = " Call this before processing input events to get the events buffer.\n The function returns NULL if there are no events to process."] pub fn android_app_swap_input_buffers( android_app: *mut android_app, ) -> *mut android_input_buffer; } extern "C" { - #[doc = " Clear the array of motion events that were waiting to be handled, and release"] - #[doc = " each of them."] - #[doc = ""] - #[doc = " This method should be called after you have processed the motion events in"] - #[doc = " your game loop. You should handle events at each iteration of your game loop."] + #[doc = " Clear the array of motion events that were waiting to be handled, and release\n each of them.\n\n This method should be called after you have processed the motion events in\n your game loop. You should handle events at each iteration of your game loop."] pub fn android_app_clear_motion_events(inputBuffer: *mut android_input_buffer); } extern "C" { - #[doc = " Clear the array of key events that were waiting to be handled, and release"] - #[doc = " each of them."] - #[doc = ""] - #[doc = " This method should be called after you have processed the key up events in"] - #[doc = " your game loop. You should handle events at each iteration of your game loop."] + #[doc = " Clear the array of key events that were waiting to be handled, and release\n each of them.\n\n This method should be called after you have processed the key up events in\n your game loop. You should handle events at each iteration of your game loop."] pub fn android_app_clear_key_events(inputBuffer: *mut android_input_buffer); } extern "C" { - #[doc = " This is a springboard into the Rust glue layer that wraps calling the"] - #[doc = " main entry for the app itself."] + #[doc = " This is a springboard into the Rust glue layer that wraps calling the\n main entry for the app itself."] pub fn _rust_glue_entry(app: *mut android_app); } extern "C" { - #[doc = " Set the filter to use when processing key events."] - #[doc = " Any events for which the filter returns false will be ignored by"] - #[doc = " android_native_app_glue. If filter is set to NULL, no filtering is done."] - #[doc = ""] - #[doc = " The default key filter will filter out volume and camera button presses."] + #[doc = " Set the filter to use when processing key events.\n Any events for which the filter returns false will be ignored by\n android_native_app_glue. If filter is set to NULL, no filtering is done.\n\n The default key filter will filter out volume and camera button presses."] pub fn android_app_set_key_event_filter( app: *mut android_app, filter: android_key_event_filter, ); } extern "C" { - #[doc = " Set the filter to use when processing touch and motion events."] - #[doc = " Any events for which the filter returns false will be ignored by"] - #[doc = " android_native_app_glue. If filter is set to NULL, no filtering is done."] - #[doc = ""] - #[doc = " Note that the default motion event filter will only allow touchscreen events"] - #[doc = " through, in order to mimic NativeActivity's behaviour, so for controller"] - #[doc = " events to be passed to the app, set the filter to NULL."] + #[doc = " Set the filter to use when processing touch and motion events.\n Any events for which the filter returns false will be ignored by\n android_native_app_glue. If filter is set to NULL, no filtering is done.\n\n Note that the default motion event filter will only allow touchscreen events\n through, in order to mimic NativeActivity's behaviour, so for controller\n events to be passed to the app, set the filter to NULL."] pub fn android_app_set_motion_event_filter( app: *mut android_app, filter: android_motion_event_filter, ); } +extern "C" { + #[doc = " You can send your custom events using the function below.\n\n Make sure your custom codes do not overlap with this library's ones.\n\n Values from 0 to 127 are reserved for this library; values from -128 to -1\n can be used for custom user's events."] + pub fn android_app_write_cmd(android_app: *mut android_app, cmd: i8); +} extern "C" { #[doc = " Determines if a looper wake up was due to new input becoming available"] pub fn android_app_input_available_wake_up(app: *mut android_app) -> bool; diff --git a/android-activity/src/game_activity/ffi_i686.rs b/android-activity/src/game_activity/ffi_i686.rs index 65c9cc98..42426aad 100644 --- a/android-activity/src/game_activity/ffi_i686.rs +++ b/android-activity/src/game_activity/ffi_i686.rs @@ -1,4 +1,4 @@ -/* automatically generated by rust-bindgen 0.59.2 */ +/* automatically generated by rust-bindgen 0.71.1 */ pub const __BIONIC__: u32 = 1; pub const __WORDSIZE: u32 = 32; @@ -21,10 +21,15 @@ pub const __ANDROID_API_O_MR1__: u32 = 27; pub const __ANDROID_API_P__: u32 = 28; pub const __ANDROID_API_Q__: u32 = 29; pub const __ANDROID_API_R__: u32 = 30; -pub const __NDK_MAJOR__: u32 = 21; +pub const __ANDROID_API_S__: u32 = 31; +pub const __ANDROID_API_T__: u32 = 33; +pub const __ANDROID_API_U__: u32 = 34; +pub const __ANDROID_API_V__: u32 = 35; +pub const __ANDROID_NDK__: u32 = 1; +pub const __NDK_MAJOR__: u32 = 26; pub const __NDK_MINOR__: u32 = 1; pub const __NDK_BETA__: u32 = 0; -pub const __NDK_BUILD__: u32 = 6352462; +pub const __NDK_BUILD__: u32 = 10909125; pub const __NDK_CANARY__: u32 = 0; pub const INT8_MIN: i32 = -128; pub const INT8_MAX: u32 = 127; @@ -63,135 +68,183 @@ pub const SIZE_MAX: u32 = 4294967295; pub const __BITS_PER_LONG: u32 = 32; pub const __FD_SETSIZE: u32 = 1024; pub const AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT: u32 = 8; -pub const __PRI_64_prefix: &[u8; 3usize] = b"ll\0"; -pub const PRId8: &[u8; 2usize] = b"d\0"; -pub const PRId16: &[u8; 2usize] = b"d\0"; -pub const PRId32: &[u8; 2usize] = b"d\0"; -pub const PRId64: &[u8; 4usize] = b"lld\0"; -pub const PRIdLEAST8: &[u8; 2usize] = b"d\0"; -pub const PRIdLEAST16: &[u8; 2usize] = b"d\0"; -pub const PRIdLEAST32: &[u8; 2usize] = b"d\0"; -pub const PRIdLEAST64: &[u8; 4usize] = b"lld\0"; -pub const PRIdFAST8: &[u8; 2usize] = b"d\0"; -pub const PRIdFAST64: &[u8; 4usize] = b"lld\0"; -pub const PRIdMAX: &[u8; 3usize] = b"jd\0"; -pub const PRIi8: &[u8; 2usize] = b"i\0"; -pub const PRIi16: &[u8; 2usize] = b"i\0"; -pub const PRIi32: &[u8; 2usize] = b"i\0"; -pub const PRIi64: &[u8; 4usize] = b"lli\0"; -pub const PRIiLEAST8: &[u8; 2usize] = b"i\0"; -pub const PRIiLEAST16: &[u8; 2usize] = b"i\0"; -pub const PRIiLEAST32: &[u8; 2usize] = b"i\0"; -pub const PRIiLEAST64: &[u8; 4usize] = b"lli\0"; -pub const PRIiFAST8: &[u8; 2usize] = b"i\0"; -pub const PRIiFAST64: &[u8; 4usize] = b"lli\0"; -pub const PRIiMAX: &[u8; 3usize] = b"ji\0"; -pub const PRIo8: &[u8; 2usize] = b"o\0"; -pub const PRIo16: &[u8; 2usize] = b"o\0"; -pub const PRIo32: &[u8; 2usize] = b"o\0"; -pub const PRIo64: &[u8; 4usize] = b"llo\0"; -pub const PRIoLEAST8: &[u8; 2usize] = b"o\0"; -pub const PRIoLEAST16: &[u8; 2usize] = b"o\0"; -pub const PRIoLEAST32: &[u8; 2usize] = b"o\0"; -pub const PRIoLEAST64: &[u8; 4usize] = b"llo\0"; -pub const PRIoFAST8: &[u8; 2usize] = b"o\0"; -pub const PRIoFAST64: &[u8; 4usize] = b"llo\0"; -pub const PRIoMAX: &[u8; 3usize] = b"jo\0"; -pub const PRIu8: &[u8; 2usize] = b"u\0"; -pub const PRIu16: &[u8; 2usize] = b"u\0"; -pub const PRIu32: &[u8; 2usize] = b"u\0"; -pub const PRIu64: &[u8; 4usize] = b"llu\0"; -pub const PRIuLEAST8: &[u8; 2usize] = b"u\0"; -pub const PRIuLEAST16: &[u8; 2usize] = b"u\0"; -pub const PRIuLEAST32: &[u8; 2usize] = b"u\0"; -pub const PRIuLEAST64: &[u8; 4usize] = b"llu\0"; -pub const PRIuFAST8: &[u8; 2usize] = b"u\0"; -pub const PRIuFAST64: &[u8; 4usize] = b"llu\0"; -pub const PRIuMAX: &[u8; 3usize] = b"ju\0"; -pub const PRIx8: &[u8; 2usize] = b"x\0"; -pub const PRIx16: &[u8; 2usize] = b"x\0"; -pub const PRIx32: &[u8; 2usize] = b"x\0"; -pub const PRIx64: &[u8; 4usize] = b"llx\0"; -pub const PRIxLEAST8: &[u8; 2usize] = b"x\0"; -pub const PRIxLEAST16: &[u8; 2usize] = b"x\0"; -pub const PRIxLEAST32: &[u8; 2usize] = b"x\0"; -pub const PRIxLEAST64: &[u8; 4usize] = b"llx\0"; -pub const PRIxFAST8: &[u8; 2usize] = b"x\0"; -pub const PRIxFAST64: &[u8; 4usize] = b"llx\0"; -pub const PRIxMAX: &[u8; 3usize] = b"jx\0"; -pub const PRIX8: &[u8; 2usize] = b"X\0"; -pub const PRIX16: &[u8; 2usize] = b"X\0"; -pub const PRIX32: &[u8; 2usize] = b"X\0"; -pub const PRIX64: &[u8; 4usize] = b"llX\0"; -pub const PRIXLEAST8: &[u8; 2usize] = b"X\0"; -pub const PRIXLEAST16: &[u8; 2usize] = b"X\0"; -pub const PRIXLEAST32: &[u8; 2usize] = b"X\0"; -pub const PRIXLEAST64: &[u8; 4usize] = b"llX\0"; -pub const PRIXFAST8: &[u8; 2usize] = b"X\0"; -pub const PRIXFAST64: &[u8; 4usize] = b"llX\0"; -pub const PRIXMAX: &[u8; 3usize] = b"jX\0"; -pub const SCNd8: &[u8; 4usize] = b"hhd\0"; -pub const SCNd16: &[u8; 3usize] = b"hd\0"; -pub const SCNd32: &[u8; 2usize] = b"d\0"; -pub const SCNd64: &[u8; 4usize] = b"lld\0"; -pub const SCNdLEAST8: &[u8; 4usize] = b"hhd\0"; -pub const SCNdLEAST16: &[u8; 3usize] = b"hd\0"; -pub const SCNdLEAST32: &[u8; 2usize] = b"d\0"; -pub const SCNdLEAST64: &[u8; 4usize] = b"lld\0"; -pub const SCNdFAST8: &[u8; 4usize] = b"hhd\0"; -pub const SCNdFAST64: &[u8; 4usize] = b"lld\0"; -pub const SCNdMAX: &[u8; 3usize] = b"jd\0"; -pub const SCNi8: &[u8; 4usize] = b"hhi\0"; -pub const SCNi16: &[u8; 3usize] = b"hi\0"; -pub const SCNi32: &[u8; 2usize] = b"i\0"; -pub const SCNi64: &[u8; 4usize] = b"lli\0"; -pub const SCNiLEAST8: &[u8; 4usize] = b"hhi\0"; -pub const SCNiLEAST16: &[u8; 3usize] = b"hi\0"; -pub const SCNiLEAST32: &[u8; 2usize] = b"i\0"; -pub const SCNiLEAST64: &[u8; 4usize] = b"lli\0"; -pub const SCNiFAST8: &[u8; 4usize] = b"hhi\0"; -pub const SCNiFAST64: &[u8; 4usize] = b"lli\0"; -pub const SCNiMAX: &[u8; 3usize] = b"ji\0"; -pub const SCNo8: &[u8; 4usize] = b"hho\0"; -pub const SCNo16: &[u8; 3usize] = b"ho\0"; -pub const SCNo32: &[u8; 2usize] = b"o\0"; -pub const SCNo64: &[u8; 4usize] = b"llo\0"; -pub const SCNoLEAST8: &[u8; 4usize] = b"hho\0"; -pub const SCNoLEAST16: &[u8; 3usize] = b"ho\0"; -pub const SCNoLEAST32: &[u8; 2usize] = b"o\0"; -pub const SCNoLEAST64: &[u8; 4usize] = b"llo\0"; -pub const SCNoFAST8: &[u8; 4usize] = b"hho\0"; -pub const SCNoFAST64: &[u8; 4usize] = b"llo\0"; -pub const SCNoMAX: &[u8; 3usize] = b"jo\0"; -pub const SCNu8: &[u8; 4usize] = b"hhu\0"; -pub const SCNu16: &[u8; 3usize] = b"hu\0"; -pub const SCNu32: &[u8; 2usize] = b"u\0"; -pub const SCNu64: &[u8; 4usize] = b"llu\0"; -pub const SCNuLEAST8: &[u8; 4usize] = b"hhu\0"; -pub const SCNuLEAST16: &[u8; 3usize] = b"hu\0"; -pub const SCNuLEAST32: &[u8; 2usize] = b"u\0"; -pub const SCNuLEAST64: &[u8; 4usize] = b"llu\0"; -pub const SCNuFAST8: &[u8; 4usize] = b"hhu\0"; -pub const SCNuFAST64: &[u8; 4usize] = b"llu\0"; -pub const SCNuMAX: &[u8; 3usize] = b"ju\0"; -pub const SCNx8: &[u8; 4usize] = b"hhx\0"; -pub const SCNx16: &[u8; 3usize] = b"hx\0"; -pub const SCNx32: &[u8; 2usize] = b"x\0"; -pub const SCNx64: &[u8; 4usize] = b"llx\0"; -pub const SCNxLEAST8: &[u8; 4usize] = b"hhx\0"; -pub const SCNxLEAST16: &[u8; 3usize] = b"hx\0"; -pub const SCNxLEAST32: &[u8; 2usize] = b"x\0"; -pub const SCNxLEAST64: &[u8; 4usize] = b"llx\0"; -pub const SCNxFAST8: &[u8; 4usize] = b"hhx\0"; -pub const SCNxFAST64: &[u8; 4usize] = b"llx\0"; -pub const SCNxMAX: &[u8; 3usize] = b"jx\0"; -pub const __GNUC_VA_LIST: u32 = 1; +pub const __bool_true_false_are_defined: u32 = 1; pub const true_: u32 = 1; pub const false_: u32 = 0; -pub const __bool_true_false_are_defined: u32 = 1; +pub const __PRI_64_prefix: &[u8; 3] = b"ll\0"; +pub const PRId8: &[u8; 2] = b"d\0"; +pub const PRId16: &[u8; 2] = b"d\0"; +pub const PRId32: &[u8; 2] = b"d\0"; +pub const PRId64: &[u8; 4] = b"lld\0"; +pub const PRIdLEAST8: &[u8; 2] = b"d\0"; +pub const PRIdLEAST16: &[u8; 2] = b"d\0"; +pub const PRIdLEAST32: &[u8; 2] = b"d\0"; +pub const PRIdLEAST64: &[u8; 4] = b"lld\0"; +pub const PRIdFAST8: &[u8; 2] = b"d\0"; +pub const PRIdFAST64: &[u8; 4] = b"lld\0"; +pub const PRIdMAX: &[u8; 3] = b"jd\0"; +pub const PRIi8: &[u8; 2] = b"i\0"; +pub const PRIi16: &[u8; 2] = b"i\0"; +pub const PRIi32: &[u8; 2] = b"i\0"; +pub const PRIi64: &[u8; 4] = b"lli\0"; +pub const PRIiLEAST8: &[u8; 2] = b"i\0"; +pub const PRIiLEAST16: &[u8; 2] = b"i\0"; +pub const PRIiLEAST32: &[u8; 2] = b"i\0"; +pub const PRIiLEAST64: &[u8; 4] = b"lli\0"; +pub const PRIiFAST8: &[u8; 2] = b"i\0"; +pub const PRIiFAST64: &[u8; 4] = b"lli\0"; +pub const PRIiMAX: &[u8; 3] = b"ji\0"; +pub const PRIb8: &[u8; 2] = b"b\0"; +pub const PRIb16: &[u8; 2] = b"b\0"; +pub const PRIb32: &[u8; 2] = b"b\0"; +pub const PRIb64: &[u8; 4] = b"llb\0"; +pub const PRIbLEAST8: &[u8; 2] = b"b\0"; +pub const PRIbLEAST16: &[u8; 2] = b"b\0"; +pub const PRIbLEAST32: &[u8; 2] = b"b\0"; +pub const PRIbLEAST64: &[u8; 4] = b"llb\0"; +pub const PRIbFAST8: &[u8; 2] = b"b\0"; +pub const PRIbFAST64: &[u8; 4] = b"llb\0"; +pub const PRIbMAX: &[u8; 3] = b"jb\0"; +pub const PRIB8: &[u8; 2] = b"B\0"; +pub const PRIB16: &[u8; 2] = b"B\0"; +pub const PRIB32: &[u8; 2] = b"B\0"; +pub const PRIB64: &[u8; 4] = b"llB\0"; +pub const PRIBLEAST8: &[u8; 2] = b"B\0"; +pub const PRIBLEAST16: &[u8; 2] = b"B\0"; +pub const PRIBLEAST32: &[u8; 2] = b"B\0"; +pub const PRIBLEAST64: &[u8; 4] = b"llB\0"; +pub const PRIBFAST8: &[u8; 2] = b"B\0"; +pub const PRIBFAST64: &[u8; 4] = b"llB\0"; +pub const PRIBMAX: &[u8; 3] = b"jB\0"; +pub const PRIo8: &[u8; 2] = b"o\0"; +pub const PRIo16: &[u8; 2] = b"o\0"; +pub const PRIo32: &[u8; 2] = b"o\0"; +pub const PRIo64: &[u8; 4] = b"llo\0"; +pub const PRIoLEAST8: &[u8; 2] = b"o\0"; +pub const PRIoLEAST16: &[u8; 2] = b"o\0"; +pub const PRIoLEAST32: &[u8; 2] = b"o\0"; +pub const PRIoLEAST64: &[u8; 4] = b"llo\0"; +pub const PRIoFAST8: &[u8; 2] = b"o\0"; +pub const PRIoFAST64: &[u8; 4] = b"llo\0"; +pub const PRIoMAX: &[u8; 3] = b"jo\0"; +pub const PRIu8: &[u8; 2] = b"u\0"; +pub const PRIu16: &[u8; 2] = b"u\0"; +pub const PRIu32: &[u8; 2] = b"u\0"; +pub const PRIu64: &[u8; 4] = b"llu\0"; +pub const PRIuLEAST8: &[u8; 2] = b"u\0"; +pub const PRIuLEAST16: &[u8; 2] = b"u\0"; +pub const PRIuLEAST32: &[u8; 2] = b"u\0"; +pub const PRIuLEAST64: &[u8; 4] = b"llu\0"; +pub const PRIuFAST8: &[u8; 2] = b"u\0"; +pub const PRIuFAST64: &[u8; 4] = b"llu\0"; +pub const PRIuMAX: &[u8; 3] = b"ju\0"; +pub const PRIx8: &[u8; 2] = b"x\0"; +pub const PRIx16: &[u8; 2] = b"x\0"; +pub const PRIx32: &[u8; 2] = b"x\0"; +pub const PRIx64: &[u8; 4] = b"llx\0"; +pub const PRIxLEAST8: &[u8; 2] = b"x\0"; +pub const PRIxLEAST16: &[u8; 2] = b"x\0"; +pub const PRIxLEAST32: &[u8; 2] = b"x\0"; +pub const PRIxLEAST64: &[u8; 4] = b"llx\0"; +pub const PRIxFAST8: &[u8; 2] = b"x\0"; +pub const PRIxFAST64: &[u8; 4] = b"llx\0"; +pub const PRIxMAX: &[u8; 3] = b"jx\0"; +pub const PRIX8: &[u8; 2] = b"X\0"; +pub const PRIX16: &[u8; 2] = b"X\0"; +pub const PRIX32: &[u8; 2] = b"X\0"; +pub const PRIX64: &[u8; 4] = b"llX\0"; +pub const PRIXLEAST8: &[u8; 2] = b"X\0"; +pub const PRIXLEAST16: &[u8; 2] = b"X\0"; +pub const PRIXLEAST32: &[u8; 2] = b"X\0"; +pub const PRIXLEAST64: &[u8; 4] = b"llX\0"; +pub const PRIXFAST8: &[u8; 2] = b"X\0"; +pub const PRIXFAST64: &[u8; 4] = b"llX\0"; +pub const PRIXMAX: &[u8; 3] = b"jX\0"; +pub const SCNd8: &[u8; 4] = b"hhd\0"; +pub const SCNd16: &[u8; 3] = b"hd\0"; +pub const SCNd32: &[u8; 2] = b"d\0"; +pub const SCNd64: &[u8; 4] = b"lld\0"; +pub const SCNdLEAST8: &[u8; 4] = b"hhd\0"; +pub const SCNdLEAST16: &[u8; 3] = b"hd\0"; +pub const SCNdLEAST32: &[u8; 2] = b"d\0"; +pub const SCNdLEAST64: &[u8; 4] = b"lld\0"; +pub const SCNdFAST8: &[u8; 4] = b"hhd\0"; +pub const SCNdFAST64: &[u8; 4] = b"lld\0"; +pub const SCNdMAX: &[u8; 3] = b"jd\0"; +pub const SCNi8: &[u8; 4] = b"hhi\0"; +pub const SCNi16: &[u8; 3] = b"hi\0"; +pub const SCNi32: &[u8; 2] = b"i\0"; +pub const SCNi64: &[u8; 4] = b"lli\0"; +pub const SCNiLEAST8: &[u8; 4] = b"hhi\0"; +pub const SCNiLEAST16: &[u8; 3] = b"hi\0"; +pub const SCNiLEAST32: &[u8; 2] = b"i\0"; +pub const SCNiLEAST64: &[u8; 4] = b"lli\0"; +pub const SCNiFAST8: &[u8; 4] = b"hhi\0"; +pub const SCNiFAST64: &[u8; 4] = b"lli\0"; +pub const SCNiMAX: &[u8; 3] = b"ji\0"; +pub const SCNb8: &[u8; 4] = b"hhb\0"; +pub const SCNb16: &[u8; 3] = b"hb\0"; +pub const SCNb32: &[u8; 2] = b"b\0"; +pub const SCNb64: &[u8; 4] = b"llb\0"; +pub const SCNbLEAST8: &[u8; 4] = b"hhb\0"; +pub const SCNbLEAST16: &[u8; 3] = b"hb\0"; +pub const SCNbLEAST32: &[u8; 2] = b"b\0"; +pub const SCNbLEAST64: &[u8; 4] = b"llb\0"; +pub const SCNbFAST8: &[u8; 4] = b"hhb\0"; +pub const SCNbFAST64: &[u8; 4] = b"llb\0"; +pub const SCNbMAX: &[u8; 3] = b"jb\0"; +pub const SCNB8: &[u8; 4] = b"hhB\0"; +pub const SCNB16: &[u8; 3] = b"hB\0"; +pub const SCNB32: &[u8; 2] = b"B\0"; +pub const SCNB64: &[u8; 4] = b"llB\0"; +pub const SCNBLEAST8: &[u8; 4] = b"hhB\0"; +pub const SCNBLEAST16: &[u8; 3] = b"hB\0"; +pub const SCNBLEAST32: &[u8; 2] = b"B\0"; +pub const SCNBLEAST64: &[u8; 4] = b"llB\0"; +pub const SCNBFAST8: &[u8; 4] = b"hhB\0"; +pub const SCNBFAST64: &[u8; 4] = b"llB\0"; +pub const SCNBMAX: &[u8; 3] = b"jB\0"; +pub const SCNo8: &[u8; 4] = b"hho\0"; +pub const SCNo16: &[u8; 3] = b"ho\0"; +pub const SCNo32: &[u8; 2] = b"o\0"; +pub const SCNo64: &[u8; 4] = b"llo\0"; +pub const SCNoLEAST8: &[u8; 4] = b"hho\0"; +pub const SCNoLEAST16: &[u8; 3] = b"ho\0"; +pub const SCNoLEAST32: &[u8; 2] = b"o\0"; +pub const SCNoLEAST64: &[u8; 4] = b"llo\0"; +pub const SCNoFAST8: &[u8; 4] = b"hho\0"; +pub const SCNoFAST64: &[u8; 4] = b"llo\0"; +pub const SCNoMAX: &[u8; 3] = b"jo\0"; +pub const SCNu8: &[u8; 4] = b"hhu\0"; +pub const SCNu16: &[u8; 3] = b"hu\0"; +pub const SCNu32: &[u8; 2] = b"u\0"; +pub const SCNu64: &[u8; 4] = b"llu\0"; +pub const SCNuLEAST8: &[u8; 4] = b"hhu\0"; +pub const SCNuLEAST16: &[u8; 3] = b"hu\0"; +pub const SCNuLEAST32: &[u8; 2] = b"u\0"; +pub const SCNuLEAST64: &[u8; 4] = b"llu\0"; +pub const SCNuFAST8: &[u8; 4] = b"hhu\0"; +pub const SCNuFAST64: &[u8; 4] = b"llu\0"; +pub const SCNuMAX: &[u8; 3] = b"ju\0"; +pub const SCNx8: &[u8; 4] = b"hhx\0"; +pub const SCNx16: &[u8; 3] = b"hx\0"; +pub const SCNx32: &[u8; 2] = b"x\0"; +pub const SCNx64: &[u8; 4] = b"llx\0"; +pub const SCNxLEAST8: &[u8; 4] = b"hhx\0"; +pub const SCNxLEAST16: &[u8; 3] = b"hx\0"; +pub const SCNxLEAST32: &[u8; 2] = b"x\0"; +pub const SCNxLEAST64: &[u8; 4] = b"llx\0"; +pub const SCNxFAST8: &[u8; 4] = b"hhx\0"; +pub const SCNxFAST64: &[u8; 4] = b"llx\0"; +pub const SCNxMAX: &[u8; 3] = b"jx\0"; pub const GAME_ACTIVITY_POINTER_INFO_AXIS_COUNT: u32 = 48; pub const GAMEACTIVITY_MAX_NUM_POINTERS_IN_MOTION_EVENT: u32 = 8; -pub const GAMEACTIVITY_MAX_NUM_HISTORICAL_IN_MOTION_EVENT: u32 = 8; +pub const GAMETEXTINPUT_MAJOR_VERSION: u32 = 4; +pub const GAMETEXTINPUT_MINOR_VERSION: u32 = 0; +pub const GAMETEXTINPUT_BUGFIX_VERSION: u32 = 0; +pub const GAMEACTIVITY_MAJOR_VERSION: u32 = 4; +pub const GAMEACTIVITY_MINOR_VERSION: u32 = 0; +pub const GAMEACTIVITY_BUGFIX_VERSION: u32 = 0; pub const POLLIN: u32 = 1; pub const POLLPRI: u32 = 2; pub const POLLOUT: u32 = 4; @@ -435,18 +488,20 @@ pub const SIGPWR: u32 = 30; pub const SIGSYS: u32 = 31; pub const SIGUNUSED: u32 = 31; pub const __SIGRTMIN: u32 = 32; +pub const SA_RESTORER: u32 = 67108864; +pub const MINSIGSTKSZ: u32 = 2048; +pub const SIGSTKSZ: u32 = 8192; pub const SA_NOCLDSTOP: u32 = 1; pub const SA_NOCLDWAIT: u32 = 2; pub const SA_SIGINFO: u32 = 4; +pub const SA_UNSUPPORTED: u32 = 1024; +pub const SA_EXPOSE_TAGBITS: u32 = 2048; pub const SA_ONSTACK: u32 = 134217728; pub const SA_RESTART: u32 = 268435456; pub const SA_NODEFER: u32 = 1073741824; pub const SA_RESETHAND: u32 = 2147483648; pub const SA_NOMASK: u32 = 1073741824; pub const SA_ONESHOT: u32 = 2147483648; -pub const SA_RESTORER: u32 = 67108864; -pub const MINSIGSTKSZ: u32 = 2048; -pub const SIGSTKSZ: u32 = 8192; pub const SIG_BLOCK: u32 = 0; pub const SIG_UNBLOCK: u32 = 1; pub const SIG_SETMASK: u32 = 2; @@ -496,7 +551,9 @@ pub const SEGV_PKUERR: u32 = 4; pub const SEGV_ACCADI: u32 = 5; pub const SEGV_ADIDERR: u32 = 6; pub const SEGV_ADIPERR: u32 = 7; -pub const NSIGSEGV: u32 = 7; +pub const SEGV_MTEAERR: u32 = 8; +pub const SEGV_MTESERR: u32 = 9; +pub const NSIGSEGV: u32 = 9; pub const BUS_ADRALN: u32 = 1; pub const BUS_ADRERR: u32 = 2; pub const BUS_OBJERR: u32 = 3; @@ -508,7 +565,9 @@ pub const TRAP_TRACE: u32 = 2; pub const TRAP_BRANCH: u32 = 3; pub const TRAP_HWBKPT: u32 = 4; pub const TRAP_UNK: u32 = 5; -pub const NSIGTRAP: u32 = 5; +pub const TRAP_PERF: u32 = 6; +pub const NSIGTRAP: u32 = 6; +pub const TRAP_PERF_FLAG_ASYNC: u32 = 1; pub const CLD_EXITED: u32 = 1; pub const CLD_KILLED: u32 = 2; pub const CLD_DUMPED: u32 = 3; @@ -524,7 +583,8 @@ pub const POLL_PRI: u32 = 5; pub const POLL_HUP: u32 = 6; pub const NSIGPOLL: u32 = 6; pub const SYS_SECCOMP: u32 = 1; -pub const NSIGSYS: u32 = 1; +pub const SYS_USER_DISPATCH: u32 = 2; +pub const NSIGSYS: u32 = 2; pub const EMT_TAGOVF: u32 = 1; pub const NSIGEMT: u32 = 1; pub const SIGEV_SIGNAL: u32 = 0; @@ -545,6 +605,9 @@ pub const UPAGES: u32 = 1; pub const FD_SETSIZE: u32 = 1024; pub const CLOCKS_PER_SEC: u32 = 1000000; pub const TIME_UTC: u32 = 1; +pub const TIME_MONOTONIC: u32 = 2; +pub const TIME_ACTIVE: u32 = 3; +pub const TIME_THREAD_ACTIVE: u32 = 4; pub const CSIGNAL: u32 = 255; pub const CLONE_VM: u32 = 256; pub const CLONE_FS: u32 = 512; @@ -570,6 +633,12 @@ pub const CLONE_NEWUSER: u32 = 268435456; pub const CLONE_NEWPID: u32 = 536870912; pub const CLONE_NEWNET: u32 = 1073741824; pub const CLONE_IO: u32 = 2147483648; +pub const CLONE_CLEAR_SIGHAND: u64 = 4294967296; +pub const CLONE_INTO_CGROUP: u64 = 8589934592; +pub const CLONE_NEWTIME: u32 = 128; +pub const CLONE_ARGS_SIZE_VER0: u32 = 64; +pub const CLONE_ARGS_SIZE_VER1: u32 = 80; +pub const CLONE_ARGS_SIZE_VER2: u32 = 88; pub const SCHED_NORMAL: u32 = 0; pub const SCHED_FIFO: u32 = 1; pub const SCHED_RR: u32 = 2; @@ -601,9 +670,6 @@ pub const PTHREAD_PROCESS_PRIVATE: u32 = 0; pub const PTHREAD_PROCESS_SHARED: u32 = 1; pub const PTHREAD_SCOPE_SYSTEM: u32 = 0; pub const PTHREAD_SCOPE_PROCESS: u32 = 1; -pub const NATIVE_APP_GLUE_MAX_NUM_MOTION_EVENTS: u32 = 16; -pub const NATIVE_APP_GLUE_MAX_HISTORICAL_POINTER_SAMPLES: u32 = 64; -pub const NATIVE_APP_GLUE_MAX_NUM_KEY_EVENTS: u32 = 4; pub const NATIVE_APP_GLUE_MAX_INPUT_BUFFERS: u32 = 2; extern "C" { pub fn android_get_application_target_sdk_version() -> ::std::os::raw::c_int; @@ -621,39 +687,27 @@ pub struct max_align_t { } #[test] fn bindgen_test_layout_max_align_t() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 16usize, - concat!("Size of: ", stringify!(max_align_t)) + "Size of max_align_t" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(max_align_t)) + "Alignment of max_align_t" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).__clang_max_align_nonce1 as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce1) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(max_align_t), - "::", - stringify!(__clang_max_align_nonce1) - ) + "Offset of field: max_align_t::__clang_max_align_nonce1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).__clang_max_align_nonce2 as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce2) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(max_align_t), - "::", - stringify!(__clang_max_align_nonce2) - ) + "Offset of field: max_align_t::__clang_max_align_nonce2" ); } pub type __int8_t = ::std::os::raw::c_schar; @@ -699,25 +753,22 @@ pub struct __kernel_fd_set { } #[test] fn bindgen_test_layout___kernel_fd_set() { + const UNINIT: ::std::mem::MaybeUninit<__kernel_fd_set> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__kernel_fd_set>(), 128usize, - concat!("Size of: ", stringify!(__kernel_fd_set)) + "Size of __kernel_fd_set" ); assert_eq!( ::std::mem::align_of::<__kernel_fd_set>(), 4usize, - concat!("Alignment of ", stringify!(__kernel_fd_set)) + "Alignment of __kernel_fd_set" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_fd_set>())).fds_bits as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fds_bits) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__kernel_fd_set), - "::", - stringify!(fds_bits) - ) + "Offset of field: __kernel_fd_set::fds_bits" ); } pub type __kernel_sighandler_t = @@ -749,29 +800,27 @@ pub struct __kernel_fsid_t { } #[test] fn bindgen_test_layout___kernel_fsid_t() { + const UNINIT: ::std::mem::MaybeUninit<__kernel_fsid_t> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__kernel_fsid_t>(), 8usize, - concat!("Size of: ", stringify!(__kernel_fsid_t)) + "Size of __kernel_fsid_t" ); assert_eq!( ::std::mem::align_of::<__kernel_fsid_t>(), 4usize, - concat!("Alignment of ", stringify!(__kernel_fsid_t)) + "Alignment of __kernel_fsid_t" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_fsid_t>())).val as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).val) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__kernel_fsid_t), - "::", - stringify!(val) - ) + "Offset of field: __kernel_fsid_t::val" ); } pub type __kernel_off_t = __kernel_long_t; pub type __kernel_loff_t = ::std::os::raw::c_longlong; +pub type __kernel_old_time_t = __kernel_long_t; pub type __kernel_time_t = __kernel_long_t; pub type __kernel_time64_t = ::std::os::raw::c_longlong; pub type __kernel_clock_t = __kernel_long_t; @@ -830,7 +879,6 @@ pub type off64_t = loff_t; pub type __socklen_t = i32; pub type socklen_t = __socklen_t; pub type __va_list = __builtin_va_list; -pub type ssize_t = __kernel_ssize_t; pub type uint_t = ::std::os::raw::c_uint; pub type uint = ::std::os::raw::c_uint; pub type u_char = ::std::os::raw::c_uchar; @@ -841,483 +889,622 @@ pub type u_int32_t = u32; pub type u_int16_t = u16; pub type u_int8_t = u8; pub type u_int64_t = u64; -pub const AASSET_MODE_UNKNOWN: ::std::os::raw::c_uint = 0; -pub const AASSET_MODE_RANDOM: ::std::os::raw::c_uint = 1; -pub const AASSET_MODE_STREAMING: ::std::os::raw::c_uint = 2; -pub const AASSET_MODE_BUFFER: ::std::os::raw::c_uint = 3; +pub const AASSET_MODE_UNKNOWN: _bindgen_ty_1 = 0; +pub const AASSET_MODE_RANDOM: _bindgen_ty_1 = 1; +pub const AASSET_MODE_STREAMING: _bindgen_ty_1 = 2; +pub const AASSET_MODE_BUFFER: _bindgen_ty_1 = 3; pub type _bindgen_ty_1 = ::std::os::raw::c_uint; -pub const AKEYCODE_UNKNOWN: ::std::os::raw::c_uint = 0; -pub const AKEYCODE_SOFT_LEFT: ::std::os::raw::c_uint = 1; -pub const AKEYCODE_SOFT_RIGHT: ::std::os::raw::c_uint = 2; -pub const AKEYCODE_HOME: ::std::os::raw::c_uint = 3; -pub const AKEYCODE_BACK: ::std::os::raw::c_uint = 4; -pub const AKEYCODE_CALL: ::std::os::raw::c_uint = 5; -pub const AKEYCODE_ENDCALL: ::std::os::raw::c_uint = 6; -pub const AKEYCODE_0: ::std::os::raw::c_uint = 7; -pub const AKEYCODE_1: ::std::os::raw::c_uint = 8; -pub const AKEYCODE_2: ::std::os::raw::c_uint = 9; -pub const AKEYCODE_3: ::std::os::raw::c_uint = 10; -pub const AKEYCODE_4: ::std::os::raw::c_uint = 11; -pub const AKEYCODE_5: ::std::os::raw::c_uint = 12; -pub const AKEYCODE_6: ::std::os::raw::c_uint = 13; -pub const AKEYCODE_7: ::std::os::raw::c_uint = 14; -pub const AKEYCODE_8: ::std::os::raw::c_uint = 15; -pub const AKEYCODE_9: ::std::os::raw::c_uint = 16; -pub const AKEYCODE_STAR: ::std::os::raw::c_uint = 17; -pub const AKEYCODE_POUND: ::std::os::raw::c_uint = 18; -pub const AKEYCODE_DPAD_UP: ::std::os::raw::c_uint = 19; -pub const AKEYCODE_DPAD_DOWN: ::std::os::raw::c_uint = 20; -pub const AKEYCODE_DPAD_LEFT: ::std::os::raw::c_uint = 21; -pub const AKEYCODE_DPAD_RIGHT: ::std::os::raw::c_uint = 22; -pub const AKEYCODE_DPAD_CENTER: ::std::os::raw::c_uint = 23; -pub const AKEYCODE_VOLUME_UP: ::std::os::raw::c_uint = 24; -pub const AKEYCODE_VOLUME_DOWN: ::std::os::raw::c_uint = 25; -pub const AKEYCODE_POWER: ::std::os::raw::c_uint = 26; -pub const AKEYCODE_CAMERA: ::std::os::raw::c_uint = 27; -pub const AKEYCODE_CLEAR: ::std::os::raw::c_uint = 28; -pub const AKEYCODE_A: ::std::os::raw::c_uint = 29; -pub const AKEYCODE_B: ::std::os::raw::c_uint = 30; -pub const AKEYCODE_C: ::std::os::raw::c_uint = 31; -pub const AKEYCODE_D: ::std::os::raw::c_uint = 32; -pub const AKEYCODE_E: ::std::os::raw::c_uint = 33; -pub const AKEYCODE_F: ::std::os::raw::c_uint = 34; -pub const AKEYCODE_G: ::std::os::raw::c_uint = 35; -pub const AKEYCODE_H: ::std::os::raw::c_uint = 36; -pub const AKEYCODE_I: ::std::os::raw::c_uint = 37; -pub const AKEYCODE_J: ::std::os::raw::c_uint = 38; -pub const AKEYCODE_K: ::std::os::raw::c_uint = 39; -pub const AKEYCODE_L: ::std::os::raw::c_uint = 40; -pub const AKEYCODE_M: ::std::os::raw::c_uint = 41; -pub const AKEYCODE_N: ::std::os::raw::c_uint = 42; -pub const AKEYCODE_O: ::std::os::raw::c_uint = 43; -pub const AKEYCODE_P: ::std::os::raw::c_uint = 44; -pub const AKEYCODE_Q: ::std::os::raw::c_uint = 45; -pub const AKEYCODE_R: ::std::os::raw::c_uint = 46; -pub const AKEYCODE_S: ::std::os::raw::c_uint = 47; -pub const AKEYCODE_T: ::std::os::raw::c_uint = 48; -pub const AKEYCODE_U: ::std::os::raw::c_uint = 49; -pub const AKEYCODE_V: ::std::os::raw::c_uint = 50; -pub const AKEYCODE_W: ::std::os::raw::c_uint = 51; -pub const AKEYCODE_X: ::std::os::raw::c_uint = 52; -pub const AKEYCODE_Y: ::std::os::raw::c_uint = 53; -pub const AKEYCODE_Z: ::std::os::raw::c_uint = 54; -pub const AKEYCODE_COMMA: ::std::os::raw::c_uint = 55; -pub const AKEYCODE_PERIOD: ::std::os::raw::c_uint = 56; -pub const AKEYCODE_ALT_LEFT: ::std::os::raw::c_uint = 57; -pub const AKEYCODE_ALT_RIGHT: ::std::os::raw::c_uint = 58; -pub const AKEYCODE_SHIFT_LEFT: ::std::os::raw::c_uint = 59; -pub const AKEYCODE_SHIFT_RIGHT: ::std::os::raw::c_uint = 60; -pub const AKEYCODE_TAB: ::std::os::raw::c_uint = 61; -pub const AKEYCODE_SPACE: ::std::os::raw::c_uint = 62; -pub const AKEYCODE_SYM: ::std::os::raw::c_uint = 63; -pub const AKEYCODE_EXPLORER: ::std::os::raw::c_uint = 64; -pub const AKEYCODE_ENVELOPE: ::std::os::raw::c_uint = 65; -pub const AKEYCODE_ENTER: ::std::os::raw::c_uint = 66; -pub const AKEYCODE_DEL: ::std::os::raw::c_uint = 67; -pub const AKEYCODE_GRAVE: ::std::os::raw::c_uint = 68; -pub const AKEYCODE_MINUS: ::std::os::raw::c_uint = 69; -pub const AKEYCODE_EQUALS: ::std::os::raw::c_uint = 70; -pub const AKEYCODE_LEFT_BRACKET: ::std::os::raw::c_uint = 71; -pub const AKEYCODE_RIGHT_BRACKET: ::std::os::raw::c_uint = 72; -pub const AKEYCODE_BACKSLASH: ::std::os::raw::c_uint = 73; -pub const AKEYCODE_SEMICOLON: ::std::os::raw::c_uint = 74; -pub const AKEYCODE_APOSTROPHE: ::std::os::raw::c_uint = 75; -pub const AKEYCODE_SLASH: ::std::os::raw::c_uint = 76; -pub const AKEYCODE_AT: ::std::os::raw::c_uint = 77; -pub const AKEYCODE_NUM: ::std::os::raw::c_uint = 78; -pub const AKEYCODE_HEADSETHOOK: ::std::os::raw::c_uint = 79; -pub const AKEYCODE_FOCUS: ::std::os::raw::c_uint = 80; -pub const AKEYCODE_PLUS: ::std::os::raw::c_uint = 81; -pub const AKEYCODE_MENU: ::std::os::raw::c_uint = 82; -pub const AKEYCODE_NOTIFICATION: ::std::os::raw::c_uint = 83; -pub const AKEYCODE_SEARCH: ::std::os::raw::c_uint = 84; -pub const AKEYCODE_MEDIA_PLAY_PAUSE: ::std::os::raw::c_uint = 85; -pub const AKEYCODE_MEDIA_STOP: ::std::os::raw::c_uint = 86; -pub const AKEYCODE_MEDIA_NEXT: ::std::os::raw::c_uint = 87; -pub const AKEYCODE_MEDIA_PREVIOUS: ::std::os::raw::c_uint = 88; -pub const AKEYCODE_MEDIA_REWIND: ::std::os::raw::c_uint = 89; -pub const AKEYCODE_MEDIA_FAST_FORWARD: ::std::os::raw::c_uint = 90; -pub const AKEYCODE_MUTE: ::std::os::raw::c_uint = 91; -pub const AKEYCODE_PAGE_UP: ::std::os::raw::c_uint = 92; -pub const AKEYCODE_PAGE_DOWN: ::std::os::raw::c_uint = 93; -pub const AKEYCODE_PICTSYMBOLS: ::std::os::raw::c_uint = 94; -pub const AKEYCODE_SWITCH_CHARSET: ::std::os::raw::c_uint = 95; -pub const AKEYCODE_BUTTON_A: ::std::os::raw::c_uint = 96; -pub const AKEYCODE_BUTTON_B: ::std::os::raw::c_uint = 97; -pub const AKEYCODE_BUTTON_C: ::std::os::raw::c_uint = 98; -pub const AKEYCODE_BUTTON_X: ::std::os::raw::c_uint = 99; -pub const AKEYCODE_BUTTON_Y: ::std::os::raw::c_uint = 100; -pub const AKEYCODE_BUTTON_Z: ::std::os::raw::c_uint = 101; -pub const AKEYCODE_BUTTON_L1: ::std::os::raw::c_uint = 102; -pub const AKEYCODE_BUTTON_R1: ::std::os::raw::c_uint = 103; -pub const AKEYCODE_BUTTON_L2: ::std::os::raw::c_uint = 104; -pub const AKEYCODE_BUTTON_R2: ::std::os::raw::c_uint = 105; -pub const AKEYCODE_BUTTON_THUMBL: ::std::os::raw::c_uint = 106; -pub const AKEYCODE_BUTTON_THUMBR: ::std::os::raw::c_uint = 107; -pub const AKEYCODE_BUTTON_START: ::std::os::raw::c_uint = 108; -pub const AKEYCODE_BUTTON_SELECT: ::std::os::raw::c_uint = 109; -pub const AKEYCODE_BUTTON_MODE: ::std::os::raw::c_uint = 110; -pub const AKEYCODE_ESCAPE: ::std::os::raw::c_uint = 111; -pub const AKEYCODE_FORWARD_DEL: ::std::os::raw::c_uint = 112; -pub const AKEYCODE_CTRL_LEFT: ::std::os::raw::c_uint = 113; -pub const AKEYCODE_CTRL_RIGHT: ::std::os::raw::c_uint = 114; -pub const AKEYCODE_CAPS_LOCK: ::std::os::raw::c_uint = 115; -pub const AKEYCODE_SCROLL_LOCK: ::std::os::raw::c_uint = 116; -pub const AKEYCODE_META_LEFT: ::std::os::raw::c_uint = 117; -pub const AKEYCODE_META_RIGHT: ::std::os::raw::c_uint = 118; -pub const AKEYCODE_FUNCTION: ::std::os::raw::c_uint = 119; -pub const AKEYCODE_SYSRQ: ::std::os::raw::c_uint = 120; -pub const AKEYCODE_BREAK: ::std::os::raw::c_uint = 121; -pub const AKEYCODE_MOVE_HOME: ::std::os::raw::c_uint = 122; -pub const AKEYCODE_MOVE_END: ::std::os::raw::c_uint = 123; -pub const AKEYCODE_INSERT: ::std::os::raw::c_uint = 124; -pub const AKEYCODE_FORWARD: ::std::os::raw::c_uint = 125; -pub const AKEYCODE_MEDIA_PLAY: ::std::os::raw::c_uint = 126; -pub const AKEYCODE_MEDIA_PAUSE: ::std::os::raw::c_uint = 127; -pub const AKEYCODE_MEDIA_CLOSE: ::std::os::raw::c_uint = 128; -pub const AKEYCODE_MEDIA_EJECT: ::std::os::raw::c_uint = 129; -pub const AKEYCODE_MEDIA_RECORD: ::std::os::raw::c_uint = 130; -pub const AKEYCODE_F1: ::std::os::raw::c_uint = 131; -pub const AKEYCODE_F2: ::std::os::raw::c_uint = 132; -pub const AKEYCODE_F3: ::std::os::raw::c_uint = 133; -pub const AKEYCODE_F4: ::std::os::raw::c_uint = 134; -pub const AKEYCODE_F5: ::std::os::raw::c_uint = 135; -pub const AKEYCODE_F6: ::std::os::raw::c_uint = 136; -pub const AKEYCODE_F7: ::std::os::raw::c_uint = 137; -pub const AKEYCODE_F8: ::std::os::raw::c_uint = 138; -pub const AKEYCODE_F9: ::std::os::raw::c_uint = 139; -pub const AKEYCODE_F10: ::std::os::raw::c_uint = 140; -pub const AKEYCODE_F11: ::std::os::raw::c_uint = 141; -pub const AKEYCODE_F12: ::std::os::raw::c_uint = 142; -pub const AKEYCODE_NUM_LOCK: ::std::os::raw::c_uint = 143; -pub const AKEYCODE_NUMPAD_0: ::std::os::raw::c_uint = 144; -pub const AKEYCODE_NUMPAD_1: ::std::os::raw::c_uint = 145; -pub const AKEYCODE_NUMPAD_2: ::std::os::raw::c_uint = 146; -pub const AKEYCODE_NUMPAD_3: ::std::os::raw::c_uint = 147; -pub const AKEYCODE_NUMPAD_4: ::std::os::raw::c_uint = 148; -pub const AKEYCODE_NUMPAD_5: ::std::os::raw::c_uint = 149; -pub const AKEYCODE_NUMPAD_6: ::std::os::raw::c_uint = 150; -pub const AKEYCODE_NUMPAD_7: ::std::os::raw::c_uint = 151; -pub const AKEYCODE_NUMPAD_8: ::std::os::raw::c_uint = 152; -pub const AKEYCODE_NUMPAD_9: ::std::os::raw::c_uint = 153; -pub const AKEYCODE_NUMPAD_DIVIDE: ::std::os::raw::c_uint = 154; -pub const AKEYCODE_NUMPAD_MULTIPLY: ::std::os::raw::c_uint = 155; -pub const AKEYCODE_NUMPAD_SUBTRACT: ::std::os::raw::c_uint = 156; -pub const AKEYCODE_NUMPAD_ADD: ::std::os::raw::c_uint = 157; -pub const AKEYCODE_NUMPAD_DOT: ::std::os::raw::c_uint = 158; -pub const AKEYCODE_NUMPAD_COMMA: ::std::os::raw::c_uint = 159; -pub const AKEYCODE_NUMPAD_ENTER: ::std::os::raw::c_uint = 160; -pub const AKEYCODE_NUMPAD_EQUALS: ::std::os::raw::c_uint = 161; -pub const AKEYCODE_NUMPAD_LEFT_PAREN: ::std::os::raw::c_uint = 162; -pub const AKEYCODE_NUMPAD_RIGHT_PAREN: ::std::os::raw::c_uint = 163; -pub const AKEYCODE_VOLUME_MUTE: ::std::os::raw::c_uint = 164; -pub const AKEYCODE_INFO: ::std::os::raw::c_uint = 165; -pub const AKEYCODE_CHANNEL_UP: ::std::os::raw::c_uint = 166; -pub const AKEYCODE_CHANNEL_DOWN: ::std::os::raw::c_uint = 167; -pub const AKEYCODE_ZOOM_IN: ::std::os::raw::c_uint = 168; -pub const AKEYCODE_ZOOM_OUT: ::std::os::raw::c_uint = 169; -pub const AKEYCODE_TV: ::std::os::raw::c_uint = 170; -pub const AKEYCODE_WINDOW: ::std::os::raw::c_uint = 171; -pub const AKEYCODE_GUIDE: ::std::os::raw::c_uint = 172; -pub const AKEYCODE_DVR: ::std::os::raw::c_uint = 173; -pub const AKEYCODE_BOOKMARK: ::std::os::raw::c_uint = 174; -pub const AKEYCODE_CAPTIONS: ::std::os::raw::c_uint = 175; -pub const AKEYCODE_SETTINGS: ::std::os::raw::c_uint = 176; -pub const AKEYCODE_TV_POWER: ::std::os::raw::c_uint = 177; -pub const AKEYCODE_TV_INPUT: ::std::os::raw::c_uint = 178; -pub const AKEYCODE_STB_POWER: ::std::os::raw::c_uint = 179; -pub const AKEYCODE_STB_INPUT: ::std::os::raw::c_uint = 180; -pub const AKEYCODE_AVR_POWER: ::std::os::raw::c_uint = 181; -pub const AKEYCODE_AVR_INPUT: ::std::os::raw::c_uint = 182; -pub const AKEYCODE_PROG_RED: ::std::os::raw::c_uint = 183; -pub const AKEYCODE_PROG_GREEN: ::std::os::raw::c_uint = 184; -pub const AKEYCODE_PROG_YELLOW: ::std::os::raw::c_uint = 185; -pub const AKEYCODE_PROG_BLUE: ::std::os::raw::c_uint = 186; -pub const AKEYCODE_APP_SWITCH: ::std::os::raw::c_uint = 187; -pub const AKEYCODE_BUTTON_1: ::std::os::raw::c_uint = 188; -pub const AKEYCODE_BUTTON_2: ::std::os::raw::c_uint = 189; -pub const AKEYCODE_BUTTON_3: ::std::os::raw::c_uint = 190; -pub const AKEYCODE_BUTTON_4: ::std::os::raw::c_uint = 191; -pub const AKEYCODE_BUTTON_5: ::std::os::raw::c_uint = 192; -pub const AKEYCODE_BUTTON_6: ::std::os::raw::c_uint = 193; -pub const AKEYCODE_BUTTON_7: ::std::os::raw::c_uint = 194; -pub const AKEYCODE_BUTTON_8: ::std::os::raw::c_uint = 195; -pub const AKEYCODE_BUTTON_9: ::std::os::raw::c_uint = 196; -pub const AKEYCODE_BUTTON_10: ::std::os::raw::c_uint = 197; -pub const AKEYCODE_BUTTON_11: ::std::os::raw::c_uint = 198; -pub const AKEYCODE_BUTTON_12: ::std::os::raw::c_uint = 199; -pub const AKEYCODE_BUTTON_13: ::std::os::raw::c_uint = 200; -pub const AKEYCODE_BUTTON_14: ::std::os::raw::c_uint = 201; -pub const AKEYCODE_BUTTON_15: ::std::os::raw::c_uint = 202; -pub const AKEYCODE_BUTTON_16: ::std::os::raw::c_uint = 203; -pub const AKEYCODE_LANGUAGE_SWITCH: ::std::os::raw::c_uint = 204; -pub const AKEYCODE_MANNER_MODE: ::std::os::raw::c_uint = 205; -pub const AKEYCODE_3D_MODE: ::std::os::raw::c_uint = 206; -pub const AKEYCODE_CONTACTS: ::std::os::raw::c_uint = 207; -pub const AKEYCODE_CALENDAR: ::std::os::raw::c_uint = 208; -pub const AKEYCODE_MUSIC: ::std::os::raw::c_uint = 209; -pub const AKEYCODE_CALCULATOR: ::std::os::raw::c_uint = 210; -pub const AKEYCODE_ZENKAKU_HANKAKU: ::std::os::raw::c_uint = 211; -pub const AKEYCODE_EISU: ::std::os::raw::c_uint = 212; -pub const AKEYCODE_MUHENKAN: ::std::os::raw::c_uint = 213; -pub const AKEYCODE_HENKAN: ::std::os::raw::c_uint = 214; -pub const AKEYCODE_KATAKANA_HIRAGANA: ::std::os::raw::c_uint = 215; -pub const AKEYCODE_YEN: ::std::os::raw::c_uint = 216; -pub const AKEYCODE_RO: ::std::os::raw::c_uint = 217; -pub const AKEYCODE_KANA: ::std::os::raw::c_uint = 218; -pub const AKEYCODE_ASSIST: ::std::os::raw::c_uint = 219; -pub const AKEYCODE_BRIGHTNESS_DOWN: ::std::os::raw::c_uint = 220; -pub const AKEYCODE_BRIGHTNESS_UP: ::std::os::raw::c_uint = 221; -pub const AKEYCODE_MEDIA_AUDIO_TRACK: ::std::os::raw::c_uint = 222; -pub const AKEYCODE_SLEEP: ::std::os::raw::c_uint = 223; -pub const AKEYCODE_WAKEUP: ::std::os::raw::c_uint = 224; -pub const AKEYCODE_PAIRING: ::std::os::raw::c_uint = 225; -pub const AKEYCODE_MEDIA_TOP_MENU: ::std::os::raw::c_uint = 226; -pub const AKEYCODE_11: ::std::os::raw::c_uint = 227; -pub const AKEYCODE_12: ::std::os::raw::c_uint = 228; -pub const AKEYCODE_LAST_CHANNEL: ::std::os::raw::c_uint = 229; -pub const AKEYCODE_TV_DATA_SERVICE: ::std::os::raw::c_uint = 230; -pub const AKEYCODE_VOICE_ASSIST: ::std::os::raw::c_uint = 231; -pub const AKEYCODE_TV_RADIO_SERVICE: ::std::os::raw::c_uint = 232; -pub const AKEYCODE_TV_TELETEXT: ::std::os::raw::c_uint = 233; -pub const AKEYCODE_TV_NUMBER_ENTRY: ::std::os::raw::c_uint = 234; -pub const AKEYCODE_TV_TERRESTRIAL_ANALOG: ::std::os::raw::c_uint = 235; -pub const AKEYCODE_TV_TERRESTRIAL_DIGITAL: ::std::os::raw::c_uint = 236; -pub const AKEYCODE_TV_SATELLITE: ::std::os::raw::c_uint = 237; -pub const AKEYCODE_TV_SATELLITE_BS: ::std::os::raw::c_uint = 238; -pub const AKEYCODE_TV_SATELLITE_CS: ::std::os::raw::c_uint = 239; -pub const AKEYCODE_TV_SATELLITE_SERVICE: ::std::os::raw::c_uint = 240; -pub const AKEYCODE_TV_NETWORK: ::std::os::raw::c_uint = 241; -pub const AKEYCODE_TV_ANTENNA_CABLE: ::std::os::raw::c_uint = 242; -pub const AKEYCODE_TV_INPUT_HDMI_1: ::std::os::raw::c_uint = 243; -pub const AKEYCODE_TV_INPUT_HDMI_2: ::std::os::raw::c_uint = 244; -pub const AKEYCODE_TV_INPUT_HDMI_3: ::std::os::raw::c_uint = 245; -pub const AKEYCODE_TV_INPUT_HDMI_4: ::std::os::raw::c_uint = 246; -pub const AKEYCODE_TV_INPUT_COMPOSITE_1: ::std::os::raw::c_uint = 247; -pub const AKEYCODE_TV_INPUT_COMPOSITE_2: ::std::os::raw::c_uint = 248; -pub const AKEYCODE_TV_INPUT_COMPONENT_1: ::std::os::raw::c_uint = 249; -pub const AKEYCODE_TV_INPUT_COMPONENT_2: ::std::os::raw::c_uint = 250; -pub const AKEYCODE_TV_INPUT_VGA_1: ::std::os::raw::c_uint = 251; -pub const AKEYCODE_TV_AUDIO_DESCRIPTION: ::std::os::raw::c_uint = 252; -pub const AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_UP: ::std::os::raw::c_uint = 253; -pub const AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_DOWN: ::std::os::raw::c_uint = 254; -pub const AKEYCODE_TV_ZOOM_MODE: ::std::os::raw::c_uint = 255; -pub const AKEYCODE_TV_CONTENTS_MENU: ::std::os::raw::c_uint = 256; -pub const AKEYCODE_TV_MEDIA_CONTEXT_MENU: ::std::os::raw::c_uint = 257; -pub const AKEYCODE_TV_TIMER_PROGRAMMING: ::std::os::raw::c_uint = 258; -pub const AKEYCODE_HELP: ::std::os::raw::c_uint = 259; -pub const AKEYCODE_NAVIGATE_PREVIOUS: ::std::os::raw::c_uint = 260; -pub const AKEYCODE_NAVIGATE_NEXT: ::std::os::raw::c_uint = 261; -pub const AKEYCODE_NAVIGATE_IN: ::std::os::raw::c_uint = 262; -pub const AKEYCODE_NAVIGATE_OUT: ::std::os::raw::c_uint = 263; -pub const AKEYCODE_STEM_PRIMARY: ::std::os::raw::c_uint = 264; -pub const AKEYCODE_STEM_1: ::std::os::raw::c_uint = 265; -pub const AKEYCODE_STEM_2: ::std::os::raw::c_uint = 266; -pub const AKEYCODE_STEM_3: ::std::os::raw::c_uint = 267; -pub const AKEYCODE_DPAD_UP_LEFT: ::std::os::raw::c_uint = 268; -pub const AKEYCODE_DPAD_DOWN_LEFT: ::std::os::raw::c_uint = 269; -pub const AKEYCODE_DPAD_UP_RIGHT: ::std::os::raw::c_uint = 270; -pub const AKEYCODE_DPAD_DOWN_RIGHT: ::std::os::raw::c_uint = 271; -pub const AKEYCODE_MEDIA_SKIP_FORWARD: ::std::os::raw::c_uint = 272; -pub const AKEYCODE_MEDIA_SKIP_BACKWARD: ::std::os::raw::c_uint = 273; -pub const AKEYCODE_MEDIA_STEP_FORWARD: ::std::os::raw::c_uint = 274; -pub const AKEYCODE_MEDIA_STEP_BACKWARD: ::std::os::raw::c_uint = 275; -pub const AKEYCODE_SOFT_SLEEP: ::std::os::raw::c_uint = 276; -pub const AKEYCODE_CUT: ::std::os::raw::c_uint = 277; -pub const AKEYCODE_COPY: ::std::os::raw::c_uint = 278; -pub const AKEYCODE_PASTE: ::std::os::raw::c_uint = 279; -pub const AKEYCODE_SYSTEM_NAVIGATION_UP: ::std::os::raw::c_uint = 280; -pub const AKEYCODE_SYSTEM_NAVIGATION_DOWN: ::std::os::raw::c_uint = 281; -pub const AKEYCODE_SYSTEM_NAVIGATION_LEFT: ::std::os::raw::c_uint = 282; -pub const AKEYCODE_SYSTEM_NAVIGATION_RIGHT: ::std::os::raw::c_uint = 283; -pub const AKEYCODE_ALL_APPS: ::std::os::raw::c_uint = 284; -pub const AKEYCODE_REFRESH: ::std::os::raw::c_uint = 285; -pub const AKEYCODE_THUMBS_UP: ::std::os::raw::c_uint = 286; -pub const AKEYCODE_THUMBS_DOWN: ::std::os::raw::c_uint = 287; -pub const AKEYCODE_PROFILE_SWITCH: ::std::os::raw::c_uint = 288; +pub const AKEYCODE_UNKNOWN: _bindgen_ty_2 = 0; +pub const AKEYCODE_SOFT_LEFT: _bindgen_ty_2 = 1; +pub const AKEYCODE_SOFT_RIGHT: _bindgen_ty_2 = 2; +pub const AKEYCODE_HOME: _bindgen_ty_2 = 3; +pub const AKEYCODE_BACK: _bindgen_ty_2 = 4; +pub const AKEYCODE_CALL: _bindgen_ty_2 = 5; +pub const AKEYCODE_ENDCALL: _bindgen_ty_2 = 6; +pub const AKEYCODE_0: _bindgen_ty_2 = 7; +pub const AKEYCODE_1: _bindgen_ty_2 = 8; +pub const AKEYCODE_2: _bindgen_ty_2 = 9; +pub const AKEYCODE_3: _bindgen_ty_2 = 10; +pub const AKEYCODE_4: _bindgen_ty_2 = 11; +pub const AKEYCODE_5: _bindgen_ty_2 = 12; +pub const AKEYCODE_6: _bindgen_ty_2 = 13; +pub const AKEYCODE_7: _bindgen_ty_2 = 14; +pub const AKEYCODE_8: _bindgen_ty_2 = 15; +pub const AKEYCODE_9: _bindgen_ty_2 = 16; +pub const AKEYCODE_STAR: _bindgen_ty_2 = 17; +pub const AKEYCODE_POUND: _bindgen_ty_2 = 18; +pub const AKEYCODE_DPAD_UP: _bindgen_ty_2 = 19; +pub const AKEYCODE_DPAD_DOWN: _bindgen_ty_2 = 20; +pub const AKEYCODE_DPAD_LEFT: _bindgen_ty_2 = 21; +pub const AKEYCODE_DPAD_RIGHT: _bindgen_ty_2 = 22; +pub const AKEYCODE_DPAD_CENTER: _bindgen_ty_2 = 23; +pub const AKEYCODE_VOLUME_UP: _bindgen_ty_2 = 24; +pub const AKEYCODE_VOLUME_DOWN: _bindgen_ty_2 = 25; +pub const AKEYCODE_POWER: _bindgen_ty_2 = 26; +pub const AKEYCODE_CAMERA: _bindgen_ty_2 = 27; +pub const AKEYCODE_CLEAR: _bindgen_ty_2 = 28; +pub const AKEYCODE_A: _bindgen_ty_2 = 29; +pub const AKEYCODE_B: _bindgen_ty_2 = 30; +pub const AKEYCODE_C: _bindgen_ty_2 = 31; +pub const AKEYCODE_D: _bindgen_ty_2 = 32; +pub const AKEYCODE_E: _bindgen_ty_2 = 33; +pub const AKEYCODE_F: _bindgen_ty_2 = 34; +pub const AKEYCODE_G: _bindgen_ty_2 = 35; +pub const AKEYCODE_H: _bindgen_ty_2 = 36; +pub const AKEYCODE_I: _bindgen_ty_2 = 37; +pub const AKEYCODE_J: _bindgen_ty_2 = 38; +pub const AKEYCODE_K: _bindgen_ty_2 = 39; +pub const AKEYCODE_L: _bindgen_ty_2 = 40; +pub const AKEYCODE_M: _bindgen_ty_2 = 41; +pub const AKEYCODE_N: _bindgen_ty_2 = 42; +pub const AKEYCODE_O: _bindgen_ty_2 = 43; +pub const AKEYCODE_P: _bindgen_ty_2 = 44; +pub const AKEYCODE_Q: _bindgen_ty_2 = 45; +pub const AKEYCODE_R: _bindgen_ty_2 = 46; +pub const AKEYCODE_S: _bindgen_ty_2 = 47; +pub const AKEYCODE_T: _bindgen_ty_2 = 48; +pub const AKEYCODE_U: _bindgen_ty_2 = 49; +pub const AKEYCODE_V: _bindgen_ty_2 = 50; +pub const AKEYCODE_W: _bindgen_ty_2 = 51; +pub const AKEYCODE_X: _bindgen_ty_2 = 52; +pub const AKEYCODE_Y: _bindgen_ty_2 = 53; +pub const AKEYCODE_Z: _bindgen_ty_2 = 54; +pub const AKEYCODE_COMMA: _bindgen_ty_2 = 55; +pub const AKEYCODE_PERIOD: _bindgen_ty_2 = 56; +pub const AKEYCODE_ALT_LEFT: _bindgen_ty_2 = 57; +pub const AKEYCODE_ALT_RIGHT: _bindgen_ty_2 = 58; +pub const AKEYCODE_SHIFT_LEFT: _bindgen_ty_2 = 59; +pub const AKEYCODE_SHIFT_RIGHT: _bindgen_ty_2 = 60; +pub const AKEYCODE_TAB: _bindgen_ty_2 = 61; +pub const AKEYCODE_SPACE: _bindgen_ty_2 = 62; +pub const AKEYCODE_SYM: _bindgen_ty_2 = 63; +pub const AKEYCODE_EXPLORER: _bindgen_ty_2 = 64; +pub const AKEYCODE_ENVELOPE: _bindgen_ty_2 = 65; +pub const AKEYCODE_ENTER: _bindgen_ty_2 = 66; +pub const AKEYCODE_DEL: _bindgen_ty_2 = 67; +pub const AKEYCODE_GRAVE: _bindgen_ty_2 = 68; +pub const AKEYCODE_MINUS: _bindgen_ty_2 = 69; +pub const AKEYCODE_EQUALS: _bindgen_ty_2 = 70; +pub const AKEYCODE_LEFT_BRACKET: _bindgen_ty_2 = 71; +pub const AKEYCODE_RIGHT_BRACKET: _bindgen_ty_2 = 72; +pub const AKEYCODE_BACKSLASH: _bindgen_ty_2 = 73; +pub const AKEYCODE_SEMICOLON: _bindgen_ty_2 = 74; +pub const AKEYCODE_APOSTROPHE: _bindgen_ty_2 = 75; +pub const AKEYCODE_SLASH: _bindgen_ty_2 = 76; +pub const AKEYCODE_AT: _bindgen_ty_2 = 77; +pub const AKEYCODE_NUM: _bindgen_ty_2 = 78; +pub const AKEYCODE_HEADSETHOOK: _bindgen_ty_2 = 79; +pub const AKEYCODE_FOCUS: _bindgen_ty_2 = 80; +pub const AKEYCODE_PLUS: _bindgen_ty_2 = 81; +pub const AKEYCODE_MENU: _bindgen_ty_2 = 82; +pub const AKEYCODE_NOTIFICATION: _bindgen_ty_2 = 83; +pub const AKEYCODE_SEARCH: _bindgen_ty_2 = 84; +pub const AKEYCODE_MEDIA_PLAY_PAUSE: _bindgen_ty_2 = 85; +pub const AKEYCODE_MEDIA_STOP: _bindgen_ty_2 = 86; +pub const AKEYCODE_MEDIA_NEXT: _bindgen_ty_2 = 87; +pub const AKEYCODE_MEDIA_PREVIOUS: _bindgen_ty_2 = 88; +pub const AKEYCODE_MEDIA_REWIND: _bindgen_ty_2 = 89; +pub const AKEYCODE_MEDIA_FAST_FORWARD: _bindgen_ty_2 = 90; +pub const AKEYCODE_MUTE: _bindgen_ty_2 = 91; +pub const AKEYCODE_PAGE_UP: _bindgen_ty_2 = 92; +pub const AKEYCODE_PAGE_DOWN: _bindgen_ty_2 = 93; +pub const AKEYCODE_PICTSYMBOLS: _bindgen_ty_2 = 94; +pub const AKEYCODE_SWITCH_CHARSET: _bindgen_ty_2 = 95; +pub const AKEYCODE_BUTTON_A: _bindgen_ty_2 = 96; +pub const AKEYCODE_BUTTON_B: _bindgen_ty_2 = 97; +pub const AKEYCODE_BUTTON_C: _bindgen_ty_2 = 98; +pub const AKEYCODE_BUTTON_X: _bindgen_ty_2 = 99; +pub const AKEYCODE_BUTTON_Y: _bindgen_ty_2 = 100; +pub const AKEYCODE_BUTTON_Z: _bindgen_ty_2 = 101; +pub const AKEYCODE_BUTTON_L1: _bindgen_ty_2 = 102; +pub const AKEYCODE_BUTTON_R1: _bindgen_ty_2 = 103; +pub const AKEYCODE_BUTTON_L2: _bindgen_ty_2 = 104; +pub const AKEYCODE_BUTTON_R2: _bindgen_ty_2 = 105; +pub const AKEYCODE_BUTTON_THUMBL: _bindgen_ty_2 = 106; +pub const AKEYCODE_BUTTON_THUMBR: _bindgen_ty_2 = 107; +pub const AKEYCODE_BUTTON_START: _bindgen_ty_2 = 108; +pub const AKEYCODE_BUTTON_SELECT: _bindgen_ty_2 = 109; +pub const AKEYCODE_BUTTON_MODE: _bindgen_ty_2 = 110; +pub const AKEYCODE_ESCAPE: _bindgen_ty_2 = 111; +pub const AKEYCODE_FORWARD_DEL: _bindgen_ty_2 = 112; +pub const AKEYCODE_CTRL_LEFT: _bindgen_ty_2 = 113; +pub const AKEYCODE_CTRL_RIGHT: _bindgen_ty_2 = 114; +pub const AKEYCODE_CAPS_LOCK: _bindgen_ty_2 = 115; +pub const AKEYCODE_SCROLL_LOCK: _bindgen_ty_2 = 116; +pub const AKEYCODE_META_LEFT: _bindgen_ty_2 = 117; +pub const AKEYCODE_META_RIGHT: _bindgen_ty_2 = 118; +pub const AKEYCODE_FUNCTION: _bindgen_ty_2 = 119; +pub const AKEYCODE_SYSRQ: _bindgen_ty_2 = 120; +pub const AKEYCODE_BREAK: _bindgen_ty_2 = 121; +pub const AKEYCODE_MOVE_HOME: _bindgen_ty_2 = 122; +pub const AKEYCODE_MOVE_END: _bindgen_ty_2 = 123; +pub const AKEYCODE_INSERT: _bindgen_ty_2 = 124; +pub const AKEYCODE_FORWARD: _bindgen_ty_2 = 125; +pub const AKEYCODE_MEDIA_PLAY: _bindgen_ty_2 = 126; +pub const AKEYCODE_MEDIA_PAUSE: _bindgen_ty_2 = 127; +pub const AKEYCODE_MEDIA_CLOSE: _bindgen_ty_2 = 128; +pub const AKEYCODE_MEDIA_EJECT: _bindgen_ty_2 = 129; +pub const AKEYCODE_MEDIA_RECORD: _bindgen_ty_2 = 130; +pub const AKEYCODE_F1: _bindgen_ty_2 = 131; +pub const AKEYCODE_F2: _bindgen_ty_2 = 132; +pub const AKEYCODE_F3: _bindgen_ty_2 = 133; +pub const AKEYCODE_F4: _bindgen_ty_2 = 134; +pub const AKEYCODE_F5: _bindgen_ty_2 = 135; +pub const AKEYCODE_F6: _bindgen_ty_2 = 136; +pub const AKEYCODE_F7: _bindgen_ty_2 = 137; +pub const AKEYCODE_F8: _bindgen_ty_2 = 138; +pub const AKEYCODE_F9: _bindgen_ty_2 = 139; +pub const AKEYCODE_F10: _bindgen_ty_2 = 140; +pub const AKEYCODE_F11: _bindgen_ty_2 = 141; +pub const AKEYCODE_F12: _bindgen_ty_2 = 142; +pub const AKEYCODE_NUM_LOCK: _bindgen_ty_2 = 143; +pub const AKEYCODE_NUMPAD_0: _bindgen_ty_2 = 144; +pub const AKEYCODE_NUMPAD_1: _bindgen_ty_2 = 145; +pub const AKEYCODE_NUMPAD_2: _bindgen_ty_2 = 146; +pub const AKEYCODE_NUMPAD_3: _bindgen_ty_2 = 147; +pub const AKEYCODE_NUMPAD_4: _bindgen_ty_2 = 148; +pub const AKEYCODE_NUMPAD_5: _bindgen_ty_2 = 149; +pub const AKEYCODE_NUMPAD_6: _bindgen_ty_2 = 150; +pub const AKEYCODE_NUMPAD_7: _bindgen_ty_2 = 151; +pub const AKEYCODE_NUMPAD_8: _bindgen_ty_2 = 152; +pub const AKEYCODE_NUMPAD_9: _bindgen_ty_2 = 153; +pub const AKEYCODE_NUMPAD_DIVIDE: _bindgen_ty_2 = 154; +pub const AKEYCODE_NUMPAD_MULTIPLY: _bindgen_ty_2 = 155; +pub const AKEYCODE_NUMPAD_SUBTRACT: _bindgen_ty_2 = 156; +pub const AKEYCODE_NUMPAD_ADD: _bindgen_ty_2 = 157; +pub const AKEYCODE_NUMPAD_DOT: _bindgen_ty_2 = 158; +pub const AKEYCODE_NUMPAD_COMMA: _bindgen_ty_2 = 159; +pub const AKEYCODE_NUMPAD_ENTER: _bindgen_ty_2 = 160; +pub const AKEYCODE_NUMPAD_EQUALS: _bindgen_ty_2 = 161; +pub const AKEYCODE_NUMPAD_LEFT_PAREN: _bindgen_ty_2 = 162; +pub const AKEYCODE_NUMPAD_RIGHT_PAREN: _bindgen_ty_2 = 163; +pub const AKEYCODE_VOLUME_MUTE: _bindgen_ty_2 = 164; +pub const AKEYCODE_INFO: _bindgen_ty_2 = 165; +pub const AKEYCODE_CHANNEL_UP: _bindgen_ty_2 = 166; +pub const AKEYCODE_CHANNEL_DOWN: _bindgen_ty_2 = 167; +pub const AKEYCODE_ZOOM_IN: _bindgen_ty_2 = 168; +pub const AKEYCODE_ZOOM_OUT: _bindgen_ty_2 = 169; +pub const AKEYCODE_TV: _bindgen_ty_2 = 170; +pub const AKEYCODE_WINDOW: _bindgen_ty_2 = 171; +pub const AKEYCODE_GUIDE: _bindgen_ty_2 = 172; +pub const AKEYCODE_DVR: _bindgen_ty_2 = 173; +pub const AKEYCODE_BOOKMARK: _bindgen_ty_2 = 174; +pub const AKEYCODE_CAPTIONS: _bindgen_ty_2 = 175; +pub const AKEYCODE_SETTINGS: _bindgen_ty_2 = 176; +pub const AKEYCODE_TV_POWER: _bindgen_ty_2 = 177; +pub const AKEYCODE_TV_INPUT: _bindgen_ty_2 = 178; +pub const AKEYCODE_STB_POWER: _bindgen_ty_2 = 179; +pub const AKEYCODE_STB_INPUT: _bindgen_ty_2 = 180; +pub const AKEYCODE_AVR_POWER: _bindgen_ty_2 = 181; +pub const AKEYCODE_AVR_INPUT: _bindgen_ty_2 = 182; +pub const AKEYCODE_PROG_RED: _bindgen_ty_2 = 183; +pub const AKEYCODE_PROG_GREEN: _bindgen_ty_2 = 184; +pub const AKEYCODE_PROG_YELLOW: _bindgen_ty_2 = 185; +pub const AKEYCODE_PROG_BLUE: _bindgen_ty_2 = 186; +pub const AKEYCODE_APP_SWITCH: _bindgen_ty_2 = 187; +pub const AKEYCODE_BUTTON_1: _bindgen_ty_2 = 188; +pub const AKEYCODE_BUTTON_2: _bindgen_ty_2 = 189; +pub const AKEYCODE_BUTTON_3: _bindgen_ty_2 = 190; +pub const AKEYCODE_BUTTON_4: _bindgen_ty_2 = 191; +pub const AKEYCODE_BUTTON_5: _bindgen_ty_2 = 192; +pub const AKEYCODE_BUTTON_6: _bindgen_ty_2 = 193; +pub const AKEYCODE_BUTTON_7: _bindgen_ty_2 = 194; +pub const AKEYCODE_BUTTON_8: _bindgen_ty_2 = 195; +pub const AKEYCODE_BUTTON_9: _bindgen_ty_2 = 196; +pub const AKEYCODE_BUTTON_10: _bindgen_ty_2 = 197; +pub const AKEYCODE_BUTTON_11: _bindgen_ty_2 = 198; +pub const AKEYCODE_BUTTON_12: _bindgen_ty_2 = 199; +pub const AKEYCODE_BUTTON_13: _bindgen_ty_2 = 200; +pub const AKEYCODE_BUTTON_14: _bindgen_ty_2 = 201; +pub const AKEYCODE_BUTTON_15: _bindgen_ty_2 = 202; +pub const AKEYCODE_BUTTON_16: _bindgen_ty_2 = 203; +pub const AKEYCODE_LANGUAGE_SWITCH: _bindgen_ty_2 = 204; +pub const AKEYCODE_MANNER_MODE: _bindgen_ty_2 = 205; +pub const AKEYCODE_3D_MODE: _bindgen_ty_2 = 206; +pub const AKEYCODE_CONTACTS: _bindgen_ty_2 = 207; +pub const AKEYCODE_CALENDAR: _bindgen_ty_2 = 208; +pub const AKEYCODE_MUSIC: _bindgen_ty_2 = 209; +pub const AKEYCODE_CALCULATOR: _bindgen_ty_2 = 210; +pub const AKEYCODE_ZENKAKU_HANKAKU: _bindgen_ty_2 = 211; +pub const AKEYCODE_EISU: _bindgen_ty_2 = 212; +pub const AKEYCODE_MUHENKAN: _bindgen_ty_2 = 213; +pub const AKEYCODE_HENKAN: _bindgen_ty_2 = 214; +pub const AKEYCODE_KATAKANA_HIRAGANA: _bindgen_ty_2 = 215; +pub const AKEYCODE_YEN: _bindgen_ty_2 = 216; +pub const AKEYCODE_RO: _bindgen_ty_2 = 217; +pub const AKEYCODE_KANA: _bindgen_ty_2 = 218; +pub const AKEYCODE_ASSIST: _bindgen_ty_2 = 219; +pub const AKEYCODE_BRIGHTNESS_DOWN: _bindgen_ty_2 = 220; +pub const AKEYCODE_BRIGHTNESS_UP: _bindgen_ty_2 = 221; +pub const AKEYCODE_MEDIA_AUDIO_TRACK: _bindgen_ty_2 = 222; +pub const AKEYCODE_SLEEP: _bindgen_ty_2 = 223; +pub const AKEYCODE_WAKEUP: _bindgen_ty_2 = 224; +pub const AKEYCODE_PAIRING: _bindgen_ty_2 = 225; +pub const AKEYCODE_MEDIA_TOP_MENU: _bindgen_ty_2 = 226; +pub const AKEYCODE_11: _bindgen_ty_2 = 227; +pub const AKEYCODE_12: _bindgen_ty_2 = 228; +pub const AKEYCODE_LAST_CHANNEL: _bindgen_ty_2 = 229; +pub const AKEYCODE_TV_DATA_SERVICE: _bindgen_ty_2 = 230; +pub const AKEYCODE_VOICE_ASSIST: _bindgen_ty_2 = 231; +pub const AKEYCODE_TV_RADIO_SERVICE: _bindgen_ty_2 = 232; +pub const AKEYCODE_TV_TELETEXT: _bindgen_ty_2 = 233; +pub const AKEYCODE_TV_NUMBER_ENTRY: _bindgen_ty_2 = 234; +pub const AKEYCODE_TV_TERRESTRIAL_ANALOG: _bindgen_ty_2 = 235; +pub const AKEYCODE_TV_TERRESTRIAL_DIGITAL: _bindgen_ty_2 = 236; +pub const AKEYCODE_TV_SATELLITE: _bindgen_ty_2 = 237; +pub const AKEYCODE_TV_SATELLITE_BS: _bindgen_ty_2 = 238; +pub const AKEYCODE_TV_SATELLITE_CS: _bindgen_ty_2 = 239; +pub const AKEYCODE_TV_SATELLITE_SERVICE: _bindgen_ty_2 = 240; +pub const AKEYCODE_TV_NETWORK: _bindgen_ty_2 = 241; +pub const AKEYCODE_TV_ANTENNA_CABLE: _bindgen_ty_2 = 242; +pub const AKEYCODE_TV_INPUT_HDMI_1: _bindgen_ty_2 = 243; +pub const AKEYCODE_TV_INPUT_HDMI_2: _bindgen_ty_2 = 244; +pub const AKEYCODE_TV_INPUT_HDMI_3: _bindgen_ty_2 = 245; +pub const AKEYCODE_TV_INPUT_HDMI_4: _bindgen_ty_2 = 246; +pub const AKEYCODE_TV_INPUT_COMPOSITE_1: _bindgen_ty_2 = 247; +pub const AKEYCODE_TV_INPUT_COMPOSITE_2: _bindgen_ty_2 = 248; +pub const AKEYCODE_TV_INPUT_COMPONENT_1: _bindgen_ty_2 = 249; +pub const AKEYCODE_TV_INPUT_COMPONENT_2: _bindgen_ty_2 = 250; +pub const AKEYCODE_TV_INPUT_VGA_1: _bindgen_ty_2 = 251; +pub const AKEYCODE_TV_AUDIO_DESCRIPTION: _bindgen_ty_2 = 252; +pub const AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_UP: _bindgen_ty_2 = 253; +pub const AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_DOWN: _bindgen_ty_2 = 254; +pub const AKEYCODE_TV_ZOOM_MODE: _bindgen_ty_2 = 255; +pub const AKEYCODE_TV_CONTENTS_MENU: _bindgen_ty_2 = 256; +pub const AKEYCODE_TV_MEDIA_CONTEXT_MENU: _bindgen_ty_2 = 257; +pub const AKEYCODE_TV_TIMER_PROGRAMMING: _bindgen_ty_2 = 258; +pub const AKEYCODE_HELP: _bindgen_ty_2 = 259; +pub const AKEYCODE_NAVIGATE_PREVIOUS: _bindgen_ty_2 = 260; +pub const AKEYCODE_NAVIGATE_NEXT: _bindgen_ty_2 = 261; +pub const AKEYCODE_NAVIGATE_IN: _bindgen_ty_2 = 262; +pub const AKEYCODE_NAVIGATE_OUT: _bindgen_ty_2 = 263; +pub const AKEYCODE_STEM_PRIMARY: _bindgen_ty_2 = 264; +pub const AKEYCODE_STEM_1: _bindgen_ty_2 = 265; +pub const AKEYCODE_STEM_2: _bindgen_ty_2 = 266; +pub const AKEYCODE_STEM_3: _bindgen_ty_2 = 267; +pub const AKEYCODE_DPAD_UP_LEFT: _bindgen_ty_2 = 268; +pub const AKEYCODE_DPAD_DOWN_LEFT: _bindgen_ty_2 = 269; +pub const AKEYCODE_DPAD_UP_RIGHT: _bindgen_ty_2 = 270; +pub const AKEYCODE_DPAD_DOWN_RIGHT: _bindgen_ty_2 = 271; +pub const AKEYCODE_MEDIA_SKIP_FORWARD: _bindgen_ty_2 = 272; +pub const AKEYCODE_MEDIA_SKIP_BACKWARD: _bindgen_ty_2 = 273; +pub const AKEYCODE_MEDIA_STEP_FORWARD: _bindgen_ty_2 = 274; +pub const AKEYCODE_MEDIA_STEP_BACKWARD: _bindgen_ty_2 = 275; +pub const AKEYCODE_SOFT_SLEEP: _bindgen_ty_2 = 276; +pub const AKEYCODE_CUT: _bindgen_ty_2 = 277; +pub const AKEYCODE_COPY: _bindgen_ty_2 = 278; +pub const AKEYCODE_PASTE: _bindgen_ty_2 = 279; +pub const AKEYCODE_SYSTEM_NAVIGATION_UP: _bindgen_ty_2 = 280; +pub const AKEYCODE_SYSTEM_NAVIGATION_DOWN: _bindgen_ty_2 = 281; +pub const AKEYCODE_SYSTEM_NAVIGATION_LEFT: _bindgen_ty_2 = 282; +pub const AKEYCODE_SYSTEM_NAVIGATION_RIGHT: _bindgen_ty_2 = 283; +pub const AKEYCODE_ALL_APPS: _bindgen_ty_2 = 284; +pub const AKEYCODE_REFRESH: _bindgen_ty_2 = 285; +pub const AKEYCODE_THUMBS_UP: _bindgen_ty_2 = 286; +pub const AKEYCODE_THUMBS_DOWN: _bindgen_ty_2 = 287; +pub const AKEYCODE_PROFILE_SWITCH: _bindgen_ty_2 = 288; +pub const AKEYCODE_VIDEO_APP_1: _bindgen_ty_2 = 289; +pub const AKEYCODE_VIDEO_APP_2: _bindgen_ty_2 = 290; +pub const AKEYCODE_VIDEO_APP_3: _bindgen_ty_2 = 291; +pub const AKEYCODE_VIDEO_APP_4: _bindgen_ty_2 = 292; +pub const AKEYCODE_VIDEO_APP_5: _bindgen_ty_2 = 293; +pub const AKEYCODE_VIDEO_APP_6: _bindgen_ty_2 = 294; +pub const AKEYCODE_VIDEO_APP_7: _bindgen_ty_2 = 295; +pub const AKEYCODE_VIDEO_APP_8: _bindgen_ty_2 = 296; +pub const AKEYCODE_FEATURED_APP_1: _bindgen_ty_2 = 297; +pub const AKEYCODE_FEATURED_APP_2: _bindgen_ty_2 = 298; +pub const AKEYCODE_FEATURED_APP_3: _bindgen_ty_2 = 299; +pub const AKEYCODE_FEATURED_APP_4: _bindgen_ty_2 = 300; +pub const AKEYCODE_DEMO_APP_1: _bindgen_ty_2 = 301; +pub const AKEYCODE_DEMO_APP_2: _bindgen_ty_2 = 302; +pub const AKEYCODE_DEMO_APP_3: _bindgen_ty_2 = 303; +pub const AKEYCODE_DEMO_APP_4: _bindgen_ty_2 = 304; pub type _bindgen_ty_2 = ::std::os::raw::c_uint; -pub const ALOOPER_PREPARE_ALLOW_NON_CALLBACKS: ::std::os::raw::c_uint = 1; +pub const ALOOPER_PREPARE_ALLOW_NON_CALLBACKS: _bindgen_ty_3 = 1; pub type _bindgen_ty_3 = ::std::os::raw::c_uint; -pub const ALOOPER_POLL_WAKE: ::std::os::raw::c_int = -1; -pub const ALOOPER_POLL_CALLBACK: ::std::os::raw::c_int = -2; -pub const ALOOPER_POLL_TIMEOUT: ::std::os::raw::c_int = -3; -pub const ALOOPER_POLL_ERROR: ::std::os::raw::c_int = -4; +pub const ALOOPER_POLL_WAKE: _bindgen_ty_4 = -1; +pub const ALOOPER_POLL_CALLBACK: _bindgen_ty_4 = -2; +pub const ALOOPER_POLL_TIMEOUT: _bindgen_ty_4 = -3; +pub const ALOOPER_POLL_ERROR: _bindgen_ty_4 = -4; pub type _bindgen_ty_4 = ::std::os::raw::c_int; -pub const ALOOPER_EVENT_INPUT: ::std::os::raw::c_uint = 1; -pub const ALOOPER_EVENT_OUTPUT: ::std::os::raw::c_uint = 2; -pub const ALOOPER_EVENT_ERROR: ::std::os::raw::c_uint = 4; -pub const ALOOPER_EVENT_HANGUP: ::std::os::raw::c_uint = 8; -pub const ALOOPER_EVENT_INVALID: ::std::os::raw::c_uint = 16; +pub const ALOOPER_EVENT_INPUT: _bindgen_ty_5 = 1; +pub const ALOOPER_EVENT_OUTPUT: _bindgen_ty_5 = 2; +pub const ALOOPER_EVENT_ERROR: _bindgen_ty_5 = 4; +pub const ALOOPER_EVENT_HANGUP: _bindgen_ty_5 = 8; +pub const ALOOPER_EVENT_INVALID: _bindgen_ty_5 = 16; pub type _bindgen_ty_5 = ::std::os::raw::c_uint; -pub const AKEY_STATE_UNKNOWN: ::std::os::raw::c_int = -1; -pub const AKEY_STATE_UP: ::std::os::raw::c_int = 0; -pub const AKEY_STATE_DOWN: ::std::os::raw::c_int = 1; -pub const AKEY_STATE_VIRTUAL: ::std::os::raw::c_int = 2; +pub type __gnuc_va_list = __builtin_va_list; +pub type va_list = __builtin_va_list; +#[repr(C)] +pub struct JavaVMAttachArgs { + pub version: jint, + pub name: *const ::std::os::raw::c_char, + pub group: jobject, +} +#[test] +fn bindgen_test_layout_JavaVMAttachArgs() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 12usize, + "Size of JavaVMAttachArgs" + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + "Alignment of JavaVMAttachArgs" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).version) as usize - ptr as usize }, + 0usize, + "Offset of field: JavaVMAttachArgs::version" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize }, + 4usize, + "Offset of field: JavaVMAttachArgs::name" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).group) as usize - ptr as usize }, + 8usize, + "Offset of field: JavaVMAttachArgs::group" + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct JavaVMOption { + pub optionString: *const ::std::os::raw::c_char, + pub extraInfo: *mut ::std::os::raw::c_void, +} +#[test] +fn bindgen_test_layout_JavaVMOption() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 8usize, + "Size of JavaVMOption" + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + "Alignment of JavaVMOption" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).optionString) as usize - ptr as usize }, + 0usize, + "Offset of field: JavaVMOption::optionString" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).extraInfo) as usize - ptr as usize }, + 4usize, + "Offset of field: JavaVMOption::extraInfo" + ); +} +#[repr(C)] +pub struct JavaVMInitArgs { + pub version: jint, + pub nOptions: jint, + pub options: *mut JavaVMOption, + pub ignoreUnrecognized: jboolean, +} +#[test] +fn bindgen_test_layout_JavaVMInitArgs() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 16usize, + "Size of JavaVMInitArgs" + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + "Alignment of JavaVMInitArgs" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).version) as usize - ptr as usize }, + 0usize, + "Offset of field: JavaVMInitArgs::version" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).nOptions) as usize - ptr as usize }, + 4usize, + "Offset of field: JavaVMInitArgs::nOptions" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).options) as usize - ptr as usize }, + 8usize, + "Offset of field: JavaVMInitArgs::options" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ignoreUnrecognized) as usize - ptr as usize }, + 12usize, + "Offset of field: JavaVMInitArgs::ignoreUnrecognized" + ); +} +pub const AKEY_STATE_UNKNOWN: _bindgen_ty_6 = -1; +pub const AKEY_STATE_UP: _bindgen_ty_6 = 0; +pub const AKEY_STATE_DOWN: _bindgen_ty_6 = 1; +pub const AKEY_STATE_VIRTUAL: _bindgen_ty_6 = 2; pub type _bindgen_ty_6 = ::std::os::raw::c_int; -pub const AMETA_NONE: ::std::os::raw::c_uint = 0; -pub const AMETA_ALT_ON: ::std::os::raw::c_uint = 2; -pub const AMETA_ALT_LEFT_ON: ::std::os::raw::c_uint = 16; -pub const AMETA_ALT_RIGHT_ON: ::std::os::raw::c_uint = 32; -pub const AMETA_SHIFT_ON: ::std::os::raw::c_uint = 1; -pub const AMETA_SHIFT_LEFT_ON: ::std::os::raw::c_uint = 64; -pub const AMETA_SHIFT_RIGHT_ON: ::std::os::raw::c_uint = 128; -pub const AMETA_SYM_ON: ::std::os::raw::c_uint = 4; -pub const AMETA_FUNCTION_ON: ::std::os::raw::c_uint = 8; -pub const AMETA_CTRL_ON: ::std::os::raw::c_uint = 4096; -pub const AMETA_CTRL_LEFT_ON: ::std::os::raw::c_uint = 8192; -pub const AMETA_CTRL_RIGHT_ON: ::std::os::raw::c_uint = 16384; -pub const AMETA_META_ON: ::std::os::raw::c_uint = 65536; -pub const AMETA_META_LEFT_ON: ::std::os::raw::c_uint = 131072; -pub const AMETA_META_RIGHT_ON: ::std::os::raw::c_uint = 262144; -pub const AMETA_CAPS_LOCK_ON: ::std::os::raw::c_uint = 1048576; -pub const AMETA_NUM_LOCK_ON: ::std::os::raw::c_uint = 2097152; -pub const AMETA_SCROLL_LOCK_ON: ::std::os::raw::c_uint = 4194304; +pub const AMETA_NONE: _bindgen_ty_7 = 0; +pub const AMETA_ALT_ON: _bindgen_ty_7 = 2; +pub const AMETA_ALT_LEFT_ON: _bindgen_ty_7 = 16; +pub const AMETA_ALT_RIGHT_ON: _bindgen_ty_7 = 32; +pub const AMETA_SHIFT_ON: _bindgen_ty_7 = 1; +pub const AMETA_SHIFT_LEFT_ON: _bindgen_ty_7 = 64; +pub const AMETA_SHIFT_RIGHT_ON: _bindgen_ty_7 = 128; +pub const AMETA_SYM_ON: _bindgen_ty_7 = 4; +pub const AMETA_FUNCTION_ON: _bindgen_ty_7 = 8; +pub const AMETA_CTRL_ON: _bindgen_ty_7 = 4096; +pub const AMETA_CTRL_LEFT_ON: _bindgen_ty_7 = 8192; +pub const AMETA_CTRL_RIGHT_ON: _bindgen_ty_7 = 16384; +pub const AMETA_META_ON: _bindgen_ty_7 = 65536; +pub const AMETA_META_LEFT_ON: _bindgen_ty_7 = 131072; +pub const AMETA_META_RIGHT_ON: _bindgen_ty_7 = 262144; +pub const AMETA_CAPS_LOCK_ON: _bindgen_ty_7 = 1048576; +pub const AMETA_NUM_LOCK_ON: _bindgen_ty_7 = 2097152; +pub const AMETA_SCROLL_LOCK_ON: _bindgen_ty_7 = 4194304; pub type _bindgen_ty_7 = ::std::os::raw::c_uint; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct AInputEvent { _unused: [u8; 0], } -pub const AINPUT_EVENT_TYPE_KEY: ::std::os::raw::c_uint = 1; -pub const AINPUT_EVENT_TYPE_MOTION: ::std::os::raw::c_uint = 2; +pub const AINPUT_EVENT_TYPE_KEY: _bindgen_ty_8 = 1; +pub const AINPUT_EVENT_TYPE_MOTION: _bindgen_ty_8 = 2; +pub const AINPUT_EVENT_TYPE_FOCUS: _bindgen_ty_8 = 3; +pub const AINPUT_EVENT_TYPE_CAPTURE: _bindgen_ty_8 = 4; +pub const AINPUT_EVENT_TYPE_DRAG: _bindgen_ty_8 = 5; +pub const AINPUT_EVENT_TYPE_TOUCH_MODE: _bindgen_ty_8 = 6; pub type _bindgen_ty_8 = ::std::os::raw::c_uint; -pub const AKEY_EVENT_ACTION_DOWN: ::std::os::raw::c_uint = 0; -pub const AKEY_EVENT_ACTION_UP: ::std::os::raw::c_uint = 1; -pub const AKEY_EVENT_ACTION_MULTIPLE: ::std::os::raw::c_uint = 2; +pub const AKEY_EVENT_ACTION_DOWN: _bindgen_ty_9 = 0; +pub const AKEY_EVENT_ACTION_UP: _bindgen_ty_9 = 1; +pub const AKEY_EVENT_ACTION_MULTIPLE: _bindgen_ty_9 = 2; pub type _bindgen_ty_9 = ::std::os::raw::c_uint; -pub const AKEY_EVENT_FLAG_WOKE_HERE: ::std::os::raw::c_uint = 1; -pub const AKEY_EVENT_FLAG_SOFT_KEYBOARD: ::std::os::raw::c_uint = 2; -pub const AKEY_EVENT_FLAG_KEEP_TOUCH_MODE: ::std::os::raw::c_uint = 4; -pub const AKEY_EVENT_FLAG_FROM_SYSTEM: ::std::os::raw::c_uint = 8; -pub const AKEY_EVENT_FLAG_EDITOR_ACTION: ::std::os::raw::c_uint = 16; -pub const AKEY_EVENT_FLAG_CANCELED: ::std::os::raw::c_uint = 32; -pub const AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY: ::std::os::raw::c_uint = 64; -pub const AKEY_EVENT_FLAG_LONG_PRESS: ::std::os::raw::c_uint = 128; -pub const AKEY_EVENT_FLAG_CANCELED_LONG_PRESS: ::std::os::raw::c_uint = 256; -pub const AKEY_EVENT_FLAG_TRACKING: ::std::os::raw::c_uint = 512; -pub const AKEY_EVENT_FLAG_FALLBACK: ::std::os::raw::c_uint = 1024; +pub const AKEY_EVENT_FLAG_WOKE_HERE: _bindgen_ty_10 = 1; +pub const AKEY_EVENT_FLAG_SOFT_KEYBOARD: _bindgen_ty_10 = 2; +pub const AKEY_EVENT_FLAG_KEEP_TOUCH_MODE: _bindgen_ty_10 = 4; +pub const AKEY_EVENT_FLAG_FROM_SYSTEM: _bindgen_ty_10 = 8; +pub const AKEY_EVENT_FLAG_EDITOR_ACTION: _bindgen_ty_10 = 16; +pub const AKEY_EVENT_FLAG_CANCELED: _bindgen_ty_10 = 32; +pub const AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY: _bindgen_ty_10 = 64; +pub const AKEY_EVENT_FLAG_LONG_PRESS: _bindgen_ty_10 = 128; +pub const AKEY_EVENT_FLAG_CANCELED_LONG_PRESS: _bindgen_ty_10 = 256; +pub const AKEY_EVENT_FLAG_TRACKING: _bindgen_ty_10 = 512; +pub const AKEY_EVENT_FLAG_FALLBACK: _bindgen_ty_10 = 1024; pub type _bindgen_ty_10 = ::std::os::raw::c_uint; -pub const AMOTION_EVENT_ACTION_MASK: ::std::os::raw::c_uint = 255; -pub const AMOTION_EVENT_ACTION_POINTER_INDEX_MASK: ::std::os::raw::c_uint = 65280; -pub const AMOTION_EVENT_ACTION_DOWN: ::std::os::raw::c_uint = 0; -pub const AMOTION_EVENT_ACTION_UP: ::std::os::raw::c_uint = 1; -pub const AMOTION_EVENT_ACTION_MOVE: ::std::os::raw::c_uint = 2; -pub const AMOTION_EVENT_ACTION_CANCEL: ::std::os::raw::c_uint = 3; -pub const AMOTION_EVENT_ACTION_OUTSIDE: ::std::os::raw::c_uint = 4; -pub const AMOTION_EVENT_ACTION_POINTER_DOWN: ::std::os::raw::c_uint = 5; -pub const AMOTION_EVENT_ACTION_POINTER_UP: ::std::os::raw::c_uint = 6; -pub const AMOTION_EVENT_ACTION_HOVER_MOVE: ::std::os::raw::c_uint = 7; -pub const AMOTION_EVENT_ACTION_SCROLL: ::std::os::raw::c_uint = 8; -pub const AMOTION_EVENT_ACTION_HOVER_ENTER: ::std::os::raw::c_uint = 9; -pub const AMOTION_EVENT_ACTION_HOVER_EXIT: ::std::os::raw::c_uint = 10; -pub const AMOTION_EVENT_ACTION_BUTTON_PRESS: ::std::os::raw::c_uint = 11; -pub const AMOTION_EVENT_ACTION_BUTTON_RELEASE: ::std::os::raw::c_uint = 12; +pub const AMOTION_EVENT_ACTION_MASK: _bindgen_ty_11 = 255; +pub const AMOTION_EVENT_ACTION_POINTER_INDEX_MASK: _bindgen_ty_11 = 65280; +pub const AMOTION_EVENT_ACTION_DOWN: _bindgen_ty_11 = 0; +pub const AMOTION_EVENT_ACTION_UP: _bindgen_ty_11 = 1; +pub const AMOTION_EVENT_ACTION_MOVE: _bindgen_ty_11 = 2; +pub const AMOTION_EVENT_ACTION_CANCEL: _bindgen_ty_11 = 3; +pub const AMOTION_EVENT_ACTION_OUTSIDE: _bindgen_ty_11 = 4; +pub const AMOTION_EVENT_ACTION_POINTER_DOWN: _bindgen_ty_11 = 5; +pub const AMOTION_EVENT_ACTION_POINTER_UP: _bindgen_ty_11 = 6; +pub const AMOTION_EVENT_ACTION_HOVER_MOVE: _bindgen_ty_11 = 7; +pub const AMOTION_EVENT_ACTION_SCROLL: _bindgen_ty_11 = 8; +pub const AMOTION_EVENT_ACTION_HOVER_ENTER: _bindgen_ty_11 = 9; +pub const AMOTION_EVENT_ACTION_HOVER_EXIT: _bindgen_ty_11 = 10; +pub const AMOTION_EVENT_ACTION_BUTTON_PRESS: _bindgen_ty_11 = 11; +pub const AMOTION_EVENT_ACTION_BUTTON_RELEASE: _bindgen_ty_11 = 12; pub type _bindgen_ty_11 = ::std::os::raw::c_uint; -pub const AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED: ::std::os::raw::c_uint = 1; +pub const AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED: _bindgen_ty_12 = 1; pub type _bindgen_ty_12 = ::std::os::raw::c_uint; -pub const AMOTION_EVENT_EDGE_FLAG_NONE: ::std::os::raw::c_uint = 0; -pub const AMOTION_EVENT_EDGE_FLAG_TOP: ::std::os::raw::c_uint = 1; -pub const AMOTION_EVENT_EDGE_FLAG_BOTTOM: ::std::os::raw::c_uint = 2; -pub const AMOTION_EVENT_EDGE_FLAG_LEFT: ::std::os::raw::c_uint = 4; -pub const AMOTION_EVENT_EDGE_FLAG_RIGHT: ::std::os::raw::c_uint = 8; +pub const AMOTION_EVENT_EDGE_FLAG_NONE: _bindgen_ty_13 = 0; +pub const AMOTION_EVENT_EDGE_FLAG_TOP: _bindgen_ty_13 = 1; +pub const AMOTION_EVENT_EDGE_FLAG_BOTTOM: _bindgen_ty_13 = 2; +pub const AMOTION_EVENT_EDGE_FLAG_LEFT: _bindgen_ty_13 = 4; +pub const AMOTION_EVENT_EDGE_FLAG_RIGHT: _bindgen_ty_13 = 8; pub type _bindgen_ty_13 = ::std::os::raw::c_uint; -pub const AMOTION_EVENT_AXIS_X: ::std::os::raw::c_uint = 0; -pub const AMOTION_EVENT_AXIS_Y: ::std::os::raw::c_uint = 1; -pub const AMOTION_EVENT_AXIS_PRESSURE: ::std::os::raw::c_uint = 2; -pub const AMOTION_EVENT_AXIS_SIZE: ::std::os::raw::c_uint = 3; -pub const AMOTION_EVENT_AXIS_TOUCH_MAJOR: ::std::os::raw::c_uint = 4; -pub const AMOTION_EVENT_AXIS_TOUCH_MINOR: ::std::os::raw::c_uint = 5; -pub const AMOTION_EVENT_AXIS_TOOL_MAJOR: ::std::os::raw::c_uint = 6; -pub const AMOTION_EVENT_AXIS_TOOL_MINOR: ::std::os::raw::c_uint = 7; -pub const AMOTION_EVENT_AXIS_ORIENTATION: ::std::os::raw::c_uint = 8; -pub const AMOTION_EVENT_AXIS_VSCROLL: ::std::os::raw::c_uint = 9; -pub const AMOTION_EVENT_AXIS_HSCROLL: ::std::os::raw::c_uint = 10; -pub const AMOTION_EVENT_AXIS_Z: ::std::os::raw::c_uint = 11; -pub const AMOTION_EVENT_AXIS_RX: ::std::os::raw::c_uint = 12; -pub const AMOTION_EVENT_AXIS_RY: ::std::os::raw::c_uint = 13; -pub const AMOTION_EVENT_AXIS_RZ: ::std::os::raw::c_uint = 14; -pub const AMOTION_EVENT_AXIS_HAT_X: ::std::os::raw::c_uint = 15; -pub const AMOTION_EVENT_AXIS_HAT_Y: ::std::os::raw::c_uint = 16; -pub const AMOTION_EVENT_AXIS_LTRIGGER: ::std::os::raw::c_uint = 17; -pub const AMOTION_EVENT_AXIS_RTRIGGER: ::std::os::raw::c_uint = 18; -pub const AMOTION_EVENT_AXIS_THROTTLE: ::std::os::raw::c_uint = 19; -pub const AMOTION_EVENT_AXIS_RUDDER: ::std::os::raw::c_uint = 20; -pub const AMOTION_EVENT_AXIS_WHEEL: ::std::os::raw::c_uint = 21; -pub const AMOTION_EVENT_AXIS_GAS: ::std::os::raw::c_uint = 22; -pub const AMOTION_EVENT_AXIS_BRAKE: ::std::os::raw::c_uint = 23; -pub const AMOTION_EVENT_AXIS_DISTANCE: ::std::os::raw::c_uint = 24; -pub const AMOTION_EVENT_AXIS_TILT: ::std::os::raw::c_uint = 25; -pub const AMOTION_EVENT_AXIS_SCROLL: ::std::os::raw::c_uint = 26; -pub const AMOTION_EVENT_AXIS_RELATIVE_X: ::std::os::raw::c_uint = 27; -pub const AMOTION_EVENT_AXIS_RELATIVE_Y: ::std::os::raw::c_uint = 28; -pub const AMOTION_EVENT_AXIS_GENERIC_1: ::std::os::raw::c_uint = 32; -pub const AMOTION_EVENT_AXIS_GENERIC_2: ::std::os::raw::c_uint = 33; -pub const AMOTION_EVENT_AXIS_GENERIC_3: ::std::os::raw::c_uint = 34; -pub const AMOTION_EVENT_AXIS_GENERIC_4: ::std::os::raw::c_uint = 35; -pub const AMOTION_EVENT_AXIS_GENERIC_5: ::std::os::raw::c_uint = 36; -pub const AMOTION_EVENT_AXIS_GENERIC_6: ::std::os::raw::c_uint = 37; -pub const AMOTION_EVENT_AXIS_GENERIC_7: ::std::os::raw::c_uint = 38; -pub const AMOTION_EVENT_AXIS_GENERIC_8: ::std::os::raw::c_uint = 39; -pub const AMOTION_EVENT_AXIS_GENERIC_9: ::std::os::raw::c_uint = 40; -pub const AMOTION_EVENT_AXIS_GENERIC_10: ::std::os::raw::c_uint = 41; -pub const AMOTION_EVENT_AXIS_GENERIC_11: ::std::os::raw::c_uint = 42; -pub const AMOTION_EVENT_AXIS_GENERIC_12: ::std::os::raw::c_uint = 43; -pub const AMOTION_EVENT_AXIS_GENERIC_13: ::std::os::raw::c_uint = 44; -pub const AMOTION_EVENT_AXIS_GENERIC_14: ::std::os::raw::c_uint = 45; -pub const AMOTION_EVENT_AXIS_GENERIC_15: ::std::os::raw::c_uint = 46; -pub const AMOTION_EVENT_AXIS_GENERIC_16: ::std::os::raw::c_uint = 47; +pub const AMOTION_EVENT_AXIS_X: _bindgen_ty_14 = 0; +pub const AMOTION_EVENT_AXIS_Y: _bindgen_ty_14 = 1; +pub const AMOTION_EVENT_AXIS_PRESSURE: _bindgen_ty_14 = 2; +pub const AMOTION_EVENT_AXIS_SIZE: _bindgen_ty_14 = 3; +pub const AMOTION_EVENT_AXIS_TOUCH_MAJOR: _bindgen_ty_14 = 4; +pub const AMOTION_EVENT_AXIS_TOUCH_MINOR: _bindgen_ty_14 = 5; +pub const AMOTION_EVENT_AXIS_TOOL_MAJOR: _bindgen_ty_14 = 6; +pub const AMOTION_EVENT_AXIS_TOOL_MINOR: _bindgen_ty_14 = 7; +pub const AMOTION_EVENT_AXIS_ORIENTATION: _bindgen_ty_14 = 8; +pub const AMOTION_EVENT_AXIS_VSCROLL: _bindgen_ty_14 = 9; +pub const AMOTION_EVENT_AXIS_HSCROLL: _bindgen_ty_14 = 10; +pub const AMOTION_EVENT_AXIS_Z: _bindgen_ty_14 = 11; +pub const AMOTION_EVENT_AXIS_RX: _bindgen_ty_14 = 12; +pub const AMOTION_EVENT_AXIS_RY: _bindgen_ty_14 = 13; +pub const AMOTION_EVENT_AXIS_RZ: _bindgen_ty_14 = 14; +pub const AMOTION_EVENT_AXIS_HAT_X: _bindgen_ty_14 = 15; +pub const AMOTION_EVENT_AXIS_HAT_Y: _bindgen_ty_14 = 16; +pub const AMOTION_EVENT_AXIS_LTRIGGER: _bindgen_ty_14 = 17; +pub const AMOTION_EVENT_AXIS_RTRIGGER: _bindgen_ty_14 = 18; +pub const AMOTION_EVENT_AXIS_THROTTLE: _bindgen_ty_14 = 19; +pub const AMOTION_EVENT_AXIS_RUDDER: _bindgen_ty_14 = 20; +pub const AMOTION_EVENT_AXIS_WHEEL: _bindgen_ty_14 = 21; +pub const AMOTION_EVENT_AXIS_GAS: _bindgen_ty_14 = 22; +pub const AMOTION_EVENT_AXIS_BRAKE: _bindgen_ty_14 = 23; +pub const AMOTION_EVENT_AXIS_DISTANCE: _bindgen_ty_14 = 24; +pub const AMOTION_EVENT_AXIS_TILT: _bindgen_ty_14 = 25; +pub const AMOTION_EVENT_AXIS_SCROLL: _bindgen_ty_14 = 26; +pub const AMOTION_EVENT_AXIS_RELATIVE_X: _bindgen_ty_14 = 27; +pub const AMOTION_EVENT_AXIS_RELATIVE_Y: _bindgen_ty_14 = 28; +pub const AMOTION_EVENT_AXIS_GENERIC_1: _bindgen_ty_14 = 32; +pub const AMOTION_EVENT_AXIS_GENERIC_2: _bindgen_ty_14 = 33; +pub const AMOTION_EVENT_AXIS_GENERIC_3: _bindgen_ty_14 = 34; +pub const AMOTION_EVENT_AXIS_GENERIC_4: _bindgen_ty_14 = 35; +pub const AMOTION_EVENT_AXIS_GENERIC_5: _bindgen_ty_14 = 36; +pub const AMOTION_EVENT_AXIS_GENERIC_6: _bindgen_ty_14 = 37; +pub const AMOTION_EVENT_AXIS_GENERIC_7: _bindgen_ty_14 = 38; +pub const AMOTION_EVENT_AXIS_GENERIC_8: _bindgen_ty_14 = 39; +pub const AMOTION_EVENT_AXIS_GENERIC_9: _bindgen_ty_14 = 40; +pub const AMOTION_EVENT_AXIS_GENERIC_10: _bindgen_ty_14 = 41; +pub const AMOTION_EVENT_AXIS_GENERIC_11: _bindgen_ty_14 = 42; +pub const AMOTION_EVENT_AXIS_GENERIC_12: _bindgen_ty_14 = 43; +pub const AMOTION_EVENT_AXIS_GENERIC_13: _bindgen_ty_14 = 44; +pub const AMOTION_EVENT_AXIS_GENERIC_14: _bindgen_ty_14 = 45; +pub const AMOTION_EVENT_AXIS_GENERIC_15: _bindgen_ty_14 = 46; +pub const AMOTION_EVENT_AXIS_GENERIC_16: _bindgen_ty_14 = 47; pub type _bindgen_ty_14 = ::std::os::raw::c_uint; -pub const AMOTION_EVENT_BUTTON_PRIMARY: ::std::os::raw::c_uint = 1; -pub const AMOTION_EVENT_BUTTON_SECONDARY: ::std::os::raw::c_uint = 2; -pub const AMOTION_EVENT_BUTTON_TERTIARY: ::std::os::raw::c_uint = 4; -pub const AMOTION_EVENT_BUTTON_BACK: ::std::os::raw::c_uint = 8; -pub const AMOTION_EVENT_BUTTON_FORWARD: ::std::os::raw::c_uint = 16; -pub const AMOTION_EVENT_BUTTON_STYLUS_PRIMARY: ::std::os::raw::c_uint = 32; -pub const AMOTION_EVENT_BUTTON_STYLUS_SECONDARY: ::std::os::raw::c_uint = 64; +pub const AMOTION_EVENT_BUTTON_PRIMARY: _bindgen_ty_15 = 1; +pub const AMOTION_EVENT_BUTTON_SECONDARY: _bindgen_ty_15 = 2; +pub const AMOTION_EVENT_BUTTON_TERTIARY: _bindgen_ty_15 = 4; +pub const AMOTION_EVENT_BUTTON_BACK: _bindgen_ty_15 = 8; +pub const AMOTION_EVENT_BUTTON_FORWARD: _bindgen_ty_15 = 16; +pub const AMOTION_EVENT_BUTTON_STYLUS_PRIMARY: _bindgen_ty_15 = 32; +pub const AMOTION_EVENT_BUTTON_STYLUS_SECONDARY: _bindgen_ty_15 = 64; pub type _bindgen_ty_15 = ::std::os::raw::c_uint; -pub const AMOTION_EVENT_TOOL_TYPE_UNKNOWN: ::std::os::raw::c_uint = 0; -pub const AMOTION_EVENT_TOOL_TYPE_FINGER: ::std::os::raw::c_uint = 1; -pub const AMOTION_EVENT_TOOL_TYPE_STYLUS: ::std::os::raw::c_uint = 2; -pub const AMOTION_EVENT_TOOL_TYPE_MOUSE: ::std::os::raw::c_uint = 3; -pub const AMOTION_EVENT_TOOL_TYPE_ERASER: ::std::os::raw::c_uint = 4; +pub const AMOTION_EVENT_TOOL_TYPE_UNKNOWN: _bindgen_ty_16 = 0; +pub const AMOTION_EVENT_TOOL_TYPE_FINGER: _bindgen_ty_16 = 1; +pub const AMOTION_EVENT_TOOL_TYPE_STYLUS: _bindgen_ty_16 = 2; +pub const AMOTION_EVENT_TOOL_TYPE_MOUSE: _bindgen_ty_16 = 3; +pub const AMOTION_EVENT_TOOL_TYPE_ERASER: _bindgen_ty_16 = 4; +pub const AMOTION_EVENT_TOOL_TYPE_PALM: _bindgen_ty_16 = 5; pub type _bindgen_ty_16 = ::std::os::raw::c_uint; -pub const AINPUT_SOURCE_CLASS_MASK: ::std::os::raw::c_uint = 255; -pub const AINPUT_SOURCE_CLASS_NONE: ::std::os::raw::c_uint = 0; -pub const AINPUT_SOURCE_CLASS_BUTTON: ::std::os::raw::c_uint = 1; -pub const AINPUT_SOURCE_CLASS_POINTER: ::std::os::raw::c_uint = 2; -pub const AINPUT_SOURCE_CLASS_NAVIGATION: ::std::os::raw::c_uint = 4; -pub const AINPUT_SOURCE_CLASS_POSITION: ::std::os::raw::c_uint = 8; -pub const AINPUT_SOURCE_CLASS_JOYSTICK: ::std::os::raw::c_uint = 16; +pub const AMotionClassification_AMOTION_EVENT_CLASSIFICATION_NONE: AMotionClassification = 0; +pub const AMotionClassification_AMOTION_EVENT_CLASSIFICATION_AMBIGUOUS_GESTURE: + AMotionClassification = 1; +pub const AMotionClassification_AMOTION_EVENT_CLASSIFICATION_DEEP_PRESS: AMotionClassification = 2; +pub type AMotionClassification = u32; +pub const AINPUT_SOURCE_CLASS_MASK: _bindgen_ty_17 = 255; +pub const AINPUT_SOURCE_CLASS_NONE: _bindgen_ty_17 = 0; +pub const AINPUT_SOURCE_CLASS_BUTTON: _bindgen_ty_17 = 1; +pub const AINPUT_SOURCE_CLASS_POINTER: _bindgen_ty_17 = 2; +pub const AINPUT_SOURCE_CLASS_NAVIGATION: _bindgen_ty_17 = 4; +pub const AINPUT_SOURCE_CLASS_POSITION: _bindgen_ty_17 = 8; +pub const AINPUT_SOURCE_CLASS_JOYSTICK: _bindgen_ty_17 = 16; pub type _bindgen_ty_17 = ::std::os::raw::c_uint; -pub const AINPUT_SOURCE_UNKNOWN: ::std::os::raw::c_uint = 0; -pub const AINPUT_SOURCE_KEYBOARD: ::std::os::raw::c_uint = 257; -pub const AINPUT_SOURCE_DPAD: ::std::os::raw::c_uint = 513; -pub const AINPUT_SOURCE_GAMEPAD: ::std::os::raw::c_uint = 1025; -pub const AINPUT_SOURCE_TOUCHSCREEN: ::std::os::raw::c_uint = 4098; -pub const AINPUT_SOURCE_MOUSE: ::std::os::raw::c_uint = 8194; -pub const AINPUT_SOURCE_STYLUS: ::std::os::raw::c_uint = 16386; -pub const AINPUT_SOURCE_BLUETOOTH_STYLUS: ::std::os::raw::c_uint = 49154; -pub const AINPUT_SOURCE_TRACKBALL: ::std::os::raw::c_uint = 65540; -pub const AINPUT_SOURCE_MOUSE_RELATIVE: ::std::os::raw::c_uint = 131076; -pub const AINPUT_SOURCE_TOUCHPAD: ::std::os::raw::c_uint = 1048584; -pub const AINPUT_SOURCE_TOUCH_NAVIGATION: ::std::os::raw::c_uint = 2097152; -pub const AINPUT_SOURCE_JOYSTICK: ::std::os::raw::c_uint = 16777232; -pub const AINPUT_SOURCE_ROTARY_ENCODER: ::std::os::raw::c_uint = 4194304; -pub const AINPUT_SOURCE_ANY: ::std::os::raw::c_uint = 4294967040; +pub const AINPUT_SOURCE_UNKNOWN: _bindgen_ty_18 = 0; +pub const AINPUT_SOURCE_KEYBOARD: _bindgen_ty_18 = 257; +pub const AINPUT_SOURCE_DPAD: _bindgen_ty_18 = 513; +pub const AINPUT_SOURCE_GAMEPAD: _bindgen_ty_18 = 1025; +pub const AINPUT_SOURCE_TOUCHSCREEN: _bindgen_ty_18 = 4098; +pub const AINPUT_SOURCE_MOUSE: _bindgen_ty_18 = 8194; +pub const AINPUT_SOURCE_STYLUS: _bindgen_ty_18 = 16386; +pub const AINPUT_SOURCE_BLUETOOTH_STYLUS: _bindgen_ty_18 = 49154; +pub const AINPUT_SOURCE_TRACKBALL: _bindgen_ty_18 = 65540; +pub const AINPUT_SOURCE_MOUSE_RELATIVE: _bindgen_ty_18 = 131076; +pub const AINPUT_SOURCE_TOUCHPAD: _bindgen_ty_18 = 1048584; +pub const AINPUT_SOURCE_TOUCH_NAVIGATION: _bindgen_ty_18 = 2097152; +pub const AINPUT_SOURCE_JOYSTICK: _bindgen_ty_18 = 16777232; +pub const AINPUT_SOURCE_HDMI: _bindgen_ty_18 = 33554433; +pub const AINPUT_SOURCE_SENSOR: _bindgen_ty_18 = 67108864; +pub const AINPUT_SOURCE_ROTARY_ENCODER: _bindgen_ty_18 = 4194304; +pub const AINPUT_SOURCE_ANY: _bindgen_ty_18 = 4294967040; pub type _bindgen_ty_18 = ::std::os::raw::c_uint; -pub const AINPUT_KEYBOARD_TYPE_NONE: ::std::os::raw::c_uint = 0; -pub const AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC: ::std::os::raw::c_uint = 1; -pub const AINPUT_KEYBOARD_TYPE_ALPHABETIC: ::std::os::raw::c_uint = 2; +pub const AINPUT_KEYBOARD_TYPE_NONE: _bindgen_ty_19 = 0; +pub const AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC: _bindgen_ty_19 = 1; +pub const AINPUT_KEYBOARD_TYPE_ALPHABETIC: _bindgen_ty_19 = 2; pub type _bindgen_ty_19 = ::std::os::raw::c_uint; -pub const AINPUT_MOTION_RANGE_X: ::std::os::raw::c_uint = 0; -pub const AINPUT_MOTION_RANGE_Y: ::std::os::raw::c_uint = 1; -pub const AINPUT_MOTION_RANGE_PRESSURE: ::std::os::raw::c_uint = 2; -pub const AINPUT_MOTION_RANGE_SIZE: ::std::os::raw::c_uint = 3; -pub const AINPUT_MOTION_RANGE_TOUCH_MAJOR: ::std::os::raw::c_uint = 4; -pub const AINPUT_MOTION_RANGE_TOUCH_MINOR: ::std::os::raw::c_uint = 5; -pub const AINPUT_MOTION_RANGE_TOOL_MAJOR: ::std::os::raw::c_uint = 6; -pub const AINPUT_MOTION_RANGE_TOOL_MINOR: ::std::os::raw::c_uint = 7; -pub const AINPUT_MOTION_RANGE_ORIENTATION: ::std::os::raw::c_uint = 8; +pub const AINPUT_MOTION_RANGE_X: _bindgen_ty_20 = 0; +pub const AINPUT_MOTION_RANGE_Y: _bindgen_ty_20 = 1; +pub const AINPUT_MOTION_RANGE_PRESSURE: _bindgen_ty_20 = 2; +pub const AINPUT_MOTION_RANGE_SIZE: _bindgen_ty_20 = 3; +pub const AINPUT_MOTION_RANGE_TOUCH_MAJOR: _bindgen_ty_20 = 4; +pub const AINPUT_MOTION_RANGE_TOUCH_MINOR: _bindgen_ty_20 = 5; +pub const AINPUT_MOTION_RANGE_TOOL_MAJOR: _bindgen_ty_20 = 6; +pub const AINPUT_MOTION_RANGE_TOOL_MINOR: _bindgen_ty_20 = 7; +pub const AINPUT_MOTION_RANGE_ORIENTATION: _bindgen_ty_20 = 8; pub type _bindgen_ty_20 = ::std::os::raw::c_uint; extern "C" { pub fn AInputEvent_getType(event: *const AInputEvent) -> i32; @@ -1328,6 +1515,9 @@ extern "C" { extern "C" { pub fn AInputEvent_getSource(event: *const AInputEvent) -> i32; } +extern "C" { + pub fn AInputEvent_release(event: *const AInputEvent); +} extern "C" { pub fn AKeyEvent_getAction(key_event: *const AInputEvent) -> i32; } @@ -1352,6 +1542,9 @@ extern "C" { extern "C" { pub fn AKeyEvent_getEventTime(key_event: *const AInputEvent) -> i64; } +extern "C" { + pub fn AKeyEvent_fromJava(env: *mut JNIEnv, keyEvent: jobject) -> *const AInputEvent; +} extern "C" { pub fn AMotionEvent_getAction(motion_event: *const AInputEvent) -> i32; } @@ -1386,168 +1579,169 @@ extern "C" { pub fn AMotionEvent_getYPrecision(motion_event: *const AInputEvent) -> f32; } extern "C" { - pub fn AMotionEvent_getPointerCount(motion_event: *const AInputEvent) -> size_t; + pub fn AMotionEvent_getPointerCount(motion_event: *const AInputEvent) -> usize; } extern "C" { - pub fn AMotionEvent_getPointerId( - motion_event: *const AInputEvent, - pointer_index: size_t, - ) -> i32; + pub fn AMotionEvent_getPointerId(motion_event: *const AInputEvent, pointer_index: usize) + -> i32; } extern "C" { - pub fn AMotionEvent_getToolType(motion_event: *const AInputEvent, pointer_index: size_t) - -> i32; + pub fn AMotionEvent_getToolType(motion_event: *const AInputEvent, pointer_index: usize) -> i32; } extern "C" { - pub fn AMotionEvent_getRawX(motion_event: *const AInputEvent, pointer_index: size_t) -> f32; + pub fn AMotionEvent_getRawX(motion_event: *const AInputEvent, pointer_index: usize) -> f32; } extern "C" { - pub fn AMotionEvent_getRawY(motion_event: *const AInputEvent, pointer_index: size_t) -> f32; + pub fn AMotionEvent_getRawY(motion_event: *const AInputEvent, pointer_index: usize) -> f32; } extern "C" { - pub fn AMotionEvent_getX(motion_event: *const AInputEvent, pointer_index: size_t) -> f32; + pub fn AMotionEvent_getX(motion_event: *const AInputEvent, pointer_index: usize) -> f32; } extern "C" { - pub fn AMotionEvent_getY(motion_event: *const AInputEvent, pointer_index: size_t) -> f32; + pub fn AMotionEvent_getY(motion_event: *const AInputEvent, pointer_index: usize) -> f32; } extern "C" { - pub fn AMotionEvent_getPressure(motion_event: *const AInputEvent, pointer_index: size_t) - -> f32; + pub fn AMotionEvent_getPressure(motion_event: *const AInputEvent, pointer_index: usize) -> f32; } extern "C" { - pub fn AMotionEvent_getSize(motion_event: *const AInputEvent, pointer_index: size_t) -> f32; + pub fn AMotionEvent_getSize(motion_event: *const AInputEvent, pointer_index: usize) -> f32; } extern "C" { pub fn AMotionEvent_getTouchMajor( motion_event: *const AInputEvent, - pointer_index: size_t, + pointer_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getTouchMinor( motion_event: *const AInputEvent, - pointer_index: size_t, + pointer_index: usize, ) -> f32; } extern "C" { - pub fn AMotionEvent_getToolMajor( - motion_event: *const AInputEvent, - pointer_index: size_t, - ) -> f32; + pub fn AMotionEvent_getToolMajor(motion_event: *const AInputEvent, pointer_index: usize) + -> f32; } extern "C" { - pub fn AMotionEvent_getToolMinor( - motion_event: *const AInputEvent, - pointer_index: size_t, - ) -> f32; + pub fn AMotionEvent_getToolMinor(motion_event: *const AInputEvent, pointer_index: usize) + -> f32; } extern "C" { pub fn AMotionEvent_getOrientation( motion_event: *const AInputEvent, - pointer_index: size_t, + pointer_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getAxisValue( motion_event: *const AInputEvent, axis: i32, - pointer_index: size_t, + pointer_index: usize, ) -> f32; } extern "C" { - pub fn AMotionEvent_getHistorySize(motion_event: *const AInputEvent) -> size_t; + pub fn AMotionEvent_getHistorySize(motion_event: *const AInputEvent) -> usize; } extern "C" { pub fn AMotionEvent_getHistoricalEventTime( motion_event: *const AInputEvent, - history_index: size_t, + history_index: usize, ) -> i64; } extern "C" { pub fn AMotionEvent_getHistoricalRawX( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalRawY( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalX( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalY( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalPressure( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalSize( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalTouchMajor( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalTouchMinor( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalToolMajor( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalToolMinor( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalOrientation( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalAxisValue( motion_event: *const AInputEvent, axis: i32, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } +extern "C" { + pub fn AMotionEvent_getActionButton(motion_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AMotionEvent_getClassification(motion_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AMotionEvent_fromJava(env: *mut JNIEnv, motionEvent: jobject) -> *const AInputEvent; +} #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct AInputQueue { @@ -1581,6 +1775,9 @@ extern "C" { handled: ::std::os::raw::c_int, ); } +extern "C" { + pub fn AInputQueue_fromJava(env: *mut JNIEnv, inputQueue: jobject) -> *mut AInputQueue; +} #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct imaxdiv_t { @@ -1589,35 +1786,27 @@ pub struct imaxdiv_t { } #[test] fn bindgen_test_layout_imaxdiv_t() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 16usize, - concat!("Size of: ", stringify!(imaxdiv_t)) + "Size of imaxdiv_t" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(imaxdiv_t)) + "Alignment of imaxdiv_t" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).quot as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).quot) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(imaxdiv_t), - "::", - stringify!(quot) - ) + "Offset of field: imaxdiv_t::quot" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rem as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rem) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(imaxdiv_t), - "::", - stringify!(rem) - ) + "Offset of field: imaxdiv_t::rem" ); } extern "C" { @@ -1655,11 +1844,52 @@ extern "C" { ) -> uintmax_t; } pub const ADataSpace_ADATASPACE_UNKNOWN: ADataSpace = 0; +pub const ADataSpace_STANDARD_MASK: ADataSpace = 4128768; +pub const ADataSpace_STANDARD_UNSPECIFIED: ADataSpace = 0; +pub const ADataSpace_STANDARD_BT709: ADataSpace = 65536; +pub const ADataSpace_STANDARD_BT601_625: ADataSpace = 131072; +pub const ADataSpace_STANDARD_BT601_625_UNADJUSTED: ADataSpace = 196608; +pub const ADataSpace_STANDARD_BT601_525: ADataSpace = 262144; +pub const ADataSpace_STANDARD_BT601_525_UNADJUSTED: ADataSpace = 327680; +pub const ADataSpace_STANDARD_BT2020: ADataSpace = 393216; +pub const ADataSpace_STANDARD_BT2020_CONSTANT_LUMINANCE: ADataSpace = 458752; +pub const ADataSpace_STANDARD_BT470M: ADataSpace = 524288; +pub const ADataSpace_STANDARD_FILM: ADataSpace = 589824; +pub const ADataSpace_STANDARD_DCI_P3: ADataSpace = 655360; +pub const ADataSpace_STANDARD_ADOBE_RGB: ADataSpace = 720896; +pub const ADataSpace_TRANSFER_MASK: ADataSpace = 130023424; +pub const ADataSpace_TRANSFER_UNSPECIFIED: ADataSpace = 0; +pub const ADataSpace_TRANSFER_LINEAR: ADataSpace = 4194304; +pub const ADataSpace_TRANSFER_SRGB: ADataSpace = 8388608; +pub const ADataSpace_TRANSFER_SMPTE_170M: ADataSpace = 12582912; +pub const ADataSpace_TRANSFER_GAMMA2_2: ADataSpace = 16777216; +pub const ADataSpace_TRANSFER_GAMMA2_6: ADataSpace = 20971520; +pub const ADataSpace_TRANSFER_GAMMA2_8: ADataSpace = 25165824; +pub const ADataSpace_TRANSFER_ST2084: ADataSpace = 29360128; +pub const ADataSpace_TRANSFER_HLG: ADataSpace = 33554432; +pub const ADataSpace_RANGE_MASK: ADataSpace = 939524096; +pub const ADataSpace_RANGE_UNSPECIFIED: ADataSpace = 0; +pub const ADataSpace_RANGE_FULL: ADataSpace = 134217728; +pub const ADataSpace_RANGE_LIMITED: ADataSpace = 268435456; +pub const ADataSpace_RANGE_EXTENDED: ADataSpace = 402653184; pub const ADataSpace_ADATASPACE_SCRGB_LINEAR: ADataSpace = 406913024; pub const ADataSpace_ADATASPACE_SRGB: ADataSpace = 142671872; pub const ADataSpace_ADATASPACE_SCRGB: ADataSpace = 411107328; pub const ADataSpace_ADATASPACE_DISPLAY_P3: ADataSpace = 143261696; pub const ADataSpace_ADATASPACE_BT2020_PQ: ADataSpace = 163971072; +pub const ADataSpace_ADATASPACE_BT2020_ITU_PQ: ADataSpace = 298188800; +pub const ADataSpace_ADATASPACE_ADOBE_RGB: ADataSpace = 151715840; +pub const ADataSpace_ADATASPACE_JFIF: ADataSpace = 146931712; +pub const ADataSpace_ADATASPACE_BT601_625: ADataSpace = 281149440; +pub const ADataSpace_ADATASPACE_BT601_525: ADataSpace = 281280512; +pub const ADataSpace_ADATASPACE_BT2020: ADataSpace = 147193856; +pub const ADataSpace_ADATASPACE_BT709: ADataSpace = 281083904; +pub const ADataSpace_ADATASPACE_DCI_P3: ADataSpace = 155844608; +pub const ADataSpace_ADATASPACE_SRGB_LINEAR: ADataSpace = 138477568; +pub const ADataSpace_ADATASPACE_BT2020_HLG: ADataSpace = 168165376; +pub const ADataSpace_ADATASPACE_BT2020_ITU_HLG: ADataSpace = 302383104; +pub const ADataSpace_DEPTH: ADataSpace = 4096; +pub const ADataSpace_DYNAMIC_DEPTH: ADataSpace = 4098; pub type ADataSpace = ::std::os::raw::c_uint; pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM: AHardwareBuffer_Format = 1; pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM: AHardwareBuffer_Format = 2; @@ -1679,6 +1909,12 @@ pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_D32_FLOAT_S8_UINT: AHard 52; pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_S8_UINT: AHardwareBuffer_Format = 53; pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_Y8Cb8Cr8_420: AHardwareBuffer_Format = 35; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_YCbCr_P010: AHardwareBuffer_Format = 54; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8_UNORM: AHardwareBuffer_Format = 56; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R16_UINT: AHardwareBuffer_Format = 57; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R16G16_UINT: AHardwareBuffer_Format = 58; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R10G10B10A10_UNORM: AHardwareBuffer_Format = + 59; pub type AHardwareBuffer_Format = ::std::os::raw::c_uint; pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_READ_NEVER: AHardwareBuffer_UsageFlags = 0; @@ -1716,6 +1952,8 @@ pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_GPU_CUBE_MAP: AHardwareBuffer_UsageFlags = 33554432; pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_GPU_MIPMAP_COMPLETE: AHardwareBuffer_UsageFlags = 67108864; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_FRONT_BUFFER: + AHardwareBuffer_UsageFlags = 2147483648; pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_0: AHardwareBuffer_UsageFlags = 268435456; pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_1: AHardwareBuffer_UsageFlags = @@ -1771,95 +2009,57 @@ pub struct AHardwareBuffer_Desc { } #[test] fn bindgen_test_layout_AHardwareBuffer_Desc() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 40usize, - concat!("Size of: ", stringify!(AHardwareBuffer_Desc)) + "Size of AHardwareBuffer_Desc" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(AHardwareBuffer_Desc)) + "Alignment of AHardwareBuffer_Desc" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).width as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).width) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Desc), - "::", - stringify!(width) - ) + "Offset of field: AHardwareBuffer_Desc::width" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).height as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).height) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Desc), - "::", - stringify!(height) - ) + "Offset of field: AHardwareBuffer_Desc::height" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).layers as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).layers) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Desc), - "::", - stringify!(layers) - ) + "Offset of field: AHardwareBuffer_Desc::layers" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).format as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).format) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Desc), - "::", - stringify!(format) - ) + "Offset of field: AHardwareBuffer_Desc::format" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).usage as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).usage) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Desc), - "::", - stringify!(usage) - ) + "Offset of field: AHardwareBuffer_Desc::usage" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).stride as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).stride) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Desc), - "::", - stringify!(stride) - ) + "Offset of field: AHardwareBuffer_Desc::stride" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rfu0 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rfu0) as usize - ptr as usize }, 28usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Desc), - "::", - stringify!(rfu0) - ) + "Offset of field: AHardwareBuffer_Desc::rfu0" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rfu1 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rfu1) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Desc), - "::", - stringify!(rfu1) - ) + "Offset of field: AHardwareBuffer_Desc::rfu1" ); } #[repr(C)] @@ -1871,47 +2071,33 @@ pub struct AHardwareBuffer_Plane { } #[test] fn bindgen_test_layout_AHardwareBuffer_Plane() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 12usize, - concat!("Size of: ", stringify!(AHardwareBuffer_Plane)) + "Size of AHardwareBuffer_Plane" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(AHardwareBuffer_Plane)) + "Alignment of AHardwareBuffer_Plane" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Plane), - "::", - stringify!(data) - ) + "Offset of field: AHardwareBuffer_Plane::data" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).pixelStride as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).pixelStride) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Plane), - "::", - stringify!(pixelStride) - ) + "Offset of field: AHardwareBuffer_Plane::pixelStride" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rowStride as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rowStride) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Plane), - "::", - stringify!(rowStride) - ) + "Offset of field: AHardwareBuffer_Plane::rowStride" ); } #[repr(C)] @@ -1922,37 +2108,28 @@ pub struct AHardwareBuffer_Planes { } #[test] fn bindgen_test_layout_AHardwareBuffer_Planes() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 52usize, - concat!("Size of: ", stringify!(AHardwareBuffer_Planes)) + "Size of AHardwareBuffer_Planes" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(AHardwareBuffer_Planes)) + "Alignment of AHardwareBuffer_Planes" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).planeCount as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).planeCount) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Planes), - "::", - stringify!(planeCount) - ) + "Offset of field: AHardwareBuffer_Planes::planeCount" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).planes as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).planes) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Planes), - "::", - stringify!(planes) - ) + "Offset of field: AHardwareBuffer_Planes::planes" ); } #[repr(C)] @@ -1987,15 +2164,6 @@ extern "C" { outVirtualAddress: *mut *mut ::std::os::raw::c_void, ) -> ::std::os::raw::c_int; } -extern "C" { - pub fn AHardwareBuffer_lockPlanes( - buffer: *mut AHardwareBuffer, - usage: u64, - fence: i32, - rect: *const ARect, - outPlanes: *mut AHardwareBuffer_Planes, - ) -> ::std::os::raw::c_int; -} extern "C" { pub fn AHardwareBuffer_unlock( buffer: *mut AHardwareBuffer, @@ -2014,6 +2182,15 @@ extern "C" { outBuffer: *mut *mut AHardwareBuffer, ) -> ::std::os::raw::c_int; } +extern "C" { + pub fn AHardwareBuffer_lockPlanes( + buffer: *mut AHardwareBuffer, + usage: u64, + fence: i32, + rect: *const ARect, + outPlanes: *mut AHardwareBuffer_Planes, + ) -> ::std::os::raw::c_int; +} extern "C" { pub fn AHardwareBuffer_isSupported(desc: *const AHardwareBuffer_Desc) -> ::std::os::raw::c_int; } @@ -2028,230 +2205,353 @@ extern "C" { outBytesPerStride: *mut i32, ) -> ::std::os::raw::c_int; } -pub type va_list = __builtin_va_list; -pub type __gnuc_va_list = __builtin_va_list; +extern "C" { + pub fn AHardwareBuffer_getId( + buffer: *const AHardwareBuffer, + outId: *mut u64, + ) -> ::std::os::raw::c_int; +} +#[doc = " \\brief Describe information about a pointer, found in a\n GameActivityMotionEvent.\n\n You can read values directly from this structure, or use helper functions\n (`GameActivityPointerAxes_getX`, `GameActivityPointerAxes_getY` and\n `GameActivityPointerAxes_getAxisValue`).\n\n The X axis and Y axis are enabled by default but any other axis that you want\n to read **must** be enabled first, using\n `GameActivityPointerAxes_enableAxis`.\n\n \\see GameActivityMotionEvent"] #[repr(C)] -pub struct JavaVMAttachArgs { - pub version: jint, - pub name: *const ::std::os::raw::c_char, - pub group: jobject, +#[derive(Debug, Copy, Clone)] +pub struct GameActivityPointerAxes { + pub id: i32, + pub toolType: i32, + pub axisValues: [f32; 48usize], + pub rawX: f32, + pub rawY: f32, } #[test] -fn bindgen_test_layout_JavaVMAttachArgs() { +fn bindgen_test_layout_GameActivityPointerAxes() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - ::std::mem::size_of::(), - 12usize, - concat!("Size of: ", stringify!(JavaVMAttachArgs)) + ::std::mem::size_of::(), + 208usize, + "Size of GameActivityPointerAxes" ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(JavaVMAttachArgs)) + "Alignment of GameActivityPointerAxes" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).version as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).id) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(JavaVMAttachArgs), - "::", - stringify!(version) - ) + "Offset of field: GameActivityPointerAxes::id" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).name as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).toolType) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(JavaVMAttachArgs), - "::", - stringify!(name) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).group as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(JavaVMAttachArgs), - "::", - stringify!(group) - ) + "Offset of field: GameActivityPointerAxes::toolType" ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct JavaVMOption { - pub optionString: *const ::std::os::raw::c_char, - pub extraInfo: *mut ::std::os::raw::c_void, -} -#[test] -fn bindgen_test_layout_JavaVMOption() { assert_eq!( - ::std::mem::size_of::(), + unsafe { ::std::ptr::addr_of!((*ptr).axisValues) as usize - ptr as usize }, 8usize, - concat!("Size of: ", stringify!(JavaVMOption)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(JavaVMOption)) + "Offset of field: GameActivityPointerAxes::axisValues" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).optionString as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(JavaVMOption), - "::", - stringify!(optionString) - ) + unsafe { ::std::ptr::addr_of!((*ptr).rawX) as usize - ptr as usize }, + 200usize, + "Offset of field: GameActivityPointerAxes::rawX" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).extraInfo as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(JavaVMOption), - "::", - stringify!(extraInfo) - ) + unsafe { ::std::ptr::addr_of!((*ptr).rawY) as usize - ptr as usize }, + 204usize, + "Offset of field: GameActivityPointerAxes::rawY" ); } +extern "C" { + #[doc = " \\brief Enable the specified axis, so that its value is reported in the\n GameActivityPointerAxes structures stored in a motion event.\n\n You must enable any axis that you want to read, apart from\n `AMOTION_EVENT_AXIS_X` and `AMOTION_EVENT_AXIS_Y` that are enabled by\n default.\n\n If the axis index is out of range, nothing is done."] + pub fn GameActivityPointerAxes_enableAxis(axis: i32); +} +extern "C" { + #[doc = " \\brief Disable the specified axis. Its value won't be reported in the\n GameActivityPointerAxes structures stored in a motion event anymore.\n\n Apart from X and Y, any axis that you want to read **must** be enabled first,\n using `GameActivityPointerAxes_enableAxis`.\n\n If the axis index is out of range, nothing is done."] + pub fn GameActivityPointerAxes_disableAxis(axis: i32); +} +extern "C" { + #[doc = " \\brief Get the value of the requested axis.\n\n Apart from X and Y, any axis that you want to read **must** be enabled first,\n using `GameActivityPointerAxes_enableAxis`.\n\n Find the valid enums for the axis (`AMOTION_EVENT_AXIS_X`,\n `AMOTION_EVENT_AXIS_Y`, `AMOTION_EVENT_AXIS_PRESSURE`...)\n in https://developer.android.com/ndk/reference/group/input.\n\n @param pointerInfo The structure containing information about the pointer,\n obtained from GameActivityMotionEvent.\n @param axis The axis to get the value from\n @return The value of the axis, or 0 if the axis is invalid or was not\n enabled."] + pub fn GameActivityPointerAxes_getAxisValue( + pointerInfo: *const GameActivityPointerAxes, + axis: i32, + ) -> f32; +} +#[doc = " \\brief Describe a motion event that happened on the GameActivity SurfaceView.\n\n This is 1:1 mapping to the information contained in a Java `MotionEvent`\n (see https://developer.android.com/reference/android/view/MotionEvent)."] #[repr(C)] -pub struct JavaVMInitArgs { - pub version: jint, - pub nOptions: jint, - pub options: *mut JavaVMOption, - pub ignoreUnrecognized: jboolean, +#[derive(Debug, Copy, Clone)] +pub struct GameActivityMotionEvent { + pub deviceId: i32, + pub source: i32, + pub action: i32, + pub eventTime: i64, + pub downTime: i64, + pub flags: i32, + pub metaState: i32, + pub actionButton: i32, + pub buttonState: i32, + pub classification: i32, + pub edgeFlags: i32, + pub pointerCount: u32, + pub pointers: [GameActivityPointerAxes; 8usize], + pub historySize: ::std::os::raw::c_int, + pub historicalEventTimesMillis: *mut i64, + pub historicalEventTimesNanos: *mut i64, + pub historicalAxisValues: *mut f32, + pub precisionX: f32, + pub precisionY: f32, } #[test] -fn bindgen_test_layout_JavaVMInitArgs() { +fn bindgen_test_layout_GameActivityMotionEvent() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(JavaVMInitArgs)) + ::std::mem::size_of::(), + 1744usize, + "Size of GameActivityMotionEvent" ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(JavaVMInitArgs)) + "Alignment of GameActivityMotionEvent" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).version as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).deviceId) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(JavaVMInitArgs), - "::", - stringify!(version) - ) + "Offset of field: GameActivityMotionEvent::deviceId" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).nOptions as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).source) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(JavaVMInitArgs), - "::", - stringify!(nOptions) - ) + "Offset of field: GameActivityMotionEvent::source" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).options as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).action) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(JavaVMInitArgs), - "::", - stringify!(options) - ) + "Offset of field: GameActivityMotionEvent::action" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).ignoreUnrecognized as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).eventTime) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(JavaVMInitArgs), - "::", - stringify!(ignoreUnrecognized) - ) + "Offset of field: GameActivityMotionEvent::eventTime" ); -} -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_CAPTION_BAR: GameCommonInsetsType = 0; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_DISPLAY_CUTOUT: GameCommonInsetsType = 1; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_IME: GameCommonInsetsType = 2; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_MANDATORY_SYSTEM_GESTURES: - GameCommonInsetsType = 3; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_NAVIGATION_BARS: GameCommonInsetsType = 4; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_STATUS_BARS: GameCommonInsetsType = 5; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_SYSTEM_BARS: GameCommonInsetsType = 6; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_SYSTEM_GESTURES: GameCommonInsetsType = 7; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_TAPABLE_ELEMENT: GameCommonInsetsType = 8; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_WATERFALL: GameCommonInsetsType = 9; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_COUNT: GameCommonInsetsType = 10; -#[doc = " The type of a component for which to retrieve insets. See"] -#[doc = " https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat.Type"] -pub type GameCommonInsetsType = ::std::os::raw::c_uint; -#[doc = " This struct holds a span within a region of text from start (inclusive) to"] -#[doc = " end (exclusive). An empty span or cursor position is specified with"] -#[doc = " start==end. An undefined span is specified with start = end = SPAN_UNDEFINED."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct GameTextInputSpan { - #[doc = " The start of the region (inclusive)."] - pub start: i32, - #[doc = " The end of the region (exclusive)."] - pub end: i32, -} -#[test] -fn bindgen_test_layout_GameTextInputSpan() { assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(GameTextInputSpan)) + unsafe { ::std::ptr::addr_of!((*ptr).downTime) as usize - ptr as usize }, + 20usize, + "Offset of field: GameActivityMotionEvent::downTime" ); assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(GameTextInputSpan)) + unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, + 28usize, + "Offset of field: GameActivityMotionEvent::flags" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).start as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(GameTextInputSpan), - "::", - stringify!(start) - ) + unsafe { ::std::ptr::addr_of!((*ptr).metaState) as usize - ptr as usize }, + 32usize, + "Offset of field: GameActivityMotionEvent::metaState" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).end as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(GameTextInputSpan), - "::", - stringify!(end) - ) + unsafe { ::std::ptr::addr_of!((*ptr).actionButton) as usize - ptr as usize }, + 36usize, + "Offset of field: GameActivityMotionEvent::actionButton" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).buttonState) as usize - ptr as usize }, + 40usize, + "Offset of field: GameActivityMotionEvent::buttonState" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).classification) as usize - ptr as usize }, + 44usize, + "Offset of field: GameActivityMotionEvent::classification" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).edgeFlags) as usize - ptr as usize }, + 48usize, + "Offset of field: GameActivityMotionEvent::edgeFlags" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pointerCount) as usize - ptr as usize }, + 52usize, + "Offset of field: GameActivityMotionEvent::pointerCount" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pointers) as usize - ptr as usize }, + 56usize, + "Offset of field: GameActivityMotionEvent::pointers" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).historySize) as usize - ptr as usize }, + 1720usize, + "Offset of field: GameActivityMotionEvent::historySize" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).historicalEventTimesMillis) as usize - ptr as usize }, + 1724usize, + "Offset of field: GameActivityMotionEvent::historicalEventTimesMillis" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).historicalEventTimesNanos) as usize - ptr as usize }, + 1728usize, + "Offset of field: GameActivityMotionEvent::historicalEventTimesNanos" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).historicalAxisValues) as usize - ptr as usize }, + 1732usize, + "Offset of field: GameActivityMotionEvent::historicalAxisValues" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).precisionX) as usize - ptr as usize }, + 1736usize, + "Offset of field: GameActivityMotionEvent::precisionX" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).precisionY) as usize - ptr as usize }, + 1740usize, + "Offset of field: GameActivityMotionEvent::precisionY" + ); +} +extern "C" { + pub fn GameActivityMotionEvent_getHistoricalAxisValue( + event: *const GameActivityMotionEvent, + axis: ::std::os::raw::c_int, + pointerIndex: ::std::os::raw::c_int, + historyPos: ::std::os::raw::c_int, + ) -> f32; +} +extern "C" { + #[doc = " \\brief Handle the freeing of the GameActivityMotionEvent struct."] + pub fn GameActivityMotionEvent_destroy(c_event: *mut GameActivityMotionEvent); +} +#[doc = " \\brief Describe a key event that happened on the GameActivity SurfaceView.\n\n This is 1:1 mapping to the information contained in a Java `KeyEvent`\n (see https://developer.android.com/reference/android/view/KeyEvent).\n The only exception is the event times, which are reported as\n nanoseconds in this struct."] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct GameActivityKeyEvent { + pub deviceId: i32, + pub source: i32, + pub action: i32, + pub eventTime: i64, + pub downTime: i64, + pub flags: i32, + pub metaState: i32, + pub modifiers: i32, + pub repeatCount: i32, + pub keyCode: i32, + pub scanCode: i32, +} +#[test] +fn bindgen_test_layout_GameActivityKeyEvent() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 52usize, + "Size of GameActivityKeyEvent" + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + "Alignment of GameActivityKeyEvent" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).deviceId) as usize - ptr as usize }, + 0usize, + "Offset of field: GameActivityKeyEvent::deviceId" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).source) as usize - ptr as usize }, + 4usize, + "Offset of field: GameActivityKeyEvent::source" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).action) as usize - ptr as usize }, + 8usize, + "Offset of field: GameActivityKeyEvent::action" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).eventTime) as usize - ptr as usize }, + 12usize, + "Offset of field: GameActivityKeyEvent::eventTime" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).downTime) as usize - ptr as usize }, + 20usize, + "Offset of field: GameActivityKeyEvent::downTime" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, + 28usize, + "Offset of field: GameActivityKeyEvent::flags" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).metaState) as usize - ptr as usize }, + 32usize, + "Offset of field: GameActivityKeyEvent::metaState" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).modifiers) as usize - ptr as usize }, + 36usize, + "Offset of field: GameActivityKeyEvent::modifiers" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).repeatCount) as usize - ptr as usize }, + 40usize, + "Offset of field: GameActivityKeyEvent::repeatCount" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).keyCode) as usize - ptr as usize }, + 44usize, + "Offset of field: GameActivityKeyEvent::keyCode" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).scanCode) as usize - ptr as usize }, + 48usize, + "Offset of field: GameActivityKeyEvent::scanCode" + ); +} +#[doc = " This struct holds a span within a region of text from start (inclusive) to\n end (exclusive). An empty span or cursor position is specified with\n start==end. An undefined span is specified with start = end = SPAN_UNDEFINED."] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct GameTextInputSpan { + #[doc = " The start of the region (inclusive)."] + pub start: i32, + #[doc = " The end of the region (exclusive)."] + pub end: i32, +} +#[test] +fn bindgen_test_layout_GameTextInputSpan() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 8usize, + "Size of GameTextInputSpan" + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + "Alignment of GameTextInputSpan" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).start) as usize - ptr as usize }, + 0usize, + "Offset of field: GameTextInputSpan::start" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).end) as usize - ptr as usize }, + 4usize, + "Offset of field: GameTextInputSpan::end" ); } pub const GameTextInputSpanFlag_SPAN_UNDEFINED: GameTextInputSpanFlag = -1; #[doc = " Values with special meaning in a GameTextInputSpan."] -pub type GameTextInputSpanFlag = ::std::os::raw::c_int; -#[doc = " This struct holds the state of an editable section of text."] -#[doc = " The text can have a selection and a composing region defined on it."] -#[doc = " A composing region is used by IMEs that allow input using multiple steps to"] -#[doc = " compose a glyph or word. Use functions GameTextInput_getState and"] -#[doc = " GameTextInput_setState to read and modify the state that an IME is editing."] +pub type GameTextInputSpanFlag = i32; +#[doc = " This struct holds the state of an editable section of text.\n The text can have a selection and a composing region defined on it.\n A composing region is used by IMEs that allow input using multiple steps to\n compose a glyph or word. Use functions GameTextInput_getState and\n GameTextInput_setState to read and modify the state that an IME is editing."] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct GameTextInputState { - #[doc = " Text owned by the state, as a modified UTF-8 string. Null-terminated."] - #[doc = " https://en.wikipedia.org/wiki/UTF-8#Modified_UTF-8"] + #[doc = " Text owned by the state, as a modified UTF-8 string. Null-terminated.\n https://en.wikipedia.org/wiki/UTF-8#Modified_UTF-8"] pub text_UTF8: *const ::std::os::raw::c_char, #[doc = " Length in bytes of text_UTF8, *not* including the null at end."] pub text_length: i32, @@ -2262,63 +2562,40 @@ pub struct GameTextInputState { } #[test] fn bindgen_test_layout_GameTextInputState() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 24usize, - concat!("Size of: ", stringify!(GameTextInputState)) + "Size of GameTextInputState" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(GameTextInputState)) + "Alignment of GameTextInputState" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).text_UTF8 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).text_UTF8) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(GameTextInputState), - "::", - stringify!(text_UTF8) - ) + "Offset of field: GameTextInputState::text_UTF8" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).text_length as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).text_length) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(GameTextInputState), - "::", - stringify!(text_length) - ) + "Offset of field: GameTextInputState::text_length" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).selection as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).selection) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(GameTextInputState), - "::", - stringify!(selection) - ) + "Offset of field: GameTextInputState::selection" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).composingRegion as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).composingRegion) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(GameTextInputState), - "::", - stringify!(composingRegion) - ) - ); -} -#[doc = " A callback called by GameTextInput_getState."] -#[doc = " @param context User-defined context."] -#[doc = " @param state State, owned by the library, that will be valid for the duration"] -#[doc = " of the callback."] + "Offset of field: GameTextInputState::composingRegion" + ); +} +#[doc = " A callback called by GameTextInput_getState.\n @param context User-defined context.\n @param state State, owned by the library, that will be valid for the duration\n of the callback."] pub type GameTextInputGetStateCallback = ::std::option::Option< unsafe extern "C" fn(context: *mut ::std::os::raw::c_void, state: *const GameTextInputState), >; @@ -2328,74 +2605,45 @@ pub struct GameTextInput { _unused: [u8; 0], } extern "C" { - #[doc = " Initialize the GameTextInput library."] - #[doc = " If called twice without GameTextInput_destroy being called, the same pointer"] - #[doc = " will be returned and a warning will be issued."] - #[doc = " @param env A JNI env valid on the calling thread."] - #[doc = " @param max_string_size The maximum length of a string that can be edited. If"] - #[doc = " zero, the maximum defaults to 65536 bytes. A buffer of this size is allocated"] - #[doc = " at initialization."] - #[doc = " @return A handle to the library."] + #[doc = " Initialize the GameTextInput library.\n If called twice without GameTextInput_destroy being called, the same pointer\n will be returned and a warning will be issued.\n @param env A JNI env valid on the calling thread.\n @param max_string_size The maximum length of a string that can be edited. If\n zero, the maximum defaults to 65536 bytes. A buffer of this size is allocated\n at initialization.\n @return A handle to the library."] pub fn GameTextInput_init(env: *mut JNIEnv, max_string_size: u32) -> *mut GameTextInput; } extern "C" { - #[doc = " When using GameTextInput, you need to create a gametextinput.InputConnection"] - #[doc = " on the Java side and pass it using this function to the library, unless using"] - #[doc = " GameActivity in which case this will be done for you. See the GameActivity"] - #[doc = " source code or GameTextInput samples for examples of usage."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param inputConnection A gametextinput.InputConnection object."] + #[doc = " When using GameTextInput, you need to create a gametextinput.InputConnection\n on the Java side and pass it using this function to the library, unless using\n GameActivity in which case this will be done for you. See the GameActivity\n source code or GameTextInput samples for examples of usage.\n @param input A valid GameTextInput library handle.\n @param inputConnection A gametextinput.InputConnection object."] pub fn GameTextInput_setInputConnection(input: *mut GameTextInput, inputConnection: jobject); } extern "C" { - #[doc = " Unless using GameActivity, it is required to call this function from your"] - #[doc = " Java gametextinput.Listener.stateChanged method to convert eventState and"] - #[doc = " trigger any event callbacks. When using GameActivity, this does not need to"] - #[doc = " be called as event processing is handled by the Activity."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param eventState A Java gametextinput.State object."] + #[doc = " Unless using GameActivity, it is required to call this function from your\n Java gametextinput.Listener.stateChanged method to convert eventState and\n trigger any event callbacks. When using GameActivity, this does not need to\n be called as event processing is handled by the Activity.\n @param input A valid GameTextInput library handle.\n @param eventState A Java gametextinput.State object."] pub fn GameTextInput_processEvent(input: *mut GameTextInput, eventState: jobject); } extern "C" { - #[doc = " Free any resources owned by the GameTextInput library."] - #[doc = " Any subsequent calls to the library will fail until GameTextInput_init is"] - #[doc = " called again."] - #[doc = " @param input A valid GameTextInput library handle."] + #[doc = " Free any resources owned by the GameTextInput library.\n Any subsequent calls to the library will fail until GameTextInput_init is\n called again.\n @param input A valid GameTextInput library handle."] pub fn GameTextInput_destroy(input: *mut GameTextInput); } pub const ShowImeFlags_SHOW_IME_UNDEFINED: ShowImeFlags = 0; pub const ShowImeFlags_SHOW_IMPLICIT: ShowImeFlags = 1; pub const ShowImeFlags_SHOW_FORCED: ShowImeFlags = 2; #[doc = " Flags to be passed to GameTextInput_showIme."] -pub type ShowImeFlags = ::std::os::raw::c_uint; +pub type ShowImeFlags = u32; extern "C" { - #[doc = " Show the IME. Calls InputMethodManager.showSoftInput()."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param flags Defined in ShowImeFlags above. For more information see:"] - #[doc = " https://developer.android.com/reference/android/view/inputmethod/InputMethodManager"] + #[doc = " Show the IME. Calls InputMethodManager.showSoftInput().\n @param input A valid GameTextInput library handle.\n @param flags Defined in ShowImeFlags above. For more information see:\n https://developer.android.com/reference/android/view/inputmethod/InputMethodManager"] pub fn GameTextInput_showIme(input: *mut GameTextInput, flags: u32); } pub const HideImeFlags_HIDE_IME_UNDEFINED: HideImeFlags = 0; pub const HideImeFlags_HIDE_IMPLICIT_ONLY: HideImeFlags = 1; pub const HideImeFlags_HIDE_NOT_ALWAYS: HideImeFlags = 2; #[doc = " Flags to be passed to GameTextInput_hideIme."] -pub type HideImeFlags = ::std::os::raw::c_uint; +pub type HideImeFlags = u32; extern "C" { - #[doc = " Show the IME. Calls InputMethodManager.hideSoftInputFromWindow()."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param flags Defined in HideImeFlags above. For more information see:"] - #[doc = " https://developer.android.com/reference/android/view/inputmethod/InputMethodManager"] + #[doc = " Hide the IME. Calls InputMethodManager.hideSoftInputFromWindow().\n @param input A valid GameTextInput library handle.\n @param flags Defined in HideImeFlags above. For more information see:\n https://developer.android.com/reference/android/view/inputmethod/InputMethodManager"] pub fn GameTextInput_hideIme(input: *mut GameTextInput, flags: u32); } extern "C" { - #[doc = " Call a callback with the current GameTextInput state, which may have been"] - #[doc = " modified by changes in the IME and calls to GameTextInput_setState. We use a"] - #[doc = " callback rather than returning the state in order to simplify ownership of"] - #[doc = " text_UTF8 strings. These strings are only valid during the calling of the"] - #[doc = " callback."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param callback A function that will be called with valid state."] - #[doc = " @param context Context used by the callback."] + #[doc = " Restarts the input method. Calls InputMethodManager.restartInput().\n @param input A valid GameTextInput library handle."] + pub fn GameTextInput_restartInput(input: *mut GameTextInput); +} +extern "C" { + #[doc = " Call a callback with the current GameTextInput state, which may have been\n modified by changes in the IME and calls to GameTextInput_setState. We use a\n callback rather than returning the state in order to simplify ownership of\n text_UTF8 strings. These strings are only valid during the calling of the\n callback.\n @param input A valid GameTextInput library handle.\n @param callback A function that will be called with valid state.\n @param context Context used by the callback."] pub fn GameTextInput_getState( input: *mut GameTextInput, callback: GameTextInputGetStateCallback, @@ -2403,18 +2651,10 @@ extern "C" { ); } extern "C" { - #[doc = " Set the current GameTextInput state. This state is reflected to any active"] - #[doc = " IME."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param state The state to set. Ownership is maintained by the caller and must"] - #[doc = " remain valid for the duration of the call."] + #[doc = " Set the current GameTextInput state. This state is reflected to any active\n IME.\n @param input A valid GameTextInput library handle.\n @param state The state to set. Ownership is maintained by the caller and must\n remain valid for the duration of the call."] pub fn GameTextInput_setState(input: *mut GameTextInput, state: *const GameTextInputState); } -#[doc = " Type of the callback needed by GameTextInput_setEventCallback that will be"] -#[doc = " called every time the IME state changes."] -#[doc = " @param context User-defined context set in GameTextInput_setEventCallback."] -#[doc = " @param current_state Current IME state, owned by the library and valid during"] -#[doc = " the callback."] +#[doc = " Type of the callback needed by GameTextInput_setEventCallback that will be\n called every time the IME state changes.\n @param context User-defined context set in GameTextInput_setEventCallback.\n @param current_state Current IME state, owned by the library and valid during\n the callback."] pub type GameTextInputEventCallback = ::std::option::Option< unsafe extern "C" fn( context: *mut ::std::os::raw::c_void, @@ -2422,34 +2662,19 @@ pub type GameTextInputEventCallback = ::std::option::Option< ), >; extern "C" { - #[doc = " Optionally set a callback to be called whenever the IME state changes."] - #[doc = " Not necessary if you are using GameActivity, which handles these callbacks"] - #[doc = " for you."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param callback Called by the library when the IME state changes."] - #[doc = " @param context Context passed as first argument to the callback."] + #[doc = " Optionally set a callback to be called whenever the IME state changes.\n Not necessary if you are using GameActivity, which handles these callbacks\n for you.\n @param input A valid GameTextInput library handle.\n @param callback Called by the library when the IME state changes.\n @param context Context passed as first argument to the callback.\n This function is deprecated. Don't perform any complex processing inside\n the callback other than copying the state variable. Using any synchronization\n primitives inside this callback may cause a deadlock."] pub fn GameTextInput_setEventCallback( input: *mut GameTextInput, callback: GameTextInputEventCallback, context: *mut ::std::os::raw::c_void, ); } -#[doc = " Type of the callback needed by GameTextInput_setImeInsetsCallback that will"] -#[doc = " be called every time the IME window insets change."] -#[doc = " @param context User-defined context set in"] -#[doc = " GameTextInput_setImeWIndowInsetsCallback."] -#[doc = " @param current_insets Current IME insets, owned by the library and valid"] -#[doc = " during the callback."] +#[doc = " Type of the callback needed by GameTextInput_setImeInsetsCallback that will\n be called every time the IME window insets change.\n @param context User-defined context set in\n GameTextInput_setImeWIndowInsetsCallback.\n @param current_insets Current IME insets, owned by the library and valid\n during the callback."] pub type GameTextInputImeInsetsCallback = ::std::option::Option< unsafe extern "C" fn(context: *mut ::std::os::raw::c_void, current_insets: *const ARect), >; extern "C" { - #[doc = " Optionally set a callback to be called whenever the IME insets change."] - #[doc = " Not necessary if you are using GameActivity, which handles these callbacks"] - #[doc = " for you."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param callback Called by the library when the IME insets change."] - #[doc = " @param context Context passed as first argument to the callback."] + #[doc = " Optionally set a callback to be called whenever the IME insets change.\n Not necessary if you are using GameActivity, which handles these callbacks\n for you.\n @param input A valid GameTextInput library handle.\n @param callback Called by the library when the IME insets change.\n @param context Context passed as first argument to the callback."] pub fn GameTextInput_setImeInsetsCallback( input: *mut GameTextInput, callback: GameTextInputImeInsetsCallback, @@ -2457,40 +2682,22 @@ extern "C" { ); } extern "C" { - #[doc = " Get the current window insets for the IME."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param insets Filled with the current insets by this function."] + #[doc = " Get the current window insets for the IME.\n @param input A valid GameTextInput library handle.\n @param insets Filled with the current insets by this function."] pub fn GameTextInput_getImeInsets(input: *const GameTextInput, insets: *mut ARect); } extern "C" { - #[doc = " Unless using GameActivity, it is required to call this function from your"] - #[doc = " Java gametextinput.Listener.onImeInsetsChanged method to"] - #[doc = " trigger any event callbacks. When using GameActivity, this does not need to"] - #[doc = " be called as insets processing is handled by the Activity."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param eventState A Java gametextinput.State object."] + #[doc = " Unless using GameActivity, it is required to call this function from your\n Java gametextinput.Listener.onImeInsetsChanged method to\n trigger any event callbacks. When using GameActivity, this does not need to\n be called as insets processing is handled by the Activity.\n @param input A valid GameTextInput library handle.\n @param eventState A Java gametextinput.State object."] pub fn GameTextInput_processImeInsets(input: *mut GameTextInput, insets: *const ARect); } extern "C" { - #[doc = " Convert a GameTextInputState struct to a Java gametextinput.State object."] - #[doc = " Don't forget to delete the returned Java local ref when you're done."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param state Input state to convert."] - #[doc = " @return A Java object of class gametextinput.State. The caller is required to"] - #[doc = " delete this local reference."] + #[doc = " Convert a GameTextInputState struct to a Java gametextinput.State object.\n Don't forget to delete the returned Java local ref when you're done.\n @param input A valid GameTextInput library handle.\n @param state Input state to convert.\n @return A Java object of class gametextinput.State. The caller is required to\n delete this local reference."] pub fn GameTextInputState_toJava( input: *const GameTextInput, state: *const GameTextInputState, ) -> jobject; } extern "C" { - #[doc = " Convert from a Java gametextinput.State object into a C GameTextInputState"] - #[doc = " struct."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param state A Java gametextinput.State object."] - #[doc = " @param callback A function called with the C struct, valid for the duration"] - #[doc = " of the call."] - #[doc = " @param context Context passed to the callback."] + #[doc = " Convert from a Java gametextinput.State object into a C GameTextInputState\n struct.\n @param input A valid GameTextInput library handle.\n @param state A Java gametextinput.State object.\n @param callback A function called with the C struct, valid for the duration\n of the call.\n @param context Context passed to the callback."] pub fn GameTextInputState_fromJava( input: *const GameTextInput, state: jobject, @@ -2498,713 +2705,234 @@ extern "C" { context: *mut ::std::os::raw::c_void, ); } -#[doc = " This structure defines the native side of an android.app.GameActivity."] -#[doc = " It is created by the framework, and handed to the application's native"] -#[doc = " code as it is being launched."] -#[repr(C)] -pub struct GameActivity { - #[doc = " Pointer to the callback function table of the native application."] - #[doc = " You can set the functions here to your own callbacks. The callbacks"] - #[doc = " pointer itself here should not be changed; it is allocated and managed"] - #[doc = " for you by the framework."] - pub callbacks: *mut GameActivityCallbacks, - #[doc = " The global handle on the process's Java VM."] - pub vm: *mut JavaVM, - #[doc = " JNI context for the main thread of the app. Note that this field"] - #[doc = " can ONLY be used from the main thread of the process; that is, the"] - #[doc = " thread that calls into the GameActivityCallbacks."] - pub env: *mut JNIEnv, - #[doc = " The GameActivity object handle."] - pub javaGameActivity: jobject, - #[doc = " Path to this application's internal data directory."] - pub internalDataPath: *const ::std::os::raw::c_char, - #[doc = " Path to this application's external (removable/mountable) data directory."] - pub externalDataPath: *const ::std::os::raw::c_char, - #[doc = " The platform's SDK version code."] - pub sdkVersion: i32, - #[doc = " This is the native instance of the application. It is not used by"] - #[doc = " the framework, but can be set by the application to its own instance"] - #[doc = " state."] - pub instance: *mut ::std::os::raw::c_void, - #[doc = " Pointer to the Asset Manager instance for the application. The"] - #[doc = " application uses this to access binary assets bundled inside its own .apk"] - #[doc = " file."] - pub assetManager: *mut AAssetManager, - #[doc = " Available starting with Honeycomb: path to the directory containing"] - #[doc = " the application's OBB files (if any). If the app doesn't have any"] - #[doc = " OBB files, this directory may not exist."] - pub obbPath: *const ::std::os::raw::c_char, -} -#[test] -fn bindgen_test_layout_GameActivity() { - assert_eq!( - ::std::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(GameActivity)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(GameActivity)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).callbacks as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(callbacks) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).vm as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(vm) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).env as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(env) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).javaGameActivity as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(javaGameActivity) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).internalDataPath as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(internalDataPath) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).externalDataPath as *const _ as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(externalDataPath) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).sdkVersion as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(sdkVersion) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).instance as *const _ as usize }, - 28usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(instance) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).assetManager as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(assetManager) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).obbPath as *const _ as usize }, - 36usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(obbPath) - ) - ); -} -#[doc = " \\brief Describe information about a pointer, found in a"] -#[doc = " GameActivityMotionEvent."] -#[doc = ""] -#[doc = " You can read values directly from this structure, or use helper functions"] -#[doc = " (`GameActivityPointerAxes_getX`, `GameActivityPointerAxes_getY` and"] -#[doc = " `GameActivityPointerAxes_getAxisValue`)."] -#[doc = ""] -#[doc = " The X axis and Y axis are enabled by default but any other axis that you want"] -#[doc = " to read **must** be enabled first, using"] -#[doc = " `GameActivityPointerAxes_enableAxis`."] -#[doc = ""] -#[doc = " \\see GameActivityMotionEvent"] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct GameActivityPointerAxes { - pub id: i32, - pub toolType: i32, - pub axisValues: [f32; 48usize], - pub rawX: f32, - pub rawY: f32, -} -#[test] -fn bindgen_test_layout_GameActivityPointerAxes() { - assert_eq!( - ::std::mem::size_of::(), - 208usize, - concat!("Size of: ", stringify!(GameActivityPointerAxes)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(GameActivityPointerAxes)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).id as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(GameActivityPointerAxes), - "::", - stringify!(id) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).toolType as *const _ as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(GameActivityPointerAxes), - "::", - stringify!(toolType) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).axisValues as *const _ as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(GameActivityPointerAxes), - "::", - stringify!(axisValues) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).rawX as *const _ as usize }, - 200usize, - concat!( - "Offset of field: ", - stringify!(GameActivityPointerAxes), - "::", - stringify!(rawX) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).rawY as *const _ as usize }, - 204usize, - concat!( - "Offset of field: ", - stringify!(GameActivityPointerAxes), - "::", - stringify!(rawY) - ) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct GameActivityHistoricalPointerAxes { - pub eventTime: i64, - pub axisValues: [f32; 48usize], -} -#[test] -fn bindgen_test_layout_GameActivityHistoricalPointerAxes() { - assert_eq!( - ::std::mem::size_of::(), - 200usize, - concat!("Size of: ", stringify!(GameActivityHistoricalPointerAxes)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!( - "Alignment of ", - stringify!(GameActivityHistoricalPointerAxes) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).eventTime as *const _ - as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(GameActivityHistoricalPointerAxes), - "::", - stringify!(eventTime) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).axisValues as *const _ - as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(GameActivityHistoricalPointerAxes), - "::", - stringify!(axisValues) - ) - ); -} -extern "C" { - #[doc = " \\brief Enable the specified axis, so that its value is reported in the"] - #[doc = " GameActivityPointerAxes structures stored in a motion event."] - #[doc = ""] - #[doc = " You must enable any axis that you want to read, apart from"] - #[doc = " `AMOTION_EVENT_AXIS_X` and `AMOTION_EVENT_AXIS_Y` that are enabled by"] - #[doc = " default."] - #[doc = ""] - #[doc = " If the axis index is out of range, nothing is done."] - pub fn GameActivityPointerAxes_enableAxis(axis: i32); -} -extern "C" { - #[doc = " \\brief Disable the specified axis. Its value won't be reported in the"] - #[doc = " GameActivityPointerAxes structures stored in a motion event anymore."] - #[doc = ""] - #[doc = " Apart from X and Y, any axis that you want to read **must** be enabled first,"] - #[doc = " using `GameActivityPointerAxes_enableAxis`."] - #[doc = ""] - #[doc = " If the axis index is out of range, nothing is done."] - pub fn GameActivityPointerAxes_disableAxis(axis: i32); -} -extern "C" { - #[doc = " \\brief Enable the specified axis, so that its value is reported in the"] - #[doc = " GameActivityHistoricalPointerAxes structures associated with a motion event."] - #[doc = ""] - #[doc = " You must enable any axis that you want to read (no axes are enabled by"] - #[doc = " default)."] - #[doc = ""] - #[doc = " If the axis index is out of range, nothing is done."] - pub fn GameActivityHistoricalPointerAxes_enableAxis(axis: i32); -} -extern "C" { - #[doc = " \\brief Disable the specified axis. Its value won't be reported in the"] - #[doc = " GameActivityHistoricalPointerAxes structures associated with motion events"] - #[doc = " anymore."] - #[doc = ""] - #[doc = " If the axis index is out of range, nothing is done."] - pub fn GameActivityHistoricalPointerAxes_disableAxis(axis: i32); -} -#[doc = " \\brief Describe a motion event that happened on the GameActivity SurfaceView."] -#[doc = ""] -#[doc = " This is 1:1 mapping to the information contained in a Java `MotionEvent`"] -#[doc = " (see https://developer.android.com/reference/android/view/MotionEvent)."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct GameActivityMotionEvent { - pub deviceId: i32, - pub source: i32, - pub action: i32, - pub eventTime: i64, - pub downTime: i64, - pub flags: i32, - pub metaState: i32, - pub actionButton: i32, - pub buttonState: i32, - pub classification: i32, - pub edgeFlags: i32, - pub pointerCount: u32, - pub pointers: [GameActivityPointerAxes; 8usize], - pub precisionX: f32, - pub precisionY: f32, - pub historicalStart: i16, - pub historicalCount: i16, -} -#[test] -fn bindgen_test_layout_GameActivityMotionEvent() { - assert_eq!( - ::std::mem::size_of::(), - 1732usize, - concat!("Size of: ", stringify!(GameActivityMotionEvent)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(GameActivityMotionEvent)) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).deviceId as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(deviceId) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).source as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(source) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).action as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(action) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).eventTime as *const _ as usize - }, - 12usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(eventTime) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).downTime as *const _ as usize - }, - 20usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(downTime) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, - 28usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(flags) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).metaState as *const _ as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(metaState) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).actionButton as *const _ as usize - }, - 36usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(actionButton) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).buttonState as *const _ as usize - }, - 40usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(buttonState) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).classification as *const _ as usize - }, - 44usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(classification) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).edgeFlags as *const _ as usize - }, - 48usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(edgeFlags) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).pointerCount as *const _ as usize - }, - 52usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(pointerCount) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).pointers as *const _ as usize - }, - 56usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(pointers) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).precisionX as *const _ as usize - }, - 1720usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(precisionX) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).precisionY as *const _ as usize - }, - 1724usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(precisionY) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).historicalStart as *const _ as usize - }, - 1728usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(historicalStart) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).historicalCount as *const _ as usize - }, - 1730usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(historicalCount) - ) - ); -} -#[doc = " \\brief Describe a key event that happened on the GameActivity SurfaceView."] -#[doc = ""] -#[doc = " This is 1:1 mapping to the information contained in a Java `KeyEvent`"] -#[doc = " (see https://developer.android.com/reference/android/view/KeyEvent)."] +#[doc = " Mask of bits that determine the overall class\n of text being given. Currently supported classes are:\n {@link #TYPE_CLASS_TEXT}, {@link #TYPE_CLASS_NUMBER},\n {@link #TYPE_CLASS_PHONE}, {@link #TYPE_CLASS_DATETIME}.\n

IME authors: If the class is not one you\n understand, assume {@link #TYPE_CLASS_TEXT} with NO variation\n or flags.

"] +pub const GameTextInputType_TYPE_MASK_CLASS: GameTextInputType = 15; +#[doc = " Mask of bits that determine the variation of\n the base content class."] +pub const GameTextInputType_TYPE_MASK_VARIATION: GameTextInputType = 4080; +#[doc = " Mask of bits that provide addition bit flags\n of options."] +pub const GameTextInputType_TYPE_MASK_FLAGS: GameTextInputType = 16773120; +#[doc = " Special content type for when no explicit type has been specified.\n This should be interpreted to mean that the target input connection\n is not rich, it can not process and show things like candidate text nor\n retrieve the current text, so the input method will need to run in a\n limited \"generate key events\" mode, if it supports it. Note that some\n input methods may not support it, for example a voice-based input\n method will likely not be able to generate key events even if this\n flag is set."] +pub const GameTextInputType_TYPE_NULL: GameTextInputType = 0; +#[doc = " Class for normal text. This class supports the following flags (only\n one of which should be set):\n {@link #TYPE_TEXT_FLAG_CAP_CHARACTERS},\n {@link #TYPE_TEXT_FLAG_CAP_WORDS}, and.\n {@link #TYPE_TEXT_FLAG_CAP_SENTENCES}. It also supports the\n following variations:\n {@link #TYPE_TEXT_VARIATION_NORMAL}, and\n {@link #TYPE_TEXT_VARIATION_URI}. If you do not recognize the\n variation, normal should be assumed."] +pub const GameTextInputType_TYPE_CLASS_TEXT: GameTextInputType = 1; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: capitalize all characters. Overrides\n {@link #TYPE_TEXT_FLAG_CAP_WORDS} and\n {@link #TYPE_TEXT_FLAG_CAP_SENTENCES}. This value is explicitly defined\n to be the same as {@link TextUtils#CAP_MODE_CHARACTERS}. Of course,\n this only affects languages where there are upper-case and lower-case\n letters."] +pub const GameTextInputType_TYPE_TEXT_FLAG_CAP_CHARACTERS: GameTextInputType = 4096; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: capitalize the first character of\n every word. Overrides {@link #TYPE_TEXT_FLAG_CAP_SENTENCES}. This\n value is explicitly defined\n to be the same as {@link TextUtils#CAP_MODE_WORDS}. Of course,\n this only affects languages where there are upper-case and lower-case\n letters."] +pub const GameTextInputType_TYPE_TEXT_FLAG_CAP_WORDS: GameTextInputType = 8192; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: capitalize the first character of\n each sentence. This value is explicitly defined\n to be the same as {@link TextUtils#CAP_MODE_SENTENCES}. For example\n in English it means to capitalize after a period and a space (note that\n other languages may have different characters for period, or not use\n spaces, or use different grammatical rules). Of course, this only affects\n languages where there are upper-case and lower-case letters."] +pub const GameTextInputType_TYPE_TEXT_FLAG_CAP_SENTENCES: GameTextInputType = 16384; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: the user is entering free-form\n text that should have auto-correction applied to it. Without this flag,\n the IME will not try to correct typos. You should always set this flag\n unless you really expect users to type non-words in this field, for\n example to choose a name for a character in a game.\n Contrast this with {@link #TYPE_TEXT_FLAG_AUTO_COMPLETE} and\n {@link #TYPE_TEXT_FLAG_NO_SUGGESTIONS}:\n {@code TYPE_TEXT_FLAG_AUTO_CORRECT} means that the IME will try to\n auto-correct typos as the user is typing, but does not define whether\n the IME offers an interface to show suggestions."] +pub const GameTextInputType_TYPE_TEXT_FLAG_AUTO_CORRECT: GameTextInputType = 32768; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: the text editor (which means\n the application) is performing auto-completion of the text being entered\n based on its own semantics, which it will present to the user as they type.\n This generally means that the input method should not be showing\n candidates itself, but can expect the editor to supply its own\n completions/candidates from\n {@link android.view.inputmethod.InputMethodSession#displayCompletions\n InputMethodSession.displayCompletions()} as a result of the editor calling\n {@link android.view.inputmethod.InputMethodManager#displayCompletions\n InputMethodManager.displayCompletions()}.\n Note the contrast with {@link #TYPE_TEXT_FLAG_AUTO_CORRECT} and\n {@link #TYPE_TEXT_FLAG_NO_SUGGESTIONS}:\n {@code TYPE_TEXT_FLAG_AUTO_COMPLETE} means the editor should show an\n interface for displaying suggestions, but instead of supplying its own\n it will rely on the Editor to pass completions/corrections."] +pub const GameTextInputType_TYPE_TEXT_FLAG_AUTO_COMPLETE: GameTextInputType = 65536; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: multiple lines of text can be\n entered into the field. If this flag is not set, the text field\n will be constrained to a single line. The IME may also choose not to\n display an enter key when this flag is not set, as there should be no\n need to create new lines."] +pub const GameTextInputType_TYPE_TEXT_FLAG_MULTI_LINE: GameTextInputType = 131072; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: the regular text view associated\n with this should not be multi-line, but when a fullscreen input method\n is providing text it should use multiple lines if it can."] +pub const GameTextInputType_TYPE_TEXT_FLAG_IME_MULTI_LINE: GameTextInputType = 262144; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: the input method does not need to\n display any dictionary-based candidates. This is useful for text views that\n do not contain words from the language and do not benefit from any\n dictionary-based completions or corrections. It overrides the\n {@link #TYPE_TEXT_FLAG_AUTO_CORRECT} value when set.\n Please avoid using this unless you are certain this is what you want.\n Many input methods need suggestions to work well, for example the ones\n based on gesture typing. Consider clearing\n {@link #TYPE_TEXT_FLAG_AUTO_CORRECT} instead if you just do not\n want the IME to correct typos.\n Note the contrast with {@link #TYPE_TEXT_FLAG_AUTO_CORRECT} and\n {@link #TYPE_TEXT_FLAG_AUTO_COMPLETE}:\n {@code TYPE_TEXT_FLAG_NO_SUGGESTIONS} means the IME does not need to\n show an interface to display suggestions. Most IMEs will also take this to\n mean they do not need to try to auto-correct what the user is typing."] +pub const GameTextInputType_TYPE_TEXT_FLAG_NO_SUGGESTIONS: GameTextInputType = 524288; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: Let the IME know the text conversion\n suggestions are required by the application. Text conversion suggestion is\n for the transliteration languages which has pronunciation characters and\n target characters. When the user is typing the pronunciation charactes, the\n IME could provide the possible target characters to the user. When this\n flag is set, the IME should insert the text conversion suggestions through\n {@link Builder#setTextConversionSuggestions(List)} and\n the {@link TextAttribute} with initialized with the text conversion\n suggestions is provided by the IME to the application. To receive the\n additional information, the application needs to implement {@link\n InputConnection#setComposingText(CharSequence, int, TextAttribute)},\n {@link InputConnection#setComposingRegion(int, int, TextAttribute)}, and\n {@link InputConnection#commitText(CharSequence, int, TextAttribute)}."] +pub const GameTextInputType_TYPE_TEXT_FLAG_ENABLE_TEXT_CONVERSION_SUGGESTIONS: GameTextInputType = + 1048576; +#[doc = " Default variation of {@link #TYPE_CLASS_TEXT}: plain old normal text."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_NORMAL: GameTextInputType = 0; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering a URI."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_URI: GameTextInputType = 16; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering an e-mail address."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_EMAIL_ADDRESS: GameTextInputType = 32; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering the subject line of\n an e-mail."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_EMAIL_SUBJECT: GameTextInputType = 48; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering a short, possibly informal\n message such as an instant message or a text message."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_SHORT_MESSAGE: GameTextInputType = 64; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering the content of a long,\n possibly formal message such as the body of an e-mail."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_LONG_MESSAGE: GameTextInputType = 80; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering the name of a person."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_PERSON_NAME: GameTextInputType = 96; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering a postal mailing address."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_POSTAL_ADDRESS: GameTextInputType = 112; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering a password."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_PASSWORD: GameTextInputType = 128; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering a password, which should\n be visible to the user."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_VISIBLE_PASSWORD: GameTextInputType = 144; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering text inside of a web form."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_WEB_EDIT_TEXT: GameTextInputType = 160; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering text to filter contents\n of a list etc."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_FILTER: GameTextInputType = 176; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering text for phonetic\n pronunciation, such as a phonetic name field in contacts. This is mostly\n useful for languages where one spelling may have several phonetic\n readings, like Japanese."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_PHONETIC: GameTextInputType = 192; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering e-mail address inside\n of a web form. This was added in\n {@link android.os.Build.VERSION_CODES#HONEYCOMB}. An IME must target\n this API version or later to see this input type; if it doesn't, a request\n for this type will be seen as {@link #TYPE_TEXT_VARIATION_EMAIL_ADDRESS}\n when passed through {@link\n android.view.inputmethod.EditorInfo#makeCompatible(int)\n EditorInfo.makeCompatible(int)}."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS: GameTextInputType = 208; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering password inside\n of a web form. This was added in\n {@link android.os.Build.VERSION_CODES#HONEYCOMB}. An IME must target\n this API version or later to see this input type; if it doesn't, a request\n for this type will be seen as {@link #TYPE_TEXT_VARIATION_PASSWORD}\n when passed through {@link\n android.view.inputmethod.EditorInfo#makeCompatible(int)\n EditorInfo.makeCompatible(int)}."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_WEB_PASSWORD: GameTextInputType = 224; +#[doc = " Class for numeric text. This class supports the following flags:\n {@link #TYPE_NUMBER_FLAG_SIGNED} and\n {@link #TYPE_NUMBER_FLAG_DECIMAL}. It also supports the following\n variations: {@link #TYPE_NUMBER_VARIATION_NORMAL} and\n {@link #TYPE_NUMBER_VARIATION_PASSWORD}.\n

IME authors: If you do not recognize\n the variation, normal should be assumed.

"] +pub const GameTextInputType_TYPE_CLASS_NUMBER: GameTextInputType = 2; +#[doc = " Flag of {@link #TYPE_CLASS_NUMBER}: the number is signed, allowing\n a positive or negative sign at the start."] +pub const GameTextInputType_TYPE_NUMBER_FLAG_SIGNED: GameTextInputType = 4096; +#[doc = " Flag of {@link #TYPE_CLASS_NUMBER}: the number is decimal, allowing\n a decimal point to provide fractional values."] +pub const GameTextInputType_TYPE_NUMBER_FLAG_DECIMAL: GameTextInputType = 8192; +#[doc = " Default variation of {@link #TYPE_CLASS_NUMBER}: plain normal\n numeric text. This was added in\n {@link android.os.Build.VERSION_CODES#HONEYCOMB}. An IME must target\n this API version or later to see this input type; if it doesn't, a request\n for this type will be dropped when passed through\n {@link android.view.inputmethod.EditorInfo#makeCompatible(int)\n EditorInfo.makeCompatible(int)}."] +pub const GameTextInputType_TYPE_NUMBER_VARIATION_NORMAL: GameTextInputType = 0; +#[doc = " Variation of {@link #TYPE_CLASS_NUMBER}: entering a numeric password.\n This was added in {@link android.os.Build.VERSION_CODES#HONEYCOMB}. An\n IME must target this API version or later to see this input type; if it\n doesn't, a request for this type will be dropped when passed\n through {@link android.view.inputmethod.EditorInfo#makeCompatible(int)\n EditorInfo.makeCompatible(int)}."] +pub const GameTextInputType_TYPE_NUMBER_VARIATION_PASSWORD: GameTextInputType = 16; +#[doc = " Class for a phone number. This class currently supports no variations\n or flags."] +pub const GameTextInputType_TYPE_CLASS_PHONE: GameTextInputType = 3; +#[doc = " Class for dates and times. It supports the\n following variations:\n {@link #TYPE_DATETIME_VARIATION_NORMAL}\n {@link #TYPE_DATETIME_VARIATION_DATE}, and\n {@link #TYPE_DATETIME_VARIATION_TIME}."] +pub const GameTextInputType_TYPE_CLASS_DATETIME: GameTextInputType = 4; +#[doc = " Default variation of {@link #TYPE_CLASS_DATETIME}: allows entering\n both a date and time."] +pub const GameTextInputType_TYPE_DATETIME_VARIATION_NORMAL: GameTextInputType = 0; +#[doc = " Default variation of {@link #TYPE_CLASS_DATETIME}: allows entering\n only a date."] +pub const GameTextInputType_TYPE_DATETIME_VARIATION_DATE: GameTextInputType = 16; +#[doc = " Default variation of {@link #TYPE_CLASS_DATETIME}: allows entering\n only a time."] +pub const GameTextInputType_TYPE_DATETIME_VARIATION_TIME: GameTextInputType = 32; +#[doc = " Definitions for inputType argument of GameActivity_setImeEditorInfo()\n\n
\n |-------|-------|-------|-------|\n                              1111 TYPE_MASK_CLASS\n                      11111111     TYPE_MASK_VARIATION\n          111111111111             TYPE_MASK_FLAGS\n |-------|-------|-------|-------|\n                                   TYPE_NULL\n |-------|-------|-------|-------|\n                                 1 TYPE_CLASS_TEXT\n                             1     TYPE_TEXT_VARIATION_URI\n                            1      TYPE_TEXT_VARIATION_EMAIL_ADDRESS\n                            11     TYPE_TEXT_VARIATION_EMAIL_SUBJECT\n                           1       TYPE_TEXT_VARIATION_SHORT_MESSAGE\n                           1 1     TYPE_TEXT_VARIATION_LONG_MESSAGE\n                           11      TYPE_TEXT_VARIATION_PERSON_NAME\n                           111     TYPE_TEXT_VARIATION_POSTAL_ADDRESS\n                          1        TYPE_TEXT_VARIATION_PASSWORD\n                          1  1     TYPE_TEXT_VARIATION_VISIBLE_PASSWORD\n                          1 1      TYPE_TEXT_VARIATION_WEB_EDIT_TEXT\n                          1 11     TYPE_TEXT_VARIATION_FILTER\n                          11       TYPE_TEXT_VARIATION_PHONETIC\n                          11 1     TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS\n                          111      TYPE_TEXT_VARIATION_WEB_PASSWORD\n                     1             TYPE_TEXT_FLAG_CAP_CHARACTERS\n                    1              TYPE_TEXT_FLAG_CAP_WORDS\n                   1               TYPE_TEXT_FLAG_CAP_SENTENCES\n                  1                TYPE_TEXT_FLAG_AUTO_CORRECT\n                 1                 TYPE_TEXT_FLAG_AUTO_COMPLETE\n                1                  TYPE_TEXT_FLAG_MULTI_LINE\n               1                   TYPE_TEXT_FLAG_IME_MULTI_LINE\n              1                    TYPE_TEXT_FLAG_NO_SUGGESTIONS\n             1 TYPE_TEXT_FLAG_ENABLE_TEXT_CONVERSION_SUGGESTIONS\n |-------|-------|-------|-------|\n                                1  TYPE_CLASS_NUMBER\n                             1     TYPE_NUMBER_VARIATION_PASSWORD\n                     1             TYPE_NUMBER_FLAG_SIGNED\n                    1              TYPE_NUMBER_FLAG_DECIMAL\n |-------|-------|-------|-------|\n                                11 TYPE_CLASS_PHONE\n |-------|-------|-------|-------|\n                               1   TYPE_CLASS_DATETIME\n                             1     TYPE_DATETIME_VARIATION_DATE\n                            1      TYPE_DATETIME_VARIATION_TIME\n |-------|-------|-------|-------|
"] +pub type GameTextInputType = u32; +#[doc = " Set of bits in {@link #imeOptions} that provide alternative actions\n associated with the \"enter\" key. This both helps the IME provide\n better feedback about what the enter key will do, and also allows it\n to provide alternative mechanisms for providing that command."] +pub const GameTextInputActionType_IME_MASK_ACTION: GameTextInputActionType = 255; +#[doc = " Bits of {@link #IME_MASK_ACTION}: no specific action has been\n associated with this editor, let the editor come up with its own if\n it can."] +pub const GameTextInputActionType_IME_ACTION_UNSPECIFIED: GameTextInputActionType = 0; +#[doc = " Bits of {@link #IME_MASK_ACTION}: there is no available action."] +pub const GameTextInputActionType_IME_ACTION_NONE: GameTextInputActionType = 1; +#[doc = " Bits of {@link #IME_MASK_ACTION}: the action key performs a \"go\"\n operation to take the user to the target of the text they typed.\n Typically used, for example, when entering a URL."] +pub const GameTextInputActionType_IME_ACTION_GO: GameTextInputActionType = 2; +#[doc = " Bits of {@link #IME_MASK_ACTION}: the action key performs a \"search\"\n operation, taking the user to the results of searching for the text\n they have typed (in whatever context is appropriate)."] +pub const GameTextInputActionType_IME_ACTION_SEARCH: GameTextInputActionType = 3; +#[doc = " Bits of {@link #IME_MASK_ACTION}: the action key performs a \"send\"\n operation, delivering the text to its target. This is typically used\n when composing a message in IM or SMS where sending is immediate."] +pub const GameTextInputActionType_IME_ACTION_SEND: GameTextInputActionType = 4; +#[doc = " Bits of {@link #IME_MASK_ACTION}: the action key performs a \"next\"\n operation, taking the user to the next field that will accept text."] +pub const GameTextInputActionType_IME_ACTION_NEXT: GameTextInputActionType = 5; +#[doc = " Bits of {@link #IME_MASK_ACTION}: the action key performs a \"done\"\n operation, typically meaning there is nothing more to input and the\n IME will be closed."] +pub const GameTextInputActionType_IME_ACTION_DONE: GameTextInputActionType = 6; +#[doc = " Bits of {@link #IME_MASK_ACTION}: like {@link #IME_ACTION_NEXT}, but\n for moving to the previous field. This will normally not be used to\n specify an action (since it precludes {@link #IME_ACTION_NEXT}), but\n can be returned to the app if it sets {@link #IME_FLAG_NAVIGATE_PREVIOUS}."] +pub const GameTextInputActionType_IME_ACTION_PREVIOUS: GameTextInputActionType = 7; +#[doc = " actionId and imeOptions argument of GameActivity_setImeEditorInfo().\n\n
\n |-------|-------|-------|-------|\n                              1111 IME_MASK_ACTION\n |-------|-------|-------|-------|\n                                   IME_ACTION_UNSPECIFIED\n                                 1 IME_ACTION_NONE\n                                1  IME_ACTION_GO\n                                11 IME_ACTION_SEARCH\n                               1   IME_ACTION_SEND\n                               1 1 IME_ACTION_NEXT\n                               11  IME_ACTION_DONE\n                               111 IME_ACTION_PREVIOUS\n         1                         IME_FLAG_NO_PERSONALIZED_LEARNING\n        1                          IME_FLAG_NO_FULLSCREEN\n       1                           IME_FLAG_NAVIGATE_PREVIOUS\n      1                            IME_FLAG_NAVIGATE_NEXT\n     1                             IME_FLAG_NO_EXTRACT_UI\n    1                              IME_FLAG_NO_ACCESSORY_ACTION\n   1                               IME_FLAG_NO_ENTER_ACTION\n  1                                IME_FLAG_FORCE_ASCII\n |-------|-------|-------|-------|
"] +pub type GameTextInputActionType = u32; +#[doc = " Flag of {@link #imeOptions}: used to request that the IME should not update\n any personalized data such as typing history and personalized language\n model based on what the user typed on this text editing object. Typical\n use cases are:
  • When the application is in a special mode, where\n user's activities are expected to be not recorded in the application's\n history. Some web browsers and chat applications may have this kind of\n modes.
  • When storing typing history does not make much sense.\n Specifying this flag in typing games may help to avoid typing history from\n being filled up with words that the user is less likely to type in their\n daily life. Another example is that when the application already knows\n that the expected input is not a valid word (e.g. a promotion code that is\n not a valid word in any natural language).
  • \n
\n\n

Applications need to be aware that the flag is not a guarantee, and some\n IMEs may not respect it.

"] +pub const GameTextInputImeOptions_IME_FLAG_NO_PERSONALIZED_LEARNING: GameTextInputImeOptions = + 16777216; +#[doc = " Flag of {@link #imeOptions}: used to request that the IME never go\n into fullscreen mode.\n By default, IMEs may go into full screen mode when they think\n it's appropriate, for example on small screens in landscape\n orientation where displaying a software keyboard may occlude\n such a large portion of the screen that the remaining part is\n too small to meaningfully display the application UI.\n If this flag is set, compliant IMEs will never go into full screen mode,\n and always leave some space to display the application UI.\n Applications need to be aware that the flag is not a guarantee, and\n some IMEs may ignore it."] +pub const GameTextInputImeOptions_IME_FLAG_NO_FULLSCREEN: GameTextInputImeOptions = 33554432; +#[doc = " Flag of {@link #imeOptions}: like {@link #IME_FLAG_NAVIGATE_NEXT}, but\n specifies there is something interesting that a backward navigation\n can focus on. If the user selects the IME's facility to backward\n navigate, this will show up in the application as an {@link\n #IME_ACTION_PREVIOUS} at {@link InputConnection#performEditorAction(int)\n InputConnection.performEditorAction(int)}."] +pub const GameTextInputImeOptions_IME_FLAG_NAVIGATE_PREVIOUS: GameTextInputImeOptions = 67108864; +#[doc = " Flag of {@link #imeOptions}: used to specify that there is something\n interesting that a forward navigation can focus on. This is like using\n {@link #IME_ACTION_NEXT}, except allows the IME to be multiline (with\n an enter key) as well as provide forward navigation. Note that some\n IMEs may not be able to do this, especially when running on a small\n screen where there is little space. In that case it does not need to\n present a UI for this option. Like {@link #IME_ACTION_NEXT}, if the\n user selects the IME's facility to forward navigate, this will show up\n in the application at {@link InputConnection#performEditorAction(int)\n InputConnection.performEditorAction(int)}."] +pub const GameTextInputImeOptions_IME_FLAG_NAVIGATE_NEXT: GameTextInputImeOptions = 134217728; +#[doc = " Flag of {@link #imeOptions}: used to specify that the IME does not need\n to show its extracted text UI. For input methods that may be fullscreen,\n often when in landscape mode, this allows them to be smaller and let part\n of the application be shown behind, through transparent UI parts in the\n fullscreen IME. The part of the UI visible to the user may not be\n responsive to touch because the IME will receive touch events, which may\n confuse the user; use {@link #IME_FLAG_NO_FULLSCREEN} instead for a better\n experience. Using this flag is discouraged and it may become deprecated in\n the future. Its meaning is unclear in some situations and it may not work\n appropriately on older versions of the platform."] +pub const GameTextInputImeOptions_IME_FLAG_NO_EXTRACT_UI: GameTextInputImeOptions = 268435456; +#[doc = " Flag of {@link #imeOptions}: used in conjunction with one of the actions\n masked by {@link #IME_MASK_ACTION}, this indicates that the action\n should not be available as an accessory button on the right of the\n extracted text when the input method is full-screen. Note that by setting\n this flag, there can be cases where the action is simply never available to\n the user. Setting this generally means that you think that in fullscreen\n mode, where there is little space to show the text, it's not worth taking\n some screen real estate to display the action and it should be used instead\n to show more text."] +pub const GameTextInputImeOptions_IME_FLAG_NO_ACCESSORY_ACTION: GameTextInputImeOptions = 536870912; +#[doc = " Flag of {@link #imeOptions}: used in conjunction with one of the actions\n masked by {@link #IME_MASK_ACTION}. If this flag is not set, IMEs will\n normally replace the \"enter\" key with the action supplied. This flag\n indicates that the action should not be available in-line as a replacement\n for the \"enter\" key. Typically this is because the action has such a\n significant impact or is not recoverable enough that accidentally hitting\n it should be avoided, such as sending a message. Note that\n {@link android.widget.TextView} will automatically set this flag for you\n on multi-line text views."] +pub const GameTextInputImeOptions_IME_FLAG_NO_ENTER_ACTION: GameTextInputImeOptions = 1073741824; +#[doc = " Flag of {@link #imeOptions}: used to request an IME that is capable of\n inputting ASCII characters. The intention of this flag is to ensure that\n the user can type Roman alphabet characters in a {@link\n android.widget.TextView}. It is typically used for an account ID or\n password input. A lot of the time, IMEs are already able to input ASCII\n even without being told so (such IMEs already respect this flag in a\n sense), but there are cases when this is not the default. For instance,\n users of languages using a different script like Arabic, Greek, Hebrew or\n Russian typically have a keyboard that can't input ASCII characters by\n default. Applications need to be aware that the flag is not a guarantee,\n and some IMEs may not respect it. However, it is strongly recommended for\n IME authors to respect this flag especially when their IME could end up\n with a state where only languages using non-ASCII are enabled."] +pub const GameTextInputImeOptions_IME_FLAG_FORCE_ASCII: GameTextInputImeOptions = 2147483648; +#[doc = " Flag of {@link #internalImeOptions}: flag is set when app window containing\n this\n {@link EditorInfo} is using {@link Configuration#ORIENTATION_PORTRAIT}\n mode.\n @hide"] +pub const GameTextInputImeOptions_IME_INTERNAL_FLAG_APP_WINDOW_PORTRAIT: GameTextInputImeOptions = + 1; +#[doc = " Generic unspecified type for {@link #imeOptions}."] +pub const GameTextInputImeOptions_IME_NULL: GameTextInputImeOptions = 0; +pub type GameTextInputImeOptions = u32; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_CAPTION_BAR: GameCommonInsetsType = 0; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_DISPLAY_CUTOUT: GameCommonInsetsType = 1; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_IME: GameCommonInsetsType = 2; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_MANDATORY_SYSTEM_GESTURES: + GameCommonInsetsType = 3; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_NAVIGATION_BARS: GameCommonInsetsType = 4; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_STATUS_BARS: GameCommonInsetsType = 5; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_SYSTEM_BARS: GameCommonInsetsType = 6; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_SYSTEM_GESTURES: GameCommonInsetsType = 7; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_TAPABLE_ELEMENT: GameCommonInsetsType = 8; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_WATERFALL: GameCommonInsetsType = 9; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_COUNT: GameCommonInsetsType = 10; +#[doc = " The type of a component for which to retrieve insets. See\n https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat.Type"] +pub type GameCommonInsetsType = u8; +#[doc = " This structure defines the native side of an android.app.GameActivity.\n It is created by the framework, and handed to the application's native\n code as it is being launched."] #[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct GameActivityKeyEvent { - pub deviceId: i32, - pub source: i32, - pub action: i32, - pub eventTime: i64, - pub downTime: i64, - pub flags: i32, - pub metaState: i32, - pub modifiers: i32, - pub repeatCount: i32, - pub keyCode: i32, - pub scanCode: i32, +pub struct GameActivity { + #[doc = " Pointer to the callback function table of the native application.\n You can set the functions here to your own callbacks. The callbacks\n pointer itself here should not be changed; it is allocated and managed\n for you by the framework."] + pub callbacks: *mut GameActivityCallbacks, + #[doc = " The global handle on the process's Java VM."] + pub vm: *mut JavaVM, + #[doc = " JNI context for the main thread of the app. Note that this field\n can ONLY be used from the main thread of the process; that is, the\n thread that calls into the GameActivityCallbacks."] + pub env: *mut JNIEnv, + #[doc = " The GameActivity object handle."] + pub javaGameActivity: jobject, + #[doc = " Path to this application's internal data directory."] + pub internalDataPath: *const ::std::os::raw::c_char, + #[doc = " Path to this application's external (removable/mountable) data directory."] + pub externalDataPath: *const ::std::os::raw::c_char, + #[doc = " The platform's SDK version code."] + pub sdkVersion: i32, + #[doc = " This is the native instance of the application. It is not used by\n the framework, but can be set by the application to its own instance\n state."] + pub instance: *mut ::std::os::raw::c_void, + #[doc = " Pointer to the Asset Manager instance for the application. The\n application uses this to access binary assets bundled inside its own .apk\n file."] + pub assetManager: *mut AAssetManager, + #[doc = " Available starting with Honeycomb: path to the directory containing\n the application's OBB files (if any). If the app doesn't have any\n OBB files, this directory may not exist."] + pub obbPath: *const ::std::os::raw::c_char, } #[test] -fn bindgen_test_layout_GameActivityKeyEvent() { +fn bindgen_test_layout_GameActivity() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - ::std::mem::size_of::(), - 52usize, - concat!("Size of: ", stringify!(GameActivityKeyEvent)) + ::std::mem::size_of::(), + 40usize, + "Size of GameActivity" ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(GameActivityKeyEvent)) + "Alignment of GameActivity" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).deviceId as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).callbacks) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(deviceId) - ) + "Offset of field: GameActivity::callbacks" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).source as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).vm) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(source) - ) + "Offset of field: GameActivity::vm" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).action as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).env) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(action) - ) + "Offset of field: GameActivity::env" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).eventTime as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).javaGameActivity) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(eventTime) - ) + "Offset of field: GameActivity::javaGameActivity" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).downTime as *const _ as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(downTime) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, - 28usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(flags) - ) + unsafe { ::std::ptr::addr_of!((*ptr).internalDataPath) as usize - ptr as usize }, + 16usize, + "Offset of field: GameActivity::internalDataPath" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).metaState as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(metaState) - ) + unsafe { ::std::ptr::addr_of!((*ptr).externalDataPath) as usize - ptr as usize }, + 20usize, + "Offset of field: GameActivity::externalDataPath" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).modifiers as *const _ as usize }, - 36usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(modifiers) - ) + unsafe { ::std::ptr::addr_of!((*ptr).sdkVersion) as usize - ptr as usize }, + 24usize, + "Offset of field: GameActivity::sdkVersion" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).repeatCount as *const _ as usize - }, - 40usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(repeatCount) - ) + unsafe { ::std::ptr::addr_of!((*ptr).instance) as usize - ptr as usize }, + 28usize, + "Offset of field: GameActivity::instance" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).keyCode as *const _ as usize }, - 44usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(keyCode) - ) + unsafe { ::std::ptr::addr_of!((*ptr).assetManager) as usize - ptr as usize }, + 32usize, + "Offset of field: GameActivity::assetManager" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).scanCode as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(scanCode) - ) + unsafe { ::std::ptr::addr_of!((*ptr).obbPath) as usize - ptr as usize }, + 36usize, + "Offset of field: GameActivity::obbPath" ); } -#[doc = " A function the user should call from their callback with the data, its length"] -#[doc = " and the library- supplied context."] +#[doc = " A function the user should call from their callback with the data, its length\n and the library- supplied context."] pub type SaveInstanceStateRecallback = ::std::option::Option< unsafe extern "C" fn( bytes: *const ::std::os::raw::c_char, @@ -3216,18 +2944,11 @@ pub type SaveInstanceStateRecallback = ::std::option::Option< #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct GameActivityCallbacks { - #[doc = " GameActivity has started. See Java documentation for Activity.onStart()"] - #[doc = " for more information."] + #[doc = " GameActivity has started. See Java documentation for Activity.onStart()\n for more information."] pub onStart: ::std::option::Option, - #[doc = " GameActivity has resumed. See Java documentation for Activity.onResume()"] - #[doc = " for more information."] + #[doc = " GameActivity has resumed. See Java documentation for Activity.onResume()\n for more information."] pub onResume: ::std::option::Option, - #[doc = " The framework is asking GameActivity to save its current instance state."] - #[doc = " See the Java documentation for Activity.onSaveInstanceState() for more"] - #[doc = " information. The user should call the recallback with their data, its"] - #[doc = " length and the provided context; they retain ownership of the data. Note"] - #[doc = " that the saved state will be persisted, so it can not contain any active"] - #[doc = " entities (pointers to memory, file descriptors, etc)."] + #[doc = " The framework is asking GameActivity to save its current instance state.\n See the Java documentation for Activity.onSaveInstanceState() for more\n information. The user should call the recallback with their data, its\n length and the provided context; they retain ownership of the data. Note\n that the saved state will be persisted, so it can not contain any active\n entities (pointers to memory, file descriptors, etc)."] pub onSaveInstanceState: ::std::option::Option< unsafe extern "C" fn( activity: *mut GameActivity, @@ -3235,27 +2956,20 @@ pub struct GameActivityCallbacks { context: *mut ::std::os::raw::c_void, ), >, - #[doc = " GameActivity has paused. See Java documentation for Activity.onPause()"] - #[doc = " for more information."] + #[doc = " GameActivity has paused. See Java documentation for Activity.onPause()\n for more information."] pub onPause: ::std::option::Option, - #[doc = " GameActivity has stopped. See Java documentation for Activity.onStop()"] - #[doc = " for more information."] + #[doc = " GameActivity has stopped. See Java documentation for Activity.onStop()\n for more information."] pub onStop: ::std::option::Option, - #[doc = " GameActivity is being destroyed. See Java documentation for"] - #[doc = " Activity.onDestroy() for more information."] + #[doc = " GameActivity is being destroyed. See Java documentation for\n Activity.onDestroy() for more information."] pub onDestroy: ::std::option::Option, - #[doc = " Focus has changed in this GameActivity's window. This is often used,"] - #[doc = " for example, to pause a game when it loses input focus."] + #[doc = " Focus has changed in this GameActivity's window. This is often used,\n for example, to pause a game when it loses input focus."] pub onWindowFocusChanged: ::std::option::Option, - #[doc = " The drawing window for this native activity has been created. You"] - #[doc = " can use the given native window object to start drawing."] + #[doc = " The drawing window for this native activity has been created. You\n can use the given native window object to start drawing."] pub onNativeWindowCreated: ::std::option::Option< unsafe extern "C" fn(activity: *mut GameActivity, window: *mut ANativeWindow), >, - #[doc = " The drawing window for this native activity has been resized. You should"] - #[doc = " retrieve the new size from the window and ensure that your rendering in"] - #[doc = " it now matches."] + #[doc = " The drawing window for this native activity has been resized. You should\n retrieve the new size from the window and ensure that your rendering in\n it now matches."] pub onNativeWindowResized: ::std::option::Option< unsafe extern "C" fn( activity: *mut GameActivity, @@ -3264,557 +2978,295 @@ pub struct GameActivityCallbacks { newHeight: i32, ), >, - #[doc = " The drawing window for this native activity needs to be redrawn. To"] - #[doc = " avoid transient artifacts during screen changes (such resizing after"] - #[doc = " rotation), applications should not return from this function until they"] - #[doc = " have finished drawing their window in its current state."] + #[doc = " The drawing window for this native activity needs to be redrawn. To\n avoid transient artifacts during screen changes (such resizing after\n rotation), applications should not return from this function until they\n have finished drawing their window in its current state."] pub onNativeWindowRedrawNeeded: ::std::option::Option< unsafe extern "C" fn(activity: *mut GameActivity, window: *mut ANativeWindow), >, - #[doc = " The drawing window for this native activity is going to be destroyed."] - #[doc = " You MUST ensure that you do not touch the window object after returning"] - #[doc = " from this function: in the common case of drawing to the window from"] - #[doc = " another thread, that means the implementation of this callback must"] - #[doc = " properly synchronize with the other thread to stop its drawing before"] - #[doc = " returning from here."] + #[doc = " The drawing window for this native activity is going to be destroyed.\n You MUST ensure that you do not touch the window object after returning\n from this function: in the common case of drawing to the window from\n another thread, that means the implementation of this callback must\n properly synchronize with the other thread to stop its drawing before\n returning from here."] pub onNativeWindowDestroyed: ::std::option::Option< unsafe extern "C" fn(activity: *mut GameActivity, window: *mut ANativeWindow), >, - #[doc = " The current device AConfiguration has changed. The new configuration can"] - #[doc = " be retrieved from assetManager."] + #[doc = " The current device AConfiguration has changed. The new configuration can\n be retrieved from assetManager."] pub onConfigurationChanged: ::std::option::Option, - #[doc = " The system is running low on memory. Use this callback to release"] - #[doc = " resources you do not need, to help the system avoid killing more"] - #[doc = " important processes."] + #[doc = " The system is running low on memory. Use this callback to release\n resources you do not need, to help the system avoid killing more\n important processes."] pub onTrimMemory: ::std::option::Option< unsafe extern "C" fn(activity: *mut GameActivity, level: ::std::os::raw::c_int), >, - #[doc = " Callback called for every MotionEvent done on the GameActivity"] - #[doc = " SurfaceView. Ownership of `event` is maintained by the library and it is"] - #[doc = " only valid during the callback."] + #[doc = " Callback called for every MotionEvent done on the GameActivity\n SurfaceView. Ownership of `event` is maintained by the library and it is\n only valid during the callback."] pub onTouchEvent: ::std::option::Option< unsafe extern "C" fn( activity: *mut GameActivity, event: *const GameActivityMotionEvent, - historical: *const GameActivityHistoricalPointerAxes, - historicalLen: ::std::os::raw::c_int, ) -> bool, >, - #[doc = " Callback called for every key down event on the GameActivity SurfaceView."] - #[doc = " Ownership of `event` is maintained by the library and it is only valid"] - #[doc = " during the callback."] + #[doc = " Callback called for every key down event on the GameActivity SurfaceView.\n Ownership of `event` is maintained by the library and it is only valid\n during the callback."] pub onKeyDown: ::std::option::Option< unsafe extern "C" fn( activity: *mut GameActivity, event: *const GameActivityKeyEvent, ) -> bool, >, - #[doc = " Callback called for every key up event on the GameActivity SurfaceView."] - #[doc = " Ownership of `event` is maintained by the library and it is only valid"] - #[doc = " during the callback."] + #[doc = " Callback called for every key up event on the GameActivity SurfaceView.\n Ownership of `event` is maintained by the library and it is only valid\n during the callback."] pub onKeyUp: ::std::option::Option< unsafe extern "C" fn( activity: *mut GameActivity, event: *const GameActivityKeyEvent, ) -> bool, >, - #[doc = " Callback called for every soft-keyboard text input event."] - #[doc = " Ownership of `state` is maintained by the library and it is only valid"] - #[doc = " during the callback."] + #[doc = " Callback called for every soft-keyboard text input event.\n Ownership of `state` is maintained by the library and it is only valid\n during the callback."] pub onTextInputEvent: ::std::option::Option< unsafe extern "C" fn(activity: *mut GameActivity, state: *const GameTextInputState), >, - #[doc = " Callback called when WindowInsets of the main app window have changed."] - #[doc = " Call GameActivity_getWindowInsets to retrieve the insets themselves."] + #[doc = " Callback called when WindowInsets of the main app window have changed.\n Call GameActivity_getWindowInsets to retrieve the insets themselves."] pub onWindowInsetsChanged: ::std::option::Option, + #[doc = " Callback called when the rectangle in the window where the content\n should be placed has changed."] + pub onContentRectChanged: ::std::option::Option< + unsafe extern "C" fn(activity: *mut GameActivity, rect: *const ARect), + >, + #[doc = " Callback called when the software keyboard is shown or hidden."] + pub onSoftwareKeyboardVisibilityChanged: + ::std::option::Option, + #[doc = " Callback called when the software keyboard is shown or hidden."] + pub onEditorAction: ::std::option::Option< + unsafe extern "C" fn(activity: *mut GameActivity, action: ::std::os::raw::c_int) -> bool, + >, } #[test] fn bindgen_test_layout_GameActivityCallbacks() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), - 72usize, - concat!("Size of: ", stringify!(GameActivityCallbacks)) + 84usize, + "Size of GameActivityCallbacks" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(GameActivityCallbacks)) + "Alignment of GameActivityCallbacks" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).onStart as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).onStart) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onStart) - ) + "Offset of field: GameActivityCallbacks::onStart" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).onResume as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).onResume) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onResume) - ) + "Offset of field: GameActivityCallbacks::onResume" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onSaveInstanceState as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onSaveInstanceState) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onSaveInstanceState) - ) + "Offset of field: GameActivityCallbacks::onSaveInstanceState" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).onPause as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).onPause) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onPause) - ) + "Offset of field: GameActivityCallbacks::onPause" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).onStop as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).onStop) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onStop) - ) + "Offset of field: GameActivityCallbacks::onStop" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).onDestroy as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).onDestroy) as usize - ptr as usize }, 20usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onDestroy) - ) + "Offset of field: GameActivityCallbacks::onDestroy" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onWindowFocusChanged as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onWindowFocusChanged) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onWindowFocusChanged) - ) + "Offset of field: GameActivityCallbacks::onWindowFocusChanged" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onNativeWindowCreated as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onNativeWindowCreated) as usize - ptr as usize }, 28usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onNativeWindowCreated) - ) + "Offset of field: GameActivityCallbacks::onNativeWindowCreated" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onNativeWindowResized as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onNativeWindowResized) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onNativeWindowResized) - ) + "Offset of field: GameActivityCallbacks::onNativeWindowResized" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onNativeWindowRedrawNeeded as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onNativeWindowRedrawNeeded) as usize - ptr as usize }, 36usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onNativeWindowRedrawNeeded) - ) + "Offset of field: GameActivityCallbacks::onNativeWindowRedrawNeeded" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onNativeWindowDestroyed as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onNativeWindowDestroyed) as usize - ptr as usize }, 40usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onNativeWindowDestroyed) - ) + "Offset of field: GameActivityCallbacks::onNativeWindowDestroyed" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onConfigurationChanged as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onConfigurationChanged) as usize - ptr as usize }, 44usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onConfigurationChanged) - ) + "Offset of field: GameActivityCallbacks::onConfigurationChanged" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onTrimMemory as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onTrimMemory) as usize - ptr as usize }, 48usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onTrimMemory) - ) + "Offset of field: GameActivityCallbacks::onTrimMemory" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onTouchEvent as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onTouchEvent) as usize - ptr as usize }, 52usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onTouchEvent) - ) + "Offset of field: GameActivityCallbacks::onTouchEvent" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).onKeyDown as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).onKeyDown) as usize - ptr as usize }, 56usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onKeyDown) - ) + "Offset of field: GameActivityCallbacks::onKeyDown" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).onKeyUp as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).onKeyUp) as usize - ptr as usize }, 60usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onKeyUp) - ) + "Offset of field: GameActivityCallbacks::onKeyUp" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onTextInputEvent as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onTextInputEvent) as usize - ptr as usize }, 64usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onTextInputEvent) - ) + "Offset of field: GameActivityCallbacks::onTextInputEvent" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).onWindowInsetsChanged) as usize - ptr as usize }, + 68usize, + "Offset of field: GameActivityCallbacks::onWindowInsetsChanged" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).onContentRectChanged) as usize - ptr as usize }, + 72usize, + "Offset of field: GameActivityCallbacks::onContentRectChanged" ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).onWindowInsetsChanged as *const _ - as usize + ::std::ptr::addr_of!((*ptr).onSoftwareKeyboardVisibilityChanged) as usize - ptr as usize }, - 68usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onWindowInsetsChanged) - ) - ); -} -extern "C" { - #[doc = " \\brief Convert a Java `MotionEvent` to a `GameActivityMotionEvent`."] - #[doc = ""] - #[doc = " This is done automatically by the GameActivity: see `onTouchEvent` to set"] - #[doc = " a callback to consume the received events."] - #[doc = " This function can be used if you re-implement events handling in your own"] - #[doc = " activity. On return, the out_event->historicalStart will be zero, and should"] - #[doc = " be updated to index into whatever buffer out_historical is copied."] - #[doc = " On return the length of out_historical is"] - #[doc = " (out_event->pointerCount x out_event->historicalCount) and is in a"] - #[doc = " pointer-major order (i.e. all axis for a pointer are contiguous)"] - #[doc = " Ownership of out_event is maintained by the caller."] - pub fn GameActivityMotionEvent_fromJava( - env: *mut JNIEnv, - motionEvent: jobject, - out_event: *mut GameActivityMotionEvent, - out_historical: *mut GameActivityHistoricalPointerAxes, - ) -> ::std::os::raw::c_int; + 76usize, + "Offset of field: GameActivityCallbacks::onSoftwareKeyboardVisibilityChanged" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).onEditorAction) as usize - ptr as usize }, + 80usize, + "Offset of field: GameActivityCallbacks::onEditorAction" + ); } -extern "C" { - #[doc = " \\brief Convert a Java `KeyEvent` to a `GameActivityKeyEvent`."] - #[doc = ""] - #[doc = " This is done automatically by the GameActivity: see `onKeyUp` and `onKeyDown`"] - #[doc = " to set a callback to consume the received events."] - #[doc = " This function can be used if you re-implement events handling in your own"] - #[doc = " activity."] - #[doc = " Ownership of out_event is maintained by the caller."] - pub fn GameActivityKeyEvent_fromJava( - env: *mut JNIEnv, - motionEvent: jobject, - out_event: *mut GameActivityKeyEvent, - ); -} -#[doc = " This is the function that must be in the native code to instantiate the"] -#[doc = " application's native activity. It is called with the activity instance (see"] -#[doc = " above); if the code is being instantiated from a previously saved instance,"] -#[doc = " the savedState will be non-NULL and point to the saved data. You must make"] -#[doc = " any copy of this data you need -- it will be released after you return from"] -#[doc = " this function."] +#[doc = " This is the function that must be in the native code to instantiate the\n application's native activity. It is called with the activity instance (see\n above); if the code is being instantiated from a previously saved instance,\n the savedState will be non-NULL and point to the saved data. You must make\n any copy of this data you need -- it will be released after you return from\n this function."] pub type GameActivity_createFunc = ::std::option::Option< unsafe extern "C" fn( activity: *mut GameActivity, savedState: *mut ::std::os::raw::c_void, - savedStateSize: size_t, + savedStateSize: usize, ), >; extern "C" { - #[doc = " Finish the given activity. Its finish() method will be called, causing it"] - #[doc = " to be stopped and destroyed. Note that this method can be called from"] - #[doc = " *any* thread; it will send a message to the main thread of the process"] - #[doc = " where the Java finish call will take place."] + #[doc = " Finish the given activity. Its finish() method will be called, causing it\n to be stopped and destroyed. Note that this method can be called from\n *any* thread; it will send a message to the main thread of the process\n where the Java finish call will take place."] pub fn GameActivity_finish(activity: *mut GameActivity); } -#[doc = " As long as this window is visible to the user, allow the lock"] -#[doc = " screen to activate while the screen is on. This can be used"] -#[doc = " independently, or in combination with {@link"] -#[doc = " GAMEACTIVITY_FLAG_KEEP_SCREEN_ON} and/or {@link"] -#[doc = " GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED}"] +#[doc = " As long as this window is visible to the user, allow the lock\n screen to activate while the screen is on. This can be used\n independently, or in combination with {@link\n GAMEACTIVITY_FLAG_KEEP_SCREEN_ON} and/or {@link\n GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED}"] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_ALLOW_LOCK_WHILE_SCREEN_ON: GameActivitySetWindowFlags = 1; #[doc = " Everything behind this window will be dimmed."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_DIM_BEHIND: GameActivitySetWindowFlags = 2; -#[doc = " Blur everything behind this window."] -#[doc = " @deprecated Blurring is no longer supported."] +#[doc = " Blur everything behind this window.\n @deprecated Blurring is no longer supported."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_BLUR_BEHIND: GameActivitySetWindowFlags = 4; -#[doc = " This window won't ever get key input focus, so the"] -#[doc = " user can not send key or other button events to it. Those will"] -#[doc = " instead go to whatever focusable window is behind it. This flag"] -#[doc = " will also enable {@link GAMEACTIVITY_FLAG_NOT_TOUCH_MODAL} whether or not"] -#[doc = " that is explicitly set."] -#[doc = ""] -#[doc = " Setting this flag also implies that the window will not need to"] -#[doc = " interact with"] -#[doc = " a soft input method, so it will be Z-ordered and positioned"] -#[doc = " independently of any active input method (typically this means it"] -#[doc = " gets Z-ordered on top of the input method, so it can use the full"] -#[doc = " screen for its content and cover the input method if needed. You"] -#[doc = " can use {@link GAMEACTIVITY_FLAG_ALT_FOCUSABLE_IM} to modify this"] -#[doc = " behavior."] +#[doc = " This window won't ever get key input focus, so the\n user can not send key or other button events to it. Those will\n instead go to whatever focusable window is behind it. This flag\n will also enable {@link GAMEACTIVITY_FLAG_NOT_TOUCH_MODAL} whether or not\n that is explicitly set.\n\n Setting this flag also implies that the window will not need to\n interact with\n a soft input method, so it will be Z-ordered and positioned\n independently of any active input method (typically this means it\n gets Z-ordered on top of the input method, so it can use the full\n screen for its content and cover the input method if needed. You\n can use {@link GAMEACTIVITY_FLAG_ALT_FOCUSABLE_IM} to modify this\n behavior."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_NOT_FOCUSABLE: GameActivitySetWindowFlags = 8; #[doc = " This window can never receive touch events."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_NOT_TOUCHABLE: GameActivitySetWindowFlags = 16; -#[doc = " Even when this window is focusable (its"] -#[doc = " {@link GAMEACTIVITY_FLAG_NOT_FOCUSABLE} is not set), allow any pointer"] -#[doc = " events outside of the window to be sent to the windows behind it."] -#[doc = " Otherwise it will consume all pointer events itself, regardless of"] -#[doc = " whether they are inside of the window."] +#[doc = " Even when this window is focusable (its\n {@link GAMEACTIVITY_FLAG_NOT_FOCUSABLE} is not set), allow any pointer\n events outside of the window to be sent to the windows behind it.\n Otherwise it will consume all pointer events itself, regardless of\n whether they are inside of the window."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_NOT_TOUCH_MODAL: GameActivitySetWindowFlags = 32; -#[doc = " When set, if the device is asleep when the touch"] -#[doc = " screen is pressed, you will receive this first touch event. Usually"] -#[doc = " the first touch event is consumed by the system since the user can"] -#[doc = " not see what they are pressing on."] -#[doc = ""] -#[doc = " @deprecated This flag has no effect."] +#[doc = " When set, if the device is asleep when the touch\n screen is pressed, you will receive this first touch event. Usually\n the first touch event is consumed by the system since the user can\n not see what they are pressing on.\n\n @deprecated This flag has no effect."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_TOUCHABLE_WHEN_WAKING: GameActivitySetWindowFlags = 64; -#[doc = " As long as this window is visible to the user, keep"] -#[doc = " the device's screen turned on and bright."] +#[doc = " As long as this window is visible to the user, keep\n the device's screen turned on and bright."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_KEEP_SCREEN_ON: GameActivitySetWindowFlags = 128; -#[doc = " Place the window within the entire screen, ignoring"] -#[doc = " decorations around the border (such as the status bar). The"] -#[doc = " window must correctly position its contents to take the screen"] -#[doc = " decoration into account."] +#[doc = " Place the window within the entire screen, ignoring\n decorations around the border (such as the status bar). The\n window must correctly position its contents to take the screen\n decoration into account."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_LAYOUT_IN_SCREEN: GameActivitySetWindowFlags = 256; #[doc = " Allows the window to extend outside of the screen."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_LAYOUT_NO_LIMITS: GameActivitySetWindowFlags = 512; -#[doc = " Hide all screen decorations (such as the status"] -#[doc = " bar) while this window is displayed. This allows the window to"] -#[doc = " use the entire display space for itself -- the status bar will"] -#[doc = " be hidden when an app window with this flag set is on the top"] -#[doc = " layer. A fullscreen window will ignore a value of {@link"] -#[doc = " GAMEACTIVITY_SOFT_INPUT_ADJUST_RESIZE}; the window will stay"] -#[doc = " fullscreen and will not resize."] +#[doc = " Hide all screen decorations (such as the status\n bar) while this window is displayed. This allows the window to\n use the entire display space for itself -- the status bar will\n be hidden when an app window with this flag set is on the top\n layer. A fullscreen window will ignore a value of {@link\n GAMEACTIVITY_SOFT_INPUT_ADJUST_RESIZE}; the window will stay\n fullscreen and will not resize."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_FULLSCREEN: GameActivitySetWindowFlags = 1024; -#[doc = " Override {@link GAMEACTIVITY_FLAG_FULLSCREEN} and force the"] -#[doc = " screen decorations (such as the status bar) to be shown."] +#[doc = " Override {@link GAMEACTIVITY_FLAG_FULLSCREEN} and force the\n screen decorations (such as the status bar) to be shown."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_FORCE_NOT_FULLSCREEN: GameActivitySetWindowFlags = 2048; -#[doc = " Turn on dithering when compositing this window to"] -#[doc = " the screen."] -#[doc = " @deprecated This flag is no longer used."] +#[doc = " Turn on dithering when compositing this window to\n the screen.\n @deprecated This flag is no longer used."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_DITHER: GameActivitySetWindowFlags = 4096; -#[doc = " Treat the content of the window as secure, preventing"] -#[doc = " it from appearing in screenshots or from being viewed on non-secure"] -#[doc = " displays."] +#[doc = " Treat the content of the window as secure, preventing\n it from appearing in screenshots or from being viewed on non-secure\n displays."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_SECURE: GameActivitySetWindowFlags = 8192; -#[doc = " A special mode where the layout parameters are used"] -#[doc = " to perform scaling of the surface when it is composited to the"] -#[doc = " screen."] +#[doc = " A special mode where the layout parameters are used\n to perform scaling of the surface when it is composited to the\n screen."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_SCALED: GameActivitySetWindowFlags = 16384; -#[doc = " Intended for windows that will often be used when the user is"] -#[doc = " holding the screen against their face, it will aggressively"] -#[doc = " filter the event stream to prevent unintended presses in this"] -#[doc = " situation that may not be desired for a particular window, when"] -#[doc = " such an event stream is detected, the application will receive"] -#[doc = " a {@link AMOTION_EVENT_ACTION_CANCEL} to indicate this so"] -#[doc = " applications can handle this accordingly by taking no action on"] -#[doc = " the event until the finger is released."] +#[doc = " Intended for windows that will often be used when the user is\n holding the screen against their face, it will aggressively\n filter the event stream to prevent unintended presses in this\n situation that may not be desired for a particular window, when\n such an event stream is detected, the application will receive\n a {@link AMOTION_EVENT_ACTION_CANCEL} to indicate this so\n applications can handle this accordingly by taking no action on\n the event until the finger is released."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_IGNORE_CHEEK_PRESSES: GameActivitySetWindowFlags = 32768; -#[doc = " A special option only for use in combination with"] -#[doc = " {@link GAMEACTIVITY_FLAG_LAYOUT_IN_SCREEN}. When requesting layout in"] -#[doc = " the screen your window may appear on top of or behind screen decorations"] -#[doc = " such as the status bar. By also including this flag, the window"] -#[doc = " manager will report the inset rectangle needed to ensure your"] -#[doc = " content is not covered by screen decorations."] +#[doc = " A special option only for use in combination with\n {@link GAMEACTIVITY_FLAG_LAYOUT_IN_SCREEN}. When requesting layout in\n the screen your window may appear on top of or behind screen decorations\n such as the status bar. By also including this flag, the window\n manager will report the inset rectangle needed to ensure your\n content is not covered by screen decorations."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_LAYOUT_INSET_DECOR: GameActivitySetWindowFlags = 65536; -#[doc = " Invert the state of {@link GAMEACTIVITY_FLAG_NOT_FOCUSABLE} with"] -#[doc = " respect to how this window interacts with the current method."] -#[doc = " That is, if FLAG_NOT_FOCUSABLE is set and this flag is set,"] -#[doc = " then the window will behave as if it needs to interact with the"] -#[doc = " input method and thus be placed behind/away from it; if {@link"] -#[doc = " GAMEACTIVITY_FLAG_NOT_FOCUSABLE} is not set and this flag is set,"] -#[doc = " then the window will behave as if it doesn't need to interact"] -#[doc = " with the input method and can be placed to use more space and"] -#[doc = " cover the input method."] +#[doc = " Invert the state of {@link GAMEACTIVITY_FLAG_NOT_FOCUSABLE} with\n respect to how this window interacts with the current method.\n That is, if FLAG_NOT_FOCUSABLE is set and this flag is set,\n then the window will behave as if it needs to interact with the\n input method and thus be placed behind/away from it; if {@link\n GAMEACTIVITY_FLAG_NOT_FOCUSABLE} is not set and this flag is set,\n then the window will behave as if it doesn't need to interact\n with the input method and can be placed to use more space and\n cover the input method."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_ALT_FOCUSABLE_IM: GameActivitySetWindowFlags = 131072; -#[doc = " If you have set {@link GAMEACTIVITY_FLAG_NOT_TOUCH_MODAL}, you"] -#[doc = " can set this flag to receive a single special MotionEvent with"] -#[doc = " the action"] -#[doc = " {@link AMOTION_EVENT_ACTION_OUTSIDE} for"] -#[doc = " touches that occur outside of your window. Note that you will not"] -#[doc = " receive the full down/move/up gesture, only the location of the"] -#[doc = " first down as an {@link AMOTION_EVENT_ACTION_OUTSIDE}."] +#[doc = " If you have set {@link GAMEACTIVITY_FLAG_NOT_TOUCH_MODAL}, you\n can set this flag to receive a single special MotionEvent with\n the action\n {@link AMOTION_EVENT_ACTION_OUTSIDE} for\n touches that occur outside of your window. Note that you will not\n receive the full down/move/up gesture, only the location of the\n first down as an {@link AMOTION_EVENT_ACTION_OUTSIDE}."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_WATCH_OUTSIDE_TOUCH: GameActivitySetWindowFlags = 262144; -#[doc = " Special flag to let windows be shown when the screen"] -#[doc = " is locked. This will let application windows take precedence over"] -#[doc = " key guard or any other lock screens. Can be used with"] -#[doc = " {@link GAMEACTIVITY_FLAG_KEEP_SCREEN_ON} to turn screen on and display"] -#[doc = " windows directly before showing the key guard window. Can be used with"] -#[doc = " {@link GAMEACTIVITY_FLAG_DISMISS_KEYGUARD} to automatically fully"] -#[doc = " dismisss non-secure keyguards. This flag only applies to the top-most"] -#[doc = " full-screen window."] +#[doc = " Special flag to let windows be shown when the screen\n is locked. This will let application windows take precedence over\n key guard or any other lock screens. Can be used with\n {@link GAMEACTIVITY_FLAG_KEEP_SCREEN_ON} to turn screen on and display\n windows directly before showing the key guard window. Can be used with\n {@link GAMEACTIVITY_FLAG_DISMISS_KEYGUARD} to automatically fully\n dismisss non-secure keyguards. This flag only applies to the top-most\n full-screen window."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED: GameActivitySetWindowFlags = 524288; -#[doc = " Ask that the system wallpaper be shown behind"] -#[doc = " your window. The window surface must be translucent to be able"] -#[doc = " to actually see the wallpaper behind it; this flag just ensures"] -#[doc = " that the wallpaper surface will be there if this window actually"] -#[doc = " has translucent regions."] +#[doc = " Ask that the system wallpaper be shown behind\n your window. The window surface must be translucent to be able\n to actually see the wallpaper behind it; this flag just ensures\n that the wallpaper surface will be there if this window actually\n has translucent regions."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_SHOW_WALLPAPER: GameActivitySetWindowFlags = 1048576; -#[doc = " When set as a window is being added or made"] -#[doc = " visible, once the window has been shown then the system will"] -#[doc = " poke the power manager's user activity (as if the user had woken"] -#[doc = " up the device) to turn the screen on."] +#[doc = " When set as a window is being added or made\n visible, once the window has been shown then the system will\n poke the power manager's user activity (as if the user had woken\n up the device) to turn the screen on."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_TURN_SCREEN_ON: GameActivitySetWindowFlags = 2097152; -#[doc = " When set the window will cause the keyguard to"] -#[doc = " be dismissed, only if it is not a secure lock keyguard. Because such"] -#[doc = " a keyguard is not needed for security, it will never re-appear if"] -#[doc = " the user navigates to another window (in contrast to"] -#[doc = " {@link GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED}, which will only temporarily"] -#[doc = " hide both secure and non-secure keyguards but ensure they reappear"] -#[doc = " when the user moves to another UI that doesn't hide them)."] -#[doc = " If the keyguard is currently active and is secure (requires an"] -#[doc = " unlock pattern) than the user will still need to confirm it before"] -#[doc = " seeing this window, unless {@link GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED} has"] -#[doc = " also been set."] +#[doc = " When set the window will cause the keyguard to\n be dismissed, only if it is not a secure lock keyguard. Because such\n a keyguard is not needed for security, it will never re-appear if\n the user navigates to another window (in contrast to\n {@link GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED}, which will only temporarily\n hide both secure and non-secure keyguards but ensure they reappear\n when the user moves to another UI that doesn't hide them).\n If the keyguard is currently active and is secure (requires an\n unlock pattern) than the user will still need to confirm it before\n seeing this window, unless {@link GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED} has\n also been set."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_DISMISS_KEYGUARD: GameActivitySetWindowFlags = 4194304; -#[doc = " Flags for GameActivity_setWindowFlags,"] -#[doc = " as per the Java API at android.view.WindowManager.LayoutParams."] -pub type GameActivitySetWindowFlags = ::std::os::raw::c_uint; -extern "C" { - #[doc = " Change the window flags of the given activity. Calls getWindow().setFlags()"] - #[doc = " of the given activity."] - #[doc = " Note that some flags must be set before the window decoration is created,"] - #[doc = " see"] - #[doc = " https://developer.android.com/reference/android/view/Window#setFlags(int,%20int)."] - #[doc = " Note also that this method can be called from"] - #[doc = " *any* thread; it will send a message to the main thread of the process"] - #[doc = " where the Java finish call will take place."] +#[doc = " Flags for GameActivity_setWindowFlags,\n as per the Java API at android.view.WindowManager.LayoutParams."] +pub type GameActivitySetWindowFlags = u32; +extern "C" { + #[doc = " Change the window flags of the given activity. Calls getWindow().setFlags()\n of the given activity.\n Note that some flags must be set before the window decoration is created,\n see\n https://developer.android.com/reference/android/view/Window#setFlags(int,%20int).\n Note also that this method can be called from\n *any* thread; it will send a message to the main thread of the process\n where the Java finish call will take place."] pub fn GameActivity_setWindowFlags( activity: *mut GameActivity, addFlags: u32, removeFlags: u32, ); } -#[doc = " Implicit request to show the input window, not as the result"] -#[doc = " of a direct request by the user."] +#[doc = " Implicit request to show the input window, not as the result\n of a direct request by the user."] pub const GameActivityShowSoftInputFlags_GAMEACTIVITY_SHOW_SOFT_INPUT_IMPLICIT: GameActivityShowSoftInputFlags = 1; -#[doc = " The user has forced the input method open (such as by"] -#[doc = " long-pressing menu) so it should not be closed until they"] -#[doc = " explicitly do so."] +#[doc = " The user has forced the input method open (such as by\n long-pressing menu) so it should not be closed until they\n explicitly do so."] pub const GameActivityShowSoftInputFlags_GAMEACTIVITY_SHOW_SOFT_INPUT_FORCED: GameActivityShowSoftInputFlags = 2; -#[doc = " Flags for GameActivity_showSoftInput; see the Java InputMethodManager"] -#[doc = " API for documentation."] -pub type GameActivityShowSoftInputFlags = ::std::os::raw::c_uint; -extern "C" { - #[doc = " Show the IME while in the given activity. Calls"] - #[doc = " InputMethodManager.showSoftInput() for the given activity. Note that this"] - #[doc = " method can be called from *any* thread; it will send a message to the main"] - #[doc = " thread of the process where the Java call will take place."] +#[doc = " Flags for GameActivity_showSoftInput; see the Java InputMethodManager\n API for documentation."] +pub type GameActivityShowSoftInputFlags = u8; +extern "C" { + #[doc = " Show the IME while in the given activity. Calls\n InputMethodManager.showSoftInput() for the given activity. Note that this\n method can be called from *any* thread; it will send a message to the main\n thread of the process where the Java call will take place."] pub fn GameActivity_showSoftInput(activity: *mut GameActivity, flags: u32); } extern "C" { - #[doc = " Set the text entry state (see documentation of the GameTextInputState struct"] - #[doc = " in the Game Text Input library reference)."] - #[doc = ""] - #[doc = " Ownership of the state is maintained by the caller."] + #[doc = " Restarts the input method. Calls InputMethodManager.restartInput().\n Note that this method can be called from *any* thread; it will send a message\n to the main thread of the process where the Java call will take place."] + pub fn GameActivity_restartInput(activity: *mut GameActivity); +} +extern "C" { + #[doc = " Set the text entry state (see documentation of the GameTextInputState struct\n in the Game Text Input library reference).\n\n Ownership of the state is maintained by the caller."] pub fn GameActivity_setTextInputState( activity: *mut GameActivity, state: *const GameTextInputState, ); } extern "C" { - #[doc = " Get the last-received text entry state (see documentation of the"] - #[doc = " GameTextInputState struct in the Game Text Input library reference)."] - #[doc = ""] + #[doc = " Get the last-received text entry state (see documentation of the\n GameTextInputState struct in the Game Text Input library reference).\n"] pub fn GameActivity_getTextInputState( activity: *mut GameActivity, callback: GameTextInputGetStateCallback, @@ -3825,29 +3277,20 @@ extern "C" { #[doc = " Get a pointer to the GameTextInput library instance."] pub fn GameActivity_getTextInput(activity: *const GameActivity) -> *mut GameTextInput; } -#[doc = " The soft input window should only be hidden if it was not"] -#[doc = " explicitly shown by the user."] +#[doc = " The soft input window should only be hidden if it was not\n explicitly shown by the user."] pub const GameActivityHideSoftInputFlags_GAMEACTIVITY_HIDE_SOFT_INPUT_IMPLICIT_ONLY: GameActivityHideSoftInputFlags = 1; -#[doc = " The soft input window should normally be hidden, unless it was"] -#[doc = " originally shown with {@link GAMEACTIVITY_SHOW_SOFT_INPUT_FORCED}."] +#[doc = " The soft input window should normally be hidden, unless it was\n originally shown with {@link GAMEACTIVITY_SHOW_SOFT_INPUT_FORCED}."] pub const GameActivityHideSoftInputFlags_GAMEACTIVITY_HIDE_SOFT_INPUT_NOT_ALWAYS: GameActivityHideSoftInputFlags = 2; -#[doc = " Flags for GameActivity_hideSoftInput; see the Java InputMethodManager"] -#[doc = " API for documentation."] -pub type GameActivityHideSoftInputFlags = ::std::os::raw::c_uint; -extern "C" { - #[doc = " Hide the IME while in the given activity. Calls"] - #[doc = " InputMethodManager.hideSoftInput() for the given activity. Note that this"] - #[doc = " method can be called from *any* thread; it will send a message to the main"] - #[doc = " thread of the process where the Java finish call will take place."] +#[doc = " Flags for GameActivity_hideSoftInput; see the Java InputMethodManager\n API for documentation."] +pub type GameActivityHideSoftInputFlags = u16; +extern "C" { + #[doc = " Hide the IME while in the given activity. Calls\n InputMethodManager.hideSoftInput() for the given activity. Note that this\n method can be called from *any* thread; it will send a message to the main\n thread of the process where the Java finish call will take place."] pub fn GameActivity_hideSoftInput(activity: *mut GameActivity, flags: u32); } extern "C" { - #[doc = " Get the current window insets of the particular component. See"] - #[doc = " https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat.Type"] - #[doc = " for more details."] - #[doc = " You can use these insets to influence what you show on the screen."] + #[doc = " Get the current window insets of the particular component. See\n https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat.Type\n for more details.\n You can use these insets to influence what you show on the screen."] pub fn GameActivity_getWindowInsets( activity: *mut GameActivity, type_: GameCommonInsetsType, @@ -3855,107 +3298,200 @@ extern "C" { ); } extern "C" { - #[doc = " Set options on how the IME behaves when it is requested for text input."] - #[doc = " See"] - #[doc = " https://developer.android.com/reference/android/view/inputmethod/EditorInfo"] - #[doc = " for the meaning of inputType, actionId and imeOptions."] - #[doc = ""] - #[doc = " Note that this function will attach the current thread to the JVM if it is"] - #[doc = " not already attached, so the caller must detach the thread from the JVM"] - #[doc = " before the thread is destroyed using DetachCurrentThread."] + #[doc = " Tells whether the software keyboard is visible or not."] + pub fn GameActivity_isSoftwareKeyboardVisible(activity: *mut GameActivity) -> bool; +} +extern "C" { + #[doc = " Set options on how the IME behaves when it is requested for text input.\n See\n https://developer.android.com/reference/android/view/inputmethod/EditorInfo\n for the meaning of inputType, actionId and imeOptions.\n\n Note: currently only TYPE_NULL AND TYPE_CLASS_NUMBER are supported."] pub fn GameActivity_setImeEditorInfo( activity: *mut GameActivity, - inputType: ::std::os::raw::c_int, - actionId: ::std::os::raw::c_int, - imeOptions: ::std::os::raw::c_int, - ); -} -pub const ACONFIGURATION_ORIENTATION_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_ORIENTATION_PORT: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_ORIENTATION_LAND: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_ORIENTATION_SQUARE: ::std::os::raw::c_uint = 3; -pub const ACONFIGURATION_TOUCHSCREEN_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_TOUCHSCREEN_NOTOUCH: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_TOUCHSCREEN_STYLUS: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_TOUCHSCREEN_FINGER: ::std::os::raw::c_uint = 3; -pub const ACONFIGURATION_DENSITY_DEFAULT: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_DENSITY_LOW: ::std::os::raw::c_uint = 120; -pub const ACONFIGURATION_DENSITY_MEDIUM: ::std::os::raw::c_uint = 160; -pub const ACONFIGURATION_DENSITY_TV: ::std::os::raw::c_uint = 213; -pub const ACONFIGURATION_DENSITY_HIGH: ::std::os::raw::c_uint = 240; -pub const ACONFIGURATION_DENSITY_XHIGH: ::std::os::raw::c_uint = 320; -pub const ACONFIGURATION_DENSITY_XXHIGH: ::std::os::raw::c_uint = 480; -pub const ACONFIGURATION_DENSITY_XXXHIGH: ::std::os::raw::c_uint = 640; -pub const ACONFIGURATION_DENSITY_ANY: ::std::os::raw::c_uint = 65534; -pub const ACONFIGURATION_DENSITY_NONE: ::std::os::raw::c_uint = 65535; -pub const ACONFIGURATION_KEYBOARD_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_KEYBOARD_NOKEYS: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_KEYBOARD_QWERTY: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_KEYBOARD_12KEY: ::std::os::raw::c_uint = 3; -pub const ACONFIGURATION_NAVIGATION_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_NAVIGATION_NONAV: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_NAVIGATION_DPAD: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_NAVIGATION_TRACKBALL: ::std::os::raw::c_uint = 3; -pub const ACONFIGURATION_NAVIGATION_WHEEL: ::std::os::raw::c_uint = 4; -pub const ACONFIGURATION_KEYSHIDDEN_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_KEYSHIDDEN_NO: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_KEYSHIDDEN_YES: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_KEYSHIDDEN_SOFT: ::std::os::raw::c_uint = 3; -pub const ACONFIGURATION_NAVHIDDEN_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_NAVHIDDEN_NO: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_NAVHIDDEN_YES: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_SCREENSIZE_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_SCREENSIZE_SMALL: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_SCREENSIZE_NORMAL: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_SCREENSIZE_LARGE: ::std::os::raw::c_uint = 3; -pub const ACONFIGURATION_SCREENSIZE_XLARGE: ::std::os::raw::c_uint = 4; -pub const ACONFIGURATION_SCREENLONG_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_SCREENLONG_NO: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_SCREENLONG_YES: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_SCREENROUND_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_SCREENROUND_NO: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_SCREENROUND_YES: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_WIDE_COLOR_GAMUT_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_WIDE_COLOR_GAMUT_NO: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_WIDE_COLOR_GAMUT_YES: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_HDR_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_HDR_NO: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_HDR_YES: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_UI_MODE_TYPE_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_UI_MODE_TYPE_NORMAL: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_UI_MODE_TYPE_DESK: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_UI_MODE_TYPE_CAR: ::std::os::raw::c_uint = 3; -pub const ACONFIGURATION_UI_MODE_TYPE_TELEVISION: ::std::os::raw::c_uint = 4; -pub const ACONFIGURATION_UI_MODE_TYPE_APPLIANCE: ::std::os::raw::c_uint = 5; -pub const ACONFIGURATION_UI_MODE_TYPE_WATCH: ::std::os::raw::c_uint = 6; -pub const ACONFIGURATION_UI_MODE_TYPE_VR_HEADSET: ::std::os::raw::c_uint = 7; -pub const ACONFIGURATION_UI_MODE_NIGHT_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_UI_MODE_NIGHT_NO: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_UI_MODE_NIGHT_YES: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_SCREEN_WIDTH_DP_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_SCREEN_HEIGHT_DP_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_LAYOUTDIR_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_LAYOUTDIR_LTR: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_LAYOUTDIR_RTL: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_MCC: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_MNC: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_LOCALE: ::std::os::raw::c_uint = 4; -pub const ACONFIGURATION_TOUCHSCREEN: ::std::os::raw::c_uint = 8; -pub const ACONFIGURATION_KEYBOARD: ::std::os::raw::c_uint = 16; -pub const ACONFIGURATION_KEYBOARD_HIDDEN: ::std::os::raw::c_uint = 32; -pub const ACONFIGURATION_NAVIGATION: ::std::os::raw::c_uint = 64; -pub const ACONFIGURATION_ORIENTATION: ::std::os::raw::c_uint = 128; -pub const ACONFIGURATION_DENSITY: ::std::os::raw::c_uint = 256; -pub const ACONFIGURATION_SCREEN_SIZE: ::std::os::raw::c_uint = 512; -pub const ACONFIGURATION_VERSION: ::std::os::raw::c_uint = 1024; -pub const ACONFIGURATION_SCREEN_LAYOUT: ::std::os::raw::c_uint = 2048; -pub const ACONFIGURATION_UI_MODE: ::std::os::raw::c_uint = 4096; -pub const ACONFIGURATION_SMALLEST_SCREEN_SIZE: ::std::os::raw::c_uint = 8192; -pub const ACONFIGURATION_LAYOUTDIR: ::std::os::raw::c_uint = 16384; -pub const ACONFIGURATION_SCREEN_ROUND: ::std::os::raw::c_uint = 32768; -pub const ACONFIGURATION_COLOR_MODE: ::std::os::raw::c_uint = 65536; -pub const ACONFIGURATION_MNC_ZERO: ::std::os::raw::c_uint = 65535; + inputType: GameTextInputType, + actionId: GameTextInputActionType, + imeOptions: GameTextInputImeOptions, + ); +} +extern "C" { + #[doc = " These are getters for Configuration class members. They may be called from\n any thread."] + pub fn GameActivity_getOrientation(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getColorMode(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getDensityDpi(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getFontScale(activity: *mut GameActivity) -> f32; +} +extern "C" { + pub fn GameActivity_getFontWeightAdjustment( + activity: *mut GameActivity, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getHardKeyboardHidden(activity: *mut GameActivity) + -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getKeyboard(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getKeyboardHidden(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getLocalesCount(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getMcc(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getMnc(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getNavigation(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getNavigationHidden(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getScreenHeightDp(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getScreenLayout(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getScreenWidthDp(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getSmallestScreenWidthDp( + activity: *mut GameActivity, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getTouchscreen(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getUIMode(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " The functions below return Java locale information.\n\n In simple cases there will be just one locale, but it's possible tha\n there are more than one locale objects. Users are encouraged to write code\n that handles all locales and not just the first one.\n\n The functions in the block below return string values in the provided buffer.\n Return value is zero if there were no errors, otherwise it's non-zero.\n If the return value is zero, `dst` will contain a null-terminated string:\n strlen(dst) <= dst_size - 1.\n If the return value is non-zero, the content of dst is undefined.\n\n Parameters:\n\n dst, dst_size: define a receiver buffer. Locale string can be something\n short like \"EN/EN\", but it may be longer. You should be safe with a buffer\n size of 256 bytes.\n\n If the buffer is too small, ENOBUFS is returned. Try allocating a larger\n buffer in this case.\n\n localeIdx must be between 0 and the value of GameActivity_getLocalesCount().\n If localeIdx is out of range, EINVAL is returned.\n\n Refer to Java documentation of locales for more information."] + pub fn GameActivity_getLocaleLanguage( + dst: *mut ::std::os::raw::c_char, + dst_size: usize, + activity: *mut GameActivity, + localeIdx: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getLocaleScript( + dst: *mut ::std::os::raw::c_char, + dst_size: usize, + activity: *mut GameActivity, + localeIdx: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getLocaleCountry( + dst: *mut ::std::os::raw::c_char, + dst_size: usize, + activity: *mut GameActivity, + localeIdx: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getLocaleVariant( + dst: *mut ::std::os::raw::c_char, + dst_size: usize, + activity: *mut GameActivity, + localeIdx: usize, + ) -> ::std::os::raw::c_int; +} +pub const ACONFIGURATION_ORIENTATION_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_ORIENTATION_PORT: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_ORIENTATION_LAND: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_ORIENTATION_SQUARE: _bindgen_ty_21 = 3; +pub const ACONFIGURATION_TOUCHSCREEN_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_TOUCHSCREEN_NOTOUCH: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_TOUCHSCREEN_STYLUS: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_TOUCHSCREEN_FINGER: _bindgen_ty_21 = 3; +pub const ACONFIGURATION_DENSITY_DEFAULT: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_DENSITY_LOW: _bindgen_ty_21 = 120; +pub const ACONFIGURATION_DENSITY_MEDIUM: _bindgen_ty_21 = 160; +pub const ACONFIGURATION_DENSITY_TV: _bindgen_ty_21 = 213; +pub const ACONFIGURATION_DENSITY_HIGH: _bindgen_ty_21 = 240; +pub const ACONFIGURATION_DENSITY_XHIGH: _bindgen_ty_21 = 320; +pub const ACONFIGURATION_DENSITY_XXHIGH: _bindgen_ty_21 = 480; +pub const ACONFIGURATION_DENSITY_XXXHIGH: _bindgen_ty_21 = 640; +pub const ACONFIGURATION_DENSITY_ANY: _bindgen_ty_21 = 65534; +pub const ACONFIGURATION_DENSITY_NONE: _bindgen_ty_21 = 65535; +pub const ACONFIGURATION_KEYBOARD_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_KEYBOARD_NOKEYS: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_KEYBOARD_QWERTY: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_KEYBOARD_12KEY: _bindgen_ty_21 = 3; +pub const ACONFIGURATION_NAVIGATION_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_NAVIGATION_NONAV: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_NAVIGATION_DPAD: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_NAVIGATION_TRACKBALL: _bindgen_ty_21 = 3; +pub const ACONFIGURATION_NAVIGATION_WHEEL: _bindgen_ty_21 = 4; +pub const ACONFIGURATION_KEYSHIDDEN_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_KEYSHIDDEN_NO: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_KEYSHIDDEN_YES: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_KEYSHIDDEN_SOFT: _bindgen_ty_21 = 3; +pub const ACONFIGURATION_NAVHIDDEN_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_NAVHIDDEN_NO: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_NAVHIDDEN_YES: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_SCREENSIZE_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_SCREENSIZE_SMALL: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_SCREENSIZE_NORMAL: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_SCREENSIZE_LARGE: _bindgen_ty_21 = 3; +pub const ACONFIGURATION_SCREENSIZE_XLARGE: _bindgen_ty_21 = 4; +pub const ACONFIGURATION_SCREENLONG_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_SCREENLONG_NO: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_SCREENLONG_YES: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_SCREENROUND_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_SCREENROUND_NO: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_SCREENROUND_YES: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_WIDE_COLOR_GAMUT_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_WIDE_COLOR_GAMUT_NO: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_WIDE_COLOR_GAMUT_YES: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_HDR_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_HDR_NO: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_HDR_YES: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_UI_MODE_TYPE_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_UI_MODE_TYPE_NORMAL: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_UI_MODE_TYPE_DESK: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_UI_MODE_TYPE_CAR: _bindgen_ty_21 = 3; +pub const ACONFIGURATION_UI_MODE_TYPE_TELEVISION: _bindgen_ty_21 = 4; +pub const ACONFIGURATION_UI_MODE_TYPE_APPLIANCE: _bindgen_ty_21 = 5; +pub const ACONFIGURATION_UI_MODE_TYPE_WATCH: _bindgen_ty_21 = 6; +pub const ACONFIGURATION_UI_MODE_TYPE_VR_HEADSET: _bindgen_ty_21 = 7; +pub const ACONFIGURATION_UI_MODE_NIGHT_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_UI_MODE_NIGHT_NO: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_UI_MODE_NIGHT_YES: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_SCREEN_WIDTH_DP_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_SCREEN_HEIGHT_DP_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_LAYOUTDIR_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_LAYOUTDIR_LTR: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_LAYOUTDIR_RTL: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_MCC: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_MNC: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_LOCALE: _bindgen_ty_21 = 4; +pub const ACONFIGURATION_TOUCHSCREEN: _bindgen_ty_21 = 8; +pub const ACONFIGURATION_KEYBOARD: _bindgen_ty_21 = 16; +pub const ACONFIGURATION_KEYBOARD_HIDDEN: _bindgen_ty_21 = 32; +pub const ACONFIGURATION_NAVIGATION: _bindgen_ty_21 = 64; +pub const ACONFIGURATION_ORIENTATION: _bindgen_ty_21 = 128; +pub const ACONFIGURATION_DENSITY: _bindgen_ty_21 = 256; +pub const ACONFIGURATION_SCREEN_SIZE: _bindgen_ty_21 = 512; +pub const ACONFIGURATION_VERSION: _bindgen_ty_21 = 1024; +pub const ACONFIGURATION_SCREEN_LAYOUT: _bindgen_ty_21 = 2048; +pub const ACONFIGURATION_UI_MODE: _bindgen_ty_21 = 4096; +pub const ACONFIGURATION_SMALLEST_SCREEN_SIZE: _bindgen_ty_21 = 8192; +pub const ACONFIGURATION_LAYOUTDIR: _bindgen_ty_21 = 16384; +pub const ACONFIGURATION_SCREEN_ROUND: _bindgen_ty_21 = 32768; +pub const ACONFIGURATION_COLOR_MODE: _bindgen_ty_21 = 65536; +pub const ACONFIGURATION_MNC_ZERO: _bindgen_ty_21 = 65535; pub type _bindgen_ty_21 = ::std::os::raw::c_uint; #[repr(C)] #[derive(Debug, Copy, Clone)] @@ -3966,45 +3502,28 @@ pub struct pollfd { } #[test] fn bindgen_test_layout_pollfd() { - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(pollfd)) - ); + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!(::std::mem::size_of::(), 8usize, "Size of pollfd"); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(pollfd)) + "Alignment of pollfd" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fd as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fd) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(pollfd), - "::", - stringify!(fd) - ) + "Offset of field: pollfd::fd" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).events as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).events) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(pollfd), - "::", - stringify!(events) - ) + "Offset of field: pollfd::events" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).revents as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).revents) as usize - ptr as usize }, 6usize, - concat!( - "Offset of field: ", - stringify!(pollfd), - "::", - stringify!(revents) - ) + "Offset of field: pollfd::revents" ); } #[repr(C)] @@ -4018,65 +3537,42 @@ pub struct _fpx_sw_bytes { } #[test] fn bindgen_test_layout__fpx_sw_bytes() { + const UNINIT: ::std::mem::MaybeUninit<_fpx_sw_bytes> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<_fpx_sw_bytes>(), 48usize, - concat!("Size of: ", stringify!(_fpx_sw_bytes)) + "Size of _fpx_sw_bytes" ); assert_eq!( ::std::mem::align_of::<_fpx_sw_bytes>(), 4usize, - concat!("Alignment of ", stringify!(_fpx_sw_bytes)) + "Alignment of _fpx_sw_bytes" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpx_sw_bytes>())).magic1 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).magic1) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_fpx_sw_bytes), - "::", - stringify!(magic1) - ) + "Offset of field: _fpx_sw_bytes::magic1" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpx_sw_bytes>())).extended_size as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).extended_size) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(_fpx_sw_bytes), - "::", - stringify!(extended_size) - ) + "Offset of field: _fpx_sw_bytes::extended_size" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpx_sw_bytes>())).xfeatures as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).xfeatures) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(_fpx_sw_bytes), - "::", - stringify!(xfeatures) - ) + "Offset of field: _fpx_sw_bytes::xfeatures" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpx_sw_bytes>())).xstate_size as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).xstate_size) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(_fpx_sw_bytes), - "::", - stringify!(xstate_size) - ) + "Offset of field: _fpx_sw_bytes::xstate_size" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpx_sw_bytes>())).padding as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).padding) as usize - ptr as usize }, 20usize, - concat!( - "Offset of field: ", - stringify!(_fpx_sw_bytes), - "::", - stringify!(padding) - ) + "Offset of field: _fpx_sw_bytes::padding" ); } #[repr(C)] @@ -4087,35 +3583,23 @@ pub struct _fpreg { } #[test] fn bindgen_test_layout__fpreg() { - assert_eq!( - ::std::mem::size_of::<_fpreg>(), - 10usize, - concat!("Size of: ", stringify!(_fpreg)) - ); + const UNINIT: ::std::mem::MaybeUninit<_fpreg> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!(::std::mem::size_of::<_fpreg>(), 10usize, "Size of _fpreg"); assert_eq!( ::std::mem::align_of::<_fpreg>(), 2usize, - concat!("Alignment of ", stringify!(_fpreg)) + "Alignment of _fpreg" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpreg>())).significand as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).significand) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_fpreg), - "::", - stringify!(significand) - ) + "Offset of field: _fpreg::significand" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpreg>())).exponent as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).exponent) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(_fpreg), - "::", - stringify!(exponent) - ) + "Offset of field: _fpreg::exponent" ); } #[repr(C)] @@ -4127,45 +3611,28 @@ pub struct _fpxreg { } #[test] fn bindgen_test_layout__fpxreg() { - assert_eq!( - ::std::mem::size_of::<_fpxreg>(), - 16usize, - concat!("Size of: ", stringify!(_fpxreg)) - ); + const UNINIT: ::std::mem::MaybeUninit<_fpxreg> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!(::std::mem::size_of::<_fpxreg>(), 16usize, "Size of _fpxreg"); assert_eq!( ::std::mem::align_of::<_fpxreg>(), 2usize, - concat!("Alignment of ", stringify!(_fpxreg)) + "Alignment of _fpxreg" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpxreg>())).significand as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).significand) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_fpxreg), - "::", - stringify!(significand) - ) + "Offset of field: _fpxreg::significand" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpxreg>())).exponent as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).exponent) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(_fpxreg), - "::", - stringify!(exponent) - ) + "Offset of field: _fpxreg::exponent" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpxreg>())).padding as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).padding) as usize - ptr as usize }, 10usize, - concat!( - "Offset of field: ", - stringify!(_fpxreg), - "::", - stringify!(padding) - ) + "Offset of field: _fpxreg::padding" ); } #[repr(C)] @@ -4175,25 +3642,18 @@ pub struct _xmmreg { } #[test] fn bindgen_test_layout__xmmreg() { - assert_eq!( - ::std::mem::size_of::<_xmmreg>(), - 16usize, - concat!("Size of: ", stringify!(_xmmreg)) - ); + const UNINIT: ::std::mem::MaybeUninit<_xmmreg> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!(::std::mem::size_of::<_xmmreg>(), 16usize, "Size of _xmmreg"); assert_eq!( ::std::mem::align_of::<_xmmreg>(), 4usize, - concat!("Alignment of ", stringify!(_xmmreg)) + "Alignment of _xmmreg" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_xmmreg>())).element as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).element) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_xmmreg), - "::", - stringify!(element) - ) + "Offset of field: _xmmreg::element" ); } #[repr(C)] @@ -4225,39 +3685,28 @@ pub union _fpstate_32__bindgen_ty_1 { } #[test] fn bindgen_test_layout__fpstate_32__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit<_fpstate_32__bindgen_ty_1> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<_fpstate_32__bindgen_ty_1>(), 176usize, - concat!("Size of: ", stringify!(_fpstate_32__bindgen_ty_1)) + "Size of _fpstate_32__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::<_fpstate_32__bindgen_ty_1>(), 4usize, - concat!("Alignment of ", stringify!(_fpstate_32__bindgen_ty_1)) + "Alignment of _fpstate_32__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<_fpstate_32__bindgen_ty_1>())).padding1 as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).padding1) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32__bindgen_ty_1), - "::", - stringify!(padding1) - ) + "Offset of field: _fpstate_32__bindgen_ty_1::padding1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<_fpstate_32__bindgen_ty_1>())).padding as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).padding) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32__bindgen_ty_1), - "::", - stringify!(padding) - ) + "Offset of field: _fpstate_32__bindgen_ty_1::padding" ); } #[repr(C)] @@ -4268,202 +3717,118 @@ pub union _fpstate_32__bindgen_ty_2 { } #[test] fn bindgen_test_layout__fpstate_32__bindgen_ty_2() { + const UNINIT: ::std::mem::MaybeUninit<_fpstate_32__bindgen_ty_2> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<_fpstate_32__bindgen_ty_2>(), 48usize, - concat!("Size of: ", stringify!(_fpstate_32__bindgen_ty_2)) + "Size of _fpstate_32__bindgen_ty_2" ); assert_eq!( ::std::mem::align_of::<_fpstate_32__bindgen_ty_2>(), 4usize, - concat!("Alignment of ", stringify!(_fpstate_32__bindgen_ty_2)) + "Alignment of _fpstate_32__bindgen_ty_2" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<_fpstate_32__bindgen_ty_2>())).padding2 as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).padding2) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32__bindgen_ty_2), - "::", - stringify!(padding2) - ) + "Offset of field: _fpstate_32__bindgen_ty_2::padding2" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<_fpstate_32__bindgen_ty_2>())).sw_reserved as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).sw_reserved) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32__bindgen_ty_2), - "::", - stringify!(sw_reserved) - ) + "Offset of field: _fpstate_32__bindgen_ty_2::sw_reserved" ); } #[test] fn bindgen_test_layout__fpstate_32() { + const UNINIT: ::std::mem::MaybeUninit<_fpstate_32> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<_fpstate_32>(), 624usize, - concat!("Size of: ", stringify!(_fpstate_32)) + "Size of _fpstate_32" ); assert_eq!( ::std::mem::align_of::<_fpstate_32>(), 4usize, - concat!("Alignment of ", stringify!(_fpstate_32)) + "Alignment of _fpstate_32" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_32>())).cw as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).cw) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32), - "::", - stringify!(cw) - ) + "Offset of field: _fpstate_32::cw" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_32>())).sw as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sw) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32), - "::", - stringify!(sw) - ) + "Offset of field: _fpstate_32::sw" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_32>())).tag as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tag) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32), - "::", - stringify!(tag) - ) + "Offset of field: _fpstate_32::tag" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_32>())).ipoff as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ipoff) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32), - "::", - stringify!(ipoff) - ) + "Offset of field: _fpstate_32::ipoff" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_32>())).cssel as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).cssel) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32), - "::", - stringify!(cssel) - ) + "Offset of field: _fpstate_32::cssel" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_32>())).dataoff as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).dataoff) as usize - ptr as usize }, 20usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32), - "::", - stringify!(dataoff) - ) + "Offset of field: _fpstate_32::dataoff" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_32>())).datasel as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).datasel) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32), - "::", - stringify!(datasel) - ) + "Offset of field: _fpstate_32::datasel" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_32>()))._st as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._st) as usize - ptr as usize }, 28usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32), - "::", - stringify!(_st) - ) + "Offset of field: _fpstate_32::_st" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_32>())).status as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).status) as usize - ptr as usize }, 108usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32), - "::", - stringify!(status) - ) + "Offset of field: _fpstate_32::status" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_32>())).magic as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).magic) as usize - ptr as usize }, 110usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32), - "::", - stringify!(magic) - ) + "Offset of field: _fpstate_32::magic" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_32>()))._fxsr_env as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._fxsr_env) as usize - ptr as usize }, 112usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32), - "::", - stringify!(_fxsr_env) - ) + "Offset of field: _fpstate_32::_fxsr_env" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_32>())).mxcsr as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).mxcsr) as usize - ptr as usize }, 136usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32), - "::", - stringify!(mxcsr) - ) + "Offset of field: _fpstate_32::mxcsr" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_32>())).reserved as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).reserved) as usize - ptr as usize }, 140usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32), - "::", - stringify!(reserved) - ) + "Offset of field: _fpstate_32::reserved" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_32>()))._fxsr_st as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._fxsr_st) as usize - ptr as usize }, 144usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32), - "::", - stringify!(_fxsr_st) - ) + "Offset of field: _fpstate_32::_fxsr_st" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_32>()))._xmm as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._xmm) as usize - ptr as usize }, 272usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32), - "::", - stringify!(_xmm) - ) + "Offset of field: _fpstate_32::_xmm" ); } #[repr(C)] @@ -4490,162 +3855,98 @@ pub union _fpstate_64__bindgen_ty_1 { } #[test] fn bindgen_test_layout__fpstate_64__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit<_fpstate_64__bindgen_ty_1> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<_fpstate_64__bindgen_ty_1>(), 48usize, - concat!("Size of: ", stringify!(_fpstate_64__bindgen_ty_1)) + "Size of _fpstate_64__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::<_fpstate_64__bindgen_ty_1>(), 4usize, - concat!("Alignment of ", stringify!(_fpstate_64__bindgen_ty_1)) + "Alignment of _fpstate_64__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<_fpstate_64__bindgen_ty_1>())).reserved3 as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).reserved3) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_64__bindgen_ty_1), - "::", - stringify!(reserved3) - ) + "Offset of field: _fpstate_64__bindgen_ty_1::reserved3" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<_fpstate_64__bindgen_ty_1>())).sw_reserved as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).sw_reserved) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_64__bindgen_ty_1), - "::", - stringify!(sw_reserved) - ) + "Offset of field: _fpstate_64__bindgen_ty_1::sw_reserved" ); } #[test] fn bindgen_test_layout__fpstate_64() { + const UNINIT: ::std::mem::MaybeUninit<_fpstate_64> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<_fpstate_64>(), 512usize, - concat!("Size of: ", stringify!(_fpstate_64)) + "Size of _fpstate_64" ); assert_eq!( ::std::mem::align_of::<_fpstate_64>(), 4usize, - concat!("Alignment of ", stringify!(_fpstate_64)) + "Alignment of _fpstate_64" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_64>())).cwd as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).cwd) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_64), - "::", - stringify!(cwd) - ) + "Offset of field: _fpstate_64::cwd" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_64>())).swd as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).swd) as usize - ptr as usize }, 2usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_64), - "::", - stringify!(swd) - ) + "Offset of field: _fpstate_64::swd" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_64>())).twd as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).twd) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_64), - "::", - stringify!(twd) - ) + "Offset of field: _fpstate_64::twd" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_64>())).fop as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fop) as usize - ptr as usize }, 6usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_64), - "::", - stringify!(fop) - ) + "Offset of field: _fpstate_64::fop" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_64>())).rip as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rip) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_64), - "::", - stringify!(rip) - ) + "Offset of field: _fpstate_64::rip" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_64>())).rdp as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rdp) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_64), - "::", - stringify!(rdp) - ) + "Offset of field: _fpstate_64::rdp" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_64>())).mxcsr as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).mxcsr) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_64), - "::", - stringify!(mxcsr) - ) + "Offset of field: _fpstate_64::mxcsr" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_64>())).mxcsr_mask as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).mxcsr_mask) as usize - ptr as usize }, 28usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_64), - "::", - stringify!(mxcsr_mask) - ) + "Offset of field: _fpstate_64::mxcsr_mask" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_64>())).st_space as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).st_space) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_64), - "::", - stringify!(st_space) - ) + "Offset of field: _fpstate_64::st_space" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_64>())).xmm_space as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).xmm_space) as usize - ptr as usize }, 160usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_64), - "::", - stringify!(xmm_space) - ) + "Offset of field: _fpstate_64::xmm_space" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_64>())).reserved2 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).reserved2) as usize - ptr as usize }, 416usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_64), - "::", - stringify!(reserved2) - ) + "Offset of field: _fpstate_64::reserved2" ); } #[repr(C)] @@ -4657,45 +3958,28 @@ pub struct _header { } #[test] fn bindgen_test_layout__header() { - assert_eq!( - ::std::mem::size_of::<_header>(), - 64usize, - concat!("Size of: ", stringify!(_header)) - ); + const UNINIT: ::std::mem::MaybeUninit<_header> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!(::std::mem::size_of::<_header>(), 64usize, "Size of _header"); assert_eq!( ::std::mem::align_of::<_header>(), 4usize, - concat!("Alignment of ", stringify!(_header)) + "Alignment of _header" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_header>())).xfeatures as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).xfeatures) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_header), - "::", - stringify!(xfeatures) - ) + "Offset of field: _header::xfeatures" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_header>())).reserved1 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).reserved1) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(_header), - "::", - stringify!(reserved1) - ) + "Offset of field: _header::reserved1" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_header>())).reserved2 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).reserved2) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(_header), - "::", - stringify!(reserved2) - ) + "Offset of field: _header::reserved2" ); } #[repr(C)] @@ -4705,25 +3989,22 @@ pub struct _ymmh_state { } #[test] fn bindgen_test_layout__ymmh_state() { + const UNINIT: ::std::mem::MaybeUninit<_ymmh_state> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<_ymmh_state>(), 256usize, - concat!("Size of: ", stringify!(_ymmh_state)) + "Size of _ymmh_state" ); assert_eq!( ::std::mem::align_of::<_ymmh_state>(), 4usize, - concat!("Alignment of ", stringify!(_ymmh_state)) + "Alignment of _ymmh_state" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_ymmh_state>())).ymmh_space as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ymmh_space) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_ymmh_state), - "::", - stringify!(ymmh_space) - ) + "Offset of field: _ymmh_state::ymmh_space" ); } #[repr(C)] @@ -4735,45 +4016,32 @@ pub struct _xstate { } #[test] fn bindgen_test_layout__xstate() { + const UNINIT: ::std::mem::MaybeUninit<_xstate> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<_xstate>(), 944usize, - concat!("Size of: ", stringify!(_xstate)) + "Size of _xstate" ); assert_eq!( ::std::mem::align_of::<_xstate>(), 4usize, - concat!("Alignment of ", stringify!(_xstate)) + "Alignment of _xstate" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_xstate>())).fpstate as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fpstate) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_xstate), - "::", - stringify!(fpstate) - ) + "Offset of field: _xstate::fpstate" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_xstate>())).xstate_hdr as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).xstate_hdr) as usize - ptr as usize }, 624usize, - concat!( - "Offset of field: ", - stringify!(_xstate), - "::", - stringify!(xstate_hdr) - ) + "Offset of field: _xstate::xstate_hdr" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_xstate>())).ymmh as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ymmh) as usize - ptr as usize }, 688usize, - concat!( - "Offset of field: ", - stringify!(_xstate), - "::", - stringify!(ymmh) - ) + "Offset of field: _xstate::ymmh" ); } #[repr(C)] @@ -4810,295 +4078,157 @@ pub struct sigcontext_32 { } #[test] fn bindgen_test_layout_sigcontext_32() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 88usize, - concat!("Size of: ", stringify!(sigcontext_32)) + "Size of sigcontext_32" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(sigcontext_32)) + "Alignment of sigcontext_32" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).gs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).gs) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(gs) - ) + "Offset of field: sigcontext_32::gs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).__gsh as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).__gsh) as usize - ptr as usize }, 2usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(__gsh) - ) + "Offset of field: sigcontext_32::__gsh" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fs) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(fs) - ) + "Offset of field: sigcontext_32::fs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).__fsh as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).__fsh) as usize - ptr as usize }, 6usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(__fsh) - ) + "Offset of field: sigcontext_32::__fsh" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).es as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).es) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(es) - ) + "Offset of field: sigcontext_32::es" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).__esh as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).__esh) as usize - ptr as usize }, 10usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(__esh) - ) + "Offset of field: sigcontext_32::__esh" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ds as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ds) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(ds) - ) + "Offset of field: sigcontext_32::ds" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).__dsh as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).__dsh) as usize - ptr as usize }, 14usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(__dsh) - ) + "Offset of field: sigcontext_32::__dsh" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).di as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).di) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(di) - ) + "Offset of field: sigcontext_32::di" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).si as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).si) as usize - ptr as usize }, 20usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(si) - ) + "Offset of field: sigcontext_32::si" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).bp as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).bp) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(bp) - ) + "Offset of field: sigcontext_32::bp" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sp as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sp) as usize - ptr as usize }, 28usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(sp) - ) + "Offset of field: sigcontext_32::sp" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).bx as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).bx) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(bx) - ) + "Offset of field: sigcontext_32::bx" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).dx as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).dx) as usize - ptr as usize }, 36usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(dx) - ) + "Offset of field: sigcontext_32::dx" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).cx as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).cx) as usize - ptr as usize }, 40usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(cx) - ) + "Offset of field: sigcontext_32::cx" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ax as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ax) as usize - ptr as usize }, 44usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(ax) - ) + "Offset of field: sigcontext_32::ax" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).trapno as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).trapno) as usize - ptr as usize }, 48usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(trapno) - ) + "Offset of field: sigcontext_32::trapno" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).err as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).err) as usize - ptr as usize }, 52usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(err) - ) + "Offset of field: sigcontext_32::err" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ip as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ip) as usize - ptr as usize }, 56usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(ip) - ) + "Offset of field: sigcontext_32::ip" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).cs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).cs) as usize - ptr as usize }, 60usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(cs) - ) + "Offset of field: sigcontext_32::cs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).__csh as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).__csh) as usize - ptr as usize }, 62usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(__csh) - ) + "Offset of field: sigcontext_32::__csh" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, 64usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(flags) - ) + "Offset of field: sigcontext_32::flags" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sp_at_signal as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sp_at_signal) as usize - ptr as usize }, 68usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(sp_at_signal) - ) + "Offset of field: sigcontext_32::sp_at_signal" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ss as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ss) as usize - ptr as usize }, 72usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(ss) - ) + "Offset of field: sigcontext_32::ss" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).__ssh as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).__ssh) as usize - ptr as usize }, 74usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(__ssh) - ) + "Offset of field: sigcontext_32::__ssh" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fpstate as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fpstate) as usize - ptr as usize }, 76usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(fpstate) - ) + "Offset of field: sigcontext_32::fpstate" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).oldmask as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).oldmask) as usize - ptr as usize }, 80usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(oldmask) - ) + "Offset of field: sigcontext_32::oldmask" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).cr2 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).cr2) as usize - ptr as usize }, 84usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(cr2) - ) + "Offset of field: sigcontext_32::cr2" ); } #[repr(C)] @@ -5135,295 +4265,157 @@ pub struct sigcontext_64 { } #[test] fn bindgen_test_layout_sigcontext_64() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 256usize, - concat!("Size of: ", stringify!(sigcontext_64)) + "Size of sigcontext_64" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(sigcontext_64)) + "Alignment of sigcontext_64" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).r8 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).r8) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(r8) - ) + "Offset of field: sigcontext_64::r8" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).r9 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).r9) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(r9) - ) + "Offset of field: sigcontext_64::r9" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).r10 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).r10) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(r10) - ) + "Offset of field: sigcontext_64::r10" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).r11 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).r11) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(r11) - ) + "Offset of field: sigcontext_64::r11" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).r12 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).r12) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(r12) - ) + "Offset of field: sigcontext_64::r12" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).r13 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).r13) as usize - ptr as usize }, 40usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(r13) - ) + "Offset of field: sigcontext_64::r13" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).r14 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).r14) as usize - ptr as usize }, 48usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(r14) - ) + "Offset of field: sigcontext_64::r14" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).r15 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).r15) as usize - ptr as usize }, 56usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(r15) - ) + "Offset of field: sigcontext_64::r15" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).di as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).di) as usize - ptr as usize }, 64usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(di) - ) + "Offset of field: sigcontext_64::di" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).si as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).si) as usize - ptr as usize }, 72usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(si) - ) + "Offset of field: sigcontext_64::si" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).bp as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).bp) as usize - ptr as usize }, 80usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(bp) - ) + "Offset of field: sigcontext_64::bp" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).bx as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).bx) as usize - ptr as usize }, 88usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(bx) - ) + "Offset of field: sigcontext_64::bx" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).dx as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).dx) as usize - ptr as usize }, 96usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(dx) - ) + "Offset of field: sigcontext_64::dx" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ax as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ax) as usize - ptr as usize }, 104usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(ax) - ) + "Offset of field: sigcontext_64::ax" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).cx as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).cx) as usize - ptr as usize }, 112usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(cx) - ) + "Offset of field: sigcontext_64::cx" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sp as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sp) as usize - ptr as usize }, 120usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(sp) - ) + "Offset of field: sigcontext_64::sp" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ip as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ip) as usize - ptr as usize }, 128usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(ip) - ) + "Offset of field: sigcontext_64::ip" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, 136usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(flags) - ) + "Offset of field: sigcontext_64::flags" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).cs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).cs) as usize - ptr as usize }, 144usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(cs) - ) + "Offset of field: sigcontext_64::cs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).gs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).gs) as usize - ptr as usize }, 146usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(gs) - ) + "Offset of field: sigcontext_64::gs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fs) as usize - ptr as usize }, 148usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(fs) - ) + "Offset of field: sigcontext_64::fs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ss as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ss) as usize - ptr as usize }, 150usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(ss) - ) + "Offset of field: sigcontext_64::ss" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).err as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).err) as usize - ptr as usize }, 152usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(err) - ) + "Offset of field: sigcontext_64::err" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).trapno as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).trapno) as usize - ptr as usize }, 160usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(trapno) - ) + "Offset of field: sigcontext_64::trapno" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).oldmask as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).oldmask) as usize - ptr as usize }, 168usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(oldmask) - ) + "Offset of field: sigcontext_64::oldmask" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).cr2 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).cr2) as usize - ptr as usize }, 176usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(cr2) - ) + "Offset of field: sigcontext_64::cr2" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fpstate as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fpstate) as usize - ptr as usize }, 184usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(fpstate) - ) + "Offset of field: sigcontext_64::fpstate" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).reserved1 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).reserved1) as usize - ptr as usize }, 192usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(reserved1) - ) + "Offset of field: sigcontext_64::reserved1" ); } #[repr(C)] @@ -5460,295 +4452,188 @@ pub struct sigcontext { } #[test] fn bindgen_test_layout_sigcontext() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 88usize, - concat!("Size of: ", stringify!(sigcontext)) + "Size of sigcontext" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(sigcontext)) + "Alignment of sigcontext" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).gs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).gs) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(gs) - ) + "Offset of field: sigcontext::gs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).__gsh as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).__gsh) as usize - ptr as usize }, 2usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(__gsh) - ) + "Offset of field: sigcontext::__gsh" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fs) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(fs) - ) + "Offset of field: sigcontext::fs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).__fsh as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).__fsh) as usize - ptr as usize }, 6usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(__fsh) - ) + "Offset of field: sigcontext::__fsh" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).es as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).es) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(es) - ) + "Offset of field: sigcontext::es" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).__esh as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).__esh) as usize - ptr as usize }, 10usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(__esh) - ) + "Offset of field: sigcontext::__esh" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ds as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ds) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(ds) - ) + "Offset of field: sigcontext::ds" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).__dsh as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).__dsh) as usize - ptr as usize }, 14usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(__dsh) - ) + "Offset of field: sigcontext::__dsh" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).edi as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).edi) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(edi) - ) + "Offset of field: sigcontext::edi" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).esi as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).esi) as usize - ptr as usize }, 20usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(esi) - ) + "Offset of field: sigcontext::esi" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ebp as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ebp) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(ebp) - ) + "Offset of field: sigcontext::ebp" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).esp as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).esp) as usize - ptr as usize }, 28usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(esp) - ) + "Offset of field: sigcontext::esp" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ebx as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ebx) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(ebx) - ) + "Offset of field: sigcontext::ebx" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).edx as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).edx) as usize - ptr as usize }, 36usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(edx) - ) + "Offset of field: sigcontext::edx" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ecx as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ecx) as usize - ptr as usize }, 40usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(ecx) - ) + "Offset of field: sigcontext::ecx" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).eax as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).eax) as usize - ptr as usize }, 44usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(eax) - ) + "Offset of field: sigcontext::eax" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).trapno as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).trapno) as usize - ptr as usize }, 48usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(trapno) - ) + "Offset of field: sigcontext::trapno" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).err as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).err) as usize - ptr as usize }, 52usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(err) - ) + "Offset of field: sigcontext::err" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).eip as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).eip) as usize - ptr as usize }, 56usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(eip) - ) + "Offset of field: sigcontext::eip" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).cs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).cs) as usize - ptr as usize }, 60usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(cs) - ) + "Offset of field: sigcontext::cs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).__csh as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).__csh) as usize - ptr as usize }, 62usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(__csh) - ) + "Offset of field: sigcontext::__csh" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).eflags as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).eflags) as usize - ptr as usize }, 64usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(eflags) - ) + "Offset of field: sigcontext::eflags" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).esp_at_signal as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).esp_at_signal) as usize - ptr as usize }, 68usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(esp_at_signal) - ) + "Offset of field: sigcontext::esp_at_signal" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ss as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ss) as usize - ptr as usize }, 72usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(ss) - ) + "Offset of field: sigcontext::ss" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).__ssh as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).__ssh) as usize - ptr as usize }, 74usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(__ssh) - ) + "Offset of field: sigcontext::__ssh" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fpstate as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fpstate) as usize - ptr as usize }, 76usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(fpstate) - ) + "Offset of field: sigcontext::fpstate" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).oldmask as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).oldmask) as usize - ptr as usize }, 80usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(oldmask) - ) + "Offset of field: sigcontext::oldmask" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).cr2 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).cr2) as usize - ptr as usize }, 84usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(cr2) - ) + "Offset of field: sigcontext::cr2" + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct timespec { + pub tv_sec: time_t, + pub tv_nsec: ::std::os::raw::c_long, +} +#[test] +fn bindgen_test_layout_timespec() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 8usize, + "Size of timespec" + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + "Alignment of timespec" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).tv_sec) as usize - ptr as usize }, + 0usize, + "Offset of field: timespec::tv_sec" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).tv_nsec) as usize - ptr as usize }, + 4usize, + "Offset of field: timespec::tv_nsec" ); } #[repr(C)] @@ -5759,35 +4644,27 @@ pub struct __kernel_timespec { } #[test] fn bindgen_test_layout___kernel_timespec() { + const UNINIT: ::std::mem::MaybeUninit<__kernel_timespec> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__kernel_timespec>(), 16usize, - concat!("Size of: ", stringify!(__kernel_timespec)) + "Size of __kernel_timespec" ); assert_eq!( ::std::mem::align_of::<__kernel_timespec>(), 4usize, - concat!("Alignment of ", stringify!(__kernel_timespec)) + "Alignment of __kernel_timespec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_timespec>())).tv_sec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tv_sec) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__kernel_timespec), - "::", - stringify!(tv_sec) - ) + "Offset of field: __kernel_timespec::tv_sec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_timespec>())).tv_nsec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tv_nsec) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__kernel_timespec), - "::", - stringify!(tv_nsec) - ) + "Offset of field: __kernel_timespec::tv_nsec" ); } #[repr(C)] @@ -5798,74 +4675,59 @@ pub struct __kernel_itimerspec { } #[test] fn bindgen_test_layout___kernel_itimerspec() { + const UNINIT: ::std::mem::MaybeUninit<__kernel_itimerspec> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__kernel_itimerspec>(), 32usize, - concat!("Size of: ", stringify!(__kernel_itimerspec)) + "Size of __kernel_itimerspec" ); assert_eq!( ::std::mem::align_of::<__kernel_itimerspec>(), 4usize, - concat!("Alignment of ", stringify!(__kernel_itimerspec)) + "Alignment of __kernel_itimerspec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_itimerspec>())).it_interval as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).it_interval) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__kernel_itimerspec), - "::", - stringify!(it_interval) - ) + "Offset of field: __kernel_itimerspec::it_interval" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_itimerspec>())).it_value as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).it_value) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(__kernel_itimerspec), - "::", - stringify!(it_value) - ) + "Offset of field: __kernel_itimerspec::it_value" ); } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct __kernel_old_timeval { - pub tv_sec: __kernel_long_t, - pub tv_usec: __kernel_long_t, +pub struct __kernel_old_timespec { + pub tv_sec: __kernel_old_time_t, + pub tv_nsec: ::std::os::raw::c_long, } #[test] -fn bindgen_test_layout___kernel_old_timeval() { +fn bindgen_test_layout___kernel_old_timespec() { + const UNINIT: ::std::mem::MaybeUninit<__kernel_old_timespec> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - ::std::mem::size_of::<__kernel_old_timeval>(), + ::std::mem::size_of::<__kernel_old_timespec>(), 8usize, - concat!("Size of: ", stringify!(__kernel_old_timeval)) + "Size of __kernel_old_timespec" ); assert_eq!( - ::std::mem::align_of::<__kernel_old_timeval>(), + ::std::mem::align_of::<__kernel_old_timespec>(), 4usize, - concat!("Alignment of ", stringify!(__kernel_old_timeval)) + "Alignment of __kernel_old_timespec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_old_timeval>())).tv_sec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tv_sec) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__kernel_old_timeval), - "::", - stringify!(tv_sec) - ) + "Offset of field: __kernel_old_timespec::tv_sec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_old_timeval>())).tv_usec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tv_nsec) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(__kernel_old_timeval), - "::", - stringify!(tv_usec) - ) + "Offset of field: __kernel_old_timespec::tv_nsec" ); } #[repr(C)] @@ -5876,152 +4738,55 @@ pub struct __kernel_sock_timeval { } #[test] fn bindgen_test_layout___kernel_sock_timeval() { + const UNINIT: ::std::mem::MaybeUninit<__kernel_sock_timeval> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__kernel_sock_timeval>(), 16usize, - concat!("Size of: ", stringify!(__kernel_sock_timeval)) - ); - assert_eq!( - ::std::mem::align_of::<__kernel_sock_timeval>(), - 4usize, - concat!("Alignment of ", stringify!(__kernel_sock_timeval)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_sock_timeval>())).tv_sec as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__kernel_sock_timeval), - "::", - stringify!(tv_sec) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_sock_timeval>())).tv_usec as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(__kernel_sock_timeval), - "::", - stringify!(tv_usec) - ) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct timespec { - pub tv_sec: __kernel_time_t, - pub tv_nsec: ::std::os::raw::c_long, -} -#[test] -fn bindgen_test_layout_timespec() { - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(timespec)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(timespec)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).tv_sec as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(timespec), - "::", - stringify!(tv_sec) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).tv_nsec as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(timespec), - "::", - stringify!(tv_nsec) - ) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct timeval { - pub tv_sec: __kernel_time_t, - pub tv_usec: __kernel_suseconds_t, -} -#[test] -fn bindgen_test_layout_timeval() { - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(timeval)) + "Size of __kernel_sock_timeval" ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::<__kernel_sock_timeval>(), 4usize, - concat!("Alignment of ", stringify!(timeval)) + "Alignment of __kernel_sock_timeval" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tv_sec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tv_sec) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(timeval), - "::", - stringify!(tv_sec) - ) + "Offset of field: __kernel_sock_timeval::tv_sec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tv_usec as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(timeval), - "::", - stringify!(tv_usec) - ) + unsafe { ::std::ptr::addr_of!((*ptr).tv_usec) as usize - ptr as usize }, + 8usize, + "Offset of field: __kernel_sock_timeval::tv_usec" ); } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct timezone { - pub tz_minuteswest: ::std::os::raw::c_int, - pub tz_dsttime: ::std::os::raw::c_int, +pub struct timeval { + pub tv_sec: __kernel_old_time_t, + pub tv_usec: __kernel_suseconds_t, } #[test] -fn bindgen_test_layout_timezone() { - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(timezone)) - ); +fn bindgen_test_layout_timeval() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!(::std::mem::size_of::(), 8usize, "Size of timeval"); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(timezone)) + "Alignment of timeval" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tz_minuteswest as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tv_sec) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(timezone), - "::", - stringify!(tz_minuteswest) - ) + "Offset of field: timeval::tv_sec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tz_dsttime as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tv_usec) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(timezone), - "::", - stringify!(tz_dsttime) - ) + "Offset of field: timeval::tv_usec" ); } #[repr(C)] @@ -6032,35 +4797,27 @@ pub struct itimerspec { } #[test] fn bindgen_test_layout_itimerspec() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 16usize, - concat!("Size of: ", stringify!(itimerspec)) + "Size of itimerspec" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(itimerspec)) + "Alignment of itimerspec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).it_interval as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).it_interval) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(itimerspec), - "::", - stringify!(it_interval) - ) + "Offset of field: itimerspec::it_interval" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).it_value as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).it_value) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(itimerspec), - "::", - stringify!(it_value) - ) + "Offset of field: itimerspec::it_value" ); } #[repr(C)] @@ -6071,35 +4828,58 @@ pub struct itimerval { } #[test] fn bindgen_test_layout_itimerval() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 16usize, - concat!("Size of: ", stringify!(itimerval)) + "Size of itimerval" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(itimerval)) + "Alignment of itimerval" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).it_interval as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).it_interval) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(itimerval), - "::", - stringify!(it_interval) - ) + "Offset of field: itimerval::it_interval" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).it_value) as usize - ptr as usize }, + 8usize, + "Offset of field: itimerval::it_value" ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct timezone { + pub tz_minuteswest: ::std::os::raw::c_int, + pub tz_dsttime: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_timezone() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - unsafe { &(*(::std::ptr::null::())).it_value as *const _ as usize }, + ::std::mem::size_of::(), 8usize, - concat!( - "Offset of field: ", - stringify!(itimerval), - "::", - stringify!(it_value) - ) + "Size of timezone" + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + "Alignment of timezone" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).tz_minuteswest) as usize - ptr as usize }, + 0usize, + "Offset of field: timezone::tz_minuteswest" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).tz_dsttime) as usize - ptr as usize }, + 4usize, + "Offset of field: timezone::tz_dsttime" ); } pub type sigset_t = ::std::os::raw::c_ulong; @@ -6129,146 +4909,100 @@ pub union __kernel_sigaction__bindgen_ty_1 { } #[test] fn bindgen_test_layout___kernel_sigaction__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit<__kernel_sigaction__bindgen_ty_1> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__kernel_sigaction__bindgen_ty_1>(), 4usize, - concat!("Size of: ", stringify!(__kernel_sigaction__bindgen_ty_1)) + "Size of __kernel_sigaction__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::<__kernel_sigaction__bindgen_ty_1>(), 4usize, - concat!( - "Alignment of ", - stringify!(__kernel_sigaction__bindgen_ty_1) - ) + "Alignment of __kernel_sigaction__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__kernel_sigaction__bindgen_ty_1>()))._sa_handler as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._sa_handler) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__kernel_sigaction__bindgen_ty_1), - "::", - stringify!(_sa_handler) - ) + "Offset of field: __kernel_sigaction__bindgen_ty_1::_sa_handler" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__kernel_sigaction__bindgen_ty_1>()))._sa_sigaction as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._sa_sigaction) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__kernel_sigaction__bindgen_ty_1), - "::", - stringify!(_sa_sigaction) - ) + "Offset of field: __kernel_sigaction__bindgen_ty_1::_sa_sigaction" ); } #[test] fn bindgen_test_layout___kernel_sigaction() { + const UNINIT: ::std::mem::MaybeUninit<__kernel_sigaction> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__kernel_sigaction>(), 16usize, - concat!("Size of: ", stringify!(__kernel_sigaction)) + "Size of __kernel_sigaction" ); assert_eq!( ::std::mem::align_of::<__kernel_sigaction>(), 4usize, - concat!("Alignment of ", stringify!(__kernel_sigaction)) + "Alignment of __kernel_sigaction" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_sigaction>()))._u as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._u) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__kernel_sigaction), - "::", - stringify!(_u) - ) + "Offset of field: __kernel_sigaction::_u" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_sigaction>())).sa_mask as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_mask) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(__kernel_sigaction), - "::", - stringify!(sa_mask) - ) + "Offset of field: __kernel_sigaction::sa_mask" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_sigaction>())).sa_flags as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_flags) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__kernel_sigaction), - "::", - stringify!(sa_flags) - ) + "Offset of field: __kernel_sigaction::sa_flags" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_sigaction>())).sa_restorer as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_restorer) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(__kernel_sigaction), - "::", - stringify!(sa_restorer) - ) + "Offset of field: __kernel_sigaction::sa_restorer" ); } #[repr(C)] +#[derive(Debug, Copy, Clone)] pub struct sigaltstack { pub ss_sp: *mut ::std::os::raw::c_void, pub ss_flags: ::std::os::raw::c_int, - pub ss_size: size_t, + pub ss_size: __kernel_size_t, } #[test] fn bindgen_test_layout_sigaltstack() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 12usize, - concat!("Size of: ", stringify!(sigaltstack)) + "Size of sigaltstack" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(sigaltstack)) + "Alignment of sigaltstack" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ss_sp as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ss_sp) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigaltstack), - "::", - stringify!(ss_sp) - ) + "Offset of field: sigaltstack::ss_sp" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ss_flags as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ss_flags) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(sigaltstack), - "::", - stringify!(ss_flags) - ) + "Offset of field: sigaltstack::ss_flags" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ss_size as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ss_size) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(sigaltstack), - "::", - stringify!(ss_size) - ) + "Offset of field: sigaltstack::ss_size" ); } pub type stack_t = sigaltstack; @@ -6280,35 +5014,23 @@ pub union sigval { } #[test] fn bindgen_test_layout_sigval() { - assert_eq!( - ::std::mem::size_of::(), - 4usize, - concat!("Size of: ", stringify!(sigval)) - ); + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!(::std::mem::size_of::(), 4usize, "Size of sigval"); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(sigval)) + "Alignment of sigval" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sival_int as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sival_int) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigval), - "::", - stringify!(sival_int) - ) + "Offset of field: sigval::sival_int" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sival_ptr as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sival_ptr) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigval), - "::", - stringify!(sival_ptr) - ) + "Offset of field: sigval::sival_ptr" ); } pub type sigval_t = sigval; @@ -6331,35 +5053,28 @@ pub struct __sifields__bindgen_ty_1 { } #[test] fn bindgen_test_layout___sifields__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_1> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_1>(), 8usize, - concat!("Size of: ", stringify!(__sifields__bindgen_ty_1)) + "Size of __sifields__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_1>(), 4usize, - concat!("Alignment of ", stringify!(__sifields__bindgen_ty_1)) + "Alignment of __sifields__bindgen_ty_1" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_1>()))._pid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._pid) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_1), - "::", - stringify!(_pid) - ) + "Offset of field: __sifields__bindgen_ty_1::_pid" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_1>()))._uid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._uid) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_1), - "::", - stringify!(_uid) - ) + "Offset of field: __sifields__bindgen_ty_1::_uid" ); } #[repr(C)] @@ -6372,61 +5087,38 @@ pub struct __sifields__bindgen_ty_2 { } #[test] fn bindgen_test_layout___sifields__bindgen_ty_2() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_2> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_2>(), 16usize, - concat!("Size of: ", stringify!(__sifields__bindgen_ty_2)) + "Size of __sifields__bindgen_ty_2" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_2>(), 4usize, - concat!("Alignment of ", stringify!(__sifields__bindgen_ty_2)) + "Alignment of __sifields__bindgen_ty_2" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_2>()))._tid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._tid) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_2), - "::", - stringify!(_tid) - ) + "Offset of field: __sifields__bindgen_ty_2::_tid" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_2>()))._overrun as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._overrun) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_2), - "::", - stringify!(_overrun) - ) + "Offset of field: __sifields__bindgen_ty_2::_overrun" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_2>()))._sigval as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._sigval) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_2), - "::", - stringify!(_sigval) - ) + "Offset of field: __sifields__bindgen_ty_2::_sigval" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_2>()))._sys_private as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._sys_private) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_2), - "::", - stringify!(_sys_private) - ) + "Offset of field: __sifields__bindgen_ty_2::_sys_private" ); } #[repr(C)] @@ -6438,47 +5130,33 @@ pub struct __sifields__bindgen_ty_3 { } #[test] fn bindgen_test_layout___sifields__bindgen_ty_3() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_3> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_3>(), 12usize, - concat!("Size of: ", stringify!(__sifields__bindgen_ty_3)) + "Size of __sifields__bindgen_ty_3" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_3>(), 4usize, - concat!("Alignment of ", stringify!(__sifields__bindgen_ty_3)) + "Alignment of __sifields__bindgen_ty_3" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_3>()))._pid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._pid) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_3), - "::", - stringify!(_pid) - ) + "Offset of field: __sifields__bindgen_ty_3::_pid" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_3>()))._uid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._uid) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_3), - "::", - stringify!(_uid) - ) + "Offset of field: __sifields__bindgen_ty_3::_uid" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_3>()))._sigval as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._sigval) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_3), - "::", - stringify!(_sigval) - ) + "Offset of field: __sifields__bindgen_ty_3::_sigval" ); } #[repr(C)] @@ -6492,67 +5170,43 @@ pub struct __sifields__bindgen_ty_4 { } #[test] fn bindgen_test_layout___sifields__bindgen_ty_4() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_4> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_4>(), 20usize, - concat!("Size of: ", stringify!(__sifields__bindgen_ty_4)) + "Size of __sifields__bindgen_ty_4" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_4>(), 4usize, - concat!("Alignment of ", stringify!(__sifields__bindgen_ty_4)) + "Alignment of __sifields__bindgen_ty_4" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_4>()))._pid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._pid) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_4), - "::", - stringify!(_pid) - ) + "Offset of field: __sifields__bindgen_ty_4::_pid" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_4>()))._uid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._uid) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_4), - "::", - stringify!(_uid) - ) + "Offset of field: __sifields__bindgen_ty_4::_uid" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_4>()))._status as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._status) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_4), - "::", - stringify!(_status) - ) + "Offset of field: __sifields__bindgen_ty_4::_status" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_4>()))._utime as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._utime) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_4), - "::", - stringify!(_utime) - ) + "Offset of field: __sifields__bindgen_ty_4::_utime" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_4>()))._stime as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._stime) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_4), - "::", - stringify!(_stime) - ) + "Offset of field: __sifields__bindgen_ty_4::_stime" ); } #[repr(C)] @@ -6564,9 +5218,11 @@ pub struct __sifields__bindgen_ty_5 { #[repr(C)] #[derive(Copy, Clone)] pub union __sifields__bindgen_ty_5__bindgen_ty_1 { + pub _trapno: ::std::os::raw::c_int, pub _addr_lsb: ::std::os::raw::c_short, pub _addr_bnd: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1, pub _addr_pkey: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2, + pub _perf: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3, } #[repr(C)] #[derive(Debug, Copy, Clone)] @@ -6577,60 +5233,33 @@ pub struct __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1 { } #[test] fn bindgen_test_layout___sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1>(), 12usize, - concat!( - "Size of: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1) - ) + "Size of __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1>(), 4usize, - concat!( - "Alignment of ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1) - ) + "Alignment of __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1>())) - ._dummy_bnd as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._dummy_bnd) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(_dummy_bnd) - ) + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1::_dummy_bnd" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1>()))._lower - as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._lower) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(_lower) - ) + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1::_lower" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1>()))._upper - as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._upper) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(_upper) - ) + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1::_upper" ); } #[repr(C)] @@ -6641,128 +5270,128 @@ pub struct __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2 { } #[test] fn bindgen_test_layout___sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2>(), 8usize, - concat!( - "Size of: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2) - ) + "Size of __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2>(), 4usize, - concat!( - "Alignment of ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2) - ) + "Alignment of __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2>())) - ._dummy_pkey as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._dummy_pkey) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2), - "::", - stringify!(_dummy_pkey) - ) + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2::_dummy_pkey" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2>()))._pkey - as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._pkey) as usize - ptr as usize }, + 4usize, + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2::_pkey" + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3 { + pub _data: ::std::os::raw::c_ulong, + pub _type: __u32, + pub _flags: __u32, +} +#[test] +fn bindgen_test_layout___sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3>(), + 12usize, + "Size of __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3" + ); + assert_eq!( + ::std::mem::align_of::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3>(), + 4usize, + "Alignment of __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._data) as usize - ptr as usize }, + 0usize, + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3::_data" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._type) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2), - "::", - stringify!(_pkey) - ) + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3::_type" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._flags) as usize - ptr as usize }, + 8usize, + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3::_flags" ); } #[test] fn bindgen_test_layout___sifields__bindgen_ty_5__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_5__bindgen_ty_1> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_5__bindgen_ty_1>(), 12usize, - concat!( - "Size of: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1) - ) + "Size of __sifields__bindgen_ty_5__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_5__bindgen_ty_1>(), 4usize, - concat!( - "Alignment of ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1) - ) + "Alignment of __sifields__bindgen_ty_5__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_5__bindgen_ty_1>()))._addr_lsb as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._trapno) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1), - "::", - stringify!(_addr_lsb) - ) + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1::_trapno" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_5__bindgen_ty_1>()))._addr_bnd as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._addr_lsb) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1), - "::", - stringify!(_addr_bnd) - ) + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1::_addr_lsb" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_5__bindgen_ty_1>()))._addr_pkey - as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._addr_bnd) as usize - ptr as usize }, + 0usize, + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1::_addr_bnd" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._addr_pkey) as usize - ptr as usize }, + 0usize, + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1::_addr_pkey" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._perf) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1), - "::", - stringify!(_addr_pkey) - ) + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1::_perf" ); } #[test] fn bindgen_test_layout___sifields__bindgen_ty_5() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_5> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_5>(), 16usize, - concat!("Size of: ", stringify!(__sifields__bindgen_ty_5)) + "Size of __sifields__bindgen_ty_5" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_5>(), 4usize, - concat!("Alignment of ", stringify!(__sifields__bindgen_ty_5)) + "Alignment of __sifields__bindgen_ty_5" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_5>()))._addr as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._addr) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5), - "::", - stringify!(_addr) - ) + "Offset of field: __sifields__bindgen_ty_5::_addr" ); } #[repr(C)] @@ -6773,35 +5402,28 @@ pub struct __sifields__bindgen_ty_6 { } #[test] fn bindgen_test_layout___sifields__bindgen_ty_6() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_6> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_6>(), 8usize, - concat!("Size of: ", stringify!(__sifields__bindgen_ty_6)) + "Size of __sifields__bindgen_ty_6" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_6>(), 4usize, - concat!("Alignment of ", stringify!(__sifields__bindgen_ty_6)) + "Alignment of __sifields__bindgen_ty_6" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_6>()))._band as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._band) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_6), - "::", - stringify!(_band) - ) + "Offset of field: __sifields__bindgen_ty_6::_band" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_6>()))._fd as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._fd) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_6), - "::", - stringify!(_fd) - ) + "Offset of field: __sifields__bindgen_ty_6::_fd" ); } #[repr(C)] @@ -6813,132 +5435,83 @@ pub struct __sifields__bindgen_ty_7 { } #[test] fn bindgen_test_layout___sifields__bindgen_ty_7() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_7> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_7>(), 12usize, - concat!("Size of: ", stringify!(__sifields__bindgen_ty_7)) + "Size of __sifields__bindgen_ty_7" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_7>(), 4usize, - concat!("Alignment of ", stringify!(__sifields__bindgen_ty_7)) + "Alignment of __sifields__bindgen_ty_7" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_7>()))._call_addr as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._call_addr) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_7), - "::", - stringify!(_call_addr) - ) + "Offset of field: __sifields__bindgen_ty_7::_call_addr" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_7>()))._syscall as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._syscall) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_7), - "::", - stringify!(_syscall) - ) + "Offset of field: __sifields__bindgen_ty_7::_syscall" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_7>()))._arch as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._arch) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_7), - "::", - stringify!(_arch) - ) + "Offset of field: __sifields__bindgen_ty_7::_arch" ); } #[test] fn bindgen_test_layout___sifields() { + const UNINIT: ::std::mem::MaybeUninit<__sifields> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields>(), 20usize, - concat!("Size of: ", stringify!(__sifields)) + "Size of __sifields" ); assert_eq!( ::std::mem::align_of::<__sifields>(), 4usize, - concat!("Alignment of ", stringify!(__sifields)) + "Alignment of __sifields" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields>()))._kill as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._kill) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields), - "::", - stringify!(_kill) - ) + "Offset of field: __sifields::_kill" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields>()))._timer as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._timer) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields), - "::", - stringify!(_timer) - ) + "Offset of field: __sifields::_timer" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields>()))._rt as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._rt) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields), - "::", - stringify!(_rt) - ) + "Offset of field: __sifields::_rt" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields>()))._sigchld as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._sigchld) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields), - "::", - stringify!(_sigchld) - ) + "Offset of field: __sifields::_sigchld" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields>()))._sigfault as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._sigfault) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields), - "::", - stringify!(_sigfault) - ) + "Offset of field: __sifields::_sigfault" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields>()))._sigpoll as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._sigpoll) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields), - "::", - stringify!(_sigpoll) - ) + "Offset of field: __sifields::_sigpoll" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields>()))._sigsys as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._sigsys) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields), - "::", - stringify!(_sigsys) - ) + "Offset of field: __sifields::_sigsys" ); } #[repr(C)] @@ -6962,93 +5535,59 @@ pub struct siginfo__bindgen_ty_1__bindgen_ty_1 { } #[test] fn bindgen_test_layout_siginfo__bindgen_ty_1__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 32usize, - concat!("Size of: ", stringify!(siginfo__bindgen_ty_1__bindgen_ty_1)) + "Size of siginfo__bindgen_ty_1__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!( - "Alignment of ", - stringify!(siginfo__bindgen_ty_1__bindgen_ty_1) - ) + "Alignment of siginfo__bindgen_ty_1__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).si_signo as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).si_signo) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(siginfo__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(si_signo) - ) + "Offset of field: siginfo__bindgen_ty_1__bindgen_ty_1::si_signo" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).si_errno as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).si_errno) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(siginfo__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(si_errno) - ) + "Offset of field: siginfo__bindgen_ty_1__bindgen_ty_1::si_errno" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).si_code as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).si_code) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(siginfo__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(si_code) - ) + "Offset of field: siginfo__bindgen_ty_1__bindgen_ty_1::si_code" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::()))._sifields as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._sifields) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(siginfo__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(_sifields) - ) + "Offset of field: siginfo__bindgen_ty_1__bindgen_ty_1::_sifields" ); } #[test] fn bindgen_test_layout_siginfo__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 128usize, - concat!("Size of: ", stringify!(siginfo__bindgen_ty_1)) + "Size of siginfo__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(siginfo__bindgen_ty_1)) + "Alignment of siginfo__bindgen_ty_1" ); assert_eq!( - unsafe { &(*(::std::ptr::null::()))._si_pad as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._si_pad) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(siginfo__bindgen_ty_1), - "::", - stringify!(_si_pad) - ) + "Offset of field: siginfo__bindgen_ty_1::_si_pad" ); } #[test] @@ -7056,12 +5595,12 @@ fn bindgen_test_layout_siginfo() { assert_eq!( ::std::mem::size_of::(), 128usize, - concat!("Size of: ", stringify!(siginfo)) + "Size of siginfo" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(siginfo)) + "Alignment of siginfo" ); } pub type siginfo_t = siginfo; @@ -7088,145 +5627,94 @@ pub struct sigevent__bindgen_ty_1__bindgen_ty_1 { } #[test] fn bindgen_test_layout_sigevent__bindgen_ty_1__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 8usize, - concat!( - "Size of: ", - stringify!(sigevent__bindgen_ty_1__bindgen_ty_1) - ) + "Size of sigevent__bindgen_ty_1__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!( - "Alignment of ", - stringify!(sigevent__bindgen_ty_1__bindgen_ty_1) - ) + "Alignment of sigevent__bindgen_ty_1__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::()))._function as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._function) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigevent__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(_function) - ) + "Offset of field: sigevent__bindgen_ty_1__bindgen_ty_1::_function" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::()))._attribute as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._attribute) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(sigevent__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(_attribute) - ) + "Offset of field: sigevent__bindgen_ty_1__bindgen_ty_1::_attribute" ); } #[test] fn bindgen_test_layout_sigevent__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 52usize, - concat!("Size of: ", stringify!(sigevent__bindgen_ty_1)) + "Size of sigevent__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(sigevent__bindgen_ty_1)) + "Alignment of sigevent__bindgen_ty_1" ); assert_eq!( - unsafe { &(*(::std::ptr::null::()))._pad as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._pad) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigevent__bindgen_ty_1), - "::", - stringify!(_pad) - ) + "Offset of field: sigevent__bindgen_ty_1::_pad" ); assert_eq!( - unsafe { &(*(::std::ptr::null::()))._tid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._tid) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigevent__bindgen_ty_1), - "::", - stringify!(_tid) - ) + "Offset of field: sigevent__bindgen_ty_1::_tid" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::()))._sigev_thread as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._sigev_thread) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigevent__bindgen_ty_1), - "::", - stringify!(_sigev_thread) - ) + "Offset of field: sigevent__bindgen_ty_1::_sigev_thread" ); } #[test] fn bindgen_test_layout_sigevent() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 64usize, - concat!("Size of: ", stringify!(sigevent)) + "Size of sigevent" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(sigevent)) + "Alignment of sigevent" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sigev_value as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sigev_value) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigevent), - "::", - stringify!(sigev_value) - ) + "Offset of field: sigevent::sigev_value" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sigev_signo as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sigev_signo) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(sigevent), - "::", - stringify!(sigev_signo) - ) + "Offset of field: sigevent::sigev_signo" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sigev_notify as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sigev_notify) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(sigevent), - "::", - stringify!(sigev_notify) - ) + "Offset of field: sigevent::sigev_notify" ); assert_eq!( - unsafe { &(*(::std::ptr::null::()))._sigev_un as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._sigev_un) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(sigevent), - "::", - stringify!(_sigev_un) - ) + "Offset of field: sigevent::_sigev_un" ); } pub type sigevent_t = sigevent; @@ -7240,25 +5728,22 @@ pub struct sigset64_t { } #[test] fn bindgen_test_layout_sigset64_t() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 8usize, - concat!("Size of: ", stringify!(sigset64_t)) + "Size of sigset64_t" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(sigset64_t)) + "Alignment of sigset64_t" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).__bits as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).__bits) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigset64_t), - "::", - stringify!(__bits) - ) + "Offset of field: sigset64_t::__bits" ); } #[repr(C)] @@ -7283,82 +5768,58 @@ pub union sigaction__bindgen_ty_1 { } #[test] fn bindgen_test_layout_sigaction__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 4usize, - concat!("Size of: ", stringify!(sigaction__bindgen_ty_1)) + "Size of sigaction__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(sigaction__bindgen_ty_1)) + "Alignment of sigaction__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).sa_handler as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_handler) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigaction__bindgen_ty_1), - "::", - stringify!(sa_handler) - ) + "Offset of field: sigaction__bindgen_ty_1::sa_handler" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).sa_sigaction as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_sigaction) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigaction__bindgen_ty_1), - "::", - stringify!(sa_sigaction) - ) + "Offset of field: sigaction__bindgen_ty_1::sa_sigaction" ); } #[test] fn bindgen_test_layout_sigaction() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 16usize, - concat!("Size of: ", stringify!(sigaction)) + "Size of sigaction" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(sigaction)) + "Alignment of sigaction" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sa_mask as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_mask) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(sigaction), - "::", - stringify!(sa_mask) - ) + "Offset of field: sigaction::sa_mask" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sa_flags as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_flags) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(sigaction), - "::", - stringify!(sa_flags) - ) + "Offset of field: sigaction::sa_flags" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sa_restorer as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_restorer) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(sigaction), - "::", - stringify!(sa_restorer) - ) + "Offset of field: sigaction::sa_restorer" ); } #[repr(C)] @@ -7383,82 +5844,58 @@ pub union sigaction64__bindgen_ty_1 { } #[test] fn bindgen_test_layout_sigaction64__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 4usize, - concat!("Size of: ", stringify!(sigaction64__bindgen_ty_1)) + "Size of sigaction64__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(sigaction64__bindgen_ty_1)) + "Alignment of sigaction64__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).sa_handler as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_handler) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigaction64__bindgen_ty_1), - "::", - stringify!(sa_handler) - ) + "Offset of field: sigaction64__bindgen_ty_1::sa_handler" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).sa_sigaction as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_sigaction) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigaction64__bindgen_ty_1), - "::", - stringify!(sa_sigaction) - ) + "Offset of field: sigaction64__bindgen_ty_1::sa_sigaction" ); } #[test] fn bindgen_test_layout_sigaction64() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 20usize, - concat!("Size of: ", stringify!(sigaction64)) + "Size of sigaction64" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(sigaction64)) + "Alignment of sigaction64" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sa_flags as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_flags) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(sigaction64), - "::", - stringify!(sa_flags) - ) + "Offset of field: sigaction64::sa_flags" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sa_restorer as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_restorer) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(sigaction64), - "::", - stringify!(sa_restorer) - ) + "Offset of field: sigaction64::sa_restorer" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sa_mask as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_mask) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(sigaction64), - "::", - stringify!(sa_mask) - ) + "Offset of field: sigaction64::sa_mask" ); } #[repr(C)] @@ -7475,95 +5912,57 @@ pub struct user_fpregs_struct { } #[test] fn bindgen_test_layout_user_fpregs_struct() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 108usize, - concat!("Size of: ", stringify!(user_fpregs_struct)) + "Size of user_fpregs_struct" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(user_fpregs_struct)) + "Alignment of user_fpregs_struct" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).cwd as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).cwd) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(user_fpregs_struct), - "::", - stringify!(cwd) - ) + "Offset of field: user_fpregs_struct::cwd" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).swd as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).swd) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(user_fpregs_struct), - "::", - stringify!(swd) - ) + "Offset of field: user_fpregs_struct::swd" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).twd as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).twd) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(user_fpregs_struct), - "::", - stringify!(twd) - ) + "Offset of field: user_fpregs_struct::twd" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fip as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fip) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(user_fpregs_struct), - "::", - stringify!(fip) - ) + "Offset of field: user_fpregs_struct::fip" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fcs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fcs) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(user_fpregs_struct), - "::", - stringify!(fcs) - ) + "Offset of field: user_fpregs_struct::fcs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).foo as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize }, 20usize, - concat!( - "Offset of field: ", - stringify!(user_fpregs_struct), - "::", - stringify!(foo) - ) + "Offset of field: user_fpregs_struct::foo" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fos as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fos) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(user_fpregs_struct), - "::", - stringify!(fos) - ) + "Offset of field: user_fpregs_struct::fos" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).st_space as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).st_space) as usize - ptr as usize }, 28usize, - concat!( - "Offset of field: ", - stringify!(user_fpregs_struct), - "::", - stringify!(st_space) - ) + "Offset of field: user_fpregs_struct::st_space" ); } #[repr(C)] @@ -7585,145 +5984,82 @@ pub struct user_fpxregs_struct { } #[test] fn bindgen_test_layout_user_fpxregs_struct() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 512usize, - concat!("Size of: ", stringify!(user_fpxregs_struct)) + "Size of user_fpxregs_struct" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(user_fpxregs_struct)) + "Alignment of user_fpxregs_struct" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).cwd as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).cwd) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(user_fpxregs_struct), - "::", - stringify!(cwd) - ) + "Offset of field: user_fpxregs_struct::cwd" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).swd as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).swd) as usize - ptr as usize }, 2usize, - concat!( - "Offset of field: ", - stringify!(user_fpxregs_struct), - "::", - stringify!(swd) - ) + "Offset of field: user_fpxregs_struct::swd" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).twd as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).twd) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(user_fpxregs_struct), - "::", - stringify!(twd) - ) + "Offset of field: user_fpxregs_struct::twd" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fop as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fop) as usize - ptr as usize }, 6usize, - concat!( - "Offset of field: ", - stringify!(user_fpxregs_struct), - "::", - stringify!(fop) - ) + "Offset of field: user_fpxregs_struct::fop" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fip as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fip) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(user_fpxregs_struct), - "::", - stringify!(fip) - ) + "Offset of field: user_fpxregs_struct::fip" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fcs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fcs) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(user_fpxregs_struct), - "::", - stringify!(fcs) - ) + "Offset of field: user_fpxregs_struct::fcs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).foo as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(user_fpxregs_struct), - "::", - stringify!(foo) - ) + "Offset of field: user_fpxregs_struct::foo" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fos as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fos) as usize - ptr as usize }, 20usize, - concat!( - "Offset of field: ", - stringify!(user_fpxregs_struct), - "::", - stringify!(fos) - ) + "Offset of field: user_fpxregs_struct::fos" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mxcsr as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).mxcsr) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(user_fpxregs_struct), - "::", - stringify!(mxcsr) - ) + "Offset of field: user_fpxregs_struct::mxcsr" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).reserved) as usize - ptr as usize }, 28usize, - concat!( - "Offset of field: ", - stringify!(user_fpxregs_struct), - "::", - stringify!(reserved) - ) + "Offset of field: user_fpxregs_struct::reserved" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).st_space as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).st_space) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(user_fpxregs_struct), - "::", - stringify!(st_space) - ) + "Offset of field: user_fpxregs_struct::st_space" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).xmm_space as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).xmm_space) as usize - ptr as usize }, 160usize, - concat!( - "Offset of field: ", - stringify!(user_fpxregs_struct), - "::", - stringify!(xmm_space) - ) + "Offset of field: user_fpxregs_struct::xmm_space" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).padding) as usize - ptr as usize }, 288usize, - concat!( - "Offset of field: ", - stringify!(user_fpxregs_struct), - "::", - stringify!(padding) - ) + "Offset of field: user_fpxregs_struct::padding" ); } #[repr(C)] @@ -7749,185 +6085,102 @@ pub struct user_regs_struct { } #[test] fn bindgen_test_layout_user_regs_struct() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 68usize, - concat!("Size of: ", stringify!(user_regs_struct)) + "Size of user_regs_struct" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(user_regs_struct)) + "Alignment of user_regs_struct" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ebx as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ebx) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(ebx) - ) + "Offset of field: user_regs_struct::ebx" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ecx as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ecx) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(ecx) - ) + "Offset of field: user_regs_struct::ecx" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).edx as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).edx) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(edx) - ) + "Offset of field: user_regs_struct::edx" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).esi as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).esi) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(esi) - ) + "Offset of field: user_regs_struct::esi" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).edi as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).edi) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(edi) - ) + "Offset of field: user_regs_struct::edi" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ebp as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ebp) as usize - ptr as usize }, 20usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(ebp) - ) + "Offset of field: user_regs_struct::ebp" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).eax as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).eax) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(eax) - ) + "Offset of field: user_regs_struct::eax" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).xds as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).xds) as usize - ptr as usize }, 28usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(xds) - ) + "Offset of field: user_regs_struct::xds" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).xes as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).xes) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(xes) - ) + "Offset of field: user_regs_struct::xes" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).xfs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).xfs) as usize - ptr as usize }, 36usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(xfs) - ) + "Offset of field: user_regs_struct::xfs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).xgs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).xgs) as usize - ptr as usize }, 40usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(xgs) - ) + "Offset of field: user_regs_struct::xgs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).orig_eax as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).orig_eax) as usize - ptr as usize }, 44usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(orig_eax) - ) + "Offset of field: user_regs_struct::orig_eax" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).eip as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).eip) as usize - ptr as usize }, 48usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(eip) - ) + "Offset of field: user_regs_struct::eip" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).xcs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).xcs) as usize - ptr as usize }, 52usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(xcs) - ) + "Offset of field: user_regs_struct::xcs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).eflags as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).eflags) as usize - ptr as usize }, 56usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(eflags) - ) + "Offset of field: user_regs_struct::eflags" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).esp as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).esp) as usize - ptr as usize }, 60usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(esp) - ) + "Offset of field: user_regs_struct::esp" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).xss as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).xss) as usize - ptr as usize }, 64usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(xss) - ) + "Offset of field: user_regs_struct::xss" ); } #[repr(C)] @@ -7951,187 +6204,106 @@ pub struct user { } #[test] fn bindgen_test_layout_user() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!(::std::mem::size_of::(), 284usize, "Size of user"); + assert_eq!(::std::mem::align_of::(), 4usize, "Alignment of user"); assert_eq!( - ::std::mem::size_of::(), - 284usize, - concat!("Size of: ", stringify!(user)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(user)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).regs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).regs) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(regs) - ) + "Offset of field: user::regs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).u_fpvalid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).u_fpvalid) as usize - ptr as usize }, 68usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(u_fpvalid) - ) + "Offset of field: user::u_fpvalid" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).i387 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).i387) as usize - ptr as usize }, 72usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(i387) - ) + "Offset of field: user::i387" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).u_tsize as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).u_tsize) as usize - ptr as usize }, 180usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(u_tsize) - ) + "Offset of field: user::u_tsize" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).u_dsize as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).u_dsize) as usize - ptr as usize }, 184usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(u_dsize) - ) + "Offset of field: user::u_dsize" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).u_ssize as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).u_ssize) as usize - ptr as usize }, 188usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(u_ssize) - ) + "Offset of field: user::u_ssize" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).start_code as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).start_code) as usize - ptr as usize }, 192usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(start_code) - ) + "Offset of field: user::start_code" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).start_stack as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).start_stack) as usize - ptr as usize }, 196usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(start_stack) - ) + "Offset of field: user::start_stack" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).signal as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).signal) as usize - ptr as usize }, 200usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(signal) - ) + "Offset of field: user::signal" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).reserved) as usize - ptr as usize }, 204usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(reserved) - ) + "Offset of field: user::reserved" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).u_ar0 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).u_ar0) as usize - ptr as usize }, 208usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(u_ar0) - ) + "Offset of field: user::u_ar0" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).u_fpstate as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).u_fpstate) as usize - ptr as usize }, 212usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(u_fpstate) - ) + "Offset of field: user::u_fpstate" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).magic as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).magic) as usize - ptr as usize }, 216usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(magic) - ) + "Offset of field: user::magic" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).u_comm as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).u_comm) as usize - ptr as usize }, 220usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(u_comm) - ) + "Offset of field: user::u_comm" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).u_debugreg as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).u_debugreg) as usize - ptr as usize }, 252usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(u_debugreg) - ) - ); -} -pub const REG_GS: ::std::os::raw::c_uint = 0; -pub const REG_FS: ::std::os::raw::c_uint = 1; -pub const REG_ES: ::std::os::raw::c_uint = 2; -pub const REG_DS: ::std::os::raw::c_uint = 3; -pub const REG_EDI: ::std::os::raw::c_uint = 4; -pub const REG_ESI: ::std::os::raw::c_uint = 5; -pub const REG_EBP: ::std::os::raw::c_uint = 6; -pub const REG_ESP: ::std::os::raw::c_uint = 7; -pub const REG_EBX: ::std::os::raw::c_uint = 8; -pub const REG_EDX: ::std::os::raw::c_uint = 9; -pub const REG_ECX: ::std::os::raw::c_uint = 10; -pub const REG_EAX: ::std::os::raw::c_uint = 11; -pub const REG_TRAPNO: ::std::os::raw::c_uint = 12; -pub const REG_ERR: ::std::os::raw::c_uint = 13; -pub const REG_EIP: ::std::os::raw::c_uint = 14; -pub const REG_CS: ::std::os::raw::c_uint = 15; -pub const REG_EFL: ::std::os::raw::c_uint = 16; -pub const REG_UESP: ::std::os::raw::c_uint = 17; -pub const REG_SS: ::std::os::raw::c_uint = 18; -pub const NGREG: ::std::os::raw::c_uint = 19; + "Offset of field: user::u_debugreg" + ); +} +pub const REG_GS: _bindgen_ty_22 = 0; +pub const REG_FS: _bindgen_ty_22 = 1; +pub const REG_ES: _bindgen_ty_22 = 2; +pub const REG_DS: _bindgen_ty_22 = 3; +pub const REG_EDI: _bindgen_ty_22 = 4; +pub const REG_ESI: _bindgen_ty_22 = 5; +pub const REG_EBP: _bindgen_ty_22 = 6; +pub const REG_ESP: _bindgen_ty_22 = 7; +pub const REG_EBX: _bindgen_ty_22 = 8; +pub const REG_EDX: _bindgen_ty_22 = 9; +pub const REG_ECX: _bindgen_ty_22 = 10; +pub const REG_EAX: _bindgen_ty_22 = 11; +pub const REG_TRAPNO: _bindgen_ty_22 = 12; +pub const REG_ERR: _bindgen_ty_22 = 13; +pub const REG_EIP: _bindgen_ty_22 = 14; +pub const REG_CS: _bindgen_ty_22 = 15; +pub const REG_EFL: _bindgen_ty_22 = 16; +pub const REG_UESP: _bindgen_ty_22 = 17; +pub const REG_SS: _bindgen_ty_22 = 18; +pub const NGREG: _bindgen_ty_22 = 19; pub type _bindgen_ty_22 = ::std::os::raw::c_uint; pub type greg_t = ::std::os::raw::c_int; pub type gregset_t = [greg_t; 19usize]; @@ -8143,35 +6315,27 @@ pub struct _libc_fpreg { } #[test] fn bindgen_test_layout__libc_fpreg() { + const UNINIT: ::std::mem::MaybeUninit<_libc_fpreg> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<_libc_fpreg>(), 10usize, - concat!("Size of: ", stringify!(_libc_fpreg)) + "Size of _libc_fpreg" ); assert_eq!( ::std::mem::align_of::<_libc_fpreg>(), 2usize, - concat!("Alignment of ", stringify!(_libc_fpreg)) + "Alignment of _libc_fpreg" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_libc_fpreg>())).significand as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).significand) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_libc_fpreg), - "::", - stringify!(significand) - ) + "Offset of field: _libc_fpreg::significand" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_libc_fpreg>())).exponent as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).exponent) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(_libc_fpreg), - "::", - stringify!(exponent) - ) + "Offset of field: _libc_fpreg::exponent" ); } #[repr(C)] @@ -8189,105 +6353,62 @@ pub struct _libc_fpstate { } #[test] fn bindgen_test_layout__libc_fpstate() { + const UNINIT: ::std::mem::MaybeUninit<_libc_fpstate> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<_libc_fpstate>(), 112usize, - concat!("Size of: ", stringify!(_libc_fpstate)) + "Size of _libc_fpstate" ); assert_eq!( ::std::mem::align_of::<_libc_fpstate>(), 4usize, - concat!("Alignment of ", stringify!(_libc_fpstate)) + "Alignment of _libc_fpstate" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_libc_fpstate>())).cw as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).cw) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_libc_fpstate), - "::", - stringify!(cw) - ) + "Offset of field: _libc_fpstate::cw" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_libc_fpstate>())).sw as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sw) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(_libc_fpstate), - "::", - stringify!(sw) - ) + "Offset of field: _libc_fpstate::sw" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_libc_fpstate>())).tag as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tag) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(_libc_fpstate), - "::", - stringify!(tag) - ) + "Offset of field: _libc_fpstate::tag" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_libc_fpstate>())).ipoff as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ipoff) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(_libc_fpstate), - "::", - stringify!(ipoff) - ) + "Offset of field: _libc_fpstate::ipoff" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_libc_fpstate>())).cssel as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).cssel) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(_libc_fpstate), - "::", - stringify!(cssel) - ) + "Offset of field: _libc_fpstate::cssel" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_libc_fpstate>())).dataoff as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).dataoff) as usize - ptr as usize }, 20usize, - concat!( - "Offset of field: ", - stringify!(_libc_fpstate), - "::", - stringify!(dataoff) - ) + "Offset of field: _libc_fpstate::dataoff" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_libc_fpstate>())).datasel as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).datasel) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(_libc_fpstate), - "::", - stringify!(datasel) - ) + "Offset of field: _libc_fpstate::datasel" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_libc_fpstate>()))._st as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._st) as usize - ptr as usize }, 28usize, - concat!( - "Offset of field: ", - stringify!(_libc_fpstate), - "::", - stringify!(_st) - ) + "Offset of field: _libc_fpstate::_st" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_libc_fpstate>())).status as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).status) as usize - ptr as usize }, 108usize, - concat!( - "Offset of field: ", - stringify!(_libc_fpstate), - "::", - stringify!(status) - ) + "Offset of field: _libc_fpstate::status" ); } pub type fpregset_t = *mut _libc_fpstate; @@ -8301,58 +6422,41 @@ pub struct mcontext_t { } #[test] fn bindgen_test_layout_mcontext_t() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 88usize, - concat!("Size of: ", stringify!(mcontext_t)) + "Size of mcontext_t" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(mcontext_t)) + "Alignment of mcontext_t" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).gregs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).gregs) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(mcontext_t), - "::", - stringify!(gregs) - ) + "Offset of field: mcontext_t::gregs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fpregs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fpregs) as usize - ptr as usize }, 76usize, - concat!( - "Offset of field: ", - stringify!(mcontext_t), - "::", - stringify!(fpregs) - ) + "Offset of field: mcontext_t::fpregs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).oldmask as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).oldmask) as usize - ptr as usize }, 80usize, - concat!( - "Offset of field: ", - stringify!(mcontext_t), - "::", - stringify!(oldmask) - ) + "Offset of field: mcontext_t::oldmask" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).cr2 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).cr2) as usize - ptr as usize }, 84usize, - concat!( - "Offset of field: ", - stringify!(mcontext_t), - "::", - stringify!(cr2) - ) + "Offset of field: mcontext_t::cr2" ); } #[repr(C)] +#[derive(Copy, Clone)] pub struct ucontext { pub uc_flags: ::std::os::raw::c_ulong, pub uc_link: *mut ucontext, @@ -8375,135 +6479,89 @@ pub struct ucontext__bindgen_ty_1__bindgen_ty_1 { } #[test] fn bindgen_test_layout_ucontext__bindgen_ty_1__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 8usize, - concat!( - "Size of: ", - stringify!(ucontext__bindgen_ty_1__bindgen_ty_1) - ) + "Size of ucontext__bindgen_ty_1__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!( - "Alignment of ", - stringify!(ucontext__bindgen_ty_1__bindgen_ty_1) - ) + "Alignment of ucontext__bindgen_ty_1__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).uc_sigmask as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).uc_sigmask) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(ucontext__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(uc_sigmask) - ) + "Offset of field: ucontext__bindgen_ty_1__bindgen_ty_1::uc_sigmask" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).__padding_rt_sigset - as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).__padding_rt_sigset) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(ucontext__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(__padding_rt_sigset) - ) + "Offset of field: ucontext__bindgen_ty_1__bindgen_ty_1::__padding_rt_sigset" ); } #[test] fn bindgen_test_layout_ucontext__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 8usize, - concat!("Size of: ", stringify!(ucontext__bindgen_ty_1)) + "Size of ucontext__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(ucontext__bindgen_ty_1)) + "Alignment of ucontext__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).uc_sigmask64 as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).uc_sigmask64) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(ucontext__bindgen_ty_1), - "::", - stringify!(uc_sigmask64) - ) + "Offset of field: ucontext__bindgen_ty_1::uc_sigmask64" ); } #[test] fn bindgen_test_layout_ucontext() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 228usize, - concat!("Size of: ", stringify!(ucontext)) + "Size of ucontext" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(ucontext)) + "Alignment of ucontext" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).uc_flags as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).uc_flags) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(ucontext), - "::", - stringify!(uc_flags) - ) + "Offset of field: ucontext::uc_flags" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).uc_link as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).uc_link) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(ucontext), - "::", - stringify!(uc_link) - ) + "Offset of field: ucontext::uc_link" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).uc_stack as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).uc_stack) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(ucontext), - "::", - stringify!(uc_stack) - ) + "Offset of field: ucontext::uc_stack" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).uc_mcontext as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).uc_mcontext) as usize - ptr as usize }, 20usize, - concat!( - "Offset of field: ", - stringify!(ucontext), - "::", - stringify!(uc_mcontext) - ) + "Offset of field: ucontext::uc_mcontext" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).__fpregs_mem as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).__fpregs_mem) as usize - ptr as usize }, 116usize, - concat!( - "Offset of field: ", - stringify!(ucontext), - "::", - stringify!(__fpregs_mem) - ) + "Offset of field: ucontext::__fpregs_mem" ); } pub type ucontext_t = ucontext; @@ -8710,43 +6768,36 @@ pub struct fd_set { } #[test] fn bindgen_test_layout_fd_set() { - assert_eq!( - ::std::mem::size_of::(), - 128usize, - concat!("Size of: ", stringify!(fd_set)) - ); + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!(::std::mem::size_of::(), 128usize, "Size of fd_set"); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(fd_set)) + "Alignment of fd_set" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fds_bits as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fds_bits) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(fd_set), - "::", - stringify!(fds_bits) - ) + "Offset of field: fd_set::fds_bits" ); } extern "C" { - pub fn __FD_CLR_chk(arg1: ::std::os::raw::c_int, arg2: *mut fd_set, arg3: size_t); + pub fn __FD_CLR_chk(arg1: ::std::os::raw::c_int, arg2: *mut fd_set, arg3: usize); } extern "C" { - pub fn __FD_SET_chk(arg1: ::std::os::raw::c_int, arg2: *mut fd_set, arg3: size_t); + pub fn __FD_SET_chk(arg1: ::std::os::raw::c_int, arg2: *mut fd_set, arg3: usize); } extern "C" { pub fn __FD_ISSET_chk( arg1: ::std::os::raw::c_int, arg2: *const fd_set, - arg3: size_t, + arg3: usize, ) -> ::std::os::raw::c_int; } extern "C" { pub fn select( - __fd_count: ::std::os::raw::c_int, + __max_fd_plus_one: ::std::os::raw::c_int, __read_fds: *mut fd_set, __write_fds: *mut fd_set, __exception_fds: *mut fd_set, @@ -8755,7 +6806,7 @@ extern "C" { } extern "C" { pub fn pselect( - __fd_count: ::std::os::raw::c_int, + __max_fd_plus_one: ::std::os::raw::c_int, __read_fds: *mut fd_set, __write_fds: *mut fd_set, __exception_fds: *mut fd_set, @@ -8765,7 +6816,7 @@ extern "C" { } extern "C" { pub fn pselect64( - __fd_count: ::std::os::raw::c_int, + __max_fd_plus_one: ::std::os::raw::c_int, __read_fds: *mut fd_set, __write_fds: *mut fd_set, __exception_fds: *mut fd_set, @@ -8830,125 +6881,64 @@ pub struct tm { } #[test] fn bindgen_test_layout_tm() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!(::std::mem::size_of::(), 44usize, "Size of tm"); + assert_eq!(::std::mem::align_of::(), 4usize, "Alignment of tm"); assert_eq!( - ::std::mem::size_of::(), - 44usize, - concat!("Size of: ", stringify!(tm)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(tm)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_sec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_sec) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_sec) - ) + "Offset of field: tm::tm_sec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_min as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_min) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_min) - ) + "Offset of field: tm::tm_min" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_hour as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_hour) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_hour) - ) + "Offset of field: tm::tm_hour" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_mday as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_mday) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_mday) - ) + "Offset of field: tm::tm_mday" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_mon as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_mon) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_mon) - ) + "Offset of field: tm::tm_mon" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_year as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_year) as usize - ptr as usize }, 20usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_year) - ) + "Offset of field: tm::tm_year" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_wday as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_wday) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_wday) - ) + "Offset of field: tm::tm_wday" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_yday as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_yday) as usize - ptr as usize }, 28usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_yday) - ) + "Offset of field: tm::tm_yday" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_isdst as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_isdst) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_isdst) - ) + "Offset of field: tm::tm_isdst" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_gmtoff as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_gmtoff) as usize - ptr as usize }, 36usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_gmtoff) - ) + "Offset of field: tm::tm_gmtoff" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_zone as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_zone) as usize - ptr as usize }, 40usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_zone) - ) + "Offset of field: tm::tm_zone" ); } extern "C" { @@ -8981,12 +6971,18 @@ extern "C" { extern "C" { pub fn localtime_r(__t: *const time_t, __tm: *mut tm) -> *mut tm; } +extern "C" { + pub fn timelocal(__tm: *mut tm) -> time_t; +} extern "C" { pub fn gmtime(__t: *const time_t) -> *mut tm; } extern "C" { pub fn gmtime_r(__t: *const time_t, __tm: *mut tm) -> *mut tm; } +extern "C" { + pub fn timegm(__tm: *mut tm) -> time_t; +} extern "C" { pub fn strptime( __s: *const ::std::os::raw::c_char, @@ -9005,19 +7001,19 @@ extern "C" { extern "C" { pub fn strftime( __buf: *mut ::std::os::raw::c_char, - __n: size_t, + __n: usize, __fmt: *const ::std::os::raw::c_char, __tm: *const tm, - ) -> size_t; + ) -> usize; } extern "C" { pub fn strftime_l( __buf: *mut ::std::os::raw::c_char, - __n: size_t, + __n: usize, __fmt: *const ::std::os::raw::c_char, __tm: *const tm, __l: locale_t, - ) -> size_t; + ) -> usize; } extern "C" { pub fn ctime(__t: *const time_t) -> *mut ::std::os::raw::c_char; @@ -9073,19 +7069,19 @@ extern "C" { ) -> ::std::os::raw::c_int; } extern "C" { - pub fn timer_gettime(__timer: timer_t, __ts: *mut itimerspec) -> ::std::os::raw::c_int; + pub fn timer_gettime(_timer: timer_t, __ts: *mut itimerspec) -> ::std::os::raw::c_int; } extern "C" { pub fn timer_getoverrun(__timer: timer_t) -> ::std::os::raw::c_int; } extern "C" { - pub fn timelocal(__tm: *mut tm) -> time_t; -} -extern "C" { - pub fn timegm(__tm: *mut tm) -> time_t; + pub fn timespec_get( + __ts: *mut timespec, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; } extern "C" { - pub fn timespec_get( + pub fn timespec_getres( __ts: *mut timespec, __base: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; @@ -9126,98 +7122,78 @@ pub struct clone_args { pub stack: __u64, pub stack_size: __u64, pub tls: __u64, + pub set_tid: __u64, + pub set_tid_size: __u64, + pub cgroup: __u64, } #[test] fn bindgen_test_layout_clone_args() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), - 64usize, - concat!("Size of: ", stringify!(clone_args)) + 88usize, + "Size of clone_args" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(clone_args)) + "Alignment of clone_args" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(clone_args), - "::", - stringify!(flags) - ) + "Offset of field: clone_args::flags" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).pidfd as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).pidfd) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(clone_args), - "::", - stringify!(pidfd) - ) + "Offset of field: clone_args::pidfd" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).child_tid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).child_tid) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(clone_args), - "::", - stringify!(child_tid) - ) + "Offset of field: clone_args::child_tid" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).parent_tid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).parent_tid) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(clone_args), - "::", - stringify!(parent_tid) - ) + "Offset of field: clone_args::parent_tid" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).exit_signal as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).exit_signal) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(clone_args), - "::", - stringify!(exit_signal) - ) + "Offset of field: clone_args::exit_signal" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).stack as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).stack) as usize - ptr as usize }, 40usize, - concat!( - "Offset of field: ", - stringify!(clone_args), - "::", - stringify!(stack) - ) + "Offset of field: clone_args::stack" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).stack_size as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).stack_size) as usize - ptr as usize }, 48usize, - concat!( - "Offset of field: ", - stringify!(clone_args), - "::", - stringify!(stack_size) - ) + "Offset of field: clone_args::stack_size" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tls as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tls) as usize - ptr as usize }, 56usize, - concat!( - "Offset of field: ", - stringify!(clone_args), - "::", - stringify!(tls) - ) + "Offset of field: clone_args::tls" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).set_tid) as usize - ptr as usize }, + 64usize, + "Offset of field: clone_args::set_tid" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).set_tid_size) as usize - ptr as usize }, + 72usize, + "Offset of field: clone_args::set_tid_size" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).cgroup) as usize - ptr as usize }, + 80usize, + "Offset of field: clone_args::cgroup" ); } #[repr(C)] @@ -9227,25 +7203,22 @@ pub struct sched_param { } #[test] fn bindgen_test_layout_sched_param() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 4usize, - concat!("Size of: ", stringify!(sched_param)) + "Size of sched_param" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(sched_param)) + "Alignment of sched_param" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sched_priority as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sched_priority) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sched_param), - "::", - stringify!(sched_priority) - ) + "Offset of field: sched_param::sched_priority" ); } extern "C" { @@ -9276,356 +7249,207 @@ extern "C" { extern "C" { pub fn sched_rr_get_interval(__pid: pid_t, __quantum: *mut timespec) -> ::std::os::raw::c_int; } -pub const PTHREAD_MUTEX_NORMAL: ::std::os::raw::c_uint = 0; -pub const PTHREAD_MUTEX_RECURSIVE: ::std::os::raw::c_uint = 1; -pub const PTHREAD_MUTEX_ERRORCHECK: ::std::os::raw::c_uint = 2; -pub const PTHREAD_MUTEX_ERRORCHECK_NP: ::std::os::raw::c_uint = 2; -pub const PTHREAD_MUTEX_RECURSIVE_NP: ::std::os::raw::c_uint = 1; -pub const PTHREAD_MUTEX_DEFAULT: ::std::os::raw::c_uint = 0; +pub const PTHREAD_MUTEX_NORMAL: _bindgen_ty_23 = 0; +pub const PTHREAD_MUTEX_RECURSIVE: _bindgen_ty_23 = 1; +pub const PTHREAD_MUTEX_ERRORCHECK: _bindgen_ty_23 = 2; +pub const PTHREAD_MUTEX_ERRORCHECK_NP: _bindgen_ty_23 = 2; +pub const PTHREAD_MUTEX_RECURSIVE_NP: _bindgen_ty_23 = 1; +pub const PTHREAD_MUTEX_DEFAULT: _bindgen_ty_23 = 0; pub type _bindgen_ty_23 = ::std::os::raw::c_uint; -pub const PTHREAD_RWLOCK_PREFER_READER_NP: ::std::os::raw::c_uint = 0; -pub const PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP: ::std::os::raw::c_uint = 1; +pub const PTHREAD_RWLOCK_PREFER_READER_NP: _bindgen_ty_24 = 0; +pub const PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP: _bindgen_ty_24 = 1; pub type _bindgen_ty_24 = ::std::os::raw::c_uint; -pub type __pthread_cleanup_func_t = - ::std::option::Option; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct __pthread_cleanup_t { pub __cleanup_prev: *mut __pthread_cleanup_t, - pub __cleanup_routine: __pthread_cleanup_func_t, + pub __cleanup_routine: + ::std::option::Option, pub __cleanup_arg: *mut ::std::os::raw::c_void, } #[test] fn bindgen_test_layout___pthread_cleanup_t() { + const UNINIT: ::std::mem::MaybeUninit<__pthread_cleanup_t> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__pthread_cleanup_t>(), 12usize, - concat!("Size of: ", stringify!(__pthread_cleanup_t)) + "Size of __pthread_cleanup_t" ); assert_eq!( ::std::mem::align_of::<__pthread_cleanup_t>(), 4usize, - concat!("Alignment of ", stringify!(__pthread_cleanup_t)) + "Alignment of __pthread_cleanup_t" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__pthread_cleanup_t>())).__cleanup_prev as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).__cleanup_prev) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__pthread_cleanup_t), - "::", - stringify!(__cleanup_prev) - ) + "Offset of field: __pthread_cleanup_t::__cleanup_prev" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__pthread_cleanup_t>())).__cleanup_routine as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).__cleanup_routine) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(__pthread_cleanup_t), - "::", - stringify!(__cleanup_routine) - ) + "Offset of field: __pthread_cleanup_t::__cleanup_routine" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__pthread_cleanup_t>())).__cleanup_arg as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).__cleanup_arg) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__pthread_cleanup_t), - "::", - stringify!(__cleanup_arg) - ) + "Offset of field: __pthread_cleanup_t::__cleanup_arg" ); } extern "C" { pub fn __pthread_cleanup_push( c: *mut __pthread_cleanup_t, - arg1: __pthread_cleanup_func_t, + arg1: ::std::option::Option, arg2: *mut ::std::os::raw::c_void, ); } extern "C" { pub fn __pthread_cleanup_pop(arg1: *mut __pthread_cleanup_t, arg2: ::std::os::raw::c_int); } -#[doc = " Data associated with an ALooper fd that will be returned as the \"outData\""] -#[doc = " when that source has data ready."] +#[doc = " Data associated with an ALooper fd that will be returned as the \"outData\"\n when that source has data ready."] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct android_poll_source { - #[doc = " The identifier of this source. May be LOOPER_ID_MAIN or"] - #[doc = " LOOPER_ID_INPUT."] + #[doc = " The identifier of this source. May be LOOPER_ID_MAIN or\n LOOPER_ID_INPUT."] pub id: i32, #[doc = " The android_app this ident is associated with."] pub app: *mut android_app, - #[doc = " Function to call to perform the standard processing of data from"] - #[doc = " this source."] + #[doc = " Function to call to perform the standard processing of data from\n this source."] pub process: ::std::option::Option< unsafe extern "C" fn(app: *mut android_app, source: *mut android_poll_source), >, } #[test] fn bindgen_test_layout_android_poll_source() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 12usize, - concat!("Size of: ", stringify!(android_poll_source)) + "Size of android_poll_source" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(android_poll_source)) + "Alignment of android_poll_source" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).id as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).id) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(android_poll_source), - "::", - stringify!(id) - ) + "Offset of field: android_poll_source::id" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).app as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).app) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(android_poll_source), - "::", - stringify!(app) - ) + "Offset of field: android_poll_source::app" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).process as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).process) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(android_poll_source), - "::", - stringify!(process) - ) + "Offset of field: android_poll_source::process" ); } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct android_input_buffer { - #[doc = " Pointer to a read-only array of pointers to GameActivityMotionEvent."] - #[doc = " Only the first motionEventsCount events are valid."] - pub motionEvents: [GameActivityMotionEvent; 16usize], + #[doc = " Pointer to a read-only array of GameActivityMotionEvent.\n Only the first motionEventsCount events are valid."] + pub motionEvents: *mut GameActivityMotionEvent, #[doc = " The number of valid motion events in `motionEvents`."] pub motionEventsCount: u64, - #[doc = " Pointer to a read-only array of pointers to GameActivityHistoricalPointerAxes."] - #[doc = ""] - #[doc = " Only the first historicalSamplesCount samples are valid."] - #[doc = " Refer to event->historicalStart, event->pointerCount and event->historicalCount"] - #[doc = " to access the specific samples that relate to an event."] - #[doc = ""] - #[doc = " Each slice of samples for one event has a length of"] - #[doc = " (event->pointerCount and event->historicalCount) and is in pointer-major"] - #[doc = " order so the historic samples for each pointer are contiguous."] - #[doc = " E.g. you would access historic sample index 3 for pointer 2 of an event with:"] - #[doc = ""] - #[doc = " historicalAxisSamples[event->historicalStart + (event->historicalCount * 2) + 3];"] - pub historicalAxisSamples: [GameActivityHistoricalPointerAxes; 64usize], - #[doc = " The number of valid historical samples in `historicalAxisSamples`."] - pub historicalSamplesCount: u64, - #[doc = " Pointer to a read-only array of pointers to GameActivityKeyEvent."] - #[doc = " Only the first keyEventsCount events are valid."] - pub keyEvents: [GameActivityKeyEvent; 4usize], + #[doc = " The size of the `motionEvents` buffer."] + pub motionEventsBufferSize: u64, + #[doc = " Pointer to a read-only array of GameActivityKeyEvent.\n Only the first keyEventsCount events are valid."] + pub keyEvents: *mut GameActivityKeyEvent, #[doc = " The number of valid \"Key\" events in `keyEvents`."] pub keyEventsCount: u64, + #[doc = " The size of the `keyEvents` buffer."] + pub keyEventsBufferSize: u64, } #[test] fn bindgen_test_layout_android_input_buffer() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), - 40744usize, - concat!("Size of: ", stringify!(android_input_buffer)) + 40usize, + "Size of android_input_buffer" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(android_input_buffer)) + "Alignment of android_input_buffer" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).motionEvents as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).motionEvents) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(android_input_buffer), - "::", - stringify!(motionEvents) - ) + "Offset of field: android_input_buffer::motionEvents" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).motionEventsCount as *const _ as usize - }, - 27712usize, - concat!( - "Offset of field: ", - stringify!(android_input_buffer), - "::", - stringify!(motionEventsCount) - ) + unsafe { ::std::ptr::addr_of!((*ptr).motionEventsCount) as usize - ptr as usize }, + 4usize, + "Offset of field: android_input_buffer::motionEventsCount" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).historicalAxisSamples as *const _ - as usize - }, - 27720usize, - concat!( - "Offset of field: ", - stringify!(android_input_buffer), - "::", - stringify!(historicalAxisSamples) - ) + unsafe { ::std::ptr::addr_of!((*ptr).motionEventsBufferSize) as usize - ptr as usize }, + 12usize, + "Offset of field: android_input_buffer::motionEventsBufferSize" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).historicalSamplesCount as *const _ - as usize - }, - 40520usize, - concat!( - "Offset of field: ", - stringify!(android_input_buffer), - "::", - stringify!(historicalSamplesCount) - ) + unsafe { ::std::ptr::addr_of!((*ptr).keyEvents) as usize - ptr as usize }, + 20usize, + "Offset of field: android_input_buffer::keyEvents" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).keyEvents as *const _ as usize }, - 40528usize, - concat!( - "Offset of field: ", - stringify!(android_input_buffer), - "::", - stringify!(keyEvents) - ) + unsafe { ::std::ptr::addr_of!((*ptr).keyEventsCount) as usize - ptr as usize }, + 24usize, + "Offset of field: android_input_buffer::keyEventsCount" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).keyEventsCount as *const _ as usize - }, - 40736usize, - concat!( - "Offset of field: ", - stringify!(android_input_buffer), - "::", - stringify!(keyEventsCount) - ) - ); -} -#[doc = " Function pointer declaration for the filtering of key events."] -#[doc = " A function with this signature should be passed to"] -#[doc = " android_app_set_key_event_filter and return false for any events that should"] -#[doc = " not be handled by android_native_app_glue. These events will be handled by"] -#[doc = " the system instead."] + unsafe { ::std::ptr::addr_of!((*ptr).keyEventsBufferSize) as usize - ptr as usize }, + 32usize, + "Offset of field: android_input_buffer::keyEventsBufferSize" + ); +} +#[doc = " Function pointer declaration for the filtering of key events.\n A function with this signature should be passed to\n android_app_set_key_event_filter and return false for any events that should\n not be handled by android_native_app_glue. These events will be handled by\n the system instead."] pub type android_key_event_filter = ::std::option::Option bool>; -#[doc = " Function pointer definition for the filtering of motion events."] -#[doc = " A function with this signature should be passed to"] -#[doc = " android_app_set_motion_event_filter and return false for any events that"] -#[doc = " should not be handled by android_native_app_glue. These events will be"] -#[doc = " handled by the system instead."] +#[doc = " Function pointer definition for the filtering of motion events.\n A function with this signature should be passed to\n android_app_set_motion_event_filter and return false for any events that\n should not be handled by android_native_app_glue. These events will be\n handled by the system instead."] pub type android_motion_event_filter = ::std::option::Option bool>; -#[doc = " The GameActivity interface provided by "] -#[doc = " is based on a set of application-provided callbacks that will be called"] -#[doc = " by the Activity's main thread when certain events occur."] -#[doc = ""] -#[doc = " This means that each one of this callbacks _should_ _not_ block, or they"] -#[doc = " risk having the system force-close the application. This programming"] -#[doc = " model is direct, lightweight, but constraining."] -#[doc = ""] -#[doc = " The 'android_native_app_glue' static library is used to provide a different"] -#[doc = " execution model where the application can implement its own main event"] -#[doc = " loop in a different thread instead. Here's how it works:"] -#[doc = ""] -#[doc = " 1/ The application must provide a function named \"android_main()\" that"] -#[doc = " will be called when the activity is created, in a new thread that is"] -#[doc = " distinct from the activity's main thread."] -#[doc = ""] -#[doc = " 2/ android_main() receives a pointer to a valid \"android_app\" structure"] -#[doc = " that contains references to other important objects, e.g. the"] -#[doc = " GameActivity obejct instance the application is running in."] -#[doc = ""] -#[doc = " 3/ the \"android_app\" object holds an ALooper instance that already"] -#[doc = " listens to activity lifecycle events (e.g. \"pause\", \"resume\")."] -#[doc = " See APP_CMD_XXX declarations below."] -#[doc = ""] -#[doc = " This corresponds to an ALooper identifier returned by"] -#[doc = " ALooper_pollOnce with value LOOPER_ID_MAIN."] -#[doc = ""] -#[doc = " Your application can use the same ALooper to listen to additional"] -#[doc = " file-descriptors. They can either be callback based, or with return"] -#[doc = " identifiers starting with LOOPER_ID_USER."] -#[doc = ""] -#[doc = " 4/ Whenever you receive a LOOPER_ID_MAIN event,"] -#[doc = " the returned data will point to an android_poll_source structure. You"] -#[doc = " can call the process() function on it, and fill in android_app->onAppCmd"] -#[doc = " to be called for your own processing of the event."] -#[doc = ""] -#[doc = " Alternatively, you can call the low-level functions to read and process"] -#[doc = " the data directly... look at the process_cmd() and process_input()"] -#[doc = " implementations in the glue to see how to do this."] -#[doc = ""] -#[doc = " See the sample named \"native-activity\" that comes with the NDK with a"] -#[doc = " full usage example. Also look at the documentation of GameActivity."] +#[doc = " The GameActivity interface provided by \n is based on a set of application-provided callbacks that will be called\n by the Activity's main thread when certain events occur.\n\n This means that each one of this callbacks _should_ _not_ block, or they\n risk having the system force-close the application. This programming\n model is direct, lightweight, but constraining.\n\n The 'android_native_app_glue' static library is used to provide a different\n execution model where the application can implement its own main event\n loop in a different thread instead. Here's how it works:\n\n 1/ The application must provide a function named \"android_main()\" that\n will be called when the activity is created, in a new thread that is\n distinct from the activity's main thread.\n\n 2/ android_main() receives a pointer to a valid \"android_app\" structure\n that contains references to other important objects, e.g. the\n GameActivity obejct instance the application is running in.\n\n 3/ the \"android_app\" object holds an ALooper instance that already\n listens to activity lifecycle events (e.g. \"pause\", \"resume\").\n See APP_CMD_XXX declarations below.\n\n This corresponds to an ALooper identifier returned by\n ALooper_pollOnce with value LOOPER_ID_MAIN.\n\n Your application can use the same ALooper to listen to additional\n file-descriptors. They can either be callback based, or with return\n identifiers starting with LOOPER_ID_USER.\n\n 4/ Whenever you receive a LOOPER_ID_MAIN event,\n the returned data will point to an android_poll_source structure. You\n can call the process() function on it, and fill in android_app->onAppCmd\n to be called for your own processing of the event.\n\n Alternatively, you can call the low-level functions to read and process\n the data directly... look at the process_cmd() and process_input()\n implementations in the glue to see how to do this.\n\n See the sample named \"native-activity\" that comes with the NDK with a\n full usage example. Also look at the documentation of GameActivity."] #[repr(C)] pub struct android_app { #[doc = " An optional pointer to application-defined state."] pub userData: *mut ::std::os::raw::c_void, - #[doc = " A required callback for processing main app commands (`APP_CMD_*`)."] - #[doc = " This is called each frame if there are app commands that need processing."] + #[doc = " A required callback for processing main app commands (`APP_CMD_*`).\n This is called each frame if there are app commands that need processing."] pub onAppCmd: ::std::option::Option, #[doc = " The GameActivity object instance that this app is running in."] pub activity: *mut GameActivity, #[doc = " The current configuration the app is running in."] pub config: *mut AConfiguration, - #[doc = " The last activity saved state, as provided at creation time."] - #[doc = " It is NULL if there was no state. You can use this as you need; the"] - #[doc = " memory will remain around until you call android_app_exec_cmd() for"] - #[doc = " APP_CMD_RESUME, at which point it will be freed and savedState set to"] - #[doc = " NULL. These variables should only be changed when processing a"] - #[doc = " APP_CMD_SAVE_STATE, at which point they will be initialized to NULL and"] - #[doc = " you can malloc your state and place the information here. In that case"] - #[doc = " the memory will be freed for you later."] + #[doc = " The last activity saved state, as provided at creation time.\n It is NULL if there was no state. You can use this as you need; the\n memory will remain around until you call android_app_exec_cmd() for\n APP_CMD_RESUME, at which point it will be freed and savedState set to\n NULL. These variables should only be changed when processing a\n APP_CMD_SAVE_STATE, at which point they will be initialized to NULL and\n you can malloc your state and place the information here. In that case\n the memory will be freed for you later."] pub savedState: *mut ::std::os::raw::c_void, #[doc = " The size of the activity saved state. It is 0 if `savedState` is NULL."] - pub savedStateSize: size_t, + pub savedStateSize: usize, #[doc = " The ALooper associated with the app's thread."] pub looper: *mut ALooper, #[doc = " When non-NULL, this is the window surface that the app can draw in."] pub window: *mut ANativeWindow, - #[doc = " Current content rectangle of the window; this is the area where the"] - #[doc = " window's content should be placed to be seen by the user."] + #[doc = " Current content rectangle of the window; this is the area where the\n window's content should be placed to be seen by the user."] pub contentRect: ARect, - #[doc = " Current state of the app's activity. May be either APP_CMD_START,"] - #[doc = " APP_CMD_RESUME, APP_CMD_PAUSE, or APP_CMD_STOP."] + #[doc = " Whether the software keyboard is visible or not."] + 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 = " 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"] - #[doc = " destroyed and waiting for the app thread to complete."] + #[doc = " This is non-zero when the application's GameActivity is being\n destroyed and waiting for the app thread to complete."] pub destroyRequested: ::std::os::raw::c_int, - #[doc = " This is used for buffering input from GameActivity. Once ready, the"] - #[doc = " application thread switches the buffers and processes what was"] - #[doc = " accumulated."] + #[doc = " This is used for buffering input from GameActivity. Once ready, the\n application thread switches the buffers and processes what was\n accumulated."] pub inputBuffers: [android_input_buffer; 2usize], pub currentInputBuffer: ::std::os::raw::c_int, - #[doc = " 0 if no text input event is outstanding, 1 if it is."] - #[doc = " Use `GameActivity_getTextInputState` to get information"] - #[doc = " about the text entered by the user."] + #[doc = " 0 if no text input event is outstanding, 1 if it is.\n Use `GameActivity_getTextInputState` to get information\n about the text entered by the user."] pub textInputState: ::std::os::raw::c_int, #[doc = " @cond INTERNAL"] pub mutex: pthread_mutex_t, @@ -9647,457 +7471,273 @@ pub struct android_app { } #[test] fn bindgen_test_layout_android_app() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), - 81632usize, - concat!("Size of: ", stringify!(android_app)) + 232usize, + "Size of android_app" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(android_app)) + "Alignment of android_app" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).userData as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).userData) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(userData) - ) + "Offset of field: android_app::userData" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).onAppCmd as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).onAppCmd) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(onAppCmd) - ) + "Offset of field: android_app::onAppCmd" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).activity as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).activity) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(activity) - ) + "Offset of field: android_app::activity" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).config as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).config) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(config) - ) + "Offset of field: android_app::config" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).savedState as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).savedState) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(savedState) - ) + "Offset of field: android_app::savedState" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).savedStateSize as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).savedStateSize) as usize - ptr as usize }, 20usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(savedStateSize) - ) + "Offset of field: android_app::savedStateSize" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).looper as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).looper) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(looper) - ) + "Offset of field: android_app::looper" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).window as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).window) as usize - ptr as usize }, 28usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(window) - ) + "Offset of field: android_app::window" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).contentRect as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).contentRect) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(contentRect) - ) + "Offset of field: android_app::contentRect" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).activityState as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).softwareKeyboardVisible) as usize - ptr as usize }, 48usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(activityState) - ) + "Offset of field: android_app::softwareKeyboardVisible" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).destroyRequested as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).editorAction) as usize - ptr as usize }, 52usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(destroyRequested) - ) + "Offset of field: android_app::editorAction" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).inputBuffers as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).activityState) as usize - ptr as usize }, 56usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(inputBuffers) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).currentInputBuffer as *const _ as usize }, - 81544usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(currentInputBuffer) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).textInputState as *const _ as usize }, - 81548usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(textInputState) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).mutex as *const _ as usize }, - 81552usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(mutex) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).cond as *const _ as usize }, - 81556usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(cond) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).msgread as *const _ as usize }, - 81560usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(msgread) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).msgwrite as *const _ as usize }, - 81564usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(msgwrite) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).thread as *const _ as usize }, - 81568usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(thread) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).cmdPollSource as *const _ as usize }, - 81572usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(cmdPollSource) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).running as *const _ as usize }, - 81584usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(running) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).stateSaved as *const _ as usize }, - 81588usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(stateSaved) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).destroyed as *const _ as usize }, - 81592usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(destroyed) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).redrawNeeded as *const _ as usize }, - 81596usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(redrawNeeded) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).pendingWindow as *const _ as usize }, - 81600usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(pendingWindow) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).pendingContentRect as *const _ as usize }, - 81604usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(pendingContentRect) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).keyEventFilter as *const _ as usize }, - 81620usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(keyEventFilter) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).motionEventFilter as *const _ as usize }, - 81624usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(motionEventFilter) - ) + "Offset of field: android_app::activityState" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).inputAvailableWakeUp as *const _ as usize - }, - 81628usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(inputAvailableWakeUp) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).inputSwapPending as *const _ as usize }, - 81629usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(inputSwapPending) - ) - ); -} -#[doc = " Looper data ID of commands coming from the app's main thread, which"] -#[doc = " is returned as an identifier from ALooper_pollOnce(). The data for this"] -#[doc = " identifier is a pointer to an android_poll_source structure."] -#[doc = " These can be retrieved and processed with android_app_read_cmd()"] -#[doc = " and android_app_exec_cmd()."] + unsafe { ::std::ptr::addr_of!((*ptr).destroyRequested) as usize - ptr as usize }, + 60usize, + "Offset of field: android_app::destroyRequested" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).inputBuffers) as usize - ptr as usize }, + 64usize, + "Offset of field: android_app::inputBuffers" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).currentInputBuffer) as usize - ptr as usize }, + 144usize, + "Offset of field: android_app::currentInputBuffer" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).textInputState) as usize - ptr as usize }, + 148usize, + "Offset of field: android_app::textInputState" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mutex) as usize - ptr as usize }, + 152usize, + "Offset of field: android_app::mutex" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).cond) as usize - ptr as usize }, + 156usize, + "Offset of field: android_app::cond" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).msgread) as usize - ptr as usize }, + 160usize, + "Offset of field: android_app::msgread" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).msgwrite) as usize - ptr as usize }, + 164usize, + "Offset of field: android_app::msgwrite" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).thread) as usize - ptr as usize }, + 168usize, + "Offset of field: android_app::thread" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).cmdPollSource) as usize - ptr as usize }, + 172usize, + "Offset of field: android_app::cmdPollSource" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).running) as usize - ptr as usize }, + 184usize, + "Offset of field: android_app::running" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).stateSaved) as usize - ptr as usize }, + 188usize, + "Offset of field: android_app::stateSaved" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).destroyed) as usize - ptr as usize }, + 192usize, + "Offset of field: android_app::destroyed" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).redrawNeeded) as usize - ptr as usize }, + 196usize, + "Offset of field: android_app::redrawNeeded" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pendingWindow) as usize - ptr as usize }, + 200usize, + "Offset of field: android_app::pendingWindow" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pendingContentRect) as usize - ptr as usize }, + 204usize, + "Offset of field: android_app::pendingContentRect" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).keyEventFilter) as usize - ptr as usize }, + 220usize, + "Offset of field: android_app::keyEventFilter" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).motionEventFilter) as usize - ptr as usize }, + 224usize, + "Offset of field: android_app::motionEventFilter" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).inputAvailableWakeUp) as usize - ptr as usize }, + 228usize, + "Offset of field: android_app::inputAvailableWakeUp" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).inputSwapPending) as usize - ptr as usize }, + 229usize, + "Offset of field: android_app::inputSwapPending" + ); +} +#[doc = " Looper data ID of commands coming from the app's main thread, which\n is returned as an identifier from ALooper_pollOnce(). The data for this\n identifier is a pointer to an android_poll_source structure.\n These can be retrieved and processed with android_app_read_cmd()\n and android_app_exec_cmd()."] pub const NativeAppGlueLooperId_LOOPER_ID_MAIN: NativeAppGlueLooperId = 1; -#[doc = " Unused. Reserved for future use when usage of AInputQueue will be"] -#[doc = " supported."] +#[doc = " Unused. Reserved for future use when usage of AInputQueue will be\n supported."] pub const NativeAppGlueLooperId_LOOPER_ID_INPUT: NativeAppGlueLooperId = 2; #[doc = " Start of user-defined ALooper identifiers."] pub const NativeAppGlueLooperId_LOOPER_ID_USER: NativeAppGlueLooperId = 3; -#[doc = " Looper ID of commands coming from the app's main thread, an AInputQueue or"] -#[doc = " user-defined sources."] -pub type NativeAppGlueLooperId = ::std::os::raw::c_uint; -#[doc = " Unused. Reserved for future use when usage of AInputQueue will be"] -#[doc = " supported."] +#[doc = " Looper ID of commands coming from the app's main thread, an AInputQueue or\n user-defined sources."] +pub type NativeAppGlueLooperId = i8; +#[doc = " Unused. Reserved for future use when usage of AInputQueue will be\n supported."] pub const NativeAppGlueAppCmd_UNUSED_APP_CMD_INPUT_CHANGED: NativeAppGlueAppCmd = 0; -#[doc = " Command from main thread: a new ANativeWindow is ready for use. Upon"] -#[doc = " receiving this command, android_app->window will contain the new window"] -#[doc = " surface."] +#[doc = " Command from main thread: a new ANativeWindow is ready for use. Upon\n receiving this command, android_app->window will contain the new window\n surface."] pub const NativeAppGlueAppCmd_APP_CMD_INIT_WINDOW: NativeAppGlueAppCmd = 1; -#[doc = " Command from main thread: the existing ANativeWindow needs to be"] -#[doc = " terminated. Upon receiving this command, android_app->window still"] -#[doc = " contains the existing window; after calling android_app_exec_cmd"] -#[doc = " it will be set to NULL."] +#[doc = " Command from main thread: the existing ANativeWindow needs to be\n terminated. Upon receiving this command, android_app->window still\n contains the existing window; after calling android_app_exec_cmd\n it will be set to NULL."] pub const NativeAppGlueAppCmd_APP_CMD_TERM_WINDOW: NativeAppGlueAppCmd = 2; -#[doc = " Command from main thread: the current ANativeWindow has been resized."] -#[doc = " Please redraw with its new size."] +#[doc = " Command from main thread: the current ANativeWindow has been resized.\n Please redraw with its new size."] pub const NativeAppGlueAppCmd_APP_CMD_WINDOW_RESIZED: NativeAppGlueAppCmd = 3; -#[doc = " Command from main thread: the system needs that the current ANativeWindow"] -#[doc = " be redrawn. You should redraw the window before handing this to"] -#[doc = " android_app_exec_cmd() in order to avoid transient drawing glitches."] +#[doc = " Command from main thread: the system needs that the current ANativeWindow\n be redrawn. You should redraw the window before handing this to\n android_app_exec_cmd() in order to avoid transient drawing glitches."] pub const NativeAppGlueAppCmd_APP_CMD_WINDOW_REDRAW_NEEDED: NativeAppGlueAppCmd = 4; -#[doc = " Command from main thread: the content area of the window has changed,"] -#[doc = " such as from the soft input window being shown or hidden. You can"] -#[doc = " find the new content rect in android_app::contentRect."] +#[doc = " Command from main thread: the content area of the window has changed,\n such as from the soft input window being shown or hidden. You can\n find the new content rect in android_app::contentRect."] pub const NativeAppGlueAppCmd_APP_CMD_CONTENT_RECT_CHANGED: NativeAppGlueAppCmd = 5; -#[doc = " Command from main thread: the app's activity window has gained"] -#[doc = " input focus."] -pub const NativeAppGlueAppCmd_APP_CMD_GAINED_FOCUS: NativeAppGlueAppCmd = 6; -#[doc = " Command from main thread: the app's activity window has lost"] -#[doc = " input focus."] -pub const NativeAppGlueAppCmd_APP_CMD_LOST_FOCUS: NativeAppGlueAppCmd = 7; +#[doc = " Command from main thread: the software keyboard was shown or hidden."] +pub const NativeAppGlueAppCmd_APP_CMD_SOFTWARE_KB_VIS_CHANGED: NativeAppGlueAppCmd = 6; +#[doc = " Command from main thread: the app's activity window has gained\n input focus."] +pub const NativeAppGlueAppCmd_APP_CMD_GAINED_FOCUS: NativeAppGlueAppCmd = 7; +#[doc = " Command from main thread: the app's activity window has lost\n input focus."] +pub const NativeAppGlueAppCmd_APP_CMD_LOST_FOCUS: NativeAppGlueAppCmd = 8; #[doc = " Command from main thread: the current device configuration has changed."] -pub const NativeAppGlueAppCmd_APP_CMD_CONFIG_CHANGED: NativeAppGlueAppCmd = 8; -#[doc = " Command from main thread: the system is running low on memory."] -#[doc = " Try to reduce your memory use."] -pub const NativeAppGlueAppCmd_APP_CMD_LOW_MEMORY: NativeAppGlueAppCmd = 9; +pub const NativeAppGlueAppCmd_APP_CMD_CONFIG_CHANGED: NativeAppGlueAppCmd = 9; +#[doc = " Command from main thread: the system is running low on memory.\n Try to reduce your memory use."] +pub const NativeAppGlueAppCmd_APP_CMD_LOW_MEMORY: NativeAppGlueAppCmd = 10; #[doc = " Command from main thread: the app's activity has been started."] -pub const NativeAppGlueAppCmd_APP_CMD_START: NativeAppGlueAppCmd = 10; +pub const NativeAppGlueAppCmd_APP_CMD_START: NativeAppGlueAppCmd = 11; #[doc = " Command from main thread: the app's activity has been resumed."] -pub const NativeAppGlueAppCmd_APP_CMD_RESUME: NativeAppGlueAppCmd = 11; -#[doc = " Command from main thread: the app should generate a new saved state"] -#[doc = " for itself, to restore from later if needed. If you have saved state,"] -#[doc = " allocate it with malloc and place it in android_app.savedState with"] -#[doc = " the size in android_app.savedStateSize. The will be freed for you"] -#[doc = " later."] -pub const NativeAppGlueAppCmd_APP_CMD_SAVE_STATE: NativeAppGlueAppCmd = 12; +pub const NativeAppGlueAppCmd_APP_CMD_RESUME: NativeAppGlueAppCmd = 12; +#[doc = " Command from main thread: the app should generate a new saved state\n for itself, to restore from later if needed. If you have saved state,\n allocate it with malloc and place it in android_app.savedState with\n the size in android_app.savedStateSize. The will be freed for you\n later."] +pub const NativeAppGlueAppCmd_APP_CMD_SAVE_STATE: NativeAppGlueAppCmd = 13; #[doc = " Command from main thread: the app's activity has been paused."] -pub const NativeAppGlueAppCmd_APP_CMD_PAUSE: NativeAppGlueAppCmd = 13; +pub const NativeAppGlueAppCmd_APP_CMD_PAUSE: NativeAppGlueAppCmd = 14; #[doc = " Command from main thread: the app's activity has been stopped."] -pub const NativeAppGlueAppCmd_APP_CMD_STOP: NativeAppGlueAppCmd = 14; -#[doc = " Command from main thread: the app's activity is being destroyed,"] -#[doc = " and waiting for the app thread to clean up and exit before proceeding."] -pub const NativeAppGlueAppCmd_APP_CMD_DESTROY: NativeAppGlueAppCmd = 15; +pub const NativeAppGlueAppCmd_APP_CMD_STOP: NativeAppGlueAppCmd = 15; +#[doc = " Command from main thread: the app's activity is being destroyed,\n and waiting for the app thread to clean up and exit before proceeding."] +pub const NativeAppGlueAppCmd_APP_CMD_DESTROY: NativeAppGlueAppCmd = 16; #[doc = " Command from main thread: the app's insets have changed."] -pub const NativeAppGlueAppCmd_APP_CMD_WINDOW_INSETS_CHANGED: NativeAppGlueAppCmd = 16; -#[doc = " Commands passed from the application's main Java thread to the game's thread."] -pub type NativeAppGlueAppCmd = ::std::os::raw::c_uint; +pub const NativeAppGlueAppCmd_APP_CMD_WINDOW_INSETS_CHANGED: NativeAppGlueAppCmd = 17; +#[doc = " Commands passed from the application's main Java thread to the game's thread.\n\n Values from 0 to 127 are reserved for this library; values from -128 to -1\n can be used for custom user's events."] +pub type NativeAppGlueAppCmd = i8; extern "C" { - #[doc = " Call when ALooper_pollAll() returns LOOPER_ID_MAIN, reading the next"] - #[doc = " app command message."] + #[doc = " Call when ALooper_pollAll() returns LOOPER_ID_MAIN, reading the next\n app command message."] pub fn android_app_read_cmd(android_app: *mut android_app) -> i8; } extern "C" { - #[doc = " Call with the command returned by android_app_read_cmd() to do the"] - #[doc = " initial pre-processing of the given command. You can perform your own"] - #[doc = " actions for the command after calling this function."] + #[doc = " Call with the command returned by android_app_read_cmd() to do the\n initial pre-processing of the given command. You can perform your own\n actions for the command after calling this function."] pub fn android_app_pre_exec_cmd(android_app: *mut android_app, cmd: i8); } extern "C" { - #[doc = " Call with the command returned by android_app_read_cmd() to do the"] - #[doc = " final post-processing of the given command. You must have done your own"] - #[doc = " actions for the command before calling this function."] + #[doc = " Call with the command returned by android_app_read_cmd() to do the\n final post-processing of the given command. You must have done your own\n actions for the command before calling this function."] pub fn android_app_post_exec_cmd(android_app: *mut android_app, cmd: i8); } extern "C" { - #[doc = " Call this before processing input events to get the events buffer."] - #[doc = " The function returns NULL if there are no events to process."] + #[doc = " Call this before processing input events to get the events buffer.\n The function returns NULL if there are no events to process."] pub fn android_app_swap_input_buffers( android_app: *mut android_app, ) -> *mut android_input_buffer; } extern "C" { - #[doc = " Clear the array of motion events that were waiting to be handled, and release"] - #[doc = " each of them."] - #[doc = ""] - #[doc = " This method should be called after you have processed the motion events in"] - #[doc = " your game loop. You should handle events at each iteration of your game loop."] + #[doc = " Clear the array of motion events that were waiting to be handled, and release\n each of them.\n\n This method should be called after you have processed the motion events in\n your game loop. You should handle events at each iteration of your game loop."] pub fn android_app_clear_motion_events(inputBuffer: *mut android_input_buffer); } extern "C" { - #[doc = " Clear the array of key events that were waiting to be handled, and release"] - #[doc = " each of them."] - #[doc = ""] - #[doc = " This method should be called after you have processed the key up events in"] - #[doc = " your game loop. You should handle events at each iteration of your game loop."] + #[doc = " Clear the array of key events that were waiting to be handled, and release\n each of them.\n\n This method should be called after you have processed the key up events in\n your game loop. You should handle events at each iteration of your game loop."] pub fn android_app_clear_key_events(inputBuffer: *mut android_input_buffer); } extern "C" { - #[doc = " This is a springboard into the Rust glue layer that wraps calling the"] - #[doc = " main entry for the app itself."] + #[doc = " This is a springboard into the Rust glue layer that wraps calling the\n main entry for the app itself."] pub fn _rust_glue_entry(app: *mut android_app); } extern "C" { - #[doc = " Set the filter to use when processing key events."] - #[doc = " Any events for which the filter returns false will be ignored by"] - #[doc = " android_native_app_glue. If filter is set to NULL, no filtering is done."] - #[doc = ""] - #[doc = " The default key filter will filter out volume and camera button presses."] + #[doc = " Set the filter to use when processing key events.\n Any events for which the filter returns false will be ignored by\n android_native_app_glue. If filter is set to NULL, no filtering is done.\n\n The default key filter will filter out volume and camera button presses."] pub fn android_app_set_key_event_filter( app: *mut android_app, filter: android_key_event_filter, ); } extern "C" { - #[doc = " Set the filter to use when processing touch and motion events."] - #[doc = " Any events for which the filter returns false will be ignored by"] - #[doc = " android_native_app_glue. If filter is set to NULL, no filtering is done."] - #[doc = ""] - #[doc = " Note that the default motion event filter will only allow touchscreen events"] - #[doc = " through, in order to mimic NativeActivity's behaviour, so for controller"] - #[doc = " events to be passed to the app, set the filter to NULL."] + #[doc = " Set the filter to use when processing touch and motion events.\n Any events for which the filter returns false will be ignored by\n android_native_app_glue. If filter is set to NULL, no filtering is done.\n\n Note that the default motion event filter will only allow touchscreen events\n through, in order to mimic NativeActivity's behaviour, so for controller\n events to be passed to the app, set the filter to NULL."] pub fn android_app_set_motion_event_filter( app: *mut android_app, filter: android_motion_event_filter, ); } +extern "C" { + #[doc = " You can send your custom events using the function below.\n\n Make sure your custom codes do not overlap with this library's ones.\n\n Values from 0 to 127 are reserved for this library; values from -128 to -1\n can be used for custom user's events."] + pub fn android_app_write_cmd(android_app: *mut android_app, cmd: i8); +} extern "C" { #[doc = " Determines if a looper wake up was due to new input becoming available"] pub fn android_app_input_available_wake_up(app: *mut android_app) -> bool; diff --git a/android-activity/src/game_activity/ffi_x86_64.rs b/android-activity/src/game_activity/ffi_x86_64.rs index 78bf9ff8..f8ac1557 100644 --- a/android-activity/src/game_activity/ffi_x86_64.rs +++ b/android-activity/src/game_activity/ffi_x86_64.rs @@ -1,4 +1,4 @@ -/* automatically generated by rust-bindgen 0.59.2 */ +/* automatically generated by rust-bindgen 0.71.1 */ pub const __BIONIC__: u32 = 1; pub const __WORDSIZE: u32 = 64; @@ -21,10 +21,15 @@ pub const __ANDROID_API_O_MR1__: u32 = 27; pub const __ANDROID_API_P__: u32 = 28; pub const __ANDROID_API_Q__: u32 = 29; pub const __ANDROID_API_R__: u32 = 30; -pub const __NDK_MAJOR__: u32 = 21; +pub const __ANDROID_API_S__: u32 = 31; +pub const __ANDROID_API_T__: u32 = 33; +pub const __ANDROID_API_U__: u32 = 34; +pub const __ANDROID_API_V__: u32 = 35; +pub const __ANDROID_NDK__: u32 = 1; +pub const __NDK_MAJOR__: u32 = 26; pub const __NDK_MINOR__: u32 = 1; pub const __NDK_BETA__: u32 = 0; -pub const __NDK_BUILD__: u32 = 6352462; +pub const __NDK_BUILD__: u32 = 10909125; pub const __NDK_CANARY__: u32 = 0; pub const INT8_MIN: i32 = -128; pub const INT8_MAX: u32 = 127; @@ -57,170 +62,230 @@ pub const WINT_MIN: u32 = 0; pub const __BITS_PER_LONG: u32 = 64; pub const __FD_SETSIZE: u32 = 1024; pub const AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT: u32 = 8; -pub const __PRI_64_prefix: &[u8; 2usize] = b"l\0"; -pub const __PRI_PTR_prefix: &[u8; 2usize] = b"l\0"; -pub const __PRI_FAST_prefix: &[u8; 2usize] = b"l\0"; -pub const PRId8: &[u8; 2usize] = b"d\0"; -pub const PRId16: &[u8; 2usize] = b"d\0"; -pub const PRId32: &[u8; 2usize] = b"d\0"; -pub const PRId64: &[u8; 3usize] = b"ld\0"; -pub const PRIdLEAST8: &[u8; 2usize] = b"d\0"; -pub const PRIdLEAST16: &[u8; 2usize] = b"d\0"; -pub const PRIdLEAST32: &[u8; 2usize] = b"d\0"; -pub const PRIdLEAST64: &[u8; 3usize] = b"ld\0"; -pub const PRIdFAST8: &[u8; 2usize] = b"d\0"; -pub const PRIdFAST16: &[u8; 3usize] = b"ld\0"; -pub const PRIdFAST32: &[u8; 3usize] = b"ld\0"; -pub const PRIdFAST64: &[u8; 3usize] = b"ld\0"; -pub const PRIdMAX: &[u8; 3usize] = b"jd\0"; -pub const PRIdPTR: &[u8; 3usize] = b"ld\0"; -pub const PRIi8: &[u8; 2usize] = b"i\0"; -pub const PRIi16: &[u8; 2usize] = b"i\0"; -pub const PRIi32: &[u8; 2usize] = b"i\0"; -pub const PRIi64: &[u8; 3usize] = b"li\0"; -pub const PRIiLEAST8: &[u8; 2usize] = b"i\0"; -pub const PRIiLEAST16: &[u8; 2usize] = b"i\0"; -pub const PRIiLEAST32: &[u8; 2usize] = b"i\0"; -pub const PRIiLEAST64: &[u8; 3usize] = b"li\0"; -pub const PRIiFAST8: &[u8; 2usize] = b"i\0"; -pub const PRIiFAST16: &[u8; 3usize] = b"li\0"; -pub const PRIiFAST32: &[u8; 3usize] = b"li\0"; -pub const PRIiFAST64: &[u8; 3usize] = b"li\0"; -pub const PRIiMAX: &[u8; 3usize] = b"ji\0"; -pub const PRIiPTR: &[u8; 3usize] = b"li\0"; -pub const PRIo8: &[u8; 2usize] = b"o\0"; -pub const PRIo16: &[u8; 2usize] = b"o\0"; -pub const PRIo32: &[u8; 2usize] = b"o\0"; -pub const PRIo64: &[u8; 3usize] = b"lo\0"; -pub const PRIoLEAST8: &[u8; 2usize] = b"o\0"; -pub const PRIoLEAST16: &[u8; 2usize] = b"o\0"; -pub const PRIoLEAST32: &[u8; 2usize] = b"o\0"; -pub const PRIoLEAST64: &[u8; 3usize] = b"lo\0"; -pub const PRIoFAST8: &[u8; 2usize] = b"o\0"; -pub const PRIoFAST16: &[u8; 3usize] = b"lo\0"; -pub const PRIoFAST32: &[u8; 3usize] = b"lo\0"; -pub const PRIoFAST64: &[u8; 3usize] = b"lo\0"; -pub const PRIoMAX: &[u8; 3usize] = b"jo\0"; -pub const PRIoPTR: &[u8; 3usize] = b"lo\0"; -pub const PRIu8: &[u8; 2usize] = b"u\0"; -pub const PRIu16: &[u8; 2usize] = b"u\0"; -pub const PRIu32: &[u8; 2usize] = b"u\0"; -pub const PRIu64: &[u8; 3usize] = b"lu\0"; -pub const PRIuLEAST8: &[u8; 2usize] = b"u\0"; -pub const PRIuLEAST16: &[u8; 2usize] = b"u\0"; -pub const PRIuLEAST32: &[u8; 2usize] = b"u\0"; -pub const PRIuLEAST64: &[u8; 3usize] = b"lu\0"; -pub const PRIuFAST8: &[u8; 2usize] = b"u\0"; -pub const PRIuFAST16: &[u8; 3usize] = b"lu\0"; -pub const PRIuFAST32: &[u8; 3usize] = b"lu\0"; -pub const PRIuFAST64: &[u8; 3usize] = b"lu\0"; -pub const PRIuMAX: &[u8; 3usize] = b"ju\0"; -pub const PRIuPTR: &[u8; 3usize] = b"lu\0"; -pub const PRIx8: &[u8; 2usize] = b"x\0"; -pub const PRIx16: &[u8; 2usize] = b"x\0"; -pub const PRIx32: &[u8; 2usize] = b"x\0"; -pub const PRIx64: &[u8; 3usize] = b"lx\0"; -pub const PRIxLEAST8: &[u8; 2usize] = b"x\0"; -pub const PRIxLEAST16: &[u8; 2usize] = b"x\0"; -pub const PRIxLEAST32: &[u8; 2usize] = b"x\0"; -pub const PRIxLEAST64: &[u8; 3usize] = b"lx\0"; -pub const PRIxFAST8: &[u8; 2usize] = b"x\0"; -pub const PRIxFAST16: &[u8; 3usize] = b"lx\0"; -pub const PRIxFAST32: &[u8; 3usize] = b"lx\0"; -pub const PRIxFAST64: &[u8; 3usize] = b"lx\0"; -pub const PRIxMAX: &[u8; 3usize] = b"jx\0"; -pub const PRIxPTR: &[u8; 3usize] = b"lx\0"; -pub const PRIX8: &[u8; 2usize] = b"X\0"; -pub const PRIX16: &[u8; 2usize] = b"X\0"; -pub const PRIX32: &[u8; 2usize] = b"X\0"; -pub const PRIX64: &[u8; 3usize] = b"lX\0"; -pub const PRIXLEAST8: &[u8; 2usize] = b"X\0"; -pub const PRIXLEAST16: &[u8; 2usize] = b"X\0"; -pub const PRIXLEAST32: &[u8; 2usize] = b"X\0"; -pub const PRIXLEAST64: &[u8; 3usize] = b"lX\0"; -pub const PRIXFAST8: &[u8; 2usize] = b"X\0"; -pub const PRIXFAST16: &[u8; 3usize] = b"lX\0"; -pub const PRIXFAST32: &[u8; 3usize] = b"lX\0"; -pub const PRIXFAST64: &[u8; 3usize] = b"lX\0"; -pub const PRIXMAX: &[u8; 3usize] = b"jX\0"; -pub const PRIXPTR: &[u8; 3usize] = b"lX\0"; -pub const SCNd8: &[u8; 4usize] = b"hhd\0"; -pub const SCNd16: &[u8; 3usize] = b"hd\0"; -pub const SCNd32: &[u8; 2usize] = b"d\0"; -pub const SCNd64: &[u8; 3usize] = b"ld\0"; -pub const SCNdLEAST8: &[u8; 4usize] = b"hhd\0"; -pub const SCNdLEAST16: &[u8; 3usize] = b"hd\0"; -pub const SCNdLEAST32: &[u8; 2usize] = b"d\0"; -pub const SCNdLEAST64: &[u8; 3usize] = b"ld\0"; -pub const SCNdFAST8: &[u8; 4usize] = b"hhd\0"; -pub const SCNdFAST16: &[u8; 3usize] = b"ld\0"; -pub const SCNdFAST32: &[u8; 3usize] = b"ld\0"; -pub const SCNdFAST64: &[u8; 3usize] = b"ld\0"; -pub const SCNdMAX: &[u8; 3usize] = b"jd\0"; -pub const SCNdPTR: &[u8; 3usize] = b"ld\0"; -pub const SCNi8: &[u8; 4usize] = b"hhi\0"; -pub const SCNi16: &[u8; 3usize] = b"hi\0"; -pub const SCNi32: &[u8; 2usize] = b"i\0"; -pub const SCNi64: &[u8; 3usize] = b"li\0"; -pub const SCNiLEAST8: &[u8; 4usize] = b"hhi\0"; -pub const SCNiLEAST16: &[u8; 3usize] = b"hi\0"; -pub const SCNiLEAST32: &[u8; 2usize] = b"i\0"; -pub const SCNiLEAST64: &[u8; 3usize] = b"li\0"; -pub const SCNiFAST8: &[u8; 4usize] = b"hhi\0"; -pub const SCNiFAST16: &[u8; 3usize] = b"li\0"; -pub const SCNiFAST32: &[u8; 3usize] = b"li\0"; -pub const SCNiFAST64: &[u8; 3usize] = b"li\0"; -pub const SCNiMAX: &[u8; 3usize] = b"ji\0"; -pub const SCNiPTR: &[u8; 3usize] = b"li\0"; -pub const SCNo8: &[u8; 4usize] = b"hho\0"; -pub const SCNo16: &[u8; 3usize] = b"ho\0"; -pub const SCNo32: &[u8; 2usize] = b"o\0"; -pub const SCNo64: &[u8; 3usize] = b"lo\0"; -pub const SCNoLEAST8: &[u8; 4usize] = b"hho\0"; -pub const SCNoLEAST16: &[u8; 3usize] = b"ho\0"; -pub const SCNoLEAST32: &[u8; 2usize] = b"o\0"; -pub const SCNoLEAST64: &[u8; 3usize] = b"lo\0"; -pub const SCNoFAST8: &[u8; 4usize] = b"hho\0"; -pub const SCNoFAST16: &[u8; 3usize] = b"lo\0"; -pub const SCNoFAST32: &[u8; 3usize] = b"lo\0"; -pub const SCNoFAST64: &[u8; 3usize] = b"lo\0"; -pub const SCNoMAX: &[u8; 3usize] = b"jo\0"; -pub const SCNoPTR: &[u8; 3usize] = b"lo\0"; -pub const SCNu8: &[u8; 4usize] = b"hhu\0"; -pub const SCNu16: &[u8; 3usize] = b"hu\0"; -pub const SCNu32: &[u8; 2usize] = b"u\0"; -pub const SCNu64: &[u8; 3usize] = b"lu\0"; -pub const SCNuLEAST8: &[u8; 4usize] = b"hhu\0"; -pub const SCNuLEAST16: &[u8; 3usize] = b"hu\0"; -pub const SCNuLEAST32: &[u8; 2usize] = b"u\0"; -pub const SCNuLEAST64: &[u8; 3usize] = b"lu\0"; -pub const SCNuFAST8: &[u8; 4usize] = b"hhu\0"; -pub const SCNuFAST16: &[u8; 3usize] = b"lu\0"; -pub const SCNuFAST32: &[u8; 3usize] = b"lu\0"; -pub const SCNuFAST64: &[u8; 3usize] = b"lu\0"; -pub const SCNuMAX: &[u8; 3usize] = b"ju\0"; -pub const SCNuPTR: &[u8; 3usize] = b"lu\0"; -pub const SCNx8: &[u8; 4usize] = b"hhx\0"; -pub const SCNx16: &[u8; 3usize] = b"hx\0"; -pub const SCNx32: &[u8; 2usize] = b"x\0"; -pub const SCNx64: &[u8; 3usize] = b"lx\0"; -pub const SCNxLEAST8: &[u8; 4usize] = b"hhx\0"; -pub const SCNxLEAST16: &[u8; 3usize] = b"hx\0"; -pub const SCNxLEAST32: &[u8; 2usize] = b"x\0"; -pub const SCNxLEAST64: &[u8; 3usize] = b"lx\0"; -pub const SCNxFAST8: &[u8; 4usize] = b"hhx\0"; -pub const SCNxFAST16: &[u8; 3usize] = b"lx\0"; -pub const SCNxFAST32: &[u8; 3usize] = b"lx\0"; -pub const SCNxFAST64: &[u8; 3usize] = b"lx\0"; -pub const SCNxMAX: &[u8; 3usize] = b"jx\0"; -pub const SCNxPTR: &[u8; 3usize] = b"lx\0"; -pub const __GNUC_VA_LIST: u32 = 1; +pub const __bool_true_false_are_defined: u32 = 1; pub const true_: u32 = 1; pub const false_: u32 = 0; -pub const __bool_true_false_are_defined: u32 = 1; +pub const __PRI_64_prefix: &[u8; 2] = b"l\0"; +pub const __PRI_PTR_prefix: &[u8; 2] = b"l\0"; +pub const __PRI_FAST_prefix: &[u8; 2] = b"l\0"; +pub const PRId8: &[u8; 2] = b"d\0"; +pub const PRId16: &[u8; 2] = b"d\0"; +pub const PRId32: &[u8; 2] = b"d\0"; +pub const PRId64: &[u8; 3] = b"ld\0"; +pub const PRIdLEAST8: &[u8; 2] = b"d\0"; +pub const PRIdLEAST16: &[u8; 2] = b"d\0"; +pub const PRIdLEAST32: &[u8; 2] = b"d\0"; +pub const PRIdLEAST64: &[u8; 3] = b"ld\0"; +pub const PRIdFAST8: &[u8; 2] = b"d\0"; +pub const PRIdFAST16: &[u8; 3] = b"ld\0"; +pub const PRIdFAST32: &[u8; 3] = b"ld\0"; +pub const PRIdFAST64: &[u8; 3] = b"ld\0"; +pub const PRIdMAX: &[u8; 3] = b"jd\0"; +pub const PRIdPTR: &[u8; 3] = b"ld\0"; +pub const PRIi8: &[u8; 2] = b"i\0"; +pub const PRIi16: &[u8; 2] = b"i\0"; +pub const PRIi32: &[u8; 2] = b"i\0"; +pub const PRIi64: &[u8; 3] = b"li\0"; +pub const PRIiLEAST8: &[u8; 2] = b"i\0"; +pub const PRIiLEAST16: &[u8; 2] = b"i\0"; +pub const PRIiLEAST32: &[u8; 2] = b"i\0"; +pub const PRIiLEAST64: &[u8; 3] = b"li\0"; +pub const PRIiFAST8: &[u8; 2] = b"i\0"; +pub const PRIiFAST16: &[u8; 3] = b"li\0"; +pub const PRIiFAST32: &[u8; 3] = b"li\0"; +pub const PRIiFAST64: &[u8; 3] = b"li\0"; +pub const PRIiMAX: &[u8; 3] = b"ji\0"; +pub const PRIiPTR: &[u8; 3] = b"li\0"; +pub const PRIb8: &[u8; 2] = b"b\0"; +pub const PRIb16: &[u8; 2] = b"b\0"; +pub const PRIb32: &[u8; 2] = b"b\0"; +pub const PRIb64: &[u8; 3] = b"lb\0"; +pub const PRIbLEAST8: &[u8; 2] = b"b\0"; +pub const PRIbLEAST16: &[u8; 2] = b"b\0"; +pub const PRIbLEAST32: &[u8; 2] = b"b\0"; +pub const PRIbLEAST64: &[u8; 3] = b"lb\0"; +pub const PRIbFAST8: &[u8; 2] = b"b\0"; +pub const PRIbFAST16: &[u8; 3] = b"lb\0"; +pub const PRIbFAST32: &[u8; 3] = b"lb\0"; +pub const PRIbFAST64: &[u8; 3] = b"lb\0"; +pub const PRIbMAX: &[u8; 3] = b"jb\0"; +pub const PRIbPTR: &[u8; 3] = b"lb\0"; +pub const PRIB8: &[u8; 2] = b"B\0"; +pub const PRIB16: &[u8; 2] = b"B\0"; +pub const PRIB32: &[u8; 2] = b"B\0"; +pub const PRIB64: &[u8; 3] = b"lB\0"; +pub const PRIBLEAST8: &[u8; 2] = b"B\0"; +pub const PRIBLEAST16: &[u8; 2] = b"B\0"; +pub const PRIBLEAST32: &[u8; 2] = b"B\0"; +pub const PRIBLEAST64: &[u8; 3] = b"lB\0"; +pub const PRIBFAST8: &[u8; 2] = b"B\0"; +pub const PRIBFAST16: &[u8; 3] = b"lB\0"; +pub const PRIBFAST32: &[u8; 3] = b"lB\0"; +pub const PRIBFAST64: &[u8; 3] = b"lB\0"; +pub const PRIBMAX: &[u8; 3] = b"jB\0"; +pub const PRIBPTR: &[u8; 3] = b"lB\0"; +pub const PRIo8: &[u8; 2] = b"o\0"; +pub const PRIo16: &[u8; 2] = b"o\0"; +pub const PRIo32: &[u8; 2] = b"o\0"; +pub const PRIo64: &[u8; 3] = b"lo\0"; +pub const PRIoLEAST8: &[u8; 2] = b"o\0"; +pub const PRIoLEAST16: &[u8; 2] = b"o\0"; +pub const PRIoLEAST32: &[u8; 2] = b"o\0"; +pub const PRIoLEAST64: &[u8; 3] = b"lo\0"; +pub const PRIoFAST8: &[u8; 2] = b"o\0"; +pub const PRIoFAST16: &[u8; 3] = b"lo\0"; +pub const PRIoFAST32: &[u8; 3] = b"lo\0"; +pub const PRIoFAST64: &[u8; 3] = b"lo\0"; +pub const PRIoMAX: &[u8; 3] = b"jo\0"; +pub const PRIoPTR: &[u8; 3] = b"lo\0"; +pub const PRIu8: &[u8; 2] = b"u\0"; +pub const PRIu16: &[u8; 2] = b"u\0"; +pub const PRIu32: &[u8; 2] = b"u\0"; +pub const PRIu64: &[u8; 3] = b"lu\0"; +pub const PRIuLEAST8: &[u8; 2] = b"u\0"; +pub const PRIuLEAST16: &[u8; 2] = b"u\0"; +pub const PRIuLEAST32: &[u8; 2] = b"u\0"; +pub const PRIuLEAST64: &[u8; 3] = b"lu\0"; +pub const PRIuFAST8: &[u8; 2] = b"u\0"; +pub const PRIuFAST16: &[u8; 3] = b"lu\0"; +pub const PRIuFAST32: &[u8; 3] = b"lu\0"; +pub const PRIuFAST64: &[u8; 3] = b"lu\0"; +pub const PRIuMAX: &[u8; 3] = b"ju\0"; +pub const PRIuPTR: &[u8; 3] = b"lu\0"; +pub const PRIx8: &[u8; 2] = b"x\0"; +pub const PRIx16: &[u8; 2] = b"x\0"; +pub const PRIx32: &[u8; 2] = b"x\0"; +pub const PRIx64: &[u8; 3] = b"lx\0"; +pub const PRIxLEAST8: &[u8; 2] = b"x\0"; +pub const PRIxLEAST16: &[u8; 2] = b"x\0"; +pub const PRIxLEAST32: &[u8; 2] = b"x\0"; +pub const PRIxLEAST64: &[u8; 3] = b"lx\0"; +pub const PRIxFAST8: &[u8; 2] = b"x\0"; +pub const PRIxFAST16: &[u8; 3] = b"lx\0"; +pub const PRIxFAST32: &[u8; 3] = b"lx\0"; +pub const PRIxFAST64: &[u8; 3] = b"lx\0"; +pub const PRIxMAX: &[u8; 3] = b"jx\0"; +pub const PRIxPTR: &[u8; 3] = b"lx\0"; +pub const PRIX8: &[u8; 2] = b"X\0"; +pub const PRIX16: &[u8; 2] = b"X\0"; +pub const PRIX32: &[u8; 2] = b"X\0"; +pub const PRIX64: &[u8; 3] = b"lX\0"; +pub const PRIXLEAST8: &[u8; 2] = b"X\0"; +pub const PRIXLEAST16: &[u8; 2] = b"X\0"; +pub const PRIXLEAST32: &[u8; 2] = b"X\0"; +pub const PRIXLEAST64: &[u8; 3] = b"lX\0"; +pub const PRIXFAST8: &[u8; 2] = b"X\0"; +pub const PRIXFAST16: &[u8; 3] = b"lX\0"; +pub const PRIXFAST32: &[u8; 3] = b"lX\0"; +pub const PRIXFAST64: &[u8; 3] = b"lX\0"; +pub const PRIXMAX: &[u8; 3] = b"jX\0"; +pub const PRIXPTR: &[u8; 3] = b"lX\0"; +pub const SCNd8: &[u8; 4] = b"hhd\0"; +pub const SCNd16: &[u8; 3] = b"hd\0"; +pub const SCNd32: &[u8; 2] = b"d\0"; +pub const SCNd64: &[u8; 3] = b"ld\0"; +pub const SCNdLEAST8: &[u8; 4] = b"hhd\0"; +pub const SCNdLEAST16: &[u8; 3] = b"hd\0"; +pub const SCNdLEAST32: &[u8; 2] = b"d\0"; +pub const SCNdLEAST64: &[u8; 3] = b"ld\0"; +pub const SCNdFAST8: &[u8; 4] = b"hhd\0"; +pub const SCNdFAST16: &[u8; 3] = b"ld\0"; +pub const SCNdFAST32: &[u8; 3] = b"ld\0"; +pub const SCNdFAST64: &[u8; 3] = b"ld\0"; +pub const SCNdMAX: &[u8; 3] = b"jd\0"; +pub const SCNdPTR: &[u8; 3] = b"ld\0"; +pub const SCNi8: &[u8; 4] = b"hhi\0"; +pub const SCNi16: &[u8; 3] = b"hi\0"; +pub const SCNi32: &[u8; 2] = b"i\0"; +pub const SCNi64: &[u8; 3] = b"li\0"; +pub const SCNiLEAST8: &[u8; 4] = b"hhi\0"; +pub const SCNiLEAST16: &[u8; 3] = b"hi\0"; +pub const SCNiLEAST32: &[u8; 2] = b"i\0"; +pub const SCNiLEAST64: &[u8; 3] = b"li\0"; +pub const SCNiFAST8: &[u8; 4] = b"hhi\0"; +pub const SCNiFAST16: &[u8; 3] = b"li\0"; +pub const SCNiFAST32: &[u8; 3] = b"li\0"; +pub const SCNiFAST64: &[u8; 3] = b"li\0"; +pub const SCNiMAX: &[u8; 3] = b"ji\0"; +pub const SCNiPTR: &[u8; 3] = b"li\0"; +pub const SCNb8: &[u8; 4] = b"hhb\0"; +pub const SCNb16: &[u8; 3] = b"hb\0"; +pub const SCNb32: &[u8; 2] = b"b\0"; +pub const SCNb64: &[u8; 3] = b"lb\0"; +pub const SCNbLEAST8: &[u8; 4] = b"hhb\0"; +pub const SCNbLEAST16: &[u8; 3] = b"hb\0"; +pub const SCNbLEAST32: &[u8; 2] = b"b\0"; +pub const SCNbLEAST64: &[u8; 3] = b"lb\0"; +pub const SCNbFAST8: &[u8; 4] = b"hhb\0"; +pub const SCNbFAST16: &[u8; 3] = b"lb\0"; +pub const SCNbFAST32: &[u8; 3] = b"lb\0"; +pub const SCNbFAST64: &[u8; 3] = b"lb\0"; +pub const SCNbMAX: &[u8; 3] = b"jb\0"; +pub const SCNbPTR: &[u8; 3] = b"lb\0"; +pub const SCNB8: &[u8; 4] = b"hhB\0"; +pub const SCNB16: &[u8; 3] = b"hB\0"; +pub const SCNB32: &[u8; 2] = b"B\0"; +pub const SCNB64: &[u8; 3] = b"lB\0"; +pub const SCNBLEAST8: &[u8; 4] = b"hhB\0"; +pub const SCNBLEAST16: &[u8; 3] = b"hB\0"; +pub const SCNBLEAST32: &[u8; 2] = b"B\0"; +pub const SCNBLEAST64: &[u8; 3] = b"lB\0"; +pub const SCNBFAST8: &[u8; 4] = b"hhB\0"; +pub const SCNBFAST16: &[u8; 3] = b"lB\0"; +pub const SCNBFAST32: &[u8; 3] = b"lB\0"; +pub const SCNBFAST64: &[u8; 3] = b"lB\0"; +pub const SCNBMAX: &[u8; 3] = b"jB\0"; +pub const SCNBPTR: &[u8; 3] = b"lB\0"; +pub const SCNo8: &[u8; 4] = b"hho\0"; +pub const SCNo16: &[u8; 3] = b"ho\0"; +pub const SCNo32: &[u8; 2] = b"o\0"; +pub const SCNo64: &[u8; 3] = b"lo\0"; +pub const SCNoLEAST8: &[u8; 4] = b"hho\0"; +pub const SCNoLEAST16: &[u8; 3] = b"ho\0"; +pub const SCNoLEAST32: &[u8; 2] = b"o\0"; +pub const SCNoLEAST64: &[u8; 3] = b"lo\0"; +pub const SCNoFAST8: &[u8; 4] = b"hho\0"; +pub const SCNoFAST16: &[u8; 3] = b"lo\0"; +pub const SCNoFAST32: &[u8; 3] = b"lo\0"; +pub const SCNoFAST64: &[u8; 3] = b"lo\0"; +pub const SCNoMAX: &[u8; 3] = b"jo\0"; +pub const SCNoPTR: &[u8; 3] = b"lo\0"; +pub const SCNu8: &[u8; 4] = b"hhu\0"; +pub const SCNu16: &[u8; 3] = b"hu\0"; +pub const SCNu32: &[u8; 2] = b"u\0"; +pub const SCNu64: &[u8; 3] = b"lu\0"; +pub const SCNuLEAST8: &[u8; 4] = b"hhu\0"; +pub const SCNuLEAST16: &[u8; 3] = b"hu\0"; +pub const SCNuLEAST32: &[u8; 2] = b"u\0"; +pub const SCNuLEAST64: &[u8; 3] = b"lu\0"; +pub const SCNuFAST8: &[u8; 4] = b"hhu\0"; +pub const SCNuFAST16: &[u8; 3] = b"lu\0"; +pub const SCNuFAST32: &[u8; 3] = b"lu\0"; +pub const SCNuFAST64: &[u8; 3] = b"lu\0"; +pub const SCNuMAX: &[u8; 3] = b"ju\0"; +pub const SCNuPTR: &[u8; 3] = b"lu\0"; +pub const SCNx8: &[u8; 4] = b"hhx\0"; +pub const SCNx16: &[u8; 3] = b"hx\0"; +pub const SCNx32: &[u8; 2] = b"x\0"; +pub const SCNx64: &[u8; 3] = b"lx\0"; +pub const SCNxLEAST8: &[u8; 4] = b"hhx\0"; +pub const SCNxLEAST16: &[u8; 3] = b"hx\0"; +pub const SCNxLEAST32: &[u8; 2] = b"x\0"; +pub const SCNxLEAST64: &[u8; 3] = b"lx\0"; +pub const SCNxFAST8: &[u8; 4] = b"hhx\0"; +pub const SCNxFAST16: &[u8; 3] = b"lx\0"; +pub const SCNxFAST32: &[u8; 3] = b"lx\0"; +pub const SCNxFAST64: &[u8; 3] = b"lx\0"; +pub const SCNxMAX: &[u8; 3] = b"jx\0"; +pub const SCNxPTR: &[u8; 3] = b"lx\0"; pub const GAME_ACTIVITY_POINTER_INFO_AXIS_COUNT: u32 = 48; pub const GAMEACTIVITY_MAX_NUM_POINTERS_IN_MOTION_EVENT: u32 = 8; -pub const GAMEACTIVITY_MAX_NUM_HISTORICAL_IN_MOTION_EVENT: u32 = 8; +pub const GAMETEXTINPUT_MAJOR_VERSION: u32 = 4; +pub const GAMETEXTINPUT_MINOR_VERSION: u32 = 0; +pub const GAMETEXTINPUT_BUGFIX_VERSION: u32 = 0; +pub const GAMEACTIVITY_MAJOR_VERSION: u32 = 4; +pub const GAMEACTIVITY_MINOR_VERSION: u32 = 0; +pub const GAMEACTIVITY_BUGFIX_VERSION: u32 = 0; pub const POLLIN: u32 = 1; pub const POLLPRI: u32 = 2; pub const POLLOUT: u32 = 4; @@ -464,18 +529,20 @@ pub const SIGPWR: u32 = 30; pub const SIGSYS: u32 = 31; pub const SIGUNUSED: u32 = 31; pub const __SIGRTMIN: u32 = 32; +pub const SA_RESTORER: u32 = 67108864; +pub const MINSIGSTKSZ: u32 = 2048; +pub const SIGSTKSZ: u32 = 8192; pub const SA_NOCLDSTOP: u32 = 1; pub const SA_NOCLDWAIT: u32 = 2; pub const SA_SIGINFO: u32 = 4; +pub const SA_UNSUPPORTED: u32 = 1024; +pub const SA_EXPOSE_TAGBITS: u32 = 2048; pub const SA_ONSTACK: u32 = 134217728; pub const SA_RESTART: u32 = 268435456; pub const SA_NODEFER: u32 = 1073741824; pub const SA_RESETHAND: u32 = 2147483648; pub const SA_NOMASK: u32 = 1073741824; pub const SA_ONESHOT: u32 = 2147483648; -pub const SA_RESTORER: u32 = 67108864; -pub const MINSIGSTKSZ: u32 = 2048; -pub const SIGSTKSZ: u32 = 8192; pub const SIG_BLOCK: u32 = 0; pub const SIG_UNBLOCK: u32 = 1; pub const SIG_SETMASK: u32 = 2; @@ -525,7 +592,9 @@ pub const SEGV_PKUERR: u32 = 4; pub const SEGV_ACCADI: u32 = 5; pub const SEGV_ADIDERR: u32 = 6; pub const SEGV_ADIPERR: u32 = 7; -pub const NSIGSEGV: u32 = 7; +pub const SEGV_MTEAERR: u32 = 8; +pub const SEGV_MTESERR: u32 = 9; +pub const NSIGSEGV: u32 = 9; pub const BUS_ADRALN: u32 = 1; pub const BUS_ADRERR: u32 = 2; pub const BUS_OBJERR: u32 = 3; @@ -537,7 +606,9 @@ pub const TRAP_TRACE: u32 = 2; pub const TRAP_BRANCH: u32 = 3; pub const TRAP_HWBKPT: u32 = 4; pub const TRAP_UNK: u32 = 5; -pub const NSIGTRAP: u32 = 5; +pub const TRAP_PERF: u32 = 6; +pub const NSIGTRAP: u32 = 6; +pub const TRAP_PERF_FLAG_ASYNC: u32 = 1; pub const CLD_EXITED: u32 = 1; pub const CLD_KILLED: u32 = 2; pub const CLD_DUMPED: u32 = 3; @@ -553,7 +624,8 @@ pub const POLL_PRI: u32 = 5; pub const POLL_HUP: u32 = 6; pub const NSIGPOLL: u32 = 6; pub const SYS_SECCOMP: u32 = 1; -pub const NSIGSYS: u32 = 1; +pub const SYS_USER_DISPATCH: u32 = 2; +pub const NSIGSYS: u32 = 2; pub const EMT_TAGOVF: u32 = 1; pub const NSIGEMT: u32 = 1; pub const SIGEV_SIGNAL: u32 = 0; @@ -573,6 +645,9 @@ pub const PAGE_MASK: i32 = -4096; pub const FD_SETSIZE: u32 = 1024; pub const CLOCKS_PER_SEC: u32 = 1000000; pub const TIME_UTC: u32 = 1; +pub const TIME_MONOTONIC: u32 = 2; +pub const TIME_ACTIVE: u32 = 3; +pub const TIME_THREAD_ACTIVE: u32 = 4; pub const CSIGNAL: u32 = 255; pub const CLONE_VM: u32 = 256; pub const CLONE_FS: u32 = 512; @@ -598,6 +673,12 @@ pub const CLONE_NEWUSER: u32 = 268435456; pub const CLONE_NEWPID: u32 = 536870912; pub const CLONE_NEWNET: u32 = 1073741824; pub const CLONE_IO: u32 = 2147483648; +pub const CLONE_CLEAR_SIGHAND: u64 = 4294967296; +pub const CLONE_INTO_CGROUP: u64 = 8589934592; +pub const CLONE_NEWTIME: u32 = 128; +pub const CLONE_ARGS_SIZE_VER0: u32 = 64; +pub const CLONE_ARGS_SIZE_VER1: u32 = 80; +pub const CLONE_ARGS_SIZE_VER2: u32 = 88; pub const SCHED_NORMAL: u32 = 0; pub const SCHED_FIFO: u32 = 1; pub const SCHED_RR: u32 = 2; @@ -629,9 +710,6 @@ pub const PTHREAD_PROCESS_PRIVATE: u32 = 0; pub const PTHREAD_PROCESS_SHARED: u32 = 1; pub const PTHREAD_SCOPE_SYSTEM: u32 = 0; pub const PTHREAD_SCOPE_PROCESS: u32 = 1; -pub const NATIVE_APP_GLUE_MAX_NUM_MOTION_EVENTS: u32 = 16; -pub const NATIVE_APP_GLUE_MAX_HISTORICAL_POINTER_SAMPLES: u32 = 64; -pub const NATIVE_APP_GLUE_MAX_NUM_KEY_EVENTS: u32 = 4; pub const NATIVE_APP_GLUE_MAX_INPUT_BUFFERS: u32 = 2; extern "C" { pub fn android_get_application_target_sdk_version() -> ::std::os::raw::c_int; @@ -650,39 +728,27 @@ pub struct max_align_t { } #[test] fn bindgen_test_layout_max_align_t() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 32usize, - concat!("Size of: ", stringify!(max_align_t)) + "Size of max_align_t" ); assert_eq!( ::std::mem::align_of::(), 16usize, - concat!("Alignment of ", stringify!(max_align_t)) + "Alignment of max_align_t" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).__clang_max_align_nonce1 as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce1) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(max_align_t), - "::", - stringify!(__clang_max_align_nonce1) - ) + "Offset of field: max_align_t::__clang_max_align_nonce1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).__clang_max_align_nonce2 as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce2) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(max_align_t), - "::", - stringify!(__clang_max_align_nonce2) - ) + "Offset of field: max_align_t::__clang_max_align_nonce2" ); } pub type __int8_t = ::std::os::raw::c_schar; @@ -728,25 +794,22 @@ pub struct __kernel_fd_set { } #[test] fn bindgen_test_layout___kernel_fd_set() { + const UNINIT: ::std::mem::MaybeUninit<__kernel_fd_set> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__kernel_fd_set>(), 128usize, - concat!("Size of: ", stringify!(__kernel_fd_set)) + "Size of __kernel_fd_set" ); assert_eq!( ::std::mem::align_of::<__kernel_fd_set>(), 8usize, - concat!("Alignment of ", stringify!(__kernel_fd_set)) + "Alignment of __kernel_fd_set" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_fd_set>())).fds_bits as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fds_bits) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__kernel_fd_set), - "::", - stringify!(fds_bits) - ) + "Offset of field: __kernel_fd_set::fds_bits" ); } pub type __kernel_sighandler_t = @@ -778,29 +841,27 @@ pub struct __kernel_fsid_t { } #[test] fn bindgen_test_layout___kernel_fsid_t() { + const UNINIT: ::std::mem::MaybeUninit<__kernel_fsid_t> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__kernel_fsid_t>(), 8usize, - concat!("Size of: ", stringify!(__kernel_fsid_t)) + "Size of __kernel_fsid_t" ); assert_eq!( ::std::mem::align_of::<__kernel_fsid_t>(), 4usize, - concat!("Alignment of ", stringify!(__kernel_fsid_t)) + "Alignment of __kernel_fsid_t" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_fsid_t>())).val as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).val) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__kernel_fsid_t), - "::", - stringify!(val) - ) + "Offset of field: __kernel_fsid_t::val" ); } pub type __kernel_off_t = __kernel_long_t; pub type __kernel_loff_t = ::std::os::raw::c_longlong; +pub type __kernel_old_time_t = __kernel_long_t; pub type __kernel_time_t = __kernel_long_t; pub type __kernel_time64_t = ::std::os::raw::c_longlong; pub type __kernel_clock_t = __kernel_long_t; @@ -859,7 +920,6 @@ pub type off64_t = loff_t; pub type __socklen_t = u32; pub type socklen_t = __socklen_t; pub type __va_list = __builtin_va_list; -pub type ssize_t = __kernel_ssize_t; pub type uint_t = ::std::os::raw::c_uint; pub type uint = ::std::os::raw::c_uint; pub type u_char = ::std::os::raw::c_uchar; @@ -870,483 +930,622 @@ pub type u_int32_t = u32; pub type u_int16_t = u16; pub type u_int8_t = u8; pub type u_int64_t = u64; -pub const AASSET_MODE_UNKNOWN: ::std::os::raw::c_uint = 0; -pub const AASSET_MODE_RANDOM: ::std::os::raw::c_uint = 1; -pub const AASSET_MODE_STREAMING: ::std::os::raw::c_uint = 2; -pub const AASSET_MODE_BUFFER: ::std::os::raw::c_uint = 3; +pub const AASSET_MODE_UNKNOWN: _bindgen_ty_1 = 0; +pub const AASSET_MODE_RANDOM: _bindgen_ty_1 = 1; +pub const AASSET_MODE_STREAMING: _bindgen_ty_1 = 2; +pub const AASSET_MODE_BUFFER: _bindgen_ty_1 = 3; pub type _bindgen_ty_1 = ::std::os::raw::c_uint; -pub const AKEYCODE_UNKNOWN: ::std::os::raw::c_uint = 0; -pub const AKEYCODE_SOFT_LEFT: ::std::os::raw::c_uint = 1; -pub const AKEYCODE_SOFT_RIGHT: ::std::os::raw::c_uint = 2; -pub const AKEYCODE_HOME: ::std::os::raw::c_uint = 3; -pub const AKEYCODE_BACK: ::std::os::raw::c_uint = 4; -pub const AKEYCODE_CALL: ::std::os::raw::c_uint = 5; -pub const AKEYCODE_ENDCALL: ::std::os::raw::c_uint = 6; -pub const AKEYCODE_0: ::std::os::raw::c_uint = 7; -pub const AKEYCODE_1: ::std::os::raw::c_uint = 8; -pub const AKEYCODE_2: ::std::os::raw::c_uint = 9; -pub const AKEYCODE_3: ::std::os::raw::c_uint = 10; -pub const AKEYCODE_4: ::std::os::raw::c_uint = 11; -pub const AKEYCODE_5: ::std::os::raw::c_uint = 12; -pub const AKEYCODE_6: ::std::os::raw::c_uint = 13; -pub const AKEYCODE_7: ::std::os::raw::c_uint = 14; -pub const AKEYCODE_8: ::std::os::raw::c_uint = 15; -pub const AKEYCODE_9: ::std::os::raw::c_uint = 16; -pub const AKEYCODE_STAR: ::std::os::raw::c_uint = 17; -pub const AKEYCODE_POUND: ::std::os::raw::c_uint = 18; -pub const AKEYCODE_DPAD_UP: ::std::os::raw::c_uint = 19; -pub const AKEYCODE_DPAD_DOWN: ::std::os::raw::c_uint = 20; -pub const AKEYCODE_DPAD_LEFT: ::std::os::raw::c_uint = 21; -pub const AKEYCODE_DPAD_RIGHT: ::std::os::raw::c_uint = 22; -pub const AKEYCODE_DPAD_CENTER: ::std::os::raw::c_uint = 23; -pub const AKEYCODE_VOLUME_UP: ::std::os::raw::c_uint = 24; -pub const AKEYCODE_VOLUME_DOWN: ::std::os::raw::c_uint = 25; -pub const AKEYCODE_POWER: ::std::os::raw::c_uint = 26; -pub const AKEYCODE_CAMERA: ::std::os::raw::c_uint = 27; -pub const AKEYCODE_CLEAR: ::std::os::raw::c_uint = 28; -pub const AKEYCODE_A: ::std::os::raw::c_uint = 29; -pub const AKEYCODE_B: ::std::os::raw::c_uint = 30; -pub const AKEYCODE_C: ::std::os::raw::c_uint = 31; -pub const AKEYCODE_D: ::std::os::raw::c_uint = 32; -pub const AKEYCODE_E: ::std::os::raw::c_uint = 33; -pub const AKEYCODE_F: ::std::os::raw::c_uint = 34; -pub const AKEYCODE_G: ::std::os::raw::c_uint = 35; -pub const AKEYCODE_H: ::std::os::raw::c_uint = 36; -pub const AKEYCODE_I: ::std::os::raw::c_uint = 37; -pub const AKEYCODE_J: ::std::os::raw::c_uint = 38; -pub const AKEYCODE_K: ::std::os::raw::c_uint = 39; -pub const AKEYCODE_L: ::std::os::raw::c_uint = 40; -pub const AKEYCODE_M: ::std::os::raw::c_uint = 41; -pub const AKEYCODE_N: ::std::os::raw::c_uint = 42; -pub const AKEYCODE_O: ::std::os::raw::c_uint = 43; -pub const AKEYCODE_P: ::std::os::raw::c_uint = 44; -pub const AKEYCODE_Q: ::std::os::raw::c_uint = 45; -pub const AKEYCODE_R: ::std::os::raw::c_uint = 46; -pub const AKEYCODE_S: ::std::os::raw::c_uint = 47; -pub const AKEYCODE_T: ::std::os::raw::c_uint = 48; -pub const AKEYCODE_U: ::std::os::raw::c_uint = 49; -pub const AKEYCODE_V: ::std::os::raw::c_uint = 50; -pub const AKEYCODE_W: ::std::os::raw::c_uint = 51; -pub const AKEYCODE_X: ::std::os::raw::c_uint = 52; -pub const AKEYCODE_Y: ::std::os::raw::c_uint = 53; -pub const AKEYCODE_Z: ::std::os::raw::c_uint = 54; -pub const AKEYCODE_COMMA: ::std::os::raw::c_uint = 55; -pub const AKEYCODE_PERIOD: ::std::os::raw::c_uint = 56; -pub const AKEYCODE_ALT_LEFT: ::std::os::raw::c_uint = 57; -pub const AKEYCODE_ALT_RIGHT: ::std::os::raw::c_uint = 58; -pub const AKEYCODE_SHIFT_LEFT: ::std::os::raw::c_uint = 59; -pub const AKEYCODE_SHIFT_RIGHT: ::std::os::raw::c_uint = 60; -pub const AKEYCODE_TAB: ::std::os::raw::c_uint = 61; -pub const AKEYCODE_SPACE: ::std::os::raw::c_uint = 62; -pub const AKEYCODE_SYM: ::std::os::raw::c_uint = 63; -pub const AKEYCODE_EXPLORER: ::std::os::raw::c_uint = 64; -pub const AKEYCODE_ENVELOPE: ::std::os::raw::c_uint = 65; -pub const AKEYCODE_ENTER: ::std::os::raw::c_uint = 66; -pub const AKEYCODE_DEL: ::std::os::raw::c_uint = 67; -pub const AKEYCODE_GRAVE: ::std::os::raw::c_uint = 68; -pub const AKEYCODE_MINUS: ::std::os::raw::c_uint = 69; -pub const AKEYCODE_EQUALS: ::std::os::raw::c_uint = 70; -pub const AKEYCODE_LEFT_BRACKET: ::std::os::raw::c_uint = 71; -pub const AKEYCODE_RIGHT_BRACKET: ::std::os::raw::c_uint = 72; -pub const AKEYCODE_BACKSLASH: ::std::os::raw::c_uint = 73; -pub const AKEYCODE_SEMICOLON: ::std::os::raw::c_uint = 74; -pub const AKEYCODE_APOSTROPHE: ::std::os::raw::c_uint = 75; -pub const AKEYCODE_SLASH: ::std::os::raw::c_uint = 76; -pub const AKEYCODE_AT: ::std::os::raw::c_uint = 77; -pub const AKEYCODE_NUM: ::std::os::raw::c_uint = 78; -pub const AKEYCODE_HEADSETHOOK: ::std::os::raw::c_uint = 79; -pub const AKEYCODE_FOCUS: ::std::os::raw::c_uint = 80; -pub const AKEYCODE_PLUS: ::std::os::raw::c_uint = 81; -pub const AKEYCODE_MENU: ::std::os::raw::c_uint = 82; -pub const AKEYCODE_NOTIFICATION: ::std::os::raw::c_uint = 83; -pub const AKEYCODE_SEARCH: ::std::os::raw::c_uint = 84; -pub const AKEYCODE_MEDIA_PLAY_PAUSE: ::std::os::raw::c_uint = 85; -pub const AKEYCODE_MEDIA_STOP: ::std::os::raw::c_uint = 86; -pub const AKEYCODE_MEDIA_NEXT: ::std::os::raw::c_uint = 87; -pub const AKEYCODE_MEDIA_PREVIOUS: ::std::os::raw::c_uint = 88; -pub const AKEYCODE_MEDIA_REWIND: ::std::os::raw::c_uint = 89; -pub const AKEYCODE_MEDIA_FAST_FORWARD: ::std::os::raw::c_uint = 90; -pub const AKEYCODE_MUTE: ::std::os::raw::c_uint = 91; -pub const AKEYCODE_PAGE_UP: ::std::os::raw::c_uint = 92; -pub const AKEYCODE_PAGE_DOWN: ::std::os::raw::c_uint = 93; -pub const AKEYCODE_PICTSYMBOLS: ::std::os::raw::c_uint = 94; -pub const AKEYCODE_SWITCH_CHARSET: ::std::os::raw::c_uint = 95; -pub const AKEYCODE_BUTTON_A: ::std::os::raw::c_uint = 96; -pub const AKEYCODE_BUTTON_B: ::std::os::raw::c_uint = 97; -pub const AKEYCODE_BUTTON_C: ::std::os::raw::c_uint = 98; -pub const AKEYCODE_BUTTON_X: ::std::os::raw::c_uint = 99; -pub const AKEYCODE_BUTTON_Y: ::std::os::raw::c_uint = 100; -pub const AKEYCODE_BUTTON_Z: ::std::os::raw::c_uint = 101; -pub const AKEYCODE_BUTTON_L1: ::std::os::raw::c_uint = 102; -pub const AKEYCODE_BUTTON_R1: ::std::os::raw::c_uint = 103; -pub const AKEYCODE_BUTTON_L2: ::std::os::raw::c_uint = 104; -pub const AKEYCODE_BUTTON_R2: ::std::os::raw::c_uint = 105; -pub const AKEYCODE_BUTTON_THUMBL: ::std::os::raw::c_uint = 106; -pub const AKEYCODE_BUTTON_THUMBR: ::std::os::raw::c_uint = 107; -pub const AKEYCODE_BUTTON_START: ::std::os::raw::c_uint = 108; -pub const AKEYCODE_BUTTON_SELECT: ::std::os::raw::c_uint = 109; -pub const AKEYCODE_BUTTON_MODE: ::std::os::raw::c_uint = 110; -pub const AKEYCODE_ESCAPE: ::std::os::raw::c_uint = 111; -pub const AKEYCODE_FORWARD_DEL: ::std::os::raw::c_uint = 112; -pub const AKEYCODE_CTRL_LEFT: ::std::os::raw::c_uint = 113; -pub const AKEYCODE_CTRL_RIGHT: ::std::os::raw::c_uint = 114; -pub const AKEYCODE_CAPS_LOCK: ::std::os::raw::c_uint = 115; -pub const AKEYCODE_SCROLL_LOCK: ::std::os::raw::c_uint = 116; -pub const AKEYCODE_META_LEFT: ::std::os::raw::c_uint = 117; -pub const AKEYCODE_META_RIGHT: ::std::os::raw::c_uint = 118; -pub const AKEYCODE_FUNCTION: ::std::os::raw::c_uint = 119; -pub const AKEYCODE_SYSRQ: ::std::os::raw::c_uint = 120; -pub const AKEYCODE_BREAK: ::std::os::raw::c_uint = 121; -pub const AKEYCODE_MOVE_HOME: ::std::os::raw::c_uint = 122; -pub const AKEYCODE_MOVE_END: ::std::os::raw::c_uint = 123; -pub const AKEYCODE_INSERT: ::std::os::raw::c_uint = 124; -pub const AKEYCODE_FORWARD: ::std::os::raw::c_uint = 125; -pub const AKEYCODE_MEDIA_PLAY: ::std::os::raw::c_uint = 126; -pub const AKEYCODE_MEDIA_PAUSE: ::std::os::raw::c_uint = 127; -pub const AKEYCODE_MEDIA_CLOSE: ::std::os::raw::c_uint = 128; -pub const AKEYCODE_MEDIA_EJECT: ::std::os::raw::c_uint = 129; -pub const AKEYCODE_MEDIA_RECORD: ::std::os::raw::c_uint = 130; -pub const AKEYCODE_F1: ::std::os::raw::c_uint = 131; -pub const AKEYCODE_F2: ::std::os::raw::c_uint = 132; -pub const AKEYCODE_F3: ::std::os::raw::c_uint = 133; -pub const AKEYCODE_F4: ::std::os::raw::c_uint = 134; -pub const AKEYCODE_F5: ::std::os::raw::c_uint = 135; -pub const AKEYCODE_F6: ::std::os::raw::c_uint = 136; -pub const AKEYCODE_F7: ::std::os::raw::c_uint = 137; -pub const AKEYCODE_F8: ::std::os::raw::c_uint = 138; -pub const AKEYCODE_F9: ::std::os::raw::c_uint = 139; -pub const AKEYCODE_F10: ::std::os::raw::c_uint = 140; -pub const AKEYCODE_F11: ::std::os::raw::c_uint = 141; -pub const AKEYCODE_F12: ::std::os::raw::c_uint = 142; -pub const AKEYCODE_NUM_LOCK: ::std::os::raw::c_uint = 143; -pub const AKEYCODE_NUMPAD_0: ::std::os::raw::c_uint = 144; -pub const AKEYCODE_NUMPAD_1: ::std::os::raw::c_uint = 145; -pub const AKEYCODE_NUMPAD_2: ::std::os::raw::c_uint = 146; -pub const AKEYCODE_NUMPAD_3: ::std::os::raw::c_uint = 147; -pub const AKEYCODE_NUMPAD_4: ::std::os::raw::c_uint = 148; -pub const AKEYCODE_NUMPAD_5: ::std::os::raw::c_uint = 149; -pub const AKEYCODE_NUMPAD_6: ::std::os::raw::c_uint = 150; -pub const AKEYCODE_NUMPAD_7: ::std::os::raw::c_uint = 151; -pub const AKEYCODE_NUMPAD_8: ::std::os::raw::c_uint = 152; -pub const AKEYCODE_NUMPAD_9: ::std::os::raw::c_uint = 153; -pub const AKEYCODE_NUMPAD_DIVIDE: ::std::os::raw::c_uint = 154; -pub const AKEYCODE_NUMPAD_MULTIPLY: ::std::os::raw::c_uint = 155; -pub const AKEYCODE_NUMPAD_SUBTRACT: ::std::os::raw::c_uint = 156; -pub const AKEYCODE_NUMPAD_ADD: ::std::os::raw::c_uint = 157; -pub const AKEYCODE_NUMPAD_DOT: ::std::os::raw::c_uint = 158; -pub const AKEYCODE_NUMPAD_COMMA: ::std::os::raw::c_uint = 159; -pub const AKEYCODE_NUMPAD_ENTER: ::std::os::raw::c_uint = 160; -pub const AKEYCODE_NUMPAD_EQUALS: ::std::os::raw::c_uint = 161; -pub const AKEYCODE_NUMPAD_LEFT_PAREN: ::std::os::raw::c_uint = 162; -pub const AKEYCODE_NUMPAD_RIGHT_PAREN: ::std::os::raw::c_uint = 163; -pub const AKEYCODE_VOLUME_MUTE: ::std::os::raw::c_uint = 164; -pub const AKEYCODE_INFO: ::std::os::raw::c_uint = 165; -pub const AKEYCODE_CHANNEL_UP: ::std::os::raw::c_uint = 166; -pub const AKEYCODE_CHANNEL_DOWN: ::std::os::raw::c_uint = 167; -pub const AKEYCODE_ZOOM_IN: ::std::os::raw::c_uint = 168; -pub const AKEYCODE_ZOOM_OUT: ::std::os::raw::c_uint = 169; -pub const AKEYCODE_TV: ::std::os::raw::c_uint = 170; -pub const AKEYCODE_WINDOW: ::std::os::raw::c_uint = 171; -pub const AKEYCODE_GUIDE: ::std::os::raw::c_uint = 172; -pub const AKEYCODE_DVR: ::std::os::raw::c_uint = 173; -pub const AKEYCODE_BOOKMARK: ::std::os::raw::c_uint = 174; -pub const AKEYCODE_CAPTIONS: ::std::os::raw::c_uint = 175; -pub const AKEYCODE_SETTINGS: ::std::os::raw::c_uint = 176; -pub const AKEYCODE_TV_POWER: ::std::os::raw::c_uint = 177; -pub const AKEYCODE_TV_INPUT: ::std::os::raw::c_uint = 178; -pub const AKEYCODE_STB_POWER: ::std::os::raw::c_uint = 179; -pub const AKEYCODE_STB_INPUT: ::std::os::raw::c_uint = 180; -pub const AKEYCODE_AVR_POWER: ::std::os::raw::c_uint = 181; -pub const AKEYCODE_AVR_INPUT: ::std::os::raw::c_uint = 182; -pub const AKEYCODE_PROG_RED: ::std::os::raw::c_uint = 183; -pub const AKEYCODE_PROG_GREEN: ::std::os::raw::c_uint = 184; -pub const AKEYCODE_PROG_YELLOW: ::std::os::raw::c_uint = 185; -pub const AKEYCODE_PROG_BLUE: ::std::os::raw::c_uint = 186; -pub const AKEYCODE_APP_SWITCH: ::std::os::raw::c_uint = 187; -pub const AKEYCODE_BUTTON_1: ::std::os::raw::c_uint = 188; -pub const AKEYCODE_BUTTON_2: ::std::os::raw::c_uint = 189; -pub const AKEYCODE_BUTTON_3: ::std::os::raw::c_uint = 190; -pub const AKEYCODE_BUTTON_4: ::std::os::raw::c_uint = 191; -pub const AKEYCODE_BUTTON_5: ::std::os::raw::c_uint = 192; -pub const AKEYCODE_BUTTON_6: ::std::os::raw::c_uint = 193; -pub const AKEYCODE_BUTTON_7: ::std::os::raw::c_uint = 194; -pub const AKEYCODE_BUTTON_8: ::std::os::raw::c_uint = 195; -pub const AKEYCODE_BUTTON_9: ::std::os::raw::c_uint = 196; -pub const AKEYCODE_BUTTON_10: ::std::os::raw::c_uint = 197; -pub const AKEYCODE_BUTTON_11: ::std::os::raw::c_uint = 198; -pub const AKEYCODE_BUTTON_12: ::std::os::raw::c_uint = 199; -pub const AKEYCODE_BUTTON_13: ::std::os::raw::c_uint = 200; -pub const AKEYCODE_BUTTON_14: ::std::os::raw::c_uint = 201; -pub const AKEYCODE_BUTTON_15: ::std::os::raw::c_uint = 202; -pub const AKEYCODE_BUTTON_16: ::std::os::raw::c_uint = 203; -pub const AKEYCODE_LANGUAGE_SWITCH: ::std::os::raw::c_uint = 204; -pub const AKEYCODE_MANNER_MODE: ::std::os::raw::c_uint = 205; -pub const AKEYCODE_3D_MODE: ::std::os::raw::c_uint = 206; -pub const AKEYCODE_CONTACTS: ::std::os::raw::c_uint = 207; -pub const AKEYCODE_CALENDAR: ::std::os::raw::c_uint = 208; -pub const AKEYCODE_MUSIC: ::std::os::raw::c_uint = 209; -pub const AKEYCODE_CALCULATOR: ::std::os::raw::c_uint = 210; -pub const AKEYCODE_ZENKAKU_HANKAKU: ::std::os::raw::c_uint = 211; -pub const AKEYCODE_EISU: ::std::os::raw::c_uint = 212; -pub const AKEYCODE_MUHENKAN: ::std::os::raw::c_uint = 213; -pub const AKEYCODE_HENKAN: ::std::os::raw::c_uint = 214; -pub const AKEYCODE_KATAKANA_HIRAGANA: ::std::os::raw::c_uint = 215; -pub const AKEYCODE_YEN: ::std::os::raw::c_uint = 216; -pub const AKEYCODE_RO: ::std::os::raw::c_uint = 217; -pub const AKEYCODE_KANA: ::std::os::raw::c_uint = 218; -pub const AKEYCODE_ASSIST: ::std::os::raw::c_uint = 219; -pub const AKEYCODE_BRIGHTNESS_DOWN: ::std::os::raw::c_uint = 220; -pub const AKEYCODE_BRIGHTNESS_UP: ::std::os::raw::c_uint = 221; -pub const AKEYCODE_MEDIA_AUDIO_TRACK: ::std::os::raw::c_uint = 222; -pub const AKEYCODE_SLEEP: ::std::os::raw::c_uint = 223; -pub const AKEYCODE_WAKEUP: ::std::os::raw::c_uint = 224; -pub const AKEYCODE_PAIRING: ::std::os::raw::c_uint = 225; -pub const AKEYCODE_MEDIA_TOP_MENU: ::std::os::raw::c_uint = 226; -pub const AKEYCODE_11: ::std::os::raw::c_uint = 227; -pub const AKEYCODE_12: ::std::os::raw::c_uint = 228; -pub const AKEYCODE_LAST_CHANNEL: ::std::os::raw::c_uint = 229; -pub const AKEYCODE_TV_DATA_SERVICE: ::std::os::raw::c_uint = 230; -pub const AKEYCODE_VOICE_ASSIST: ::std::os::raw::c_uint = 231; -pub const AKEYCODE_TV_RADIO_SERVICE: ::std::os::raw::c_uint = 232; -pub const AKEYCODE_TV_TELETEXT: ::std::os::raw::c_uint = 233; -pub const AKEYCODE_TV_NUMBER_ENTRY: ::std::os::raw::c_uint = 234; -pub const AKEYCODE_TV_TERRESTRIAL_ANALOG: ::std::os::raw::c_uint = 235; -pub const AKEYCODE_TV_TERRESTRIAL_DIGITAL: ::std::os::raw::c_uint = 236; -pub const AKEYCODE_TV_SATELLITE: ::std::os::raw::c_uint = 237; -pub const AKEYCODE_TV_SATELLITE_BS: ::std::os::raw::c_uint = 238; -pub const AKEYCODE_TV_SATELLITE_CS: ::std::os::raw::c_uint = 239; -pub const AKEYCODE_TV_SATELLITE_SERVICE: ::std::os::raw::c_uint = 240; -pub const AKEYCODE_TV_NETWORK: ::std::os::raw::c_uint = 241; -pub const AKEYCODE_TV_ANTENNA_CABLE: ::std::os::raw::c_uint = 242; -pub const AKEYCODE_TV_INPUT_HDMI_1: ::std::os::raw::c_uint = 243; -pub const AKEYCODE_TV_INPUT_HDMI_2: ::std::os::raw::c_uint = 244; -pub const AKEYCODE_TV_INPUT_HDMI_3: ::std::os::raw::c_uint = 245; -pub const AKEYCODE_TV_INPUT_HDMI_4: ::std::os::raw::c_uint = 246; -pub const AKEYCODE_TV_INPUT_COMPOSITE_1: ::std::os::raw::c_uint = 247; -pub const AKEYCODE_TV_INPUT_COMPOSITE_2: ::std::os::raw::c_uint = 248; -pub const AKEYCODE_TV_INPUT_COMPONENT_1: ::std::os::raw::c_uint = 249; -pub const AKEYCODE_TV_INPUT_COMPONENT_2: ::std::os::raw::c_uint = 250; -pub const AKEYCODE_TV_INPUT_VGA_1: ::std::os::raw::c_uint = 251; -pub const AKEYCODE_TV_AUDIO_DESCRIPTION: ::std::os::raw::c_uint = 252; -pub const AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_UP: ::std::os::raw::c_uint = 253; -pub const AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_DOWN: ::std::os::raw::c_uint = 254; -pub const AKEYCODE_TV_ZOOM_MODE: ::std::os::raw::c_uint = 255; -pub const AKEYCODE_TV_CONTENTS_MENU: ::std::os::raw::c_uint = 256; -pub const AKEYCODE_TV_MEDIA_CONTEXT_MENU: ::std::os::raw::c_uint = 257; -pub const AKEYCODE_TV_TIMER_PROGRAMMING: ::std::os::raw::c_uint = 258; -pub const AKEYCODE_HELP: ::std::os::raw::c_uint = 259; -pub const AKEYCODE_NAVIGATE_PREVIOUS: ::std::os::raw::c_uint = 260; -pub const AKEYCODE_NAVIGATE_NEXT: ::std::os::raw::c_uint = 261; -pub const AKEYCODE_NAVIGATE_IN: ::std::os::raw::c_uint = 262; -pub const AKEYCODE_NAVIGATE_OUT: ::std::os::raw::c_uint = 263; -pub const AKEYCODE_STEM_PRIMARY: ::std::os::raw::c_uint = 264; -pub const AKEYCODE_STEM_1: ::std::os::raw::c_uint = 265; -pub const AKEYCODE_STEM_2: ::std::os::raw::c_uint = 266; -pub const AKEYCODE_STEM_3: ::std::os::raw::c_uint = 267; -pub const AKEYCODE_DPAD_UP_LEFT: ::std::os::raw::c_uint = 268; -pub const AKEYCODE_DPAD_DOWN_LEFT: ::std::os::raw::c_uint = 269; -pub const AKEYCODE_DPAD_UP_RIGHT: ::std::os::raw::c_uint = 270; -pub const AKEYCODE_DPAD_DOWN_RIGHT: ::std::os::raw::c_uint = 271; -pub const AKEYCODE_MEDIA_SKIP_FORWARD: ::std::os::raw::c_uint = 272; -pub const AKEYCODE_MEDIA_SKIP_BACKWARD: ::std::os::raw::c_uint = 273; -pub const AKEYCODE_MEDIA_STEP_FORWARD: ::std::os::raw::c_uint = 274; -pub const AKEYCODE_MEDIA_STEP_BACKWARD: ::std::os::raw::c_uint = 275; -pub const AKEYCODE_SOFT_SLEEP: ::std::os::raw::c_uint = 276; -pub const AKEYCODE_CUT: ::std::os::raw::c_uint = 277; -pub const AKEYCODE_COPY: ::std::os::raw::c_uint = 278; -pub const AKEYCODE_PASTE: ::std::os::raw::c_uint = 279; -pub const AKEYCODE_SYSTEM_NAVIGATION_UP: ::std::os::raw::c_uint = 280; -pub const AKEYCODE_SYSTEM_NAVIGATION_DOWN: ::std::os::raw::c_uint = 281; -pub const AKEYCODE_SYSTEM_NAVIGATION_LEFT: ::std::os::raw::c_uint = 282; -pub const AKEYCODE_SYSTEM_NAVIGATION_RIGHT: ::std::os::raw::c_uint = 283; -pub const AKEYCODE_ALL_APPS: ::std::os::raw::c_uint = 284; -pub const AKEYCODE_REFRESH: ::std::os::raw::c_uint = 285; -pub const AKEYCODE_THUMBS_UP: ::std::os::raw::c_uint = 286; -pub const AKEYCODE_THUMBS_DOWN: ::std::os::raw::c_uint = 287; -pub const AKEYCODE_PROFILE_SWITCH: ::std::os::raw::c_uint = 288; +pub const AKEYCODE_UNKNOWN: _bindgen_ty_2 = 0; +pub const AKEYCODE_SOFT_LEFT: _bindgen_ty_2 = 1; +pub const AKEYCODE_SOFT_RIGHT: _bindgen_ty_2 = 2; +pub const AKEYCODE_HOME: _bindgen_ty_2 = 3; +pub const AKEYCODE_BACK: _bindgen_ty_2 = 4; +pub const AKEYCODE_CALL: _bindgen_ty_2 = 5; +pub const AKEYCODE_ENDCALL: _bindgen_ty_2 = 6; +pub const AKEYCODE_0: _bindgen_ty_2 = 7; +pub const AKEYCODE_1: _bindgen_ty_2 = 8; +pub const AKEYCODE_2: _bindgen_ty_2 = 9; +pub const AKEYCODE_3: _bindgen_ty_2 = 10; +pub const AKEYCODE_4: _bindgen_ty_2 = 11; +pub const AKEYCODE_5: _bindgen_ty_2 = 12; +pub const AKEYCODE_6: _bindgen_ty_2 = 13; +pub const AKEYCODE_7: _bindgen_ty_2 = 14; +pub const AKEYCODE_8: _bindgen_ty_2 = 15; +pub const AKEYCODE_9: _bindgen_ty_2 = 16; +pub const AKEYCODE_STAR: _bindgen_ty_2 = 17; +pub const AKEYCODE_POUND: _bindgen_ty_2 = 18; +pub const AKEYCODE_DPAD_UP: _bindgen_ty_2 = 19; +pub const AKEYCODE_DPAD_DOWN: _bindgen_ty_2 = 20; +pub const AKEYCODE_DPAD_LEFT: _bindgen_ty_2 = 21; +pub const AKEYCODE_DPAD_RIGHT: _bindgen_ty_2 = 22; +pub const AKEYCODE_DPAD_CENTER: _bindgen_ty_2 = 23; +pub const AKEYCODE_VOLUME_UP: _bindgen_ty_2 = 24; +pub const AKEYCODE_VOLUME_DOWN: _bindgen_ty_2 = 25; +pub const AKEYCODE_POWER: _bindgen_ty_2 = 26; +pub const AKEYCODE_CAMERA: _bindgen_ty_2 = 27; +pub const AKEYCODE_CLEAR: _bindgen_ty_2 = 28; +pub const AKEYCODE_A: _bindgen_ty_2 = 29; +pub const AKEYCODE_B: _bindgen_ty_2 = 30; +pub const AKEYCODE_C: _bindgen_ty_2 = 31; +pub const AKEYCODE_D: _bindgen_ty_2 = 32; +pub const AKEYCODE_E: _bindgen_ty_2 = 33; +pub const AKEYCODE_F: _bindgen_ty_2 = 34; +pub const AKEYCODE_G: _bindgen_ty_2 = 35; +pub const AKEYCODE_H: _bindgen_ty_2 = 36; +pub const AKEYCODE_I: _bindgen_ty_2 = 37; +pub const AKEYCODE_J: _bindgen_ty_2 = 38; +pub const AKEYCODE_K: _bindgen_ty_2 = 39; +pub const AKEYCODE_L: _bindgen_ty_2 = 40; +pub const AKEYCODE_M: _bindgen_ty_2 = 41; +pub const AKEYCODE_N: _bindgen_ty_2 = 42; +pub const AKEYCODE_O: _bindgen_ty_2 = 43; +pub const AKEYCODE_P: _bindgen_ty_2 = 44; +pub const AKEYCODE_Q: _bindgen_ty_2 = 45; +pub const AKEYCODE_R: _bindgen_ty_2 = 46; +pub const AKEYCODE_S: _bindgen_ty_2 = 47; +pub const AKEYCODE_T: _bindgen_ty_2 = 48; +pub const AKEYCODE_U: _bindgen_ty_2 = 49; +pub const AKEYCODE_V: _bindgen_ty_2 = 50; +pub const AKEYCODE_W: _bindgen_ty_2 = 51; +pub const AKEYCODE_X: _bindgen_ty_2 = 52; +pub const AKEYCODE_Y: _bindgen_ty_2 = 53; +pub const AKEYCODE_Z: _bindgen_ty_2 = 54; +pub const AKEYCODE_COMMA: _bindgen_ty_2 = 55; +pub const AKEYCODE_PERIOD: _bindgen_ty_2 = 56; +pub const AKEYCODE_ALT_LEFT: _bindgen_ty_2 = 57; +pub const AKEYCODE_ALT_RIGHT: _bindgen_ty_2 = 58; +pub const AKEYCODE_SHIFT_LEFT: _bindgen_ty_2 = 59; +pub const AKEYCODE_SHIFT_RIGHT: _bindgen_ty_2 = 60; +pub const AKEYCODE_TAB: _bindgen_ty_2 = 61; +pub const AKEYCODE_SPACE: _bindgen_ty_2 = 62; +pub const AKEYCODE_SYM: _bindgen_ty_2 = 63; +pub const AKEYCODE_EXPLORER: _bindgen_ty_2 = 64; +pub const AKEYCODE_ENVELOPE: _bindgen_ty_2 = 65; +pub const AKEYCODE_ENTER: _bindgen_ty_2 = 66; +pub const AKEYCODE_DEL: _bindgen_ty_2 = 67; +pub const AKEYCODE_GRAVE: _bindgen_ty_2 = 68; +pub const AKEYCODE_MINUS: _bindgen_ty_2 = 69; +pub const AKEYCODE_EQUALS: _bindgen_ty_2 = 70; +pub const AKEYCODE_LEFT_BRACKET: _bindgen_ty_2 = 71; +pub const AKEYCODE_RIGHT_BRACKET: _bindgen_ty_2 = 72; +pub const AKEYCODE_BACKSLASH: _bindgen_ty_2 = 73; +pub const AKEYCODE_SEMICOLON: _bindgen_ty_2 = 74; +pub const AKEYCODE_APOSTROPHE: _bindgen_ty_2 = 75; +pub const AKEYCODE_SLASH: _bindgen_ty_2 = 76; +pub const AKEYCODE_AT: _bindgen_ty_2 = 77; +pub const AKEYCODE_NUM: _bindgen_ty_2 = 78; +pub const AKEYCODE_HEADSETHOOK: _bindgen_ty_2 = 79; +pub const AKEYCODE_FOCUS: _bindgen_ty_2 = 80; +pub const AKEYCODE_PLUS: _bindgen_ty_2 = 81; +pub const AKEYCODE_MENU: _bindgen_ty_2 = 82; +pub const AKEYCODE_NOTIFICATION: _bindgen_ty_2 = 83; +pub const AKEYCODE_SEARCH: _bindgen_ty_2 = 84; +pub const AKEYCODE_MEDIA_PLAY_PAUSE: _bindgen_ty_2 = 85; +pub const AKEYCODE_MEDIA_STOP: _bindgen_ty_2 = 86; +pub const AKEYCODE_MEDIA_NEXT: _bindgen_ty_2 = 87; +pub const AKEYCODE_MEDIA_PREVIOUS: _bindgen_ty_2 = 88; +pub const AKEYCODE_MEDIA_REWIND: _bindgen_ty_2 = 89; +pub const AKEYCODE_MEDIA_FAST_FORWARD: _bindgen_ty_2 = 90; +pub const AKEYCODE_MUTE: _bindgen_ty_2 = 91; +pub const AKEYCODE_PAGE_UP: _bindgen_ty_2 = 92; +pub const AKEYCODE_PAGE_DOWN: _bindgen_ty_2 = 93; +pub const AKEYCODE_PICTSYMBOLS: _bindgen_ty_2 = 94; +pub const AKEYCODE_SWITCH_CHARSET: _bindgen_ty_2 = 95; +pub const AKEYCODE_BUTTON_A: _bindgen_ty_2 = 96; +pub const AKEYCODE_BUTTON_B: _bindgen_ty_2 = 97; +pub const AKEYCODE_BUTTON_C: _bindgen_ty_2 = 98; +pub const AKEYCODE_BUTTON_X: _bindgen_ty_2 = 99; +pub const AKEYCODE_BUTTON_Y: _bindgen_ty_2 = 100; +pub const AKEYCODE_BUTTON_Z: _bindgen_ty_2 = 101; +pub const AKEYCODE_BUTTON_L1: _bindgen_ty_2 = 102; +pub const AKEYCODE_BUTTON_R1: _bindgen_ty_2 = 103; +pub const AKEYCODE_BUTTON_L2: _bindgen_ty_2 = 104; +pub const AKEYCODE_BUTTON_R2: _bindgen_ty_2 = 105; +pub const AKEYCODE_BUTTON_THUMBL: _bindgen_ty_2 = 106; +pub const AKEYCODE_BUTTON_THUMBR: _bindgen_ty_2 = 107; +pub const AKEYCODE_BUTTON_START: _bindgen_ty_2 = 108; +pub const AKEYCODE_BUTTON_SELECT: _bindgen_ty_2 = 109; +pub const AKEYCODE_BUTTON_MODE: _bindgen_ty_2 = 110; +pub const AKEYCODE_ESCAPE: _bindgen_ty_2 = 111; +pub const AKEYCODE_FORWARD_DEL: _bindgen_ty_2 = 112; +pub const AKEYCODE_CTRL_LEFT: _bindgen_ty_2 = 113; +pub const AKEYCODE_CTRL_RIGHT: _bindgen_ty_2 = 114; +pub const AKEYCODE_CAPS_LOCK: _bindgen_ty_2 = 115; +pub const AKEYCODE_SCROLL_LOCK: _bindgen_ty_2 = 116; +pub const AKEYCODE_META_LEFT: _bindgen_ty_2 = 117; +pub const AKEYCODE_META_RIGHT: _bindgen_ty_2 = 118; +pub const AKEYCODE_FUNCTION: _bindgen_ty_2 = 119; +pub const AKEYCODE_SYSRQ: _bindgen_ty_2 = 120; +pub const AKEYCODE_BREAK: _bindgen_ty_2 = 121; +pub const AKEYCODE_MOVE_HOME: _bindgen_ty_2 = 122; +pub const AKEYCODE_MOVE_END: _bindgen_ty_2 = 123; +pub const AKEYCODE_INSERT: _bindgen_ty_2 = 124; +pub const AKEYCODE_FORWARD: _bindgen_ty_2 = 125; +pub const AKEYCODE_MEDIA_PLAY: _bindgen_ty_2 = 126; +pub const AKEYCODE_MEDIA_PAUSE: _bindgen_ty_2 = 127; +pub const AKEYCODE_MEDIA_CLOSE: _bindgen_ty_2 = 128; +pub const AKEYCODE_MEDIA_EJECT: _bindgen_ty_2 = 129; +pub const AKEYCODE_MEDIA_RECORD: _bindgen_ty_2 = 130; +pub const AKEYCODE_F1: _bindgen_ty_2 = 131; +pub const AKEYCODE_F2: _bindgen_ty_2 = 132; +pub const AKEYCODE_F3: _bindgen_ty_2 = 133; +pub const AKEYCODE_F4: _bindgen_ty_2 = 134; +pub const AKEYCODE_F5: _bindgen_ty_2 = 135; +pub const AKEYCODE_F6: _bindgen_ty_2 = 136; +pub const AKEYCODE_F7: _bindgen_ty_2 = 137; +pub const AKEYCODE_F8: _bindgen_ty_2 = 138; +pub const AKEYCODE_F9: _bindgen_ty_2 = 139; +pub const AKEYCODE_F10: _bindgen_ty_2 = 140; +pub const AKEYCODE_F11: _bindgen_ty_2 = 141; +pub const AKEYCODE_F12: _bindgen_ty_2 = 142; +pub const AKEYCODE_NUM_LOCK: _bindgen_ty_2 = 143; +pub const AKEYCODE_NUMPAD_0: _bindgen_ty_2 = 144; +pub const AKEYCODE_NUMPAD_1: _bindgen_ty_2 = 145; +pub const AKEYCODE_NUMPAD_2: _bindgen_ty_2 = 146; +pub const AKEYCODE_NUMPAD_3: _bindgen_ty_2 = 147; +pub const AKEYCODE_NUMPAD_4: _bindgen_ty_2 = 148; +pub const AKEYCODE_NUMPAD_5: _bindgen_ty_2 = 149; +pub const AKEYCODE_NUMPAD_6: _bindgen_ty_2 = 150; +pub const AKEYCODE_NUMPAD_7: _bindgen_ty_2 = 151; +pub const AKEYCODE_NUMPAD_8: _bindgen_ty_2 = 152; +pub const AKEYCODE_NUMPAD_9: _bindgen_ty_2 = 153; +pub const AKEYCODE_NUMPAD_DIVIDE: _bindgen_ty_2 = 154; +pub const AKEYCODE_NUMPAD_MULTIPLY: _bindgen_ty_2 = 155; +pub const AKEYCODE_NUMPAD_SUBTRACT: _bindgen_ty_2 = 156; +pub const AKEYCODE_NUMPAD_ADD: _bindgen_ty_2 = 157; +pub const AKEYCODE_NUMPAD_DOT: _bindgen_ty_2 = 158; +pub const AKEYCODE_NUMPAD_COMMA: _bindgen_ty_2 = 159; +pub const AKEYCODE_NUMPAD_ENTER: _bindgen_ty_2 = 160; +pub const AKEYCODE_NUMPAD_EQUALS: _bindgen_ty_2 = 161; +pub const AKEYCODE_NUMPAD_LEFT_PAREN: _bindgen_ty_2 = 162; +pub const AKEYCODE_NUMPAD_RIGHT_PAREN: _bindgen_ty_2 = 163; +pub const AKEYCODE_VOLUME_MUTE: _bindgen_ty_2 = 164; +pub const AKEYCODE_INFO: _bindgen_ty_2 = 165; +pub const AKEYCODE_CHANNEL_UP: _bindgen_ty_2 = 166; +pub const AKEYCODE_CHANNEL_DOWN: _bindgen_ty_2 = 167; +pub const AKEYCODE_ZOOM_IN: _bindgen_ty_2 = 168; +pub const AKEYCODE_ZOOM_OUT: _bindgen_ty_2 = 169; +pub const AKEYCODE_TV: _bindgen_ty_2 = 170; +pub const AKEYCODE_WINDOW: _bindgen_ty_2 = 171; +pub const AKEYCODE_GUIDE: _bindgen_ty_2 = 172; +pub const AKEYCODE_DVR: _bindgen_ty_2 = 173; +pub const AKEYCODE_BOOKMARK: _bindgen_ty_2 = 174; +pub const AKEYCODE_CAPTIONS: _bindgen_ty_2 = 175; +pub const AKEYCODE_SETTINGS: _bindgen_ty_2 = 176; +pub const AKEYCODE_TV_POWER: _bindgen_ty_2 = 177; +pub const AKEYCODE_TV_INPUT: _bindgen_ty_2 = 178; +pub const AKEYCODE_STB_POWER: _bindgen_ty_2 = 179; +pub const AKEYCODE_STB_INPUT: _bindgen_ty_2 = 180; +pub const AKEYCODE_AVR_POWER: _bindgen_ty_2 = 181; +pub const AKEYCODE_AVR_INPUT: _bindgen_ty_2 = 182; +pub const AKEYCODE_PROG_RED: _bindgen_ty_2 = 183; +pub const AKEYCODE_PROG_GREEN: _bindgen_ty_2 = 184; +pub const AKEYCODE_PROG_YELLOW: _bindgen_ty_2 = 185; +pub const AKEYCODE_PROG_BLUE: _bindgen_ty_2 = 186; +pub const AKEYCODE_APP_SWITCH: _bindgen_ty_2 = 187; +pub const AKEYCODE_BUTTON_1: _bindgen_ty_2 = 188; +pub const AKEYCODE_BUTTON_2: _bindgen_ty_2 = 189; +pub const AKEYCODE_BUTTON_3: _bindgen_ty_2 = 190; +pub const AKEYCODE_BUTTON_4: _bindgen_ty_2 = 191; +pub const AKEYCODE_BUTTON_5: _bindgen_ty_2 = 192; +pub const AKEYCODE_BUTTON_6: _bindgen_ty_2 = 193; +pub const AKEYCODE_BUTTON_7: _bindgen_ty_2 = 194; +pub const AKEYCODE_BUTTON_8: _bindgen_ty_2 = 195; +pub const AKEYCODE_BUTTON_9: _bindgen_ty_2 = 196; +pub const AKEYCODE_BUTTON_10: _bindgen_ty_2 = 197; +pub const AKEYCODE_BUTTON_11: _bindgen_ty_2 = 198; +pub const AKEYCODE_BUTTON_12: _bindgen_ty_2 = 199; +pub const AKEYCODE_BUTTON_13: _bindgen_ty_2 = 200; +pub const AKEYCODE_BUTTON_14: _bindgen_ty_2 = 201; +pub const AKEYCODE_BUTTON_15: _bindgen_ty_2 = 202; +pub const AKEYCODE_BUTTON_16: _bindgen_ty_2 = 203; +pub const AKEYCODE_LANGUAGE_SWITCH: _bindgen_ty_2 = 204; +pub const AKEYCODE_MANNER_MODE: _bindgen_ty_2 = 205; +pub const AKEYCODE_3D_MODE: _bindgen_ty_2 = 206; +pub const AKEYCODE_CONTACTS: _bindgen_ty_2 = 207; +pub const AKEYCODE_CALENDAR: _bindgen_ty_2 = 208; +pub const AKEYCODE_MUSIC: _bindgen_ty_2 = 209; +pub const AKEYCODE_CALCULATOR: _bindgen_ty_2 = 210; +pub const AKEYCODE_ZENKAKU_HANKAKU: _bindgen_ty_2 = 211; +pub const AKEYCODE_EISU: _bindgen_ty_2 = 212; +pub const AKEYCODE_MUHENKAN: _bindgen_ty_2 = 213; +pub const AKEYCODE_HENKAN: _bindgen_ty_2 = 214; +pub const AKEYCODE_KATAKANA_HIRAGANA: _bindgen_ty_2 = 215; +pub const AKEYCODE_YEN: _bindgen_ty_2 = 216; +pub const AKEYCODE_RO: _bindgen_ty_2 = 217; +pub const AKEYCODE_KANA: _bindgen_ty_2 = 218; +pub const AKEYCODE_ASSIST: _bindgen_ty_2 = 219; +pub const AKEYCODE_BRIGHTNESS_DOWN: _bindgen_ty_2 = 220; +pub const AKEYCODE_BRIGHTNESS_UP: _bindgen_ty_2 = 221; +pub const AKEYCODE_MEDIA_AUDIO_TRACK: _bindgen_ty_2 = 222; +pub const AKEYCODE_SLEEP: _bindgen_ty_2 = 223; +pub const AKEYCODE_WAKEUP: _bindgen_ty_2 = 224; +pub const AKEYCODE_PAIRING: _bindgen_ty_2 = 225; +pub const AKEYCODE_MEDIA_TOP_MENU: _bindgen_ty_2 = 226; +pub const AKEYCODE_11: _bindgen_ty_2 = 227; +pub const AKEYCODE_12: _bindgen_ty_2 = 228; +pub const AKEYCODE_LAST_CHANNEL: _bindgen_ty_2 = 229; +pub const AKEYCODE_TV_DATA_SERVICE: _bindgen_ty_2 = 230; +pub const AKEYCODE_VOICE_ASSIST: _bindgen_ty_2 = 231; +pub const AKEYCODE_TV_RADIO_SERVICE: _bindgen_ty_2 = 232; +pub const AKEYCODE_TV_TELETEXT: _bindgen_ty_2 = 233; +pub const AKEYCODE_TV_NUMBER_ENTRY: _bindgen_ty_2 = 234; +pub const AKEYCODE_TV_TERRESTRIAL_ANALOG: _bindgen_ty_2 = 235; +pub const AKEYCODE_TV_TERRESTRIAL_DIGITAL: _bindgen_ty_2 = 236; +pub const AKEYCODE_TV_SATELLITE: _bindgen_ty_2 = 237; +pub const AKEYCODE_TV_SATELLITE_BS: _bindgen_ty_2 = 238; +pub const AKEYCODE_TV_SATELLITE_CS: _bindgen_ty_2 = 239; +pub const AKEYCODE_TV_SATELLITE_SERVICE: _bindgen_ty_2 = 240; +pub const AKEYCODE_TV_NETWORK: _bindgen_ty_2 = 241; +pub const AKEYCODE_TV_ANTENNA_CABLE: _bindgen_ty_2 = 242; +pub const AKEYCODE_TV_INPUT_HDMI_1: _bindgen_ty_2 = 243; +pub const AKEYCODE_TV_INPUT_HDMI_2: _bindgen_ty_2 = 244; +pub const AKEYCODE_TV_INPUT_HDMI_3: _bindgen_ty_2 = 245; +pub const AKEYCODE_TV_INPUT_HDMI_4: _bindgen_ty_2 = 246; +pub const AKEYCODE_TV_INPUT_COMPOSITE_1: _bindgen_ty_2 = 247; +pub const AKEYCODE_TV_INPUT_COMPOSITE_2: _bindgen_ty_2 = 248; +pub const AKEYCODE_TV_INPUT_COMPONENT_1: _bindgen_ty_2 = 249; +pub const AKEYCODE_TV_INPUT_COMPONENT_2: _bindgen_ty_2 = 250; +pub const AKEYCODE_TV_INPUT_VGA_1: _bindgen_ty_2 = 251; +pub const AKEYCODE_TV_AUDIO_DESCRIPTION: _bindgen_ty_2 = 252; +pub const AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_UP: _bindgen_ty_2 = 253; +pub const AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_DOWN: _bindgen_ty_2 = 254; +pub const AKEYCODE_TV_ZOOM_MODE: _bindgen_ty_2 = 255; +pub const AKEYCODE_TV_CONTENTS_MENU: _bindgen_ty_2 = 256; +pub const AKEYCODE_TV_MEDIA_CONTEXT_MENU: _bindgen_ty_2 = 257; +pub const AKEYCODE_TV_TIMER_PROGRAMMING: _bindgen_ty_2 = 258; +pub const AKEYCODE_HELP: _bindgen_ty_2 = 259; +pub const AKEYCODE_NAVIGATE_PREVIOUS: _bindgen_ty_2 = 260; +pub const AKEYCODE_NAVIGATE_NEXT: _bindgen_ty_2 = 261; +pub const AKEYCODE_NAVIGATE_IN: _bindgen_ty_2 = 262; +pub const AKEYCODE_NAVIGATE_OUT: _bindgen_ty_2 = 263; +pub const AKEYCODE_STEM_PRIMARY: _bindgen_ty_2 = 264; +pub const AKEYCODE_STEM_1: _bindgen_ty_2 = 265; +pub const AKEYCODE_STEM_2: _bindgen_ty_2 = 266; +pub const AKEYCODE_STEM_3: _bindgen_ty_2 = 267; +pub const AKEYCODE_DPAD_UP_LEFT: _bindgen_ty_2 = 268; +pub const AKEYCODE_DPAD_DOWN_LEFT: _bindgen_ty_2 = 269; +pub const AKEYCODE_DPAD_UP_RIGHT: _bindgen_ty_2 = 270; +pub const AKEYCODE_DPAD_DOWN_RIGHT: _bindgen_ty_2 = 271; +pub const AKEYCODE_MEDIA_SKIP_FORWARD: _bindgen_ty_2 = 272; +pub const AKEYCODE_MEDIA_SKIP_BACKWARD: _bindgen_ty_2 = 273; +pub const AKEYCODE_MEDIA_STEP_FORWARD: _bindgen_ty_2 = 274; +pub const AKEYCODE_MEDIA_STEP_BACKWARD: _bindgen_ty_2 = 275; +pub const AKEYCODE_SOFT_SLEEP: _bindgen_ty_2 = 276; +pub const AKEYCODE_CUT: _bindgen_ty_2 = 277; +pub const AKEYCODE_COPY: _bindgen_ty_2 = 278; +pub const AKEYCODE_PASTE: _bindgen_ty_2 = 279; +pub const AKEYCODE_SYSTEM_NAVIGATION_UP: _bindgen_ty_2 = 280; +pub const AKEYCODE_SYSTEM_NAVIGATION_DOWN: _bindgen_ty_2 = 281; +pub const AKEYCODE_SYSTEM_NAVIGATION_LEFT: _bindgen_ty_2 = 282; +pub const AKEYCODE_SYSTEM_NAVIGATION_RIGHT: _bindgen_ty_2 = 283; +pub const AKEYCODE_ALL_APPS: _bindgen_ty_2 = 284; +pub const AKEYCODE_REFRESH: _bindgen_ty_2 = 285; +pub const AKEYCODE_THUMBS_UP: _bindgen_ty_2 = 286; +pub const AKEYCODE_THUMBS_DOWN: _bindgen_ty_2 = 287; +pub const AKEYCODE_PROFILE_SWITCH: _bindgen_ty_2 = 288; +pub const AKEYCODE_VIDEO_APP_1: _bindgen_ty_2 = 289; +pub const AKEYCODE_VIDEO_APP_2: _bindgen_ty_2 = 290; +pub const AKEYCODE_VIDEO_APP_3: _bindgen_ty_2 = 291; +pub const AKEYCODE_VIDEO_APP_4: _bindgen_ty_2 = 292; +pub const AKEYCODE_VIDEO_APP_5: _bindgen_ty_2 = 293; +pub const AKEYCODE_VIDEO_APP_6: _bindgen_ty_2 = 294; +pub const AKEYCODE_VIDEO_APP_7: _bindgen_ty_2 = 295; +pub const AKEYCODE_VIDEO_APP_8: _bindgen_ty_2 = 296; +pub const AKEYCODE_FEATURED_APP_1: _bindgen_ty_2 = 297; +pub const AKEYCODE_FEATURED_APP_2: _bindgen_ty_2 = 298; +pub const AKEYCODE_FEATURED_APP_3: _bindgen_ty_2 = 299; +pub const AKEYCODE_FEATURED_APP_4: _bindgen_ty_2 = 300; +pub const AKEYCODE_DEMO_APP_1: _bindgen_ty_2 = 301; +pub const AKEYCODE_DEMO_APP_2: _bindgen_ty_2 = 302; +pub const AKEYCODE_DEMO_APP_3: _bindgen_ty_2 = 303; +pub const AKEYCODE_DEMO_APP_4: _bindgen_ty_2 = 304; pub type _bindgen_ty_2 = ::std::os::raw::c_uint; -pub const ALOOPER_PREPARE_ALLOW_NON_CALLBACKS: ::std::os::raw::c_uint = 1; +pub const ALOOPER_PREPARE_ALLOW_NON_CALLBACKS: _bindgen_ty_3 = 1; pub type _bindgen_ty_3 = ::std::os::raw::c_uint; -pub const ALOOPER_POLL_WAKE: ::std::os::raw::c_int = -1; -pub const ALOOPER_POLL_CALLBACK: ::std::os::raw::c_int = -2; -pub const ALOOPER_POLL_TIMEOUT: ::std::os::raw::c_int = -3; -pub const ALOOPER_POLL_ERROR: ::std::os::raw::c_int = -4; +pub const ALOOPER_POLL_WAKE: _bindgen_ty_4 = -1; +pub const ALOOPER_POLL_CALLBACK: _bindgen_ty_4 = -2; +pub const ALOOPER_POLL_TIMEOUT: _bindgen_ty_4 = -3; +pub const ALOOPER_POLL_ERROR: _bindgen_ty_4 = -4; pub type _bindgen_ty_4 = ::std::os::raw::c_int; -pub const ALOOPER_EVENT_INPUT: ::std::os::raw::c_uint = 1; -pub const ALOOPER_EVENT_OUTPUT: ::std::os::raw::c_uint = 2; -pub const ALOOPER_EVENT_ERROR: ::std::os::raw::c_uint = 4; -pub const ALOOPER_EVENT_HANGUP: ::std::os::raw::c_uint = 8; -pub const ALOOPER_EVENT_INVALID: ::std::os::raw::c_uint = 16; +pub const ALOOPER_EVENT_INPUT: _bindgen_ty_5 = 1; +pub const ALOOPER_EVENT_OUTPUT: _bindgen_ty_5 = 2; +pub const ALOOPER_EVENT_ERROR: _bindgen_ty_5 = 4; +pub const ALOOPER_EVENT_HANGUP: _bindgen_ty_5 = 8; +pub const ALOOPER_EVENT_INVALID: _bindgen_ty_5 = 16; pub type _bindgen_ty_5 = ::std::os::raw::c_uint; -pub const AKEY_STATE_UNKNOWN: ::std::os::raw::c_int = -1; -pub const AKEY_STATE_UP: ::std::os::raw::c_int = 0; -pub const AKEY_STATE_DOWN: ::std::os::raw::c_int = 1; -pub const AKEY_STATE_VIRTUAL: ::std::os::raw::c_int = 2; +pub type __gnuc_va_list = __builtin_va_list; +pub type va_list = __builtin_va_list; +#[repr(C)] +pub struct JavaVMAttachArgs { + pub version: jint, + pub name: *const ::std::os::raw::c_char, + pub group: jobject, +} +#[test] +fn bindgen_test_layout_JavaVMAttachArgs() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 24usize, + "Size of JavaVMAttachArgs" + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + "Alignment of JavaVMAttachArgs" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).version) as usize - ptr as usize }, + 0usize, + "Offset of field: JavaVMAttachArgs::version" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize }, + 8usize, + "Offset of field: JavaVMAttachArgs::name" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).group) as usize - ptr as usize }, + 16usize, + "Offset of field: JavaVMAttachArgs::group" + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct JavaVMOption { + pub optionString: *const ::std::os::raw::c_char, + pub extraInfo: *mut ::std::os::raw::c_void, +} +#[test] +fn bindgen_test_layout_JavaVMOption() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 16usize, + "Size of JavaVMOption" + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + "Alignment of JavaVMOption" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).optionString) as usize - ptr as usize }, + 0usize, + "Offset of field: JavaVMOption::optionString" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).extraInfo) as usize - ptr as usize }, + 8usize, + "Offset of field: JavaVMOption::extraInfo" + ); +} +#[repr(C)] +pub struct JavaVMInitArgs { + pub version: jint, + pub nOptions: jint, + pub options: *mut JavaVMOption, + pub ignoreUnrecognized: jboolean, +} +#[test] +fn bindgen_test_layout_JavaVMInitArgs() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 24usize, + "Size of JavaVMInitArgs" + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + "Alignment of JavaVMInitArgs" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).version) as usize - ptr as usize }, + 0usize, + "Offset of field: JavaVMInitArgs::version" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).nOptions) as usize - ptr as usize }, + 4usize, + "Offset of field: JavaVMInitArgs::nOptions" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).options) as usize - ptr as usize }, + 8usize, + "Offset of field: JavaVMInitArgs::options" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ignoreUnrecognized) as usize - ptr as usize }, + 16usize, + "Offset of field: JavaVMInitArgs::ignoreUnrecognized" + ); +} +pub const AKEY_STATE_UNKNOWN: _bindgen_ty_6 = -1; +pub const AKEY_STATE_UP: _bindgen_ty_6 = 0; +pub const AKEY_STATE_DOWN: _bindgen_ty_6 = 1; +pub const AKEY_STATE_VIRTUAL: _bindgen_ty_6 = 2; pub type _bindgen_ty_6 = ::std::os::raw::c_int; -pub const AMETA_NONE: ::std::os::raw::c_uint = 0; -pub const AMETA_ALT_ON: ::std::os::raw::c_uint = 2; -pub const AMETA_ALT_LEFT_ON: ::std::os::raw::c_uint = 16; -pub const AMETA_ALT_RIGHT_ON: ::std::os::raw::c_uint = 32; -pub const AMETA_SHIFT_ON: ::std::os::raw::c_uint = 1; -pub const AMETA_SHIFT_LEFT_ON: ::std::os::raw::c_uint = 64; -pub const AMETA_SHIFT_RIGHT_ON: ::std::os::raw::c_uint = 128; -pub const AMETA_SYM_ON: ::std::os::raw::c_uint = 4; -pub const AMETA_FUNCTION_ON: ::std::os::raw::c_uint = 8; -pub const AMETA_CTRL_ON: ::std::os::raw::c_uint = 4096; -pub const AMETA_CTRL_LEFT_ON: ::std::os::raw::c_uint = 8192; -pub const AMETA_CTRL_RIGHT_ON: ::std::os::raw::c_uint = 16384; -pub const AMETA_META_ON: ::std::os::raw::c_uint = 65536; -pub const AMETA_META_LEFT_ON: ::std::os::raw::c_uint = 131072; -pub const AMETA_META_RIGHT_ON: ::std::os::raw::c_uint = 262144; -pub const AMETA_CAPS_LOCK_ON: ::std::os::raw::c_uint = 1048576; -pub const AMETA_NUM_LOCK_ON: ::std::os::raw::c_uint = 2097152; -pub const AMETA_SCROLL_LOCK_ON: ::std::os::raw::c_uint = 4194304; +pub const AMETA_NONE: _bindgen_ty_7 = 0; +pub const AMETA_ALT_ON: _bindgen_ty_7 = 2; +pub const AMETA_ALT_LEFT_ON: _bindgen_ty_7 = 16; +pub const AMETA_ALT_RIGHT_ON: _bindgen_ty_7 = 32; +pub const AMETA_SHIFT_ON: _bindgen_ty_7 = 1; +pub const AMETA_SHIFT_LEFT_ON: _bindgen_ty_7 = 64; +pub const AMETA_SHIFT_RIGHT_ON: _bindgen_ty_7 = 128; +pub const AMETA_SYM_ON: _bindgen_ty_7 = 4; +pub const AMETA_FUNCTION_ON: _bindgen_ty_7 = 8; +pub const AMETA_CTRL_ON: _bindgen_ty_7 = 4096; +pub const AMETA_CTRL_LEFT_ON: _bindgen_ty_7 = 8192; +pub const AMETA_CTRL_RIGHT_ON: _bindgen_ty_7 = 16384; +pub const AMETA_META_ON: _bindgen_ty_7 = 65536; +pub const AMETA_META_LEFT_ON: _bindgen_ty_7 = 131072; +pub const AMETA_META_RIGHT_ON: _bindgen_ty_7 = 262144; +pub const AMETA_CAPS_LOCK_ON: _bindgen_ty_7 = 1048576; +pub const AMETA_NUM_LOCK_ON: _bindgen_ty_7 = 2097152; +pub const AMETA_SCROLL_LOCK_ON: _bindgen_ty_7 = 4194304; pub type _bindgen_ty_7 = ::std::os::raw::c_uint; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct AInputEvent { _unused: [u8; 0], } -pub const AINPUT_EVENT_TYPE_KEY: ::std::os::raw::c_uint = 1; -pub const AINPUT_EVENT_TYPE_MOTION: ::std::os::raw::c_uint = 2; +pub const AINPUT_EVENT_TYPE_KEY: _bindgen_ty_8 = 1; +pub const AINPUT_EVENT_TYPE_MOTION: _bindgen_ty_8 = 2; +pub const AINPUT_EVENT_TYPE_FOCUS: _bindgen_ty_8 = 3; +pub const AINPUT_EVENT_TYPE_CAPTURE: _bindgen_ty_8 = 4; +pub const AINPUT_EVENT_TYPE_DRAG: _bindgen_ty_8 = 5; +pub const AINPUT_EVENT_TYPE_TOUCH_MODE: _bindgen_ty_8 = 6; pub type _bindgen_ty_8 = ::std::os::raw::c_uint; -pub const AKEY_EVENT_ACTION_DOWN: ::std::os::raw::c_uint = 0; -pub const AKEY_EVENT_ACTION_UP: ::std::os::raw::c_uint = 1; -pub const AKEY_EVENT_ACTION_MULTIPLE: ::std::os::raw::c_uint = 2; +pub const AKEY_EVENT_ACTION_DOWN: _bindgen_ty_9 = 0; +pub const AKEY_EVENT_ACTION_UP: _bindgen_ty_9 = 1; +pub const AKEY_EVENT_ACTION_MULTIPLE: _bindgen_ty_9 = 2; pub type _bindgen_ty_9 = ::std::os::raw::c_uint; -pub const AKEY_EVENT_FLAG_WOKE_HERE: ::std::os::raw::c_uint = 1; -pub const AKEY_EVENT_FLAG_SOFT_KEYBOARD: ::std::os::raw::c_uint = 2; -pub const AKEY_EVENT_FLAG_KEEP_TOUCH_MODE: ::std::os::raw::c_uint = 4; -pub const AKEY_EVENT_FLAG_FROM_SYSTEM: ::std::os::raw::c_uint = 8; -pub const AKEY_EVENT_FLAG_EDITOR_ACTION: ::std::os::raw::c_uint = 16; -pub const AKEY_EVENT_FLAG_CANCELED: ::std::os::raw::c_uint = 32; -pub const AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY: ::std::os::raw::c_uint = 64; -pub const AKEY_EVENT_FLAG_LONG_PRESS: ::std::os::raw::c_uint = 128; -pub const AKEY_EVENT_FLAG_CANCELED_LONG_PRESS: ::std::os::raw::c_uint = 256; -pub const AKEY_EVENT_FLAG_TRACKING: ::std::os::raw::c_uint = 512; -pub const AKEY_EVENT_FLAG_FALLBACK: ::std::os::raw::c_uint = 1024; +pub const AKEY_EVENT_FLAG_WOKE_HERE: _bindgen_ty_10 = 1; +pub const AKEY_EVENT_FLAG_SOFT_KEYBOARD: _bindgen_ty_10 = 2; +pub const AKEY_EVENT_FLAG_KEEP_TOUCH_MODE: _bindgen_ty_10 = 4; +pub const AKEY_EVENT_FLAG_FROM_SYSTEM: _bindgen_ty_10 = 8; +pub const AKEY_EVENT_FLAG_EDITOR_ACTION: _bindgen_ty_10 = 16; +pub const AKEY_EVENT_FLAG_CANCELED: _bindgen_ty_10 = 32; +pub const AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY: _bindgen_ty_10 = 64; +pub const AKEY_EVENT_FLAG_LONG_PRESS: _bindgen_ty_10 = 128; +pub const AKEY_EVENT_FLAG_CANCELED_LONG_PRESS: _bindgen_ty_10 = 256; +pub const AKEY_EVENT_FLAG_TRACKING: _bindgen_ty_10 = 512; +pub const AKEY_EVENT_FLAG_FALLBACK: _bindgen_ty_10 = 1024; pub type _bindgen_ty_10 = ::std::os::raw::c_uint; -pub const AMOTION_EVENT_ACTION_MASK: ::std::os::raw::c_uint = 255; -pub const AMOTION_EVENT_ACTION_POINTER_INDEX_MASK: ::std::os::raw::c_uint = 65280; -pub const AMOTION_EVENT_ACTION_DOWN: ::std::os::raw::c_uint = 0; -pub const AMOTION_EVENT_ACTION_UP: ::std::os::raw::c_uint = 1; -pub const AMOTION_EVENT_ACTION_MOVE: ::std::os::raw::c_uint = 2; -pub const AMOTION_EVENT_ACTION_CANCEL: ::std::os::raw::c_uint = 3; -pub const AMOTION_EVENT_ACTION_OUTSIDE: ::std::os::raw::c_uint = 4; -pub const AMOTION_EVENT_ACTION_POINTER_DOWN: ::std::os::raw::c_uint = 5; -pub const AMOTION_EVENT_ACTION_POINTER_UP: ::std::os::raw::c_uint = 6; -pub const AMOTION_EVENT_ACTION_HOVER_MOVE: ::std::os::raw::c_uint = 7; -pub const AMOTION_EVENT_ACTION_SCROLL: ::std::os::raw::c_uint = 8; -pub const AMOTION_EVENT_ACTION_HOVER_ENTER: ::std::os::raw::c_uint = 9; -pub const AMOTION_EVENT_ACTION_HOVER_EXIT: ::std::os::raw::c_uint = 10; -pub const AMOTION_EVENT_ACTION_BUTTON_PRESS: ::std::os::raw::c_uint = 11; -pub const AMOTION_EVENT_ACTION_BUTTON_RELEASE: ::std::os::raw::c_uint = 12; +pub const AMOTION_EVENT_ACTION_MASK: _bindgen_ty_11 = 255; +pub const AMOTION_EVENT_ACTION_POINTER_INDEX_MASK: _bindgen_ty_11 = 65280; +pub const AMOTION_EVENT_ACTION_DOWN: _bindgen_ty_11 = 0; +pub const AMOTION_EVENT_ACTION_UP: _bindgen_ty_11 = 1; +pub const AMOTION_EVENT_ACTION_MOVE: _bindgen_ty_11 = 2; +pub const AMOTION_EVENT_ACTION_CANCEL: _bindgen_ty_11 = 3; +pub const AMOTION_EVENT_ACTION_OUTSIDE: _bindgen_ty_11 = 4; +pub const AMOTION_EVENT_ACTION_POINTER_DOWN: _bindgen_ty_11 = 5; +pub const AMOTION_EVENT_ACTION_POINTER_UP: _bindgen_ty_11 = 6; +pub const AMOTION_EVENT_ACTION_HOVER_MOVE: _bindgen_ty_11 = 7; +pub const AMOTION_EVENT_ACTION_SCROLL: _bindgen_ty_11 = 8; +pub const AMOTION_EVENT_ACTION_HOVER_ENTER: _bindgen_ty_11 = 9; +pub const AMOTION_EVENT_ACTION_HOVER_EXIT: _bindgen_ty_11 = 10; +pub const AMOTION_EVENT_ACTION_BUTTON_PRESS: _bindgen_ty_11 = 11; +pub const AMOTION_EVENT_ACTION_BUTTON_RELEASE: _bindgen_ty_11 = 12; pub type _bindgen_ty_11 = ::std::os::raw::c_uint; -pub const AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED: ::std::os::raw::c_uint = 1; +pub const AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED: _bindgen_ty_12 = 1; pub type _bindgen_ty_12 = ::std::os::raw::c_uint; -pub const AMOTION_EVENT_EDGE_FLAG_NONE: ::std::os::raw::c_uint = 0; -pub const AMOTION_EVENT_EDGE_FLAG_TOP: ::std::os::raw::c_uint = 1; -pub const AMOTION_EVENT_EDGE_FLAG_BOTTOM: ::std::os::raw::c_uint = 2; -pub const AMOTION_EVENT_EDGE_FLAG_LEFT: ::std::os::raw::c_uint = 4; -pub const AMOTION_EVENT_EDGE_FLAG_RIGHT: ::std::os::raw::c_uint = 8; +pub const AMOTION_EVENT_EDGE_FLAG_NONE: _bindgen_ty_13 = 0; +pub const AMOTION_EVENT_EDGE_FLAG_TOP: _bindgen_ty_13 = 1; +pub const AMOTION_EVENT_EDGE_FLAG_BOTTOM: _bindgen_ty_13 = 2; +pub const AMOTION_EVENT_EDGE_FLAG_LEFT: _bindgen_ty_13 = 4; +pub const AMOTION_EVENT_EDGE_FLAG_RIGHT: _bindgen_ty_13 = 8; pub type _bindgen_ty_13 = ::std::os::raw::c_uint; -pub const AMOTION_EVENT_AXIS_X: ::std::os::raw::c_uint = 0; -pub const AMOTION_EVENT_AXIS_Y: ::std::os::raw::c_uint = 1; -pub const AMOTION_EVENT_AXIS_PRESSURE: ::std::os::raw::c_uint = 2; -pub const AMOTION_EVENT_AXIS_SIZE: ::std::os::raw::c_uint = 3; -pub const AMOTION_EVENT_AXIS_TOUCH_MAJOR: ::std::os::raw::c_uint = 4; -pub const AMOTION_EVENT_AXIS_TOUCH_MINOR: ::std::os::raw::c_uint = 5; -pub const AMOTION_EVENT_AXIS_TOOL_MAJOR: ::std::os::raw::c_uint = 6; -pub const AMOTION_EVENT_AXIS_TOOL_MINOR: ::std::os::raw::c_uint = 7; -pub const AMOTION_EVENT_AXIS_ORIENTATION: ::std::os::raw::c_uint = 8; -pub const AMOTION_EVENT_AXIS_VSCROLL: ::std::os::raw::c_uint = 9; -pub const AMOTION_EVENT_AXIS_HSCROLL: ::std::os::raw::c_uint = 10; -pub const AMOTION_EVENT_AXIS_Z: ::std::os::raw::c_uint = 11; -pub const AMOTION_EVENT_AXIS_RX: ::std::os::raw::c_uint = 12; -pub const AMOTION_EVENT_AXIS_RY: ::std::os::raw::c_uint = 13; -pub const AMOTION_EVENT_AXIS_RZ: ::std::os::raw::c_uint = 14; -pub const AMOTION_EVENT_AXIS_HAT_X: ::std::os::raw::c_uint = 15; -pub const AMOTION_EVENT_AXIS_HAT_Y: ::std::os::raw::c_uint = 16; -pub const AMOTION_EVENT_AXIS_LTRIGGER: ::std::os::raw::c_uint = 17; -pub const AMOTION_EVENT_AXIS_RTRIGGER: ::std::os::raw::c_uint = 18; -pub const AMOTION_EVENT_AXIS_THROTTLE: ::std::os::raw::c_uint = 19; -pub const AMOTION_EVENT_AXIS_RUDDER: ::std::os::raw::c_uint = 20; -pub const AMOTION_EVENT_AXIS_WHEEL: ::std::os::raw::c_uint = 21; -pub const AMOTION_EVENT_AXIS_GAS: ::std::os::raw::c_uint = 22; -pub const AMOTION_EVENT_AXIS_BRAKE: ::std::os::raw::c_uint = 23; -pub const AMOTION_EVENT_AXIS_DISTANCE: ::std::os::raw::c_uint = 24; -pub const AMOTION_EVENT_AXIS_TILT: ::std::os::raw::c_uint = 25; -pub const AMOTION_EVENT_AXIS_SCROLL: ::std::os::raw::c_uint = 26; -pub const AMOTION_EVENT_AXIS_RELATIVE_X: ::std::os::raw::c_uint = 27; -pub const AMOTION_EVENT_AXIS_RELATIVE_Y: ::std::os::raw::c_uint = 28; -pub const AMOTION_EVENT_AXIS_GENERIC_1: ::std::os::raw::c_uint = 32; -pub const AMOTION_EVENT_AXIS_GENERIC_2: ::std::os::raw::c_uint = 33; -pub const AMOTION_EVENT_AXIS_GENERIC_3: ::std::os::raw::c_uint = 34; -pub const AMOTION_EVENT_AXIS_GENERIC_4: ::std::os::raw::c_uint = 35; -pub const AMOTION_EVENT_AXIS_GENERIC_5: ::std::os::raw::c_uint = 36; -pub const AMOTION_EVENT_AXIS_GENERIC_6: ::std::os::raw::c_uint = 37; -pub const AMOTION_EVENT_AXIS_GENERIC_7: ::std::os::raw::c_uint = 38; -pub const AMOTION_EVENT_AXIS_GENERIC_8: ::std::os::raw::c_uint = 39; -pub const AMOTION_EVENT_AXIS_GENERIC_9: ::std::os::raw::c_uint = 40; -pub const AMOTION_EVENT_AXIS_GENERIC_10: ::std::os::raw::c_uint = 41; -pub const AMOTION_EVENT_AXIS_GENERIC_11: ::std::os::raw::c_uint = 42; -pub const AMOTION_EVENT_AXIS_GENERIC_12: ::std::os::raw::c_uint = 43; -pub const AMOTION_EVENT_AXIS_GENERIC_13: ::std::os::raw::c_uint = 44; -pub const AMOTION_EVENT_AXIS_GENERIC_14: ::std::os::raw::c_uint = 45; -pub const AMOTION_EVENT_AXIS_GENERIC_15: ::std::os::raw::c_uint = 46; -pub const AMOTION_EVENT_AXIS_GENERIC_16: ::std::os::raw::c_uint = 47; +pub const AMOTION_EVENT_AXIS_X: _bindgen_ty_14 = 0; +pub const AMOTION_EVENT_AXIS_Y: _bindgen_ty_14 = 1; +pub const AMOTION_EVENT_AXIS_PRESSURE: _bindgen_ty_14 = 2; +pub const AMOTION_EVENT_AXIS_SIZE: _bindgen_ty_14 = 3; +pub const AMOTION_EVENT_AXIS_TOUCH_MAJOR: _bindgen_ty_14 = 4; +pub const AMOTION_EVENT_AXIS_TOUCH_MINOR: _bindgen_ty_14 = 5; +pub const AMOTION_EVENT_AXIS_TOOL_MAJOR: _bindgen_ty_14 = 6; +pub const AMOTION_EVENT_AXIS_TOOL_MINOR: _bindgen_ty_14 = 7; +pub const AMOTION_EVENT_AXIS_ORIENTATION: _bindgen_ty_14 = 8; +pub const AMOTION_EVENT_AXIS_VSCROLL: _bindgen_ty_14 = 9; +pub const AMOTION_EVENT_AXIS_HSCROLL: _bindgen_ty_14 = 10; +pub const AMOTION_EVENT_AXIS_Z: _bindgen_ty_14 = 11; +pub const AMOTION_EVENT_AXIS_RX: _bindgen_ty_14 = 12; +pub const AMOTION_EVENT_AXIS_RY: _bindgen_ty_14 = 13; +pub const AMOTION_EVENT_AXIS_RZ: _bindgen_ty_14 = 14; +pub const AMOTION_EVENT_AXIS_HAT_X: _bindgen_ty_14 = 15; +pub const AMOTION_EVENT_AXIS_HAT_Y: _bindgen_ty_14 = 16; +pub const AMOTION_EVENT_AXIS_LTRIGGER: _bindgen_ty_14 = 17; +pub const AMOTION_EVENT_AXIS_RTRIGGER: _bindgen_ty_14 = 18; +pub const AMOTION_EVENT_AXIS_THROTTLE: _bindgen_ty_14 = 19; +pub const AMOTION_EVENT_AXIS_RUDDER: _bindgen_ty_14 = 20; +pub const AMOTION_EVENT_AXIS_WHEEL: _bindgen_ty_14 = 21; +pub const AMOTION_EVENT_AXIS_GAS: _bindgen_ty_14 = 22; +pub const AMOTION_EVENT_AXIS_BRAKE: _bindgen_ty_14 = 23; +pub const AMOTION_EVENT_AXIS_DISTANCE: _bindgen_ty_14 = 24; +pub const AMOTION_EVENT_AXIS_TILT: _bindgen_ty_14 = 25; +pub const AMOTION_EVENT_AXIS_SCROLL: _bindgen_ty_14 = 26; +pub const AMOTION_EVENT_AXIS_RELATIVE_X: _bindgen_ty_14 = 27; +pub const AMOTION_EVENT_AXIS_RELATIVE_Y: _bindgen_ty_14 = 28; +pub const AMOTION_EVENT_AXIS_GENERIC_1: _bindgen_ty_14 = 32; +pub const AMOTION_EVENT_AXIS_GENERIC_2: _bindgen_ty_14 = 33; +pub const AMOTION_EVENT_AXIS_GENERIC_3: _bindgen_ty_14 = 34; +pub const AMOTION_EVENT_AXIS_GENERIC_4: _bindgen_ty_14 = 35; +pub const AMOTION_EVENT_AXIS_GENERIC_5: _bindgen_ty_14 = 36; +pub const AMOTION_EVENT_AXIS_GENERIC_6: _bindgen_ty_14 = 37; +pub const AMOTION_EVENT_AXIS_GENERIC_7: _bindgen_ty_14 = 38; +pub const AMOTION_EVENT_AXIS_GENERIC_8: _bindgen_ty_14 = 39; +pub const AMOTION_EVENT_AXIS_GENERIC_9: _bindgen_ty_14 = 40; +pub const AMOTION_EVENT_AXIS_GENERIC_10: _bindgen_ty_14 = 41; +pub const AMOTION_EVENT_AXIS_GENERIC_11: _bindgen_ty_14 = 42; +pub const AMOTION_EVENT_AXIS_GENERIC_12: _bindgen_ty_14 = 43; +pub const AMOTION_EVENT_AXIS_GENERIC_13: _bindgen_ty_14 = 44; +pub const AMOTION_EVENT_AXIS_GENERIC_14: _bindgen_ty_14 = 45; +pub const AMOTION_EVENT_AXIS_GENERIC_15: _bindgen_ty_14 = 46; +pub const AMOTION_EVENT_AXIS_GENERIC_16: _bindgen_ty_14 = 47; pub type _bindgen_ty_14 = ::std::os::raw::c_uint; -pub const AMOTION_EVENT_BUTTON_PRIMARY: ::std::os::raw::c_uint = 1; -pub const AMOTION_EVENT_BUTTON_SECONDARY: ::std::os::raw::c_uint = 2; -pub const AMOTION_EVENT_BUTTON_TERTIARY: ::std::os::raw::c_uint = 4; -pub const AMOTION_EVENT_BUTTON_BACK: ::std::os::raw::c_uint = 8; -pub const AMOTION_EVENT_BUTTON_FORWARD: ::std::os::raw::c_uint = 16; -pub const AMOTION_EVENT_BUTTON_STYLUS_PRIMARY: ::std::os::raw::c_uint = 32; -pub const AMOTION_EVENT_BUTTON_STYLUS_SECONDARY: ::std::os::raw::c_uint = 64; +pub const AMOTION_EVENT_BUTTON_PRIMARY: _bindgen_ty_15 = 1; +pub const AMOTION_EVENT_BUTTON_SECONDARY: _bindgen_ty_15 = 2; +pub const AMOTION_EVENT_BUTTON_TERTIARY: _bindgen_ty_15 = 4; +pub const AMOTION_EVENT_BUTTON_BACK: _bindgen_ty_15 = 8; +pub const AMOTION_EVENT_BUTTON_FORWARD: _bindgen_ty_15 = 16; +pub const AMOTION_EVENT_BUTTON_STYLUS_PRIMARY: _bindgen_ty_15 = 32; +pub const AMOTION_EVENT_BUTTON_STYLUS_SECONDARY: _bindgen_ty_15 = 64; pub type _bindgen_ty_15 = ::std::os::raw::c_uint; -pub const AMOTION_EVENT_TOOL_TYPE_UNKNOWN: ::std::os::raw::c_uint = 0; -pub const AMOTION_EVENT_TOOL_TYPE_FINGER: ::std::os::raw::c_uint = 1; -pub const AMOTION_EVENT_TOOL_TYPE_STYLUS: ::std::os::raw::c_uint = 2; -pub const AMOTION_EVENT_TOOL_TYPE_MOUSE: ::std::os::raw::c_uint = 3; -pub const AMOTION_EVENT_TOOL_TYPE_ERASER: ::std::os::raw::c_uint = 4; +pub const AMOTION_EVENT_TOOL_TYPE_UNKNOWN: _bindgen_ty_16 = 0; +pub const AMOTION_EVENT_TOOL_TYPE_FINGER: _bindgen_ty_16 = 1; +pub const AMOTION_EVENT_TOOL_TYPE_STYLUS: _bindgen_ty_16 = 2; +pub const AMOTION_EVENT_TOOL_TYPE_MOUSE: _bindgen_ty_16 = 3; +pub const AMOTION_EVENT_TOOL_TYPE_ERASER: _bindgen_ty_16 = 4; +pub const AMOTION_EVENT_TOOL_TYPE_PALM: _bindgen_ty_16 = 5; pub type _bindgen_ty_16 = ::std::os::raw::c_uint; -pub const AINPUT_SOURCE_CLASS_MASK: ::std::os::raw::c_uint = 255; -pub const AINPUT_SOURCE_CLASS_NONE: ::std::os::raw::c_uint = 0; -pub const AINPUT_SOURCE_CLASS_BUTTON: ::std::os::raw::c_uint = 1; -pub const AINPUT_SOURCE_CLASS_POINTER: ::std::os::raw::c_uint = 2; -pub const AINPUT_SOURCE_CLASS_NAVIGATION: ::std::os::raw::c_uint = 4; -pub const AINPUT_SOURCE_CLASS_POSITION: ::std::os::raw::c_uint = 8; -pub const AINPUT_SOURCE_CLASS_JOYSTICK: ::std::os::raw::c_uint = 16; +pub const AMotionClassification_AMOTION_EVENT_CLASSIFICATION_NONE: AMotionClassification = 0; +pub const AMotionClassification_AMOTION_EVENT_CLASSIFICATION_AMBIGUOUS_GESTURE: + AMotionClassification = 1; +pub const AMotionClassification_AMOTION_EVENT_CLASSIFICATION_DEEP_PRESS: AMotionClassification = 2; +pub type AMotionClassification = u32; +pub const AINPUT_SOURCE_CLASS_MASK: _bindgen_ty_17 = 255; +pub const AINPUT_SOURCE_CLASS_NONE: _bindgen_ty_17 = 0; +pub const AINPUT_SOURCE_CLASS_BUTTON: _bindgen_ty_17 = 1; +pub const AINPUT_SOURCE_CLASS_POINTER: _bindgen_ty_17 = 2; +pub const AINPUT_SOURCE_CLASS_NAVIGATION: _bindgen_ty_17 = 4; +pub const AINPUT_SOURCE_CLASS_POSITION: _bindgen_ty_17 = 8; +pub const AINPUT_SOURCE_CLASS_JOYSTICK: _bindgen_ty_17 = 16; pub type _bindgen_ty_17 = ::std::os::raw::c_uint; -pub const AINPUT_SOURCE_UNKNOWN: ::std::os::raw::c_uint = 0; -pub const AINPUT_SOURCE_KEYBOARD: ::std::os::raw::c_uint = 257; -pub const AINPUT_SOURCE_DPAD: ::std::os::raw::c_uint = 513; -pub const AINPUT_SOURCE_GAMEPAD: ::std::os::raw::c_uint = 1025; -pub const AINPUT_SOURCE_TOUCHSCREEN: ::std::os::raw::c_uint = 4098; -pub const AINPUT_SOURCE_MOUSE: ::std::os::raw::c_uint = 8194; -pub const AINPUT_SOURCE_STYLUS: ::std::os::raw::c_uint = 16386; -pub const AINPUT_SOURCE_BLUETOOTH_STYLUS: ::std::os::raw::c_uint = 49154; -pub const AINPUT_SOURCE_TRACKBALL: ::std::os::raw::c_uint = 65540; -pub const AINPUT_SOURCE_MOUSE_RELATIVE: ::std::os::raw::c_uint = 131076; -pub const AINPUT_SOURCE_TOUCHPAD: ::std::os::raw::c_uint = 1048584; -pub const AINPUT_SOURCE_TOUCH_NAVIGATION: ::std::os::raw::c_uint = 2097152; -pub const AINPUT_SOURCE_JOYSTICK: ::std::os::raw::c_uint = 16777232; -pub const AINPUT_SOURCE_ROTARY_ENCODER: ::std::os::raw::c_uint = 4194304; -pub const AINPUT_SOURCE_ANY: ::std::os::raw::c_uint = 4294967040; +pub const AINPUT_SOURCE_UNKNOWN: _bindgen_ty_18 = 0; +pub const AINPUT_SOURCE_KEYBOARD: _bindgen_ty_18 = 257; +pub const AINPUT_SOURCE_DPAD: _bindgen_ty_18 = 513; +pub const AINPUT_SOURCE_GAMEPAD: _bindgen_ty_18 = 1025; +pub const AINPUT_SOURCE_TOUCHSCREEN: _bindgen_ty_18 = 4098; +pub const AINPUT_SOURCE_MOUSE: _bindgen_ty_18 = 8194; +pub const AINPUT_SOURCE_STYLUS: _bindgen_ty_18 = 16386; +pub const AINPUT_SOURCE_BLUETOOTH_STYLUS: _bindgen_ty_18 = 49154; +pub const AINPUT_SOURCE_TRACKBALL: _bindgen_ty_18 = 65540; +pub const AINPUT_SOURCE_MOUSE_RELATIVE: _bindgen_ty_18 = 131076; +pub const AINPUT_SOURCE_TOUCHPAD: _bindgen_ty_18 = 1048584; +pub const AINPUT_SOURCE_TOUCH_NAVIGATION: _bindgen_ty_18 = 2097152; +pub const AINPUT_SOURCE_JOYSTICK: _bindgen_ty_18 = 16777232; +pub const AINPUT_SOURCE_HDMI: _bindgen_ty_18 = 33554433; +pub const AINPUT_SOURCE_SENSOR: _bindgen_ty_18 = 67108864; +pub const AINPUT_SOURCE_ROTARY_ENCODER: _bindgen_ty_18 = 4194304; +pub const AINPUT_SOURCE_ANY: _bindgen_ty_18 = 4294967040; pub type _bindgen_ty_18 = ::std::os::raw::c_uint; -pub const AINPUT_KEYBOARD_TYPE_NONE: ::std::os::raw::c_uint = 0; -pub const AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC: ::std::os::raw::c_uint = 1; -pub const AINPUT_KEYBOARD_TYPE_ALPHABETIC: ::std::os::raw::c_uint = 2; +pub const AINPUT_KEYBOARD_TYPE_NONE: _bindgen_ty_19 = 0; +pub const AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC: _bindgen_ty_19 = 1; +pub const AINPUT_KEYBOARD_TYPE_ALPHABETIC: _bindgen_ty_19 = 2; pub type _bindgen_ty_19 = ::std::os::raw::c_uint; -pub const AINPUT_MOTION_RANGE_X: ::std::os::raw::c_uint = 0; -pub const AINPUT_MOTION_RANGE_Y: ::std::os::raw::c_uint = 1; -pub const AINPUT_MOTION_RANGE_PRESSURE: ::std::os::raw::c_uint = 2; -pub const AINPUT_MOTION_RANGE_SIZE: ::std::os::raw::c_uint = 3; -pub const AINPUT_MOTION_RANGE_TOUCH_MAJOR: ::std::os::raw::c_uint = 4; -pub const AINPUT_MOTION_RANGE_TOUCH_MINOR: ::std::os::raw::c_uint = 5; -pub const AINPUT_MOTION_RANGE_TOOL_MAJOR: ::std::os::raw::c_uint = 6; -pub const AINPUT_MOTION_RANGE_TOOL_MINOR: ::std::os::raw::c_uint = 7; -pub const AINPUT_MOTION_RANGE_ORIENTATION: ::std::os::raw::c_uint = 8; +pub const AINPUT_MOTION_RANGE_X: _bindgen_ty_20 = 0; +pub const AINPUT_MOTION_RANGE_Y: _bindgen_ty_20 = 1; +pub const AINPUT_MOTION_RANGE_PRESSURE: _bindgen_ty_20 = 2; +pub const AINPUT_MOTION_RANGE_SIZE: _bindgen_ty_20 = 3; +pub const AINPUT_MOTION_RANGE_TOUCH_MAJOR: _bindgen_ty_20 = 4; +pub const AINPUT_MOTION_RANGE_TOUCH_MINOR: _bindgen_ty_20 = 5; +pub const AINPUT_MOTION_RANGE_TOOL_MAJOR: _bindgen_ty_20 = 6; +pub const AINPUT_MOTION_RANGE_TOOL_MINOR: _bindgen_ty_20 = 7; +pub const AINPUT_MOTION_RANGE_ORIENTATION: _bindgen_ty_20 = 8; pub type _bindgen_ty_20 = ::std::os::raw::c_uint; extern "C" { pub fn AInputEvent_getType(event: *const AInputEvent) -> i32; @@ -1357,6 +1556,9 @@ extern "C" { extern "C" { pub fn AInputEvent_getSource(event: *const AInputEvent) -> i32; } +extern "C" { + pub fn AInputEvent_release(event: *const AInputEvent); +} extern "C" { pub fn AKeyEvent_getAction(key_event: *const AInputEvent) -> i32; } @@ -1381,6 +1583,9 @@ extern "C" { extern "C" { pub fn AKeyEvent_getEventTime(key_event: *const AInputEvent) -> i64; } +extern "C" { + pub fn AKeyEvent_fromJava(env: *mut JNIEnv, keyEvent: jobject) -> *const AInputEvent; +} extern "C" { pub fn AMotionEvent_getAction(motion_event: *const AInputEvent) -> i32; } @@ -1415,168 +1620,169 @@ extern "C" { pub fn AMotionEvent_getYPrecision(motion_event: *const AInputEvent) -> f32; } extern "C" { - pub fn AMotionEvent_getPointerCount(motion_event: *const AInputEvent) -> size_t; + pub fn AMotionEvent_getPointerCount(motion_event: *const AInputEvent) -> usize; } extern "C" { - pub fn AMotionEvent_getPointerId( - motion_event: *const AInputEvent, - pointer_index: size_t, - ) -> i32; + pub fn AMotionEvent_getPointerId(motion_event: *const AInputEvent, pointer_index: usize) + -> i32; } extern "C" { - pub fn AMotionEvent_getToolType(motion_event: *const AInputEvent, pointer_index: size_t) - -> i32; + pub fn AMotionEvent_getToolType(motion_event: *const AInputEvent, pointer_index: usize) -> i32; } extern "C" { - pub fn AMotionEvent_getRawX(motion_event: *const AInputEvent, pointer_index: size_t) -> f32; + pub fn AMotionEvent_getRawX(motion_event: *const AInputEvent, pointer_index: usize) -> f32; } extern "C" { - pub fn AMotionEvent_getRawY(motion_event: *const AInputEvent, pointer_index: size_t) -> f32; + pub fn AMotionEvent_getRawY(motion_event: *const AInputEvent, pointer_index: usize) -> f32; } extern "C" { - pub fn AMotionEvent_getX(motion_event: *const AInputEvent, pointer_index: size_t) -> f32; + pub fn AMotionEvent_getX(motion_event: *const AInputEvent, pointer_index: usize) -> f32; } extern "C" { - pub fn AMotionEvent_getY(motion_event: *const AInputEvent, pointer_index: size_t) -> f32; + pub fn AMotionEvent_getY(motion_event: *const AInputEvent, pointer_index: usize) -> f32; } extern "C" { - pub fn AMotionEvent_getPressure(motion_event: *const AInputEvent, pointer_index: size_t) - -> f32; + pub fn AMotionEvent_getPressure(motion_event: *const AInputEvent, pointer_index: usize) -> f32; } extern "C" { - pub fn AMotionEvent_getSize(motion_event: *const AInputEvent, pointer_index: size_t) -> f32; + pub fn AMotionEvent_getSize(motion_event: *const AInputEvent, pointer_index: usize) -> f32; } extern "C" { pub fn AMotionEvent_getTouchMajor( motion_event: *const AInputEvent, - pointer_index: size_t, + pointer_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getTouchMinor( motion_event: *const AInputEvent, - pointer_index: size_t, + pointer_index: usize, ) -> f32; } extern "C" { - pub fn AMotionEvent_getToolMajor( - motion_event: *const AInputEvent, - pointer_index: size_t, - ) -> f32; + pub fn AMotionEvent_getToolMajor(motion_event: *const AInputEvent, pointer_index: usize) + -> f32; } extern "C" { - pub fn AMotionEvent_getToolMinor( - motion_event: *const AInputEvent, - pointer_index: size_t, - ) -> f32; + pub fn AMotionEvent_getToolMinor(motion_event: *const AInputEvent, pointer_index: usize) + -> f32; } extern "C" { pub fn AMotionEvent_getOrientation( motion_event: *const AInputEvent, - pointer_index: size_t, + pointer_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getAxisValue( motion_event: *const AInputEvent, axis: i32, - pointer_index: size_t, + pointer_index: usize, ) -> f32; } extern "C" { - pub fn AMotionEvent_getHistorySize(motion_event: *const AInputEvent) -> size_t; + pub fn AMotionEvent_getHistorySize(motion_event: *const AInputEvent) -> usize; } extern "C" { pub fn AMotionEvent_getHistoricalEventTime( motion_event: *const AInputEvent, - history_index: size_t, + history_index: usize, ) -> i64; } extern "C" { pub fn AMotionEvent_getHistoricalRawX( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalRawY( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalX( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalY( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalPressure( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalSize( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalTouchMajor( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalTouchMinor( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalToolMajor( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalToolMinor( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalOrientation( motion_event: *const AInputEvent, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } extern "C" { pub fn AMotionEvent_getHistoricalAxisValue( motion_event: *const AInputEvent, axis: i32, - pointer_index: size_t, - history_index: size_t, + pointer_index: usize, + history_index: usize, ) -> f32; } +extern "C" { + pub fn AMotionEvent_getActionButton(motion_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AMotionEvent_getClassification(motion_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AMotionEvent_fromJava(env: *mut JNIEnv, motionEvent: jobject) -> *const AInputEvent; +} #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct AInputQueue { @@ -1610,6 +1816,9 @@ extern "C" { handled: ::std::os::raw::c_int, ); } +extern "C" { + pub fn AInputQueue_fromJava(env: *mut JNIEnv, inputQueue: jobject) -> *mut AInputQueue; +} #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct imaxdiv_t { @@ -1618,35 +1827,27 @@ pub struct imaxdiv_t { } #[test] fn bindgen_test_layout_imaxdiv_t() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 16usize, - concat!("Size of: ", stringify!(imaxdiv_t)) + "Size of imaxdiv_t" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(imaxdiv_t)) + "Alignment of imaxdiv_t" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).quot as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).quot) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(imaxdiv_t), - "::", - stringify!(quot) - ) + "Offset of field: imaxdiv_t::quot" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rem as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rem) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(imaxdiv_t), - "::", - stringify!(rem) - ) + "Offset of field: imaxdiv_t::rem" ); } extern "C" { @@ -1684,11 +1885,52 @@ extern "C" { ) -> uintmax_t; } pub const ADataSpace_ADATASPACE_UNKNOWN: ADataSpace = 0; +pub const ADataSpace_STANDARD_MASK: ADataSpace = 4128768; +pub const ADataSpace_STANDARD_UNSPECIFIED: ADataSpace = 0; +pub const ADataSpace_STANDARD_BT709: ADataSpace = 65536; +pub const ADataSpace_STANDARD_BT601_625: ADataSpace = 131072; +pub const ADataSpace_STANDARD_BT601_625_UNADJUSTED: ADataSpace = 196608; +pub const ADataSpace_STANDARD_BT601_525: ADataSpace = 262144; +pub const ADataSpace_STANDARD_BT601_525_UNADJUSTED: ADataSpace = 327680; +pub const ADataSpace_STANDARD_BT2020: ADataSpace = 393216; +pub const ADataSpace_STANDARD_BT2020_CONSTANT_LUMINANCE: ADataSpace = 458752; +pub const ADataSpace_STANDARD_BT470M: ADataSpace = 524288; +pub const ADataSpace_STANDARD_FILM: ADataSpace = 589824; +pub const ADataSpace_STANDARD_DCI_P3: ADataSpace = 655360; +pub const ADataSpace_STANDARD_ADOBE_RGB: ADataSpace = 720896; +pub const ADataSpace_TRANSFER_MASK: ADataSpace = 130023424; +pub const ADataSpace_TRANSFER_UNSPECIFIED: ADataSpace = 0; +pub const ADataSpace_TRANSFER_LINEAR: ADataSpace = 4194304; +pub const ADataSpace_TRANSFER_SRGB: ADataSpace = 8388608; +pub const ADataSpace_TRANSFER_SMPTE_170M: ADataSpace = 12582912; +pub const ADataSpace_TRANSFER_GAMMA2_2: ADataSpace = 16777216; +pub const ADataSpace_TRANSFER_GAMMA2_6: ADataSpace = 20971520; +pub const ADataSpace_TRANSFER_GAMMA2_8: ADataSpace = 25165824; +pub const ADataSpace_TRANSFER_ST2084: ADataSpace = 29360128; +pub const ADataSpace_TRANSFER_HLG: ADataSpace = 33554432; +pub const ADataSpace_RANGE_MASK: ADataSpace = 939524096; +pub const ADataSpace_RANGE_UNSPECIFIED: ADataSpace = 0; +pub const ADataSpace_RANGE_FULL: ADataSpace = 134217728; +pub const ADataSpace_RANGE_LIMITED: ADataSpace = 268435456; +pub const ADataSpace_RANGE_EXTENDED: ADataSpace = 402653184; pub const ADataSpace_ADATASPACE_SCRGB_LINEAR: ADataSpace = 406913024; pub const ADataSpace_ADATASPACE_SRGB: ADataSpace = 142671872; pub const ADataSpace_ADATASPACE_SCRGB: ADataSpace = 411107328; pub const ADataSpace_ADATASPACE_DISPLAY_P3: ADataSpace = 143261696; pub const ADataSpace_ADATASPACE_BT2020_PQ: ADataSpace = 163971072; +pub const ADataSpace_ADATASPACE_BT2020_ITU_PQ: ADataSpace = 298188800; +pub const ADataSpace_ADATASPACE_ADOBE_RGB: ADataSpace = 151715840; +pub const ADataSpace_ADATASPACE_JFIF: ADataSpace = 146931712; +pub const ADataSpace_ADATASPACE_BT601_625: ADataSpace = 281149440; +pub const ADataSpace_ADATASPACE_BT601_525: ADataSpace = 281280512; +pub const ADataSpace_ADATASPACE_BT2020: ADataSpace = 147193856; +pub const ADataSpace_ADATASPACE_BT709: ADataSpace = 281083904; +pub const ADataSpace_ADATASPACE_DCI_P3: ADataSpace = 155844608; +pub const ADataSpace_ADATASPACE_SRGB_LINEAR: ADataSpace = 138477568; +pub const ADataSpace_ADATASPACE_BT2020_HLG: ADataSpace = 168165376; +pub const ADataSpace_ADATASPACE_BT2020_ITU_HLG: ADataSpace = 302383104; +pub const ADataSpace_DEPTH: ADataSpace = 4096; +pub const ADataSpace_DYNAMIC_DEPTH: ADataSpace = 4098; pub type ADataSpace = ::std::os::raw::c_uint; pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM: AHardwareBuffer_Format = 1; pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM: AHardwareBuffer_Format = 2; @@ -1708,6 +1950,12 @@ pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_D32_FLOAT_S8_UINT: AHard 52; pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_S8_UINT: AHardwareBuffer_Format = 53; pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_Y8Cb8Cr8_420: AHardwareBuffer_Format = 35; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_YCbCr_P010: AHardwareBuffer_Format = 54; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8_UNORM: AHardwareBuffer_Format = 56; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R16_UINT: AHardwareBuffer_Format = 57; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R16G16_UINT: AHardwareBuffer_Format = 58; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R10G10B10A10_UNORM: AHardwareBuffer_Format = + 59; pub type AHardwareBuffer_Format = ::std::os::raw::c_uint; pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_READ_NEVER: AHardwareBuffer_UsageFlags = 0; @@ -1745,6 +1993,8 @@ pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_GPU_CUBE_MAP: AHardwareBuffer_UsageFlags = 33554432; pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_GPU_MIPMAP_COMPLETE: AHardwareBuffer_UsageFlags = 67108864; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_FRONT_BUFFER: + AHardwareBuffer_UsageFlags = 4294967296; pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_0: AHardwareBuffer_UsageFlags = 268435456; pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_1: AHardwareBuffer_UsageFlags = @@ -1800,95 +2050,57 @@ pub struct AHardwareBuffer_Desc { } #[test] fn bindgen_test_layout_AHardwareBuffer_Desc() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 40usize, - concat!("Size of: ", stringify!(AHardwareBuffer_Desc)) + "Size of AHardwareBuffer_Desc" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(AHardwareBuffer_Desc)) + "Alignment of AHardwareBuffer_Desc" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).width as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).width) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Desc), - "::", - stringify!(width) - ) + "Offset of field: AHardwareBuffer_Desc::width" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).height as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).height) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Desc), - "::", - stringify!(height) - ) + "Offset of field: AHardwareBuffer_Desc::height" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).layers as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).layers) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Desc), - "::", - stringify!(layers) - ) + "Offset of field: AHardwareBuffer_Desc::layers" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).format as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).format) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Desc), - "::", - stringify!(format) - ) + "Offset of field: AHardwareBuffer_Desc::format" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).usage as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).usage) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Desc), - "::", - stringify!(usage) - ) + "Offset of field: AHardwareBuffer_Desc::usage" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).stride as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).stride) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Desc), - "::", - stringify!(stride) - ) + "Offset of field: AHardwareBuffer_Desc::stride" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rfu0 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rfu0) as usize - ptr as usize }, 28usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Desc), - "::", - stringify!(rfu0) - ) + "Offset of field: AHardwareBuffer_Desc::rfu0" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rfu1 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rfu1) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Desc), - "::", - stringify!(rfu1) - ) + "Offset of field: AHardwareBuffer_Desc::rfu1" ); } #[repr(C)] @@ -1900,47 +2112,33 @@ pub struct AHardwareBuffer_Plane { } #[test] fn bindgen_test_layout_AHardwareBuffer_Plane() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 16usize, - concat!("Size of: ", stringify!(AHardwareBuffer_Plane)) + "Size of AHardwareBuffer_Plane" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(AHardwareBuffer_Plane)) + "Alignment of AHardwareBuffer_Plane" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Plane), - "::", - stringify!(data) - ) + "Offset of field: AHardwareBuffer_Plane::data" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).pixelStride as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).pixelStride) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Plane), - "::", - stringify!(pixelStride) - ) + "Offset of field: AHardwareBuffer_Plane::pixelStride" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rowStride as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rowStride) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Plane), - "::", - stringify!(rowStride) - ) + "Offset of field: AHardwareBuffer_Plane::rowStride" ); } #[repr(C)] @@ -1951,37 +2149,28 @@ pub struct AHardwareBuffer_Planes { } #[test] fn bindgen_test_layout_AHardwareBuffer_Planes() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 72usize, - concat!("Size of: ", stringify!(AHardwareBuffer_Planes)) + "Size of AHardwareBuffer_Planes" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(AHardwareBuffer_Planes)) + "Alignment of AHardwareBuffer_Planes" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).planeCount as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).planeCount) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Planes), - "::", - stringify!(planeCount) - ) + "Offset of field: AHardwareBuffer_Planes::planeCount" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).planes as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).planes) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(AHardwareBuffer_Planes), - "::", - stringify!(planes) - ) + "Offset of field: AHardwareBuffer_Planes::planes" ); } #[repr(C)] @@ -2016,15 +2205,6 @@ extern "C" { outVirtualAddress: *mut *mut ::std::os::raw::c_void, ) -> ::std::os::raw::c_int; } -extern "C" { - pub fn AHardwareBuffer_lockPlanes( - buffer: *mut AHardwareBuffer, - usage: u64, - fence: i32, - rect: *const ARect, - outPlanes: *mut AHardwareBuffer_Planes, - ) -> ::std::os::raw::c_int; -} extern "C" { pub fn AHardwareBuffer_unlock( buffer: *mut AHardwareBuffer, @@ -2043,6 +2223,15 @@ extern "C" { outBuffer: *mut *mut AHardwareBuffer, ) -> ::std::os::raw::c_int; } +extern "C" { + pub fn AHardwareBuffer_lockPlanes( + buffer: *mut AHardwareBuffer, + usage: u64, + fence: i32, + rect: *const ARect, + outPlanes: *mut AHardwareBuffer_Planes, + ) -> ::std::os::raw::c_int; +} extern "C" { pub fn AHardwareBuffer_isSupported(desc: *const AHardwareBuffer_Desc) -> ::std::os::raw::c_int; } @@ -2057,230 +2246,353 @@ extern "C" { outBytesPerStride: *mut i32, ) -> ::std::os::raw::c_int; } -pub type va_list = __builtin_va_list; -pub type __gnuc_va_list = __builtin_va_list; +extern "C" { + pub fn AHardwareBuffer_getId( + buffer: *const AHardwareBuffer, + outId: *mut u64, + ) -> ::std::os::raw::c_int; +} +#[doc = " \\brief Describe information about a pointer, found in a\n GameActivityMotionEvent.\n\n You can read values directly from this structure, or use helper functions\n (`GameActivityPointerAxes_getX`, `GameActivityPointerAxes_getY` and\n `GameActivityPointerAxes_getAxisValue`).\n\n The X axis and Y axis are enabled by default but any other axis that you want\n to read **must** be enabled first, using\n `GameActivityPointerAxes_enableAxis`.\n\n \\see GameActivityMotionEvent"] #[repr(C)] -pub struct JavaVMAttachArgs { - pub version: jint, - pub name: *const ::std::os::raw::c_char, - pub group: jobject, +#[derive(Debug, Copy, Clone)] +pub struct GameActivityPointerAxes { + pub id: i32, + pub toolType: i32, + pub axisValues: [f32; 48usize], + pub rawX: f32, + pub rawY: f32, } #[test] -fn bindgen_test_layout_JavaVMAttachArgs() { +fn bindgen_test_layout_GameActivityPointerAxes() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - ::std::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(JavaVMAttachArgs)) + ::std::mem::size_of::(), + 208usize, + "Size of GameActivityPointerAxes" ); assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(JavaVMAttachArgs)) + ::std::mem::align_of::(), + 4usize, + "Alignment of GameActivityPointerAxes" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).version as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).id) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(JavaVMAttachArgs), - "::", - stringify!(version) - ) + "Offset of field: GameActivityPointerAxes::id" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).name as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).toolType) as usize - ptr as usize }, + 4usize, + "Offset of field: GameActivityPointerAxes::toolType" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).axisValues) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(JavaVMAttachArgs), - "::", - stringify!(name) - ) + "Offset of field: GameActivityPointerAxes::axisValues" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).group as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(JavaVMAttachArgs), - "::", - stringify!(group) - ) + unsafe { ::std::ptr::addr_of!((*ptr).rawX) as usize - ptr as usize }, + 200usize, + "Offset of field: GameActivityPointerAxes::rawX" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).rawY) as usize - ptr as usize }, + 204usize, + "Offset of field: GameActivityPointerAxes::rawY" ); } +extern "C" { + #[doc = " \\brief Enable the specified axis, so that its value is reported in the\n GameActivityPointerAxes structures stored in a motion event.\n\n You must enable any axis that you want to read, apart from\n `AMOTION_EVENT_AXIS_X` and `AMOTION_EVENT_AXIS_Y` that are enabled by\n default.\n\n If the axis index is out of range, nothing is done."] + pub fn GameActivityPointerAxes_enableAxis(axis: i32); +} +extern "C" { + #[doc = " \\brief Disable the specified axis. Its value won't be reported in the\n GameActivityPointerAxes structures stored in a motion event anymore.\n\n Apart from X and Y, any axis that you want to read **must** be enabled first,\n using `GameActivityPointerAxes_enableAxis`.\n\n If the axis index is out of range, nothing is done."] + pub fn GameActivityPointerAxes_disableAxis(axis: i32); +} +extern "C" { + #[doc = " \\brief Get the value of the requested axis.\n\n Apart from X and Y, any axis that you want to read **must** be enabled first,\n using `GameActivityPointerAxes_enableAxis`.\n\n Find the valid enums for the axis (`AMOTION_EVENT_AXIS_X`,\n `AMOTION_EVENT_AXIS_Y`, `AMOTION_EVENT_AXIS_PRESSURE`...)\n in https://developer.android.com/ndk/reference/group/input.\n\n @param pointerInfo The structure containing information about the pointer,\n obtained from GameActivityMotionEvent.\n @param axis The axis to get the value from\n @return The value of the axis, or 0 if the axis is invalid or was not\n enabled."] + pub fn GameActivityPointerAxes_getAxisValue( + pointerInfo: *const GameActivityPointerAxes, + axis: i32, + ) -> f32; +} +#[doc = " \\brief Describe a motion event that happened on the GameActivity SurfaceView.\n\n This is 1:1 mapping to the information contained in a Java `MotionEvent`\n (see https://developer.android.com/reference/android/view/MotionEvent)."] #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct JavaVMOption { - pub optionString: *const ::std::os::raw::c_char, - pub extraInfo: *mut ::std::os::raw::c_void, +pub struct GameActivityMotionEvent { + pub deviceId: i32, + pub source: i32, + pub action: i32, + pub eventTime: i64, + pub downTime: i64, + pub flags: i32, + pub metaState: i32, + pub actionButton: i32, + pub buttonState: i32, + pub classification: i32, + pub edgeFlags: i32, + pub pointerCount: u32, + pub pointers: [GameActivityPointerAxes; 8usize], + pub historySize: ::std::os::raw::c_int, + pub historicalEventTimesMillis: *mut i64, + pub historicalEventTimesNanos: *mut i64, + pub historicalAxisValues: *mut f32, + pub precisionX: f32, + pub precisionY: f32, } #[test] -fn bindgen_test_layout_JavaVMOption() { +fn bindgen_test_layout_GameActivityMotionEvent() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(JavaVMOption)) + ::std::mem::size_of::(), + 1760usize, + "Size of GameActivityMotionEvent" ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(JavaVMOption)) + "Alignment of GameActivityMotionEvent" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).optionString as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).deviceId) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(JavaVMOption), - "::", - stringify!(optionString) - ) + "Offset of field: GameActivityMotionEvent::deviceId" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).extraInfo as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).source) as usize - ptr as usize }, + 4usize, + "Offset of field: GameActivityMotionEvent::source" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).action) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(JavaVMOption), - "::", - stringify!(extraInfo) - ) + "Offset of field: GameActivityMotionEvent::action" ); -} -#[repr(C)] -pub struct JavaVMInitArgs { - pub version: jint, - pub nOptions: jint, - pub options: *mut JavaVMOption, - pub ignoreUnrecognized: jboolean, -} -#[test] -fn bindgen_test_layout_JavaVMInitArgs() { assert_eq!( - ::std::mem::size_of::(), + unsafe { ::std::ptr::addr_of!((*ptr).eventTime) as usize - ptr as usize }, + 16usize, + "Offset of field: GameActivityMotionEvent::eventTime" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).downTime) as usize - ptr as usize }, 24usize, - concat!("Size of: ", stringify!(JavaVMInitArgs)) + "Offset of field: GameActivityMotionEvent::downTime" ); assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(JavaVMInitArgs)) + unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, + 32usize, + "Offset of field: GameActivityMotionEvent::flags" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).version as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(JavaVMInitArgs), - "::", - stringify!(version) - ) + unsafe { ::std::ptr::addr_of!((*ptr).metaState) as usize - ptr as usize }, + 36usize, + "Offset of field: GameActivityMotionEvent::metaState" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).nOptions as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(JavaVMInitArgs), - "::", - stringify!(nOptions) - ) + unsafe { ::std::ptr::addr_of!((*ptr).actionButton) as usize - ptr as usize }, + 40usize, + "Offset of field: GameActivityMotionEvent::actionButton" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).options as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(JavaVMInitArgs), - "::", - stringify!(options) - ) + unsafe { ::std::ptr::addr_of!((*ptr).buttonState) as usize - ptr as usize }, + 44usize, + "Offset of field: GameActivityMotionEvent::buttonState" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).ignoreUnrecognized as *const _ as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(JavaVMInitArgs), - "::", - stringify!(ignoreUnrecognized) - ) + unsafe { ::std::ptr::addr_of!((*ptr).classification) as usize - ptr as usize }, + 48usize, + "Offset of field: GameActivityMotionEvent::classification" ); -} -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_CAPTION_BAR: GameCommonInsetsType = 0; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_DISPLAY_CUTOUT: GameCommonInsetsType = 1; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_IME: GameCommonInsetsType = 2; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_MANDATORY_SYSTEM_GESTURES: - GameCommonInsetsType = 3; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_NAVIGATION_BARS: GameCommonInsetsType = 4; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_STATUS_BARS: GameCommonInsetsType = 5; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_SYSTEM_BARS: GameCommonInsetsType = 6; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_SYSTEM_GESTURES: GameCommonInsetsType = 7; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_TAPABLE_ELEMENT: GameCommonInsetsType = 8; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_WATERFALL: GameCommonInsetsType = 9; -pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_COUNT: GameCommonInsetsType = 10; -#[doc = " The type of a component for which to retrieve insets. See"] -#[doc = " https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat.Type"] -pub type GameCommonInsetsType = ::std::os::raw::c_uint; -#[doc = " This struct holds a span within a region of text from start (inclusive) to"] -#[doc = " end (exclusive). An empty span or cursor position is specified with"] -#[doc = " start==end. An undefined span is specified with start = end = SPAN_UNDEFINED."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct GameTextInputSpan { - #[doc = " The start of the region (inclusive)."] - pub start: i32, + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).edgeFlags) as usize - ptr as usize }, + 52usize, + "Offset of field: GameActivityMotionEvent::edgeFlags" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pointerCount) as usize - ptr as usize }, + 56usize, + "Offset of field: GameActivityMotionEvent::pointerCount" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pointers) as usize - ptr as usize }, + 60usize, + "Offset of field: GameActivityMotionEvent::pointers" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).historySize) as usize - ptr as usize }, + 1724usize, + "Offset of field: GameActivityMotionEvent::historySize" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).historicalEventTimesMillis) as usize - ptr as usize }, + 1728usize, + "Offset of field: GameActivityMotionEvent::historicalEventTimesMillis" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).historicalEventTimesNanos) as usize - ptr as usize }, + 1736usize, + "Offset of field: GameActivityMotionEvent::historicalEventTimesNanos" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).historicalAxisValues) as usize - ptr as usize }, + 1744usize, + "Offset of field: GameActivityMotionEvent::historicalAxisValues" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).precisionX) as usize - ptr as usize }, + 1752usize, + "Offset of field: GameActivityMotionEvent::precisionX" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).precisionY) as usize - ptr as usize }, + 1756usize, + "Offset of field: GameActivityMotionEvent::precisionY" + ); +} +extern "C" { + pub fn GameActivityMotionEvent_getHistoricalAxisValue( + event: *const GameActivityMotionEvent, + axis: ::std::os::raw::c_int, + pointerIndex: ::std::os::raw::c_int, + historyPos: ::std::os::raw::c_int, + ) -> f32; +} +extern "C" { + #[doc = " \\brief Handle the freeing of the GameActivityMotionEvent struct."] + pub fn GameActivityMotionEvent_destroy(c_event: *mut GameActivityMotionEvent); +} +#[doc = " \\brief Describe a key event that happened on the GameActivity SurfaceView.\n\n This is 1:1 mapping to the information contained in a Java `KeyEvent`\n (see https://developer.android.com/reference/android/view/KeyEvent).\n The only exception is the event times, which are reported as\n nanoseconds in this struct."] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct GameActivityKeyEvent { + pub deviceId: i32, + pub source: i32, + pub action: i32, + pub eventTime: i64, + pub downTime: i64, + pub flags: i32, + pub metaState: i32, + pub modifiers: i32, + pub repeatCount: i32, + pub keyCode: i32, + pub scanCode: i32, +} +#[test] +fn bindgen_test_layout_GameActivityKeyEvent() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 56usize, + "Size of GameActivityKeyEvent" + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + "Alignment of GameActivityKeyEvent" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).deviceId) as usize - ptr as usize }, + 0usize, + "Offset of field: GameActivityKeyEvent::deviceId" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).source) as usize - ptr as usize }, + 4usize, + "Offset of field: GameActivityKeyEvent::source" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).action) as usize - ptr as usize }, + 8usize, + "Offset of field: GameActivityKeyEvent::action" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).eventTime) as usize - ptr as usize }, + 16usize, + "Offset of field: GameActivityKeyEvent::eventTime" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).downTime) as usize - ptr as usize }, + 24usize, + "Offset of field: GameActivityKeyEvent::downTime" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, + 32usize, + "Offset of field: GameActivityKeyEvent::flags" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).metaState) as usize - ptr as usize }, + 36usize, + "Offset of field: GameActivityKeyEvent::metaState" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).modifiers) as usize - ptr as usize }, + 40usize, + "Offset of field: GameActivityKeyEvent::modifiers" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).repeatCount) as usize - ptr as usize }, + 44usize, + "Offset of field: GameActivityKeyEvent::repeatCount" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).keyCode) as usize - ptr as usize }, + 48usize, + "Offset of field: GameActivityKeyEvent::keyCode" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).scanCode) as usize - ptr as usize }, + 52usize, + "Offset of field: GameActivityKeyEvent::scanCode" + ); +} +#[doc = " This struct holds a span within a region of text from start (inclusive) to\n end (exclusive). An empty span or cursor position is specified with\n start==end. An undefined span is specified with start = end = SPAN_UNDEFINED."] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct GameTextInputSpan { + #[doc = " The start of the region (inclusive)."] + pub start: i32, #[doc = " The end of the region (exclusive)."] pub end: i32, } #[test] fn bindgen_test_layout_GameTextInputSpan() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 8usize, - concat!("Size of: ", stringify!(GameTextInputSpan)) + "Size of GameTextInputSpan" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(GameTextInputSpan)) + "Alignment of GameTextInputSpan" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).start as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).start) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(GameTextInputSpan), - "::", - stringify!(start) - ) + "Offset of field: GameTextInputSpan::start" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).end as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).end) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(GameTextInputSpan), - "::", - stringify!(end) - ) + "Offset of field: GameTextInputSpan::end" ); } pub const GameTextInputSpanFlag_SPAN_UNDEFINED: GameTextInputSpanFlag = -1; #[doc = " Values with special meaning in a GameTextInputSpan."] -pub type GameTextInputSpanFlag = ::std::os::raw::c_int; -#[doc = " This struct holds the state of an editable section of text."] -#[doc = " The text can have a selection and a composing region defined on it."] -#[doc = " A composing region is used by IMEs that allow input using multiple steps to"] -#[doc = " compose a glyph or word. Use functions GameTextInput_getState and"] -#[doc = " GameTextInput_setState to read and modify the state that an IME is editing."] +pub type GameTextInputSpanFlag = i32; +#[doc = " This struct holds the state of an editable section of text.\n The text can have a selection and a composing region defined on it.\n A composing region is used by IMEs that allow input using multiple steps to\n compose a glyph or word. Use functions GameTextInput_getState and\n GameTextInput_setState to read and modify the state that an IME is editing."] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct GameTextInputState { - #[doc = " Text owned by the state, as a modified UTF-8 string. Null-terminated."] - #[doc = " https://en.wikipedia.org/wiki/UTF-8#Modified_UTF-8"] + #[doc = " Text owned by the state, as a modified UTF-8 string. Null-terminated.\n https://en.wikipedia.org/wiki/UTF-8#Modified_UTF-8"] pub text_UTF8: *const ::std::os::raw::c_char, #[doc = " Length in bytes of text_UTF8, *not* including the null at end."] pub text_length: i32, @@ -2291,63 +2603,40 @@ pub struct GameTextInputState { } #[test] fn bindgen_test_layout_GameTextInputState() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 32usize, - concat!("Size of: ", stringify!(GameTextInputState)) + "Size of GameTextInputState" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(GameTextInputState)) + "Alignment of GameTextInputState" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).text_UTF8 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).text_UTF8) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(GameTextInputState), - "::", - stringify!(text_UTF8) - ) + "Offset of field: GameTextInputState::text_UTF8" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).text_length as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).text_length) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(GameTextInputState), - "::", - stringify!(text_length) - ) + "Offset of field: GameTextInputState::text_length" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).selection as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).selection) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(GameTextInputState), - "::", - stringify!(selection) - ) + "Offset of field: GameTextInputState::selection" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).composingRegion as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).composingRegion) as usize - ptr as usize }, 20usize, - concat!( - "Offset of field: ", - stringify!(GameTextInputState), - "::", - stringify!(composingRegion) - ) - ); -} -#[doc = " A callback called by GameTextInput_getState."] -#[doc = " @param context User-defined context."] -#[doc = " @param state State, owned by the library, that will be valid for the duration"] -#[doc = " of the callback."] + "Offset of field: GameTextInputState::composingRegion" + ); +} +#[doc = " A callback called by GameTextInput_getState.\n @param context User-defined context.\n @param state State, owned by the library, that will be valid for the duration\n of the callback."] pub type GameTextInputGetStateCallback = ::std::option::Option< unsafe extern "C" fn(context: *mut ::std::os::raw::c_void, state: *const GameTextInputState), >; @@ -2357,74 +2646,45 @@ pub struct GameTextInput { _unused: [u8; 0], } extern "C" { - #[doc = " Initialize the GameTextInput library."] - #[doc = " If called twice without GameTextInput_destroy being called, the same pointer"] - #[doc = " will be returned and a warning will be issued."] - #[doc = " @param env A JNI env valid on the calling thread."] - #[doc = " @param max_string_size The maximum length of a string that can be edited. If"] - #[doc = " zero, the maximum defaults to 65536 bytes. A buffer of this size is allocated"] - #[doc = " at initialization."] - #[doc = " @return A handle to the library."] + #[doc = " Initialize the GameTextInput library.\n If called twice without GameTextInput_destroy being called, the same pointer\n will be returned and a warning will be issued.\n @param env A JNI env valid on the calling thread.\n @param max_string_size The maximum length of a string that can be edited. If\n zero, the maximum defaults to 65536 bytes. A buffer of this size is allocated\n at initialization.\n @return A handle to the library."] pub fn GameTextInput_init(env: *mut JNIEnv, max_string_size: u32) -> *mut GameTextInput; } extern "C" { - #[doc = " When using GameTextInput, you need to create a gametextinput.InputConnection"] - #[doc = " on the Java side and pass it using this function to the library, unless using"] - #[doc = " GameActivity in which case this will be done for you. See the GameActivity"] - #[doc = " source code or GameTextInput samples for examples of usage."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param inputConnection A gametextinput.InputConnection object."] + #[doc = " When using GameTextInput, you need to create a gametextinput.InputConnection\n on the Java side and pass it using this function to the library, unless using\n GameActivity in which case this will be done for you. See the GameActivity\n source code or GameTextInput samples for examples of usage.\n @param input A valid GameTextInput library handle.\n @param inputConnection A gametextinput.InputConnection object."] pub fn GameTextInput_setInputConnection(input: *mut GameTextInput, inputConnection: jobject); } extern "C" { - #[doc = " Unless using GameActivity, it is required to call this function from your"] - #[doc = " Java gametextinput.Listener.stateChanged method to convert eventState and"] - #[doc = " trigger any event callbacks. When using GameActivity, this does not need to"] - #[doc = " be called as event processing is handled by the Activity."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param eventState A Java gametextinput.State object."] + #[doc = " Unless using GameActivity, it is required to call this function from your\n Java gametextinput.Listener.stateChanged method to convert eventState and\n trigger any event callbacks. When using GameActivity, this does not need to\n be called as event processing is handled by the Activity.\n @param input A valid GameTextInput library handle.\n @param eventState A Java gametextinput.State object."] pub fn GameTextInput_processEvent(input: *mut GameTextInput, eventState: jobject); } extern "C" { - #[doc = " Free any resources owned by the GameTextInput library."] - #[doc = " Any subsequent calls to the library will fail until GameTextInput_init is"] - #[doc = " called again."] - #[doc = " @param input A valid GameTextInput library handle."] + #[doc = " Free any resources owned by the GameTextInput library.\n Any subsequent calls to the library will fail until GameTextInput_init is\n called again.\n @param input A valid GameTextInput library handle."] pub fn GameTextInput_destroy(input: *mut GameTextInput); } pub const ShowImeFlags_SHOW_IME_UNDEFINED: ShowImeFlags = 0; pub const ShowImeFlags_SHOW_IMPLICIT: ShowImeFlags = 1; pub const ShowImeFlags_SHOW_FORCED: ShowImeFlags = 2; #[doc = " Flags to be passed to GameTextInput_showIme."] -pub type ShowImeFlags = ::std::os::raw::c_uint; +pub type ShowImeFlags = u32; extern "C" { - #[doc = " Show the IME. Calls InputMethodManager.showSoftInput()."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param flags Defined in ShowImeFlags above. For more information see:"] - #[doc = " https://developer.android.com/reference/android/view/inputmethod/InputMethodManager"] + #[doc = " Show the IME. Calls InputMethodManager.showSoftInput().\n @param input A valid GameTextInput library handle.\n @param flags Defined in ShowImeFlags above. For more information see:\n https://developer.android.com/reference/android/view/inputmethod/InputMethodManager"] pub fn GameTextInput_showIme(input: *mut GameTextInput, flags: u32); } pub const HideImeFlags_HIDE_IME_UNDEFINED: HideImeFlags = 0; pub const HideImeFlags_HIDE_IMPLICIT_ONLY: HideImeFlags = 1; pub const HideImeFlags_HIDE_NOT_ALWAYS: HideImeFlags = 2; #[doc = " Flags to be passed to GameTextInput_hideIme."] -pub type HideImeFlags = ::std::os::raw::c_uint; +pub type HideImeFlags = u32; extern "C" { - #[doc = " Show the IME. Calls InputMethodManager.hideSoftInputFromWindow()."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param flags Defined in HideImeFlags above. For more information see:"] - #[doc = " https://developer.android.com/reference/android/view/inputmethod/InputMethodManager"] + #[doc = " Hide the IME. Calls InputMethodManager.hideSoftInputFromWindow().\n @param input A valid GameTextInput library handle.\n @param flags Defined in HideImeFlags above. For more information see:\n https://developer.android.com/reference/android/view/inputmethod/InputMethodManager"] pub fn GameTextInput_hideIme(input: *mut GameTextInput, flags: u32); } extern "C" { - #[doc = " Call a callback with the current GameTextInput state, which may have been"] - #[doc = " modified by changes in the IME and calls to GameTextInput_setState. We use a"] - #[doc = " callback rather than returning the state in order to simplify ownership of"] - #[doc = " text_UTF8 strings. These strings are only valid during the calling of the"] - #[doc = " callback."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param callback A function that will be called with valid state."] - #[doc = " @param context Context used by the callback."] + #[doc = " Restarts the input method. Calls InputMethodManager.restartInput().\n @param input A valid GameTextInput library handle."] + pub fn GameTextInput_restartInput(input: *mut GameTextInput); +} +extern "C" { + #[doc = " Call a callback with the current GameTextInput state, which may have been\n modified by changes in the IME and calls to GameTextInput_setState. We use a\n callback rather than returning the state in order to simplify ownership of\n text_UTF8 strings. These strings are only valid during the calling of the\n callback.\n @param input A valid GameTextInput library handle.\n @param callback A function that will be called with valid state.\n @param context Context used by the callback."] pub fn GameTextInput_getState( input: *mut GameTextInput, callback: GameTextInputGetStateCallback, @@ -2432,18 +2692,10 @@ extern "C" { ); } extern "C" { - #[doc = " Set the current GameTextInput state. This state is reflected to any active"] - #[doc = " IME."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param state The state to set. Ownership is maintained by the caller and must"] - #[doc = " remain valid for the duration of the call."] + #[doc = " Set the current GameTextInput state. This state is reflected to any active\n IME.\n @param input A valid GameTextInput library handle.\n @param state The state to set. Ownership is maintained by the caller and must\n remain valid for the duration of the call."] pub fn GameTextInput_setState(input: *mut GameTextInput, state: *const GameTextInputState); } -#[doc = " Type of the callback needed by GameTextInput_setEventCallback that will be"] -#[doc = " called every time the IME state changes."] -#[doc = " @param context User-defined context set in GameTextInput_setEventCallback."] -#[doc = " @param current_state Current IME state, owned by the library and valid during"] -#[doc = " the callback."] +#[doc = " Type of the callback needed by GameTextInput_setEventCallback that will be\n called every time the IME state changes.\n @param context User-defined context set in GameTextInput_setEventCallback.\n @param current_state Current IME state, owned by the library and valid during\n the callback."] pub type GameTextInputEventCallback = ::std::option::Option< unsafe extern "C" fn( context: *mut ::std::os::raw::c_void, @@ -2451,34 +2703,19 @@ pub type GameTextInputEventCallback = ::std::option::Option< ), >; extern "C" { - #[doc = " Optionally set a callback to be called whenever the IME state changes."] - #[doc = " Not necessary if you are using GameActivity, which handles these callbacks"] - #[doc = " for you."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param callback Called by the library when the IME state changes."] - #[doc = " @param context Context passed as first argument to the callback."] + #[doc = " Optionally set a callback to be called whenever the IME state changes.\n Not necessary if you are using GameActivity, which handles these callbacks\n for you.\n @param input A valid GameTextInput library handle.\n @param callback Called by the library when the IME state changes.\n @param context Context passed as first argument to the callback.\n This function is deprecated. Don't perform any complex processing inside\n the callback other than copying the state variable. Using any synchronization\n primitives inside this callback may cause a deadlock."] pub fn GameTextInput_setEventCallback( input: *mut GameTextInput, callback: GameTextInputEventCallback, context: *mut ::std::os::raw::c_void, ); } -#[doc = " Type of the callback needed by GameTextInput_setImeInsetsCallback that will"] -#[doc = " be called every time the IME window insets change."] -#[doc = " @param context User-defined context set in"] -#[doc = " GameTextInput_setImeWIndowInsetsCallback."] -#[doc = " @param current_insets Current IME insets, owned by the library and valid"] -#[doc = " during the callback."] +#[doc = " Type of the callback needed by GameTextInput_setImeInsetsCallback that will\n be called every time the IME window insets change.\n @param context User-defined context set in\n GameTextInput_setImeWIndowInsetsCallback.\n @param current_insets Current IME insets, owned by the library and valid\n during the callback."] pub type GameTextInputImeInsetsCallback = ::std::option::Option< unsafe extern "C" fn(context: *mut ::std::os::raw::c_void, current_insets: *const ARect), >; extern "C" { - #[doc = " Optionally set a callback to be called whenever the IME insets change."] - #[doc = " Not necessary if you are using GameActivity, which handles these callbacks"] - #[doc = " for you."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param callback Called by the library when the IME insets change."] - #[doc = " @param context Context passed as first argument to the callback."] + #[doc = " Optionally set a callback to be called whenever the IME insets change.\n Not necessary if you are using GameActivity, which handles these callbacks\n for you.\n @param input A valid GameTextInput library handle.\n @param callback Called by the library when the IME insets change.\n @param context Context passed as first argument to the callback."] pub fn GameTextInput_setImeInsetsCallback( input: *mut GameTextInput, callback: GameTextInputImeInsetsCallback, @@ -2486,754 +2723,257 @@ extern "C" { ); } extern "C" { - #[doc = " Get the current window insets for the IME."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param insets Filled with the current insets by this function."] + #[doc = " Get the current window insets for the IME.\n @param input A valid GameTextInput library handle.\n @param insets Filled with the current insets by this function."] pub fn GameTextInput_getImeInsets(input: *const GameTextInput, insets: *mut ARect); } extern "C" { - #[doc = " Unless using GameActivity, it is required to call this function from your"] - #[doc = " Java gametextinput.Listener.onImeInsetsChanged method to"] - #[doc = " trigger any event callbacks. When using GameActivity, this does not need to"] - #[doc = " be called as insets processing is handled by the Activity."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param eventState A Java gametextinput.State object."] + #[doc = " Unless using GameActivity, it is required to call this function from your\n Java gametextinput.Listener.onImeInsetsChanged method to\n trigger any event callbacks. When using GameActivity, this does not need to\n be called as insets processing is handled by the Activity.\n @param input A valid GameTextInput library handle.\n @param eventState A Java gametextinput.State object."] pub fn GameTextInput_processImeInsets(input: *mut GameTextInput, insets: *const ARect); } extern "C" { - #[doc = " Convert a GameTextInputState struct to a Java gametextinput.State object."] - #[doc = " Don't forget to delete the returned Java local ref when you're done."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param state Input state to convert."] - #[doc = " @return A Java object of class gametextinput.State. The caller is required to"] - #[doc = " delete this local reference."] + #[doc = " Convert a GameTextInputState struct to a Java gametextinput.State object.\n Don't forget to delete the returned Java local ref when you're done.\n @param input A valid GameTextInput library handle.\n @param state Input state to convert.\n @return A Java object of class gametextinput.State. The caller is required to\n delete this local reference."] pub fn GameTextInputState_toJava( input: *const GameTextInput, state: *const GameTextInputState, ) -> jobject; } extern "C" { - #[doc = " Convert from a Java gametextinput.State object into a C GameTextInputState"] - #[doc = " struct."] - #[doc = " @param input A valid GameTextInput library handle."] - #[doc = " @param state A Java gametextinput.State object."] - #[doc = " @param callback A function called with the C struct, valid for the duration"] - #[doc = " of the call."] - #[doc = " @param context Context passed to the callback."] + #[doc = " Convert from a Java gametextinput.State object into a C GameTextInputState\n struct.\n @param input A valid GameTextInput library handle.\n @param state A Java gametextinput.State object.\n @param callback A function called with the C struct, valid for the duration\n of the call.\n @param context Context passed to the callback."] pub fn GameTextInputState_fromJava( input: *const GameTextInput, - state: jobject, - callback: GameTextInputGetStateCallback, - context: *mut ::std::os::raw::c_void, - ); -} -#[doc = " This structure defines the native side of an android.app.GameActivity."] -#[doc = " It is created by the framework, and handed to the application's native"] -#[doc = " code as it is being launched."] -#[repr(C)] -pub struct GameActivity { - #[doc = " Pointer to the callback function table of the native application."] - #[doc = " You can set the functions here to your own callbacks. The callbacks"] - #[doc = " pointer itself here should not be changed; it is allocated and managed"] - #[doc = " for you by the framework."] - pub callbacks: *mut GameActivityCallbacks, - #[doc = " The global handle on the process's Java VM."] - pub vm: *mut JavaVM, - #[doc = " JNI context for the main thread of the app. Note that this field"] - #[doc = " can ONLY be used from the main thread of the process; that is, the"] - #[doc = " thread that calls into the GameActivityCallbacks."] - pub env: *mut JNIEnv, - #[doc = " The GameActivity object handle."] - pub javaGameActivity: jobject, - #[doc = " Path to this application's internal data directory."] - pub internalDataPath: *const ::std::os::raw::c_char, - #[doc = " Path to this application's external (removable/mountable) data directory."] - pub externalDataPath: *const ::std::os::raw::c_char, - #[doc = " The platform's SDK version code."] - pub sdkVersion: i32, - #[doc = " This is the native instance of the application. It is not used by"] - #[doc = " the framework, but can be set by the application to its own instance"] - #[doc = " state."] - pub instance: *mut ::std::os::raw::c_void, - #[doc = " Pointer to the Asset Manager instance for the application. The"] - #[doc = " application uses this to access binary assets bundled inside its own .apk"] - #[doc = " file."] - pub assetManager: *mut AAssetManager, - #[doc = " Available starting with Honeycomb: path to the directory containing"] - #[doc = " the application's OBB files (if any). If the app doesn't have any"] - #[doc = " OBB files, this directory may not exist."] - pub obbPath: *const ::std::os::raw::c_char, -} -#[test] -fn bindgen_test_layout_GameActivity() { - assert_eq!( - ::std::mem::size_of::(), - 80usize, - concat!("Size of: ", stringify!(GameActivity)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(GameActivity)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).callbacks as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(callbacks) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).vm as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(vm) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).env as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(env) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).javaGameActivity as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(javaGameActivity) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).internalDataPath as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(internalDataPath) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).externalDataPath as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(externalDataPath) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).sdkVersion as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(sdkVersion) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).instance as *const _ as usize }, - 56usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(instance) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).assetManager as *const _ as usize }, - 64usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(assetManager) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).obbPath as *const _ as usize }, - 72usize, - concat!( - "Offset of field: ", - stringify!(GameActivity), - "::", - stringify!(obbPath) - ) - ); -} -#[doc = " \\brief Describe information about a pointer, found in a"] -#[doc = " GameActivityMotionEvent."] -#[doc = ""] -#[doc = " You can read values directly from this structure, or use helper functions"] -#[doc = " (`GameActivityPointerAxes_getX`, `GameActivityPointerAxes_getY` and"] -#[doc = " `GameActivityPointerAxes_getAxisValue`)."] -#[doc = ""] -#[doc = " The X axis and Y axis are enabled by default but any other axis that you want"] -#[doc = " to read **must** be enabled first, using"] -#[doc = " `GameActivityPointerAxes_enableAxis`."] -#[doc = ""] -#[doc = " \\see GameActivityMotionEvent"] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct GameActivityPointerAxes { - pub id: i32, - pub toolType: i32, - pub axisValues: [f32; 48usize], - pub rawX: f32, - pub rawY: f32, -} -#[test] -fn bindgen_test_layout_GameActivityPointerAxes() { - assert_eq!( - ::std::mem::size_of::(), - 208usize, - concat!("Size of: ", stringify!(GameActivityPointerAxes)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(GameActivityPointerAxes)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).id as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(GameActivityPointerAxes), - "::", - stringify!(id) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).toolType as *const _ as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(GameActivityPointerAxes), - "::", - stringify!(toolType) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).axisValues as *const _ as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(GameActivityPointerAxes), - "::", - stringify!(axisValues) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).rawX as *const _ as usize }, - 200usize, - concat!( - "Offset of field: ", - stringify!(GameActivityPointerAxes), - "::", - stringify!(rawX) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).rawY as *const _ as usize }, - 204usize, - concat!( - "Offset of field: ", - stringify!(GameActivityPointerAxes), - "::", - stringify!(rawY) - ) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct GameActivityHistoricalPointerAxes { - pub eventTime: i64, - pub axisValues: [f32; 48usize], -} -#[test] -fn bindgen_test_layout_GameActivityHistoricalPointerAxes() { - assert_eq!( - ::std::mem::size_of::(), - 200usize, - concat!("Size of: ", stringify!(GameActivityHistoricalPointerAxes)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!( - "Alignment of ", - stringify!(GameActivityHistoricalPointerAxes) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).eventTime as *const _ - as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(GameActivityHistoricalPointerAxes), - "::", - stringify!(eventTime) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).axisValues as *const _ - as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(GameActivityHistoricalPointerAxes), - "::", - stringify!(axisValues) - ) - ); -} -extern "C" { - #[doc = " \\brief Enable the specified axis, so that its value is reported in the"] - #[doc = " GameActivityPointerAxes structures stored in a motion event."] - #[doc = ""] - #[doc = " You must enable any axis that you want to read, apart from"] - #[doc = " `AMOTION_EVENT_AXIS_X` and `AMOTION_EVENT_AXIS_Y` that are enabled by"] - #[doc = " default."] - #[doc = ""] - #[doc = " If the axis index is out of range, nothing is done."] - pub fn GameActivityPointerAxes_enableAxis(axis: i32); -} -extern "C" { - #[doc = " \\brief Disable the specified axis. Its value won't be reported in the"] - #[doc = " GameActivityPointerAxes structures stored in a motion event anymore."] - #[doc = ""] - #[doc = " Apart from X and Y, any axis that you want to read **must** be enabled first,"] - #[doc = " using `GameActivityPointerAxes_enableAxis`."] - #[doc = ""] - #[doc = " If the axis index is out of range, nothing is done."] - pub fn GameActivityPointerAxes_disableAxis(axis: i32); -} -extern "C" { - #[doc = " \\brief Enable the specified axis, so that its value is reported in the"] - #[doc = " GameActivityHistoricalPointerAxes structures associated with a motion event."] - #[doc = ""] - #[doc = " You must enable any axis that you want to read (no axes are enabled by"] - #[doc = " default)."] - #[doc = ""] - #[doc = " If the axis index is out of range, nothing is done."] - pub fn GameActivityHistoricalPointerAxes_enableAxis(axis: i32); -} -extern "C" { - #[doc = " \\brief Disable the specified axis. Its value won't be reported in the"] - #[doc = " GameActivityHistoricalPointerAxes structures associated with motion events"] - #[doc = " anymore."] - #[doc = ""] - #[doc = " If the axis index is out of range, nothing is done."] - pub fn GameActivityHistoricalPointerAxes_disableAxis(axis: i32); -} -#[doc = " \\brief Describe a motion event that happened on the GameActivity SurfaceView."] -#[doc = ""] -#[doc = " This is 1:1 mapping to the information contained in a Java `MotionEvent`"] -#[doc = " (see https://developer.android.com/reference/android/view/MotionEvent)."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct GameActivityMotionEvent { - pub deviceId: i32, - pub source: i32, - pub action: i32, - pub eventTime: i64, - pub downTime: i64, - pub flags: i32, - pub metaState: i32, - pub actionButton: i32, - pub buttonState: i32, - pub classification: i32, - pub edgeFlags: i32, - pub pointerCount: u32, - pub pointers: [GameActivityPointerAxes; 8usize], - pub precisionX: f32, - pub precisionY: f32, - pub historicalStart: i16, - pub historicalCount: i16, -} -#[test] -fn bindgen_test_layout_GameActivityMotionEvent() { - assert_eq!( - ::std::mem::size_of::(), - 1736usize, - concat!("Size of: ", stringify!(GameActivityMotionEvent)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(GameActivityMotionEvent)) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).deviceId as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(deviceId) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).source as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(source) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).action as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(action) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).eventTime as *const _ as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(eventTime) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).downTime as *const _ as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(downTime) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(flags) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).metaState as *const _ as usize - }, - 36usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(metaState) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).actionButton as *const _ as usize - }, - 40usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(actionButton) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).buttonState as *const _ as usize - }, - 44usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(buttonState) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).classification as *const _ as usize - }, - 48usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(classification) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).edgeFlags as *const _ as usize - }, - 52usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(edgeFlags) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).pointerCount as *const _ as usize - }, - 56usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(pointerCount) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).pointers as *const _ as usize - }, - 60usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(pointers) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).precisionX as *const _ as usize - }, - 1724usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(precisionX) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).precisionY as *const _ as usize - }, - 1728usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(precisionY) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).historicalStart as *const _ as usize - }, - 1732usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(historicalStart) - ) + state: jobject, + callback: GameTextInputGetStateCallback, + context: *mut ::std::os::raw::c_void, ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).historicalCount as *const _ as usize - }, - 1734usize, - concat!( - "Offset of field: ", - stringify!(GameActivityMotionEvent), - "::", - stringify!(historicalCount) - ) - ); -} -#[doc = " \\brief Describe a key event that happened on the GameActivity SurfaceView."] -#[doc = ""] -#[doc = " This is 1:1 mapping to the information contained in a Java `KeyEvent`"] -#[doc = " (see https://developer.android.com/reference/android/view/KeyEvent)."] +} +#[doc = " Mask of bits that determine the overall class\n of text being given. Currently supported classes are:\n {@link #TYPE_CLASS_TEXT}, {@link #TYPE_CLASS_NUMBER},\n {@link #TYPE_CLASS_PHONE}, {@link #TYPE_CLASS_DATETIME}.\n

IME authors: If the class is not one you\n understand, assume {@link #TYPE_CLASS_TEXT} with NO variation\n or flags.

"] +pub const GameTextInputType_TYPE_MASK_CLASS: GameTextInputType = 15; +#[doc = " Mask of bits that determine the variation of\n the base content class."] +pub const GameTextInputType_TYPE_MASK_VARIATION: GameTextInputType = 4080; +#[doc = " Mask of bits that provide addition bit flags\n of options."] +pub const GameTextInputType_TYPE_MASK_FLAGS: GameTextInputType = 16773120; +#[doc = " Special content type for when no explicit type has been specified.\n This should be interpreted to mean that the target input connection\n is not rich, it can not process and show things like candidate text nor\n retrieve the current text, so the input method will need to run in a\n limited \"generate key events\" mode, if it supports it. Note that some\n input methods may not support it, for example a voice-based input\n method will likely not be able to generate key events even if this\n flag is set."] +pub const GameTextInputType_TYPE_NULL: GameTextInputType = 0; +#[doc = " Class for normal text. This class supports the following flags (only\n one of which should be set):\n {@link #TYPE_TEXT_FLAG_CAP_CHARACTERS},\n {@link #TYPE_TEXT_FLAG_CAP_WORDS}, and.\n {@link #TYPE_TEXT_FLAG_CAP_SENTENCES}. It also supports the\n following variations:\n {@link #TYPE_TEXT_VARIATION_NORMAL}, and\n {@link #TYPE_TEXT_VARIATION_URI}. If you do not recognize the\n variation, normal should be assumed."] +pub const GameTextInputType_TYPE_CLASS_TEXT: GameTextInputType = 1; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: capitalize all characters. Overrides\n {@link #TYPE_TEXT_FLAG_CAP_WORDS} and\n {@link #TYPE_TEXT_FLAG_CAP_SENTENCES}. This value is explicitly defined\n to be the same as {@link TextUtils#CAP_MODE_CHARACTERS}. Of course,\n this only affects languages where there are upper-case and lower-case\n letters."] +pub const GameTextInputType_TYPE_TEXT_FLAG_CAP_CHARACTERS: GameTextInputType = 4096; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: capitalize the first character of\n every word. Overrides {@link #TYPE_TEXT_FLAG_CAP_SENTENCES}. This\n value is explicitly defined\n to be the same as {@link TextUtils#CAP_MODE_WORDS}. Of course,\n this only affects languages where there are upper-case and lower-case\n letters."] +pub const GameTextInputType_TYPE_TEXT_FLAG_CAP_WORDS: GameTextInputType = 8192; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: capitalize the first character of\n each sentence. This value is explicitly defined\n to be the same as {@link TextUtils#CAP_MODE_SENTENCES}. For example\n in English it means to capitalize after a period and a space (note that\n other languages may have different characters for period, or not use\n spaces, or use different grammatical rules). Of course, this only affects\n languages where there are upper-case and lower-case letters."] +pub const GameTextInputType_TYPE_TEXT_FLAG_CAP_SENTENCES: GameTextInputType = 16384; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: the user is entering free-form\n text that should have auto-correction applied to it. Without this flag,\n the IME will not try to correct typos. You should always set this flag\n unless you really expect users to type non-words in this field, for\n example to choose a name for a character in a game.\n Contrast this with {@link #TYPE_TEXT_FLAG_AUTO_COMPLETE} and\n {@link #TYPE_TEXT_FLAG_NO_SUGGESTIONS}:\n {@code TYPE_TEXT_FLAG_AUTO_CORRECT} means that the IME will try to\n auto-correct typos as the user is typing, but does not define whether\n the IME offers an interface to show suggestions."] +pub const GameTextInputType_TYPE_TEXT_FLAG_AUTO_CORRECT: GameTextInputType = 32768; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: the text editor (which means\n the application) is performing auto-completion of the text being entered\n based on its own semantics, which it will present to the user as they type.\n This generally means that the input method should not be showing\n candidates itself, but can expect the editor to supply its own\n completions/candidates from\n {@link android.view.inputmethod.InputMethodSession#displayCompletions\n InputMethodSession.displayCompletions()} as a result of the editor calling\n {@link android.view.inputmethod.InputMethodManager#displayCompletions\n InputMethodManager.displayCompletions()}.\n Note the contrast with {@link #TYPE_TEXT_FLAG_AUTO_CORRECT} and\n {@link #TYPE_TEXT_FLAG_NO_SUGGESTIONS}:\n {@code TYPE_TEXT_FLAG_AUTO_COMPLETE} means the editor should show an\n interface for displaying suggestions, but instead of supplying its own\n it will rely on the Editor to pass completions/corrections."] +pub const GameTextInputType_TYPE_TEXT_FLAG_AUTO_COMPLETE: GameTextInputType = 65536; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: multiple lines of text can be\n entered into the field. If this flag is not set, the text field\n will be constrained to a single line. The IME may also choose not to\n display an enter key when this flag is not set, as there should be no\n need to create new lines."] +pub const GameTextInputType_TYPE_TEXT_FLAG_MULTI_LINE: GameTextInputType = 131072; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: the regular text view associated\n with this should not be multi-line, but when a fullscreen input method\n is providing text it should use multiple lines if it can."] +pub const GameTextInputType_TYPE_TEXT_FLAG_IME_MULTI_LINE: GameTextInputType = 262144; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: the input method does not need to\n display any dictionary-based candidates. This is useful for text views that\n do not contain words from the language and do not benefit from any\n dictionary-based completions or corrections. It overrides the\n {@link #TYPE_TEXT_FLAG_AUTO_CORRECT} value when set.\n Please avoid using this unless you are certain this is what you want.\n Many input methods need suggestions to work well, for example the ones\n based on gesture typing. Consider clearing\n {@link #TYPE_TEXT_FLAG_AUTO_CORRECT} instead if you just do not\n want the IME to correct typos.\n Note the contrast with {@link #TYPE_TEXT_FLAG_AUTO_CORRECT} and\n {@link #TYPE_TEXT_FLAG_AUTO_COMPLETE}:\n {@code TYPE_TEXT_FLAG_NO_SUGGESTIONS} means the IME does not need to\n show an interface to display suggestions. Most IMEs will also take this to\n mean they do not need to try to auto-correct what the user is typing."] +pub const GameTextInputType_TYPE_TEXT_FLAG_NO_SUGGESTIONS: GameTextInputType = 524288; +#[doc = " Flag for {@link #TYPE_CLASS_TEXT}: Let the IME know the text conversion\n suggestions are required by the application. Text conversion suggestion is\n for the transliteration languages which has pronunciation characters and\n target characters. When the user is typing the pronunciation charactes, the\n IME could provide the possible target characters to the user. When this\n flag is set, the IME should insert the text conversion suggestions through\n {@link Builder#setTextConversionSuggestions(List)} and\n the {@link TextAttribute} with initialized with the text conversion\n suggestions is provided by the IME to the application. To receive the\n additional information, the application needs to implement {@link\n InputConnection#setComposingText(CharSequence, int, TextAttribute)},\n {@link InputConnection#setComposingRegion(int, int, TextAttribute)}, and\n {@link InputConnection#commitText(CharSequence, int, TextAttribute)}."] +pub const GameTextInputType_TYPE_TEXT_FLAG_ENABLE_TEXT_CONVERSION_SUGGESTIONS: GameTextInputType = + 1048576; +#[doc = " Default variation of {@link #TYPE_CLASS_TEXT}: plain old normal text."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_NORMAL: GameTextInputType = 0; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering a URI."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_URI: GameTextInputType = 16; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering an e-mail address."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_EMAIL_ADDRESS: GameTextInputType = 32; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering the subject line of\n an e-mail."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_EMAIL_SUBJECT: GameTextInputType = 48; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering a short, possibly informal\n message such as an instant message or a text message."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_SHORT_MESSAGE: GameTextInputType = 64; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering the content of a long,\n possibly formal message such as the body of an e-mail."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_LONG_MESSAGE: GameTextInputType = 80; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering the name of a person."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_PERSON_NAME: GameTextInputType = 96; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering a postal mailing address."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_POSTAL_ADDRESS: GameTextInputType = 112; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering a password."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_PASSWORD: GameTextInputType = 128; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering a password, which should\n be visible to the user."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_VISIBLE_PASSWORD: GameTextInputType = 144; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering text inside of a web form."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_WEB_EDIT_TEXT: GameTextInputType = 160; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering text to filter contents\n of a list etc."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_FILTER: GameTextInputType = 176; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering text for phonetic\n pronunciation, such as a phonetic name field in contacts. This is mostly\n useful for languages where one spelling may have several phonetic\n readings, like Japanese."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_PHONETIC: GameTextInputType = 192; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering e-mail address inside\n of a web form. This was added in\n {@link android.os.Build.VERSION_CODES#HONEYCOMB}. An IME must target\n this API version or later to see this input type; if it doesn't, a request\n for this type will be seen as {@link #TYPE_TEXT_VARIATION_EMAIL_ADDRESS}\n when passed through {@link\n android.view.inputmethod.EditorInfo#makeCompatible(int)\n EditorInfo.makeCompatible(int)}."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS: GameTextInputType = 208; +#[doc = " Variation of {@link #TYPE_CLASS_TEXT}: entering password inside\n of a web form. This was added in\n {@link android.os.Build.VERSION_CODES#HONEYCOMB}. An IME must target\n this API version or later to see this input type; if it doesn't, a request\n for this type will be seen as {@link #TYPE_TEXT_VARIATION_PASSWORD}\n when passed through {@link\n android.view.inputmethod.EditorInfo#makeCompatible(int)\n EditorInfo.makeCompatible(int)}."] +pub const GameTextInputType_TYPE_TEXT_VARIATION_WEB_PASSWORD: GameTextInputType = 224; +#[doc = " Class for numeric text. This class supports the following flags:\n {@link #TYPE_NUMBER_FLAG_SIGNED} and\n {@link #TYPE_NUMBER_FLAG_DECIMAL}. It also supports the following\n variations: {@link #TYPE_NUMBER_VARIATION_NORMAL} and\n {@link #TYPE_NUMBER_VARIATION_PASSWORD}.\n

IME authors: If you do not recognize\n the variation, normal should be assumed.

"] +pub const GameTextInputType_TYPE_CLASS_NUMBER: GameTextInputType = 2; +#[doc = " Flag of {@link #TYPE_CLASS_NUMBER}: the number is signed, allowing\n a positive or negative sign at the start."] +pub const GameTextInputType_TYPE_NUMBER_FLAG_SIGNED: GameTextInputType = 4096; +#[doc = " Flag of {@link #TYPE_CLASS_NUMBER}: the number is decimal, allowing\n a decimal point to provide fractional values."] +pub const GameTextInputType_TYPE_NUMBER_FLAG_DECIMAL: GameTextInputType = 8192; +#[doc = " Default variation of {@link #TYPE_CLASS_NUMBER}: plain normal\n numeric text. This was added in\n {@link android.os.Build.VERSION_CODES#HONEYCOMB}. An IME must target\n this API version or later to see this input type; if it doesn't, a request\n for this type will be dropped when passed through\n {@link android.view.inputmethod.EditorInfo#makeCompatible(int)\n EditorInfo.makeCompatible(int)}."] +pub const GameTextInputType_TYPE_NUMBER_VARIATION_NORMAL: GameTextInputType = 0; +#[doc = " Variation of {@link #TYPE_CLASS_NUMBER}: entering a numeric password.\n This was added in {@link android.os.Build.VERSION_CODES#HONEYCOMB}. An\n IME must target this API version or later to see this input type; if it\n doesn't, a request for this type will be dropped when passed\n through {@link android.view.inputmethod.EditorInfo#makeCompatible(int)\n EditorInfo.makeCompatible(int)}."] +pub const GameTextInputType_TYPE_NUMBER_VARIATION_PASSWORD: GameTextInputType = 16; +#[doc = " Class for a phone number. This class currently supports no variations\n or flags."] +pub const GameTextInputType_TYPE_CLASS_PHONE: GameTextInputType = 3; +#[doc = " Class for dates and times. It supports the\n following variations:\n {@link #TYPE_DATETIME_VARIATION_NORMAL}\n {@link #TYPE_DATETIME_VARIATION_DATE}, and\n {@link #TYPE_DATETIME_VARIATION_TIME}."] +pub const GameTextInputType_TYPE_CLASS_DATETIME: GameTextInputType = 4; +#[doc = " Default variation of {@link #TYPE_CLASS_DATETIME}: allows entering\n both a date and time."] +pub const GameTextInputType_TYPE_DATETIME_VARIATION_NORMAL: GameTextInputType = 0; +#[doc = " Default variation of {@link #TYPE_CLASS_DATETIME}: allows entering\n only a date."] +pub const GameTextInputType_TYPE_DATETIME_VARIATION_DATE: GameTextInputType = 16; +#[doc = " Default variation of {@link #TYPE_CLASS_DATETIME}: allows entering\n only a time."] +pub const GameTextInputType_TYPE_DATETIME_VARIATION_TIME: GameTextInputType = 32; +#[doc = " Definitions for inputType argument of GameActivity_setImeEditorInfo()\n\n
\n |-------|-------|-------|-------|\n                              1111 TYPE_MASK_CLASS\n                      11111111     TYPE_MASK_VARIATION\n          111111111111             TYPE_MASK_FLAGS\n |-------|-------|-------|-------|\n                                   TYPE_NULL\n |-------|-------|-------|-------|\n                                 1 TYPE_CLASS_TEXT\n                             1     TYPE_TEXT_VARIATION_URI\n                            1      TYPE_TEXT_VARIATION_EMAIL_ADDRESS\n                            11     TYPE_TEXT_VARIATION_EMAIL_SUBJECT\n                           1       TYPE_TEXT_VARIATION_SHORT_MESSAGE\n                           1 1     TYPE_TEXT_VARIATION_LONG_MESSAGE\n                           11      TYPE_TEXT_VARIATION_PERSON_NAME\n                           111     TYPE_TEXT_VARIATION_POSTAL_ADDRESS\n                          1        TYPE_TEXT_VARIATION_PASSWORD\n                          1  1     TYPE_TEXT_VARIATION_VISIBLE_PASSWORD\n                          1 1      TYPE_TEXT_VARIATION_WEB_EDIT_TEXT\n                          1 11     TYPE_TEXT_VARIATION_FILTER\n                          11       TYPE_TEXT_VARIATION_PHONETIC\n                          11 1     TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS\n                          111      TYPE_TEXT_VARIATION_WEB_PASSWORD\n                     1             TYPE_TEXT_FLAG_CAP_CHARACTERS\n                    1              TYPE_TEXT_FLAG_CAP_WORDS\n                   1               TYPE_TEXT_FLAG_CAP_SENTENCES\n                  1                TYPE_TEXT_FLAG_AUTO_CORRECT\n                 1                 TYPE_TEXT_FLAG_AUTO_COMPLETE\n                1                  TYPE_TEXT_FLAG_MULTI_LINE\n               1                   TYPE_TEXT_FLAG_IME_MULTI_LINE\n              1                    TYPE_TEXT_FLAG_NO_SUGGESTIONS\n             1 TYPE_TEXT_FLAG_ENABLE_TEXT_CONVERSION_SUGGESTIONS\n |-------|-------|-------|-------|\n                                1  TYPE_CLASS_NUMBER\n                             1     TYPE_NUMBER_VARIATION_PASSWORD\n                     1             TYPE_NUMBER_FLAG_SIGNED\n                    1              TYPE_NUMBER_FLAG_DECIMAL\n |-------|-------|-------|-------|\n                                11 TYPE_CLASS_PHONE\n |-------|-------|-------|-------|\n                               1   TYPE_CLASS_DATETIME\n                             1     TYPE_DATETIME_VARIATION_DATE\n                            1      TYPE_DATETIME_VARIATION_TIME\n |-------|-------|-------|-------|
"] +pub type GameTextInputType = u32; +#[doc = " Set of bits in {@link #imeOptions} that provide alternative actions\n associated with the \"enter\" key. This both helps the IME provide\n better feedback about what the enter key will do, and also allows it\n to provide alternative mechanisms for providing that command."] +pub const GameTextInputActionType_IME_MASK_ACTION: GameTextInputActionType = 255; +#[doc = " Bits of {@link #IME_MASK_ACTION}: no specific action has been\n associated with this editor, let the editor come up with its own if\n it can."] +pub const GameTextInputActionType_IME_ACTION_UNSPECIFIED: GameTextInputActionType = 0; +#[doc = " Bits of {@link #IME_MASK_ACTION}: there is no available action."] +pub const GameTextInputActionType_IME_ACTION_NONE: GameTextInputActionType = 1; +#[doc = " Bits of {@link #IME_MASK_ACTION}: the action key performs a \"go\"\n operation to take the user to the target of the text they typed.\n Typically used, for example, when entering a URL."] +pub const GameTextInputActionType_IME_ACTION_GO: GameTextInputActionType = 2; +#[doc = " Bits of {@link #IME_MASK_ACTION}: the action key performs a \"search\"\n operation, taking the user to the results of searching for the text\n they have typed (in whatever context is appropriate)."] +pub const GameTextInputActionType_IME_ACTION_SEARCH: GameTextInputActionType = 3; +#[doc = " Bits of {@link #IME_MASK_ACTION}: the action key performs a \"send\"\n operation, delivering the text to its target. This is typically used\n when composing a message in IM or SMS where sending is immediate."] +pub const GameTextInputActionType_IME_ACTION_SEND: GameTextInputActionType = 4; +#[doc = " Bits of {@link #IME_MASK_ACTION}: the action key performs a \"next\"\n operation, taking the user to the next field that will accept text."] +pub const GameTextInputActionType_IME_ACTION_NEXT: GameTextInputActionType = 5; +#[doc = " Bits of {@link #IME_MASK_ACTION}: the action key performs a \"done\"\n operation, typically meaning there is nothing more to input and the\n IME will be closed."] +pub const GameTextInputActionType_IME_ACTION_DONE: GameTextInputActionType = 6; +#[doc = " Bits of {@link #IME_MASK_ACTION}: like {@link #IME_ACTION_NEXT}, but\n for moving to the previous field. This will normally not be used to\n specify an action (since it precludes {@link #IME_ACTION_NEXT}), but\n can be returned to the app if it sets {@link #IME_FLAG_NAVIGATE_PREVIOUS}."] +pub const GameTextInputActionType_IME_ACTION_PREVIOUS: GameTextInputActionType = 7; +#[doc = " actionId and imeOptions argument of GameActivity_setImeEditorInfo().\n\n
\n |-------|-------|-------|-------|\n                              1111 IME_MASK_ACTION\n |-------|-------|-------|-------|\n                                   IME_ACTION_UNSPECIFIED\n                                 1 IME_ACTION_NONE\n                                1  IME_ACTION_GO\n                                11 IME_ACTION_SEARCH\n                               1   IME_ACTION_SEND\n                               1 1 IME_ACTION_NEXT\n                               11  IME_ACTION_DONE\n                               111 IME_ACTION_PREVIOUS\n         1                         IME_FLAG_NO_PERSONALIZED_LEARNING\n        1                          IME_FLAG_NO_FULLSCREEN\n       1                           IME_FLAG_NAVIGATE_PREVIOUS\n      1                            IME_FLAG_NAVIGATE_NEXT\n     1                             IME_FLAG_NO_EXTRACT_UI\n    1                              IME_FLAG_NO_ACCESSORY_ACTION\n   1                               IME_FLAG_NO_ENTER_ACTION\n  1                                IME_FLAG_FORCE_ASCII\n |-------|-------|-------|-------|
"] +pub type GameTextInputActionType = u32; +#[doc = " Flag of {@link #imeOptions}: used to request that the IME should not update\n any personalized data such as typing history and personalized language\n model based on what the user typed on this text editing object. Typical\n use cases are:
  • When the application is in a special mode, where\n user's activities are expected to be not recorded in the application's\n history. Some web browsers and chat applications may have this kind of\n modes.
  • When storing typing history does not make much sense.\n Specifying this flag in typing games may help to avoid typing history from\n being filled up with words that the user is less likely to type in their\n daily life. Another example is that when the application already knows\n that the expected input is not a valid word (e.g. a promotion code that is\n not a valid word in any natural language).
  • \n
\n\n

Applications need to be aware that the flag is not a guarantee, and some\n IMEs may not respect it.

"] +pub const GameTextInputImeOptions_IME_FLAG_NO_PERSONALIZED_LEARNING: GameTextInputImeOptions = + 16777216; +#[doc = " Flag of {@link #imeOptions}: used to request that the IME never go\n into fullscreen mode.\n By default, IMEs may go into full screen mode when they think\n it's appropriate, for example on small screens in landscape\n orientation where displaying a software keyboard may occlude\n such a large portion of the screen that the remaining part is\n too small to meaningfully display the application UI.\n If this flag is set, compliant IMEs will never go into full screen mode,\n and always leave some space to display the application UI.\n Applications need to be aware that the flag is not a guarantee, and\n some IMEs may ignore it."] +pub const GameTextInputImeOptions_IME_FLAG_NO_FULLSCREEN: GameTextInputImeOptions = 33554432; +#[doc = " Flag of {@link #imeOptions}: like {@link #IME_FLAG_NAVIGATE_NEXT}, but\n specifies there is something interesting that a backward navigation\n can focus on. If the user selects the IME's facility to backward\n navigate, this will show up in the application as an {@link\n #IME_ACTION_PREVIOUS} at {@link InputConnection#performEditorAction(int)\n InputConnection.performEditorAction(int)}."] +pub const GameTextInputImeOptions_IME_FLAG_NAVIGATE_PREVIOUS: GameTextInputImeOptions = 67108864; +#[doc = " Flag of {@link #imeOptions}: used to specify that there is something\n interesting that a forward navigation can focus on. This is like using\n {@link #IME_ACTION_NEXT}, except allows the IME to be multiline (with\n an enter key) as well as provide forward navigation. Note that some\n IMEs may not be able to do this, especially when running on a small\n screen where there is little space. In that case it does not need to\n present a UI for this option. Like {@link #IME_ACTION_NEXT}, if the\n user selects the IME's facility to forward navigate, this will show up\n in the application at {@link InputConnection#performEditorAction(int)\n InputConnection.performEditorAction(int)}."] +pub const GameTextInputImeOptions_IME_FLAG_NAVIGATE_NEXT: GameTextInputImeOptions = 134217728; +#[doc = " Flag of {@link #imeOptions}: used to specify that the IME does not need\n to show its extracted text UI. For input methods that may be fullscreen,\n often when in landscape mode, this allows them to be smaller and let part\n of the application be shown behind, through transparent UI parts in the\n fullscreen IME. The part of the UI visible to the user may not be\n responsive to touch because the IME will receive touch events, which may\n confuse the user; use {@link #IME_FLAG_NO_FULLSCREEN} instead for a better\n experience. Using this flag is discouraged and it may become deprecated in\n the future. Its meaning is unclear in some situations and it may not work\n appropriately on older versions of the platform."] +pub const GameTextInputImeOptions_IME_FLAG_NO_EXTRACT_UI: GameTextInputImeOptions = 268435456; +#[doc = " Flag of {@link #imeOptions}: used in conjunction with one of the actions\n masked by {@link #IME_MASK_ACTION}, this indicates that the action\n should not be available as an accessory button on the right of the\n extracted text when the input method is full-screen. Note that by setting\n this flag, there can be cases where the action is simply never available to\n the user. Setting this generally means that you think that in fullscreen\n mode, where there is little space to show the text, it's not worth taking\n some screen real estate to display the action and it should be used instead\n to show more text."] +pub const GameTextInputImeOptions_IME_FLAG_NO_ACCESSORY_ACTION: GameTextInputImeOptions = 536870912; +#[doc = " Flag of {@link #imeOptions}: used in conjunction with one of the actions\n masked by {@link #IME_MASK_ACTION}. If this flag is not set, IMEs will\n normally replace the \"enter\" key with the action supplied. This flag\n indicates that the action should not be available in-line as a replacement\n for the \"enter\" key. Typically this is because the action has such a\n significant impact or is not recoverable enough that accidentally hitting\n it should be avoided, such as sending a message. Note that\n {@link android.widget.TextView} will automatically set this flag for you\n on multi-line text views."] +pub const GameTextInputImeOptions_IME_FLAG_NO_ENTER_ACTION: GameTextInputImeOptions = 1073741824; +#[doc = " Flag of {@link #imeOptions}: used to request an IME that is capable of\n inputting ASCII characters. The intention of this flag is to ensure that\n the user can type Roman alphabet characters in a {@link\n android.widget.TextView}. It is typically used for an account ID or\n password input. A lot of the time, IMEs are already able to input ASCII\n even without being told so (such IMEs already respect this flag in a\n sense), but there are cases when this is not the default. For instance,\n users of languages using a different script like Arabic, Greek, Hebrew or\n Russian typically have a keyboard that can't input ASCII characters by\n default. Applications need to be aware that the flag is not a guarantee,\n and some IMEs may not respect it. However, it is strongly recommended for\n IME authors to respect this flag especially when their IME could end up\n with a state where only languages using non-ASCII are enabled."] +pub const GameTextInputImeOptions_IME_FLAG_FORCE_ASCII: GameTextInputImeOptions = 2147483648; +#[doc = " Flag of {@link #internalImeOptions}: flag is set when app window containing\n this\n {@link EditorInfo} is using {@link Configuration#ORIENTATION_PORTRAIT}\n mode.\n @hide"] +pub const GameTextInputImeOptions_IME_INTERNAL_FLAG_APP_WINDOW_PORTRAIT: GameTextInputImeOptions = + 1; +#[doc = " Generic unspecified type for {@link #imeOptions}."] +pub const GameTextInputImeOptions_IME_NULL: GameTextInputImeOptions = 0; +pub type GameTextInputImeOptions = u32; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_CAPTION_BAR: GameCommonInsetsType = 0; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_DISPLAY_CUTOUT: GameCommonInsetsType = 1; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_IME: GameCommonInsetsType = 2; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_MANDATORY_SYSTEM_GESTURES: + GameCommonInsetsType = 3; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_NAVIGATION_BARS: GameCommonInsetsType = 4; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_STATUS_BARS: GameCommonInsetsType = 5; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_SYSTEM_BARS: GameCommonInsetsType = 6; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_SYSTEM_GESTURES: GameCommonInsetsType = 7; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_TAPABLE_ELEMENT: GameCommonInsetsType = 8; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_WATERFALL: GameCommonInsetsType = 9; +pub const GameCommonInsetsType_GAMECOMMON_INSETS_TYPE_COUNT: GameCommonInsetsType = 10; +#[doc = " The type of a component for which to retrieve insets. See\n https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat.Type"] +pub type GameCommonInsetsType = u8; +#[doc = " This structure defines the native side of an android.app.GameActivity.\n It is created by the framework, and handed to the application's native\n code as it is being launched."] #[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct GameActivityKeyEvent { - pub deviceId: i32, - pub source: i32, - pub action: i32, - pub eventTime: i64, - pub downTime: i64, - pub flags: i32, - pub metaState: i32, - pub modifiers: i32, - pub repeatCount: i32, - pub keyCode: i32, - pub scanCode: i32, +pub struct GameActivity { + #[doc = " Pointer to the callback function table of the native application.\n You can set the functions here to your own callbacks. The callbacks\n pointer itself here should not be changed; it is allocated and managed\n for you by the framework."] + pub callbacks: *mut GameActivityCallbacks, + #[doc = " The global handle on the process's Java VM."] + pub vm: *mut JavaVM, + #[doc = " JNI context for the main thread of the app. Note that this field\n can ONLY be used from the main thread of the process; that is, the\n thread that calls into the GameActivityCallbacks."] + pub env: *mut JNIEnv, + #[doc = " The GameActivity object handle."] + pub javaGameActivity: jobject, + #[doc = " Path to this application's internal data directory."] + pub internalDataPath: *const ::std::os::raw::c_char, + #[doc = " Path to this application's external (removable/mountable) data directory."] + pub externalDataPath: *const ::std::os::raw::c_char, + #[doc = " The platform's SDK version code."] + pub sdkVersion: i32, + #[doc = " This is the native instance of the application. It is not used by\n the framework, but can be set by the application to its own instance\n state."] + pub instance: *mut ::std::os::raw::c_void, + #[doc = " Pointer to the Asset Manager instance for the application. The\n application uses this to access binary assets bundled inside its own .apk\n file."] + pub assetManager: *mut AAssetManager, + #[doc = " Available starting with Honeycomb: path to the directory containing\n the application's OBB files (if any). If the app doesn't have any\n OBB files, this directory may not exist."] + pub obbPath: *const ::std::os::raw::c_char, } #[test] -fn bindgen_test_layout_GameActivityKeyEvent() { +fn bindgen_test_layout_GameActivity() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - ::std::mem::size_of::(), - 56usize, - concat!("Size of: ", stringify!(GameActivityKeyEvent)) + ::std::mem::size_of::(), + 80usize, + "Size of GameActivity" ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(GameActivityKeyEvent)) + "Alignment of GameActivity" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).deviceId as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).callbacks) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(deviceId) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).source as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(source) - ) + "Offset of field: GameActivity::callbacks" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).action as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).vm) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(action) - ) + "Offset of field: GameActivity::vm" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).eventTime as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).env) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(eventTime) - ) + "Offset of field: GameActivity::env" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).downTime as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).javaGameActivity) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(downTime) - ) + "Offset of field: GameActivity::javaGameActivity" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).internalDataPath) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(flags) - ) + "Offset of field: GameActivity::internalDataPath" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).metaState as *const _ as usize }, - 36usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(metaState) - ) + unsafe { ::std::ptr::addr_of!((*ptr).externalDataPath) as usize - ptr as usize }, + 40usize, + "Offset of field: GameActivity::externalDataPath" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).modifiers as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(modifiers) - ) + unsafe { ::std::ptr::addr_of!((*ptr).sdkVersion) as usize - ptr as usize }, + 48usize, + "Offset of field: GameActivity::sdkVersion" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).repeatCount as *const _ as usize - }, - 44usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(repeatCount) - ) + unsafe { ::std::ptr::addr_of!((*ptr).instance) as usize - ptr as usize }, + 56usize, + "Offset of field: GameActivity::instance" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).keyCode as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(keyCode) - ) + unsafe { ::std::ptr::addr_of!((*ptr).assetManager) as usize - ptr as usize }, + 64usize, + "Offset of field: GameActivity::assetManager" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).scanCode as *const _ as usize }, - 52usize, - concat!( - "Offset of field: ", - stringify!(GameActivityKeyEvent), - "::", - stringify!(scanCode) - ) + unsafe { ::std::ptr::addr_of!((*ptr).obbPath) as usize - ptr as usize }, + 72usize, + "Offset of field: GameActivity::obbPath" ); } -#[doc = " A function the user should call from their callback with the data, its length"] -#[doc = " and the library- supplied context."] +#[doc = " A function the user should call from their callback with the data, its length\n and the library- supplied context."] pub type SaveInstanceStateRecallback = ::std::option::Option< unsafe extern "C" fn( bytes: *const ::std::os::raw::c_char, @@ -3245,18 +2985,11 @@ pub type SaveInstanceStateRecallback = ::std::option::Option< #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct GameActivityCallbacks { - #[doc = " GameActivity has started. See Java documentation for Activity.onStart()"] - #[doc = " for more information."] + #[doc = " GameActivity has started. See Java documentation for Activity.onStart()\n for more information."] pub onStart: ::std::option::Option, - #[doc = " GameActivity has resumed. See Java documentation for Activity.onResume()"] - #[doc = " for more information."] + #[doc = " GameActivity has resumed. See Java documentation for Activity.onResume()\n for more information."] pub onResume: ::std::option::Option, - #[doc = " The framework is asking GameActivity to save its current instance state."] - #[doc = " See the Java documentation for Activity.onSaveInstanceState() for more"] - #[doc = " information. The user should call the recallback with their data, its"] - #[doc = " length and the provided context; they retain ownership of the data. Note"] - #[doc = " that the saved state will be persisted, so it can not contain any active"] - #[doc = " entities (pointers to memory, file descriptors, etc)."] + #[doc = " The framework is asking GameActivity to save its current instance state.\n See the Java documentation for Activity.onSaveInstanceState() for more\n information. The user should call the recallback with their data, its\n length and the provided context; they retain ownership of the data. Note\n that the saved state will be persisted, so it can not contain any active\n entities (pointers to memory, file descriptors, etc)."] pub onSaveInstanceState: ::std::option::Option< unsafe extern "C" fn( activity: *mut GameActivity, @@ -3264,27 +2997,20 @@ pub struct GameActivityCallbacks { context: *mut ::std::os::raw::c_void, ), >, - #[doc = " GameActivity has paused. See Java documentation for Activity.onPause()"] - #[doc = " for more information."] + #[doc = " GameActivity has paused. See Java documentation for Activity.onPause()\n for more information."] pub onPause: ::std::option::Option, - #[doc = " GameActivity has stopped. See Java documentation for Activity.onStop()"] - #[doc = " for more information."] + #[doc = " GameActivity has stopped. See Java documentation for Activity.onStop()\n for more information."] pub onStop: ::std::option::Option, - #[doc = " GameActivity is being destroyed. See Java documentation for"] - #[doc = " Activity.onDestroy() for more information."] + #[doc = " GameActivity is being destroyed. See Java documentation for\n Activity.onDestroy() for more information."] pub onDestroy: ::std::option::Option, - #[doc = " Focus has changed in this GameActivity's window. This is often used,"] - #[doc = " for example, to pause a game when it loses input focus."] + #[doc = " Focus has changed in this GameActivity's window. This is often used,\n for example, to pause a game when it loses input focus."] pub onWindowFocusChanged: ::std::option::Option, - #[doc = " The drawing window for this native activity has been created. You"] - #[doc = " can use the given native window object to start drawing."] + #[doc = " The drawing window for this native activity has been created. You\n can use the given native window object to start drawing."] pub onNativeWindowCreated: ::std::option::Option< unsafe extern "C" fn(activity: *mut GameActivity, window: *mut ANativeWindow), >, - #[doc = " The drawing window for this native activity has been resized. You should"] - #[doc = " retrieve the new size from the window and ensure that your rendering in"] - #[doc = " it now matches."] + #[doc = " The drawing window for this native activity has been resized. You should\n retrieve the new size from the window and ensure that your rendering in\n it now matches."] pub onNativeWindowResized: ::std::option::Option< unsafe extern "C" fn( activity: *mut GameActivity, @@ -3293,557 +3019,295 @@ pub struct GameActivityCallbacks { newHeight: i32, ), >, - #[doc = " The drawing window for this native activity needs to be redrawn. To"] - #[doc = " avoid transient artifacts during screen changes (such resizing after"] - #[doc = " rotation), applications should not return from this function until they"] - #[doc = " have finished drawing their window in its current state."] + #[doc = " The drawing window for this native activity needs to be redrawn. To\n avoid transient artifacts during screen changes (such resizing after\n rotation), applications should not return from this function until they\n have finished drawing their window in its current state."] pub onNativeWindowRedrawNeeded: ::std::option::Option< unsafe extern "C" fn(activity: *mut GameActivity, window: *mut ANativeWindow), >, - #[doc = " The drawing window for this native activity is going to be destroyed."] - #[doc = " You MUST ensure that you do not touch the window object after returning"] - #[doc = " from this function: in the common case of drawing to the window from"] - #[doc = " another thread, that means the implementation of this callback must"] - #[doc = " properly synchronize with the other thread to stop its drawing before"] - #[doc = " returning from here."] + #[doc = " The drawing window for this native activity is going to be destroyed.\n You MUST ensure that you do not touch the window object after returning\n from this function: in the common case of drawing to the window from\n another thread, that means the implementation of this callback must\n properly synchronize with the other thread to stop its drawing before\n returning from here."] pub onNativeWindowDestroyed: ::std::option::Option< unsafe extern "C" fn(activity: *mut GameActivity, window: *mut ANativeWindow), >, - #[doc = " The current device AConfiguration has changed. The new configuration can"] - #[doc = " be retrieved from assetManager."] + #[doc = " The current device AConfiguration has changed. The new configuration can\n be retrieved from assetManager."] pub onConfigurationChanged: ::std::option::Option, - #[doc = " The system is running low on memory. Use this callback to release"] - #[doc = " resources you do not need, to help the system avoid killing more"] - #[doc = " important processes."] + #[doc = " The system is running low on memory. Use this callback to release\n resources you do not need, to help the system avoid killing more\n important processes."] pub onTrimMemory: ::std::option::Option< unsafe extern "C" fn(activity: *mut GameActivity, level: ::std::os::raw::c_int), >, - #[doc = " Callback called for every MotionEvent done on the GameActivity"] - #[doc = " SurfaceView. Ownership of `event` is maintained by the library and it is"] - #[doc = " only valid during the callback."] + #[doc = " Callback called for every MotionEvent done on the GameActivity\n SurfaceView. Ownership of `event` is maintained by the library and it is\n only valid during the callback."] pub onTouchEvent: ::std::option::Option< unsafe extern "C" fn( activity: *mut GameActivity, event: *const GameActivityMotionEvent, - historical: *const GameActivityHistoricalPointerAxes, - historicalLen: ::std::os::raw::c_int, ) -> bool, >, - #[doc = " Callback called for every key down event on the GameActivity SurfaceView."] - #[doc = " Ownership of `event` is maintained by the library and it is only valid"] - #[doc = " during the callback."] + #[doc = " Callback called for every key down event on the GameActivity SurfaceView.\n Ownership of `event` is maintained by the library and it is only valid\n during the callback."] pub onKeyDown: ::std::option::Option< unsafe extern "C" fn( activity: *mut GameActivity, event: *const GameActivityKeyEvent, ) -> bool, >, - #[doc = " Callback called for every key up event on the GameActivity SurfaceView."] - #[doc = " Ownership of `event` is maintained by the library and it is only valid"] - #[doc = " during the callback."] + #[doc = " Callback called for every key up event on the GameActivity SurfaceView.\n Ownership of `event` is maintained by the library and it is only valid\n during the callback."] pub onKeyUp: ::std::option::Option< unsafe extern "C" fn( activity: *mut GameActivity, event: *const GameActivityKeyEvent, ) -> bool, >, - #[doc = " Callback called for every soft-keyboard text input event."] - #[doc = " Ownership of `state` is maintained by the library and it is only valid"] - #[doc = " during the callback."] + #[doc = " Callback called for every soft-keyboard text input event.\n Ownership of `state` is maintained by the library and it is only valid\n during the callback."] pub onTextInputEvent: ::std::option::Option< unsafe extern "C" fn(activity: *mut GameActivity, state: *const GameTextInputState), >, - #[doc = " Callback called when WindowInsets of the main app window have changed."] - #[doc = " Call GameActivity_getWindowInsets to retrieve the insets themselves."] + #[doc = " Callback called when WindowInsets of the main app window have changed.\n Call GameActivity_getWindowInsets to retrieve the insets themselves."] pub onWindowInsetsChanged: ::std::option::Option, + #[doc = " Callback called when the rectangle in the window where the content\n should be placed has changed."] + pub onContentRectChanged: ::std::option::Option< + unsafe extern "C" fn(activity: *mut GameActivity, rect: *const ARect), + >, + #[doc = " Callback called when the software keyboard is shown or hidden."] + pub onSoftwareKeyboardVisibilityChanged: + ::std::option::Option, + #[doc = " Callback called when the software keyboard is shown or hidden."] + pub onEditorAction: ::std::option::Option< + unsafe extern "C" fn(activity: *mut GameActivity, action: ::std::os::raw::c_int) -> bool, + >, } #[test] fn bindgen_test_layout_GameActivityCallbacks() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), - 144usize, - concat!("Size of: ", stringify!(GameActivityCallbacks)) + 168usize, + "Size of GameActivityCallbacks" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(GameActivityCallbacks)) + "Alignment of GameActivityCallbacks" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).onStart as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).onStart) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onStart) - ) + "Offset of field: GameActivityCallbacks::onStart" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).onResume as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).onResume) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onResume) - ) + "Offset of field: GameActivityCallbacks::onResume" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onSaveInstanceState as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onSaveInstanceState) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onSaveInstanceState) - ) + "Offset of field: GameActivityCallbacks::onSaveInstanceState" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).onPause as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).onPause) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onPause) - ) + "Offset of field: GameActivityCallbacks::onPause" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).onStop as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).onStop) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onStop) - ) + "Offset of field: GameActivityCallbacks::onStop" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).onDestroy as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).onDestroy) as usize - ptr as usize }, 40usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onDestroy) - ) + "Offset of field: GameActivityCallbacks::onDestroy" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onWindowFocusChanged as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onWindowFocusChanged) as usize - ptr as usize }, 48usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onWindowFocusChanged) - ) + "Offset of field: GameActivityCallbacks::onWindowFocusChanged" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onNativeWindowCreated as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onNativeWindowCreated) as usize - ptr as usize }, 56usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onNativeWindowCreated) - ) + "Offset of field: GameActivityCallbacks::onNativeWindowCreated" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onNativeWindowResized as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onNativeWindowResized) as usize - ptr as usize }, 64usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onNativeWindowResized) - ) + "Offset of field: GameActivityCallbacks::onNativeWindowResized" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onNativeWindowRedrawNeeded as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onNativeWindowRedrawNeeded) as usize - ptr as usize }, 72usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onNativeWindowRedrawNeeded) - ) + "Offset of field: GameActivityCallbacks::onNativeWindowRedrawNeeded" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onNativeWindowDestroyed as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onNativeWindowDestroyed) as usize - ptr as usize }, 80usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onNativeWindowDestroyed) - ) + "Offset of field: GameActivityCallbacks::onNativeWindowDestroyed" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onConfigurationChanged as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onConfigurationChanged) as usize - ptr as usize }, 88usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onConfigurationChanged) - ) + "Offset of field: GameActivityCallbacks::onConfigurationChanged" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onTrimMemory as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onTrimMemory) as usize - ptr as usize }, 96usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onTrimMemory) - ) + "Offset of field: GameActivityCallbacks::onTrimMemory" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onTouchEvent as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onTouchEvent) as usize - ptr as usize }, 104usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onTouchEvent) - ) + "Offset of field: GameActivityCallbacks::onTouchEvent" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).onKeyDown as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).onKeyDown) as usize - ptr as usize }, 112usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onKeyDown) - ) + "Offset of field: GameActivityCallbacks::onKeyDown" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).onKeyUp as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).onKeyUp) as usize - ptr as usize }, 120usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onKeyUp) - ) + "Offset of field: GameActivityCallbacks::onKeyUp" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).onTextInputEvent as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).onTextInputEvent) as usize - ptr as usize }, 128usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onTextInputEvent) - ) + "Offset of field: GameActivityCallbacks::onTextInputEvent" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).onWindowInsetsChanged) as usize - ptr as usize }, + 136usize, + "Offset of field: GameActivityCallbacks::onWindowInsetsChanged" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).onContentRectChanged) as usize - ptr as usize }, + 144usize, + "Offset of field: GameActivityCallbacks::onContentRectChanged" ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).onWindowInsetsChanged as *const _ - as usize + ::std::ptr::addr_of!((*ptr).onSoftwareKeyboardVisibilityChanged) as usize - ptr as usize }, - 136usize, - concat!( - "Offset of field: ", - stringify!(GameActivityCallbacks), - "::", - stringify!(onWindowInsetsChanged) - ) - ); -} -extern "C" { - #[doc = " \\brief Convert a Java `MotionEvent` to a `GameActivityMotionEvent`."] - #[doc = ""] - #[doc = " This is done automatically by the GameActivity: see `onTouchEvent` to set"] - #[doc = " a callback to consume the received events."] - #[doc = " This function can be used if you re-implement events handling in your own"] - #[doc = " activity. On return, the out_event->historicalStart will be zero, and should"] - #[doc = " be updated to index into whatever buffer out_historical is copied."] - #[doc = " On return the length of out_historical is"] - #[doc = " (out_event->pointerCount x out_event->historicalCount) and is in a"] - #[doc = " pointer-major order (i.e. all axis for a pointer are contiguous)"] - #[doc = " Ownership of out_event is maintained by the caller."] - pub fn GameActivityMotionEvent_fromJava( - env: *mut JNIEnv, - motionEvent: jobject, - out_event: *mut GameActivityMotionEvent, - out_historical: *mut GameActivityHistoricalPointerAxes, - ) -> ::std::os::raw::c_int; + 152usize, + "Offset of field: GameActivityCallbacks::onSoftwareKeyboardVisibilityChanged" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).onEditorAction) as usize - ptr as usize }, + 160usize, + "Offset of field: GameActivityCallbacks::onEditorAction" + ); } -extern "C" { - #[doc = " \\brief Convert a Java `KeyEvent` to a `GameActivityKeyEvent`."] - #[doc = ""] - #[doc = " This is done automatically by the GameActivity: see `onKeyUp` and `onKeyDown`"] - #[doc = " to set a callback to consume the received events."] - #[doc = " This function can be used if you re-implement events handling in your own"] - #[doc = " activity."] - #[doc = " Ownership of out_event is maintained by the caller."] - pub fn GameActivityKeyEvent_fromJava( - env: *mut JNIEnv, - motionEvent: jobject, - out_event: *mut GameActivityKeyEvent, - ); -} -#[doc = " This is the function that must be in the native code to instantiate the"] -#[doc = " application's native activity. It is called with the activity instance (see"] -#[doc = " above); if the code is being instantiated from a previously saved instance,"] -#[doc = " the savedState will be non-NULL and point to the saved data. You must make"] -#[doc = " any copy of this data you need -- it will be released after you return from"] -#[doc = " this function."] +#[doc = " This is the function that must be in the native code to instantiate the\n application's native activity. It is called with the activity instance (see\n above); if the code is being instantiated from a previously saved instance,\n the savedState will be non-NULL and point to the saved data. You must make\n any copy of this data you need -- it will be released after you return from\n this function."] pub type GameActivity_createFunc = ::std::option::Option< unsafe extern "C" fn( activity: *mut GameActivity, savedState: *mut ::std::os::raw::c_void, - savedStateSize: size_t, + savedStateSize: usize, ), >; extern "C" { - #[doc = " Finish the given activity. Its finish() method will be called, causing it"] - #[doc = " to be stopped and destroyed. Note that this method can be called from"] - #[doc = " *any* thread; it will send a message to the main thread of the process"] - #[doc = " where the Java finish call will take place."] + #[doc = " Finish the given activity. Its finish() method will be called, causing it\n to be stopped and destroyed. Note that this method can be called from\n *any* thread; it will send a message to the main thread of the process\n where the Java finish call will take place."] pub fn GameActivity_finish(activity: *mut GameActivity); } -#[doc = " As long as this window is visible to the user, allow the lock"] -#[doc = " screen to activate while the screen is on. This can be used"] -#[doc = " independently, or in combination with {@link"] -#[doc = " GAMEACTIVITY_FLAG_KEEP_SCREEN_ON} and/or {@link"] -#[doc = " GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED}"] +#[doc = " As long as this window is visible to the user, allow the lock\n screen to activate while the screen is on. This can be used\n independently, or in combination with {@link\n GAMEACTIVITY_FLAG_KEEP_SCREEN_ON} and/or {@link\n GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED}"] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_ALLOW_LOCK_WHILE_SCREEN_ON: GameActivitySetWindowFlags = 1; #[doc = " Everything behind this window will be dimmed."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_DIM_BEHIND: GameActivitySetWindowFlags = 2; -#[doc = " Blur everything behind this window."] -#[doc = " @deprecated Blurring is no longer supported."] +#[doc = " Blur everything behind this window.\n @deprecated Blurring is no longer supported."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_BLUR_BEHIND: GameActivitySetWindowFlags = 4; -#[doc = " This window won't ever get key input focus, so the"] -#[doc = " user can not send key or other button events to it. Those will"] -#[doc = " instead go to whatever focusable window is behind it. This flag"] -#[doc = " will also enable {@link GAMEACTIVITY_FLAG_NOT_TOUCH_MODAL} whether or not"] -#[doc = " that is explicitly set."] -#[doc = ""] -#[doc = " Setting this flag also implies that the window will not need to"] -#[doc = " interact with"] -#[doc = " a soft input method, so it will be Z-ordered and positioned"] -#[doc = " independently of any active input method (typically this means it"] -#[doc = " gets Z-ordered on top of the input method, so it can use the full"] -#[doc = " screen for its content and cover the input method if needed. You"] -#[doc = " can use {@link GAMEACTIVITY_FLAG_ALT_FOCUSABLE_IM} to modify this"] -#[doc = " behavior."] +#[doc = " This window won't ever get key input focus, so the\n user can not send key or other button events to it. Those will\n instead go to whatever focusable window is behind it. This flag\n will also enable {@link GAMEACTIVITY_FLAG_NOT_TOUCH_MODAL} whether or not\n that is explicitly set.\n\n Setting this flag also implies that the window will not need to\n interact with\n a soft input method, so it will be Z-ordered and positioned\n independently of any active input method (typically this means it\n gets Z-ordered on top of the input method, so it can use the full\n screen for its content and cover the input method if needed. You\n can use {@link GAMEACTIVITY_FLAG_ALT_FOCUSABLE_IM} to modify this\n behavior."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_NOT_FOCUSABLE: GameActivitySetWindowFlags = 8; #[doc = " This window can never receive touch events."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_NOT_TOUCHABLE: GameActivitySetWindowFlags = 16; -#[doc = " Even when this window is focusable (its"] -#[doc = " {@link GAMEACTIVITY_FLAG_NOT_FOCUSABLE} is not set), allow any pointer"] -#[doc = " events outside of the window to be sent to the windows behind it."] -#[doc = " Otherwise it will consume all pointer events itself, regardless of"] -#[doc = " whether they are inside of the window."] +#[doc = " Even when this window is focusable (its\n {@link GAMEACTIVITY_FLAG_NOT_FOCUSABLE} is not set), allow any pointer\n events outside of the window to be sent to the windows behind it.\n Otherwise it will consume all pointer events itself, regardless of\n whether they are inside of the window."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_NOT_TOUCH_MODAL: GameActivitySetWindowFlags = 32; -#[doc = " When set, if the device is asleep when the touch"] -#[doc = " screen is pressed, you will receive this first touch event. Usually"] -#[doc = " the first touch event is consumed by the system since the user can"] -#[doc = " not see what they are pressing on."] -#[doc = ""] -#[doc = " @deprecated This flag has no effect."] +#[doc = " When set, if the device is asleep when the touch\n screen is pressed, you will receive this first touch event. Usually\n the first touch event is consumed by the system since the user can\n not see what they are pressing on.\n\n @deprecated This flag has no effect."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_TOUCHABLE_WHEN_WAKING: GameActivitySetWindowFlags = 64; -#[doc = " As long as this window is visible to the user, keep"] -#[doc = " the device's screen turned on and bright."] +#[doc = " As long as this window is visible to the user, keep\n the device's screen turned on and bright."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_KEEP_SCREEN_ON: GameActivitySetWindowFlags = 128; -#[doc = " Place the window within the entire screen, ignoring"] -#[doc = " decorations around the border (such as the status bar). The"] -#[doc = " window must correctly position its contents to take the screen"] -#[doc = " decoration into account."] +#[doc = " Place the window within the entire screen, ignoring\n decorations around the border (such as the status bar). The\n window must correctly position its contents to take the screen\n decoration into account."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_LAYOUT_IN_SCREEN: GameActivitySetWindowFlags = 256; #[doc = " Allows the window to extend outside of the screen."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_LAYOUT_NO_LIMITS: GameActivitySetWindowFlags = 512; -#[doc = " Hide all screen decorations (such as the status"] -#[doc = " bar) while this window is displayed. This allows the window to"] -#[doc = " use the entire display space for itself -- the status bar will"] -#[doc = " be hidden when an app window with this flag set is on the top"] -#[doc = " layer. A fullscreen window will ignore a value of {@link"] -#[doc = " GAMEACTIVITY_SOFT_INPUT_ADJUST_RESIZE}; the window will stay"] -#[doc = " fullscreen and will not resize."] +#[doc = " Hide all screen decorations (such as the status\n bar) while this window is displayed. This allows the window to\n use the entire display space for itself -- the status bar will\n be hidden when an app window with this flag set is on the top\n layer. A fullscreen window will ignore a value of {@link\n GAMEACTIVITY_SOFT_INPUT_ADJUST_RESIZE}; the window will stay\n fullscreen and will not resize."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_FULLSCREEN: GameActivitySetWindowFlags = 1024; -#[doc = " Override {@link GAMEACTIVITY_FLAG_FULLSCREEN} and force the"] -#[doc = " screen decorations (such as the status bar) to be shown."] +#[doc = " Override {@link GAMEACTIVITY_FLAG_FULLSCREEN} and force the\n screen decorations (such as the status bar) to be shown."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_FORCE_NOT_FULLSCREEN: GameActivitySetWindowFlags = 2048; -#[doc = " Turn on dithering when compositing this window to"] -#[doc = " the screen."] -#[doc = " @deprecated This flag is no longer used."] +#[doc = " Turn on dithering when compositing this window to\n the screen.\n @deprecated This flag is no longer used."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_DITHER: GameActivitySetWindowFlags = 4096; -#[doc = " Treat the content of the window as secure, preventing"] -#[doc = " it from appearing in screenshots or from being viewed on non-secure"] -#[doc = " displays."] +#[doc = " Treat the content of the window as secure, preventing\n it from appearing in screenshots or from being viewed on non-secure\n displays."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_SECURE: GameActivitySetWindowFlags = 8192; -#[doc = " A special mode where the layout parameters are used"] -#[doc = " to perform scaling of the surface when it is composited to the"] -#[doc = " screen."] +#[doc = " A special mode where the layout parameters are used\n to perform scaling of the surface when it is composited to the\n screen."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_SCALED: GameActivitySetWindowFlags = 16384; -#[doc = " Intended for windows that will often be used when the user is"] -#[doc = " holding the screen against their face, it will aggressively"] -#[doc = " filter the event stream to prevent unintended presses in this"] -#[doc = " situation that may not be desired for a particular window, when"] -#[doc = " such an event stream is detected, the application will receive"] -#[doc = " a {@link AMOTION_EVENT_ACTION_CANCEL} to indicate this so"] -#[doc = " applications can handle this accordingly by taking no action on"] -#[doc = " the event until the finger is released."] +#[doc = " Intended for windows that will often be used when the user is\n holding the screen against their face, it will aggressively\n filter the event stream to prevent unintended presses in this\n situation that may not be desired for a particular window, when\n such an event stream is detected, the application will receive\n a {@link AMOTION_EVENT_ACTION_CANCEL} to indicate this so\n applications can handle this accordingly by taking no action on\n the event until the finger is released."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_IGNORE_CHEEK_PRESSES: GameActivitySetWindowFlags = 32768; -#[doc = " A special option only for use in combination with"] -#[doc = " {@link GAMEACTIVITY_FLAG_LAYOUT_IN_SCREEN}. When requesting layout in"] -#[doc = " the screen your window may appear on top of or behind screen decorations"] -#[doc = " such as the status bar. By also including this flag, the window"] -#[doc = " manager will report the inset rectangle needed to ensure your"] -#[doc = " content is not covered by screen decorations."] +#[doc = " A special option only for use in combination with\n {@link GAMEACTIVITY_FLAG_LAYOUT_IN_SCREEN}. When requesting layout in\n the screen your window may appear on top of or behind screen decorations\n such as the status bar. By also including this flag, the window\n manager will report the inset rectangle needed to ensure your\n content is not covered by screen decorations."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_LAYOUT_INSET_DECOR: GameActivitySetWindowFlags = 65536; -#[doc = " Invert the state of {@link GAMEACTIVITY_FLAG_NOT_FOCUSABLE} with"] -#[doc = " respect to how this window interacts with the current method."] -#[doc = " That is, if FLAG_NOT_FOCUSABLE is set and this flag is set,"] -#[doc = " then the window will behave as if it needs to interact with the"] -#[doc = " input method and thus be placed behind/away from it; if {@link"] -#[doc = " GAMEACTIVITY_FLAG_NOT_FOCUSABLE} is not set and this flag is set,"] -#[doc = " then the window will behave as if it doesn't need to interact"] -#[doc = " with the input method and can be placed to use more space and"] -#[doc = " cover the input method."] +#[doc = " Invert the state of {@link GAMEACTIVITY_FLAG_NOT_FOCUSABLE} with\n respect to how this window interacts with the current method.\n That is, if FLAG_NOT_FOCUSABLE is set and this flag is set,\n then the window will behave as if it needs to interact with the\n input method and thus be placed behind/away from it; if {@link\n GAMEACTIVITY_FLAG_NOT_FOCUSABLE} is not set and this flag is set,\n then the window will behave as if it doesn't need to interact\n with the input method and can be placed to use more space and\n cover the input method."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_ALT_FOCUSABLE_IM: GameActivitySetWindowFlags = 131072; -#[doc = " If you have set {@link GAMEACTIVITY_FLAG_NOT_TOUCH_MODAL}, you"] -#[doc = " can set this flag to receive a single special MotionEvent with"] -#[doc = " the action"] -#[doc = " {@link AMOTION_EVENT_ACTION_OUTSIDE} for"] -#[doc = " touches that occur outside of your window. Note that you will not"] -#[doc = " receive the full down/move/up gesture, only the location of the"] -#[doc = " first down as an {@link AMOTION_EVENT_ACTION_OUTSIDE}."] +#[doc = " If you have set {@link GAMEACTIVITY_FLAG_NOT_TOUCH_MODAL}, you\n can set this flag to receive a single special MotionEvent with\n the action\n {@link AMOTION_EVENT_ACTION_OUTSIDE} for\n touches that occur outside of your window. Note that you will not\n receive the full down/move/up gesture, only the location of the\n first down as an {@link AMOTION_EVENT_ACTION_OUTSIDE}."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_WATCH_OUTSIDE_TOUCH: GameActivitySetWindowFlags = 262144; -#[doc = " Special flag to let windows be shown when the screen"] -#[doc = " is locked. This will let application windows take precedence over"] -#[doc = " key guard or any other lock screens. Can be used with"] -#[doc = " {@link GAMEACTIVITY_FLAG_KEEP_SCREEN_ON} to turn screen on and display"] -#[doc = " windows directly before showing the key guard window. Can be used with"] -#[doc = " {@link GAMEACTIVITY_FLAG_DISMISS_KEYGUARD} to automatically fully"] -#[doc = " dismisss non-secure keyguards. This flag only applies to the top-most"] -#[doc = " full-screen window."] +#[doc = " Special flag to let windows be shown when the screen\n is locked. This will let application windows take precedence over\n key guard or any other lock screens. Can be used with\n {@link GAMEACTIVITY_FLAG_KEEP_SCREEN_ON} to turn screen on and display\n windows directly before showing the key guard window. Can be used with\n {@link GAMEACTIVITY_FLAG_DISMISS_KEYGUARD} to automatically fully\n dismisss non-secure keyguards. This flag only applies to the top-most\n full-screen window."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED: GameActivitySetWindowFlags = 524288; -#[doc = " Ask that the system wallpaper be shown behind"] -#[doc = " your window. The window surface must be translucent to be able"] -#[doc = " to actually see the wallpaper behind it; this flag just ensures"] -#[doc = " that the wallpaper surface will be there if this window actually"] -#[doc = " has translucent regions."] +#[doc = " Ask that the system wallpaper be shown behind\n your window. The window surface must be translucent to be able\n to actually see the wallpaper behind it; this flag just ensures\n that the wallpaper surface will be there if this window actually\n has translucent regions."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_SHOW_WALLPAPER: GameActivitySetWindowFlags = 1048576; -#[doc = " When set as a window is being added or made"] -#[doc = " visible, once the window has been shown then the system will"] -#[doc = " poke the power manager's user activity (as if the user had woken"] -#[doc = " up the device) to turn the screen on."] +#[doc = " When set as a window is being added or made\n visible, once the window has been shown then the system will\n poke the power manager's user activity (as if the user had woken\n up the device) to turn the screen on."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_TURN_SCREEN_ON: GameActivitySetWindowFlags = 2097152; -#[doc = " When set the window will cause the keyguard to"] -#[doc = " be dismissed, only if it is not a secure lock keyguard. Because such"] -#[doc = " a keyguard is not needed for security, it will never re-appear if"] -#[doc = " the user navigates to another window (in contrast to"] -#[doc = " {@link GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED}, which will only temporarily"] -#[doc = " hide both secure and non-secure keyguards but ensure they reappear"] -#[doc = " when the user moves to another UI that doesn't hide them)."] -#[doc = " If the keyguard is currently active and is secure (requires an"] -#[doc = " unlock pattern) than the user will still need to confirm it before"] -#[doc = " seeing this window, unless {@link GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED} has"] -#[doc = " also been set."] +#[doc = " When set the window will cause the keyguard to\n be dismissed, only if it is not a secure lock keyguard. Because such\n a keyguard is not needed for security, it will never re-appear if\n the user navigates to another window (in contrast to\n {@link GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED}, which will only temporarily\n hide both secure and non-secure keyguards but ensure they reappear\n when the user moves to another UI that doesn't hide them).\n If the keyguard is currently active and is secure (requires an\n unlock pattern) than the user will still need to confirm it before\n seeing this window, unless {@link GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED} has\n also been set."] pub const GameActivitySetWindowFlags_GAMEACTIVITY_FLAG_DISMISS_KEYGUARD: GameActivitySetWindowFlags = 4194304; -#[doc = " Flags for GameActivity_setWindowFlags,"] -#[doc = " as per the Java API at android.view.WindowManager.LayoutParams."] -pub type GameActivitySetWindowFlags = ::std::os::raw::c_uint; -extern "C" { - #[doc = " Change the window flags of the given activity. Calls getWindow().setFlags()"] - #[doc = " of the given activity."] - #[doc = " Note that some flags must be set before the window decoration is created,"] - #[doc = " see"] - #[doc = " https://developer.android.com/reference/android/view/Window#setFlags(int,%20int)."] - #[doc = " Note also that this method can be called from"] - #[doc = " *any* thread; it will send a message to the main thread of the process"] - #[doc = " where the Java finish call will take place."] +#[doc = " Flags for GameActivity_setWindowFlags,\n as per the Java API at android.view.WindowManager.LayoutParams."] +pub type GameActivitySetWindowFlags = u32; +extern "C" { + #[doc = " Change the window flags of the given activity. Calls getWindow().setFlags()\n of the given activity.\n Note that some flags must be set before the window decoration is created,\n see\n https://developer.android.com/reference/android/view/Window#setFlags(int,%20int).\n Note also that this method can be called from\n *any* thread; it will send a message to the main thread of the process\n where the Java finish call will take place."] pub fn GameActivity_setWindowFlags( activity: *mut GameActivity, addFlags: u32, removeFlags: u32, ); } -#[doc = " Implicit request to show the input window, not as the result"] -#[doc = " of a direct request by the user."] +#[doc = " Implicit request to show the input window, not as the result\n of a direct request by the user."] pub const GameActivityShowSoftInputFlags_GAMEACTIVITY_SHOW_SOFT_INPUT_IMPLICIT: GameActivityShowSoftInputFlags = 1; -#[doc = " The user has forced the input method open (such as by"] -#[doc = " long-pressing menu) so it should not be closed until they"] -#[doc = " explicitly do so."] +#[doc = " The user has forced the input method open (such as by\n long-pressing menu) so it should not be closed until they\n explicitly do so."] pub const GameActivityShowSoftInputFlags_GAMEACTIVITY_SHOW_SOFT_INPUT_FORCED: GameActivityShowSoftInputFlags = 2; -#[doc = " Flags for GameActivity_showSoftInput; see the Java InputMethodManager"] -#[doc = " API for documentation."] -pub type GameActivityShowSoftInputFlags = ::std::os::raw::c_uint; -extern "C" { - #[doc = " Show the IME while in the given activity. Calls"] - #[doc = " InputMethodManager.showSoftInput() for the given activity. Note that this"] - #[doc = " method can be called from *any* thread; it will send a message to the main"] - #[doc = " thread of the process where the Java call will take place."] +#[doc = " Flags for GameActivity_showSoftInput; see the Java InputMethodManager\n API for documentation."] +pub type GameActivityShowSoftInputFlags = u8; +extern "C" { + #[doc = " Show the IME while in the given activity. Calls\n InputMethodManager.showSoftInput() for the given activity. Note that this\n method can be called from *any* thread; it will send a message to the main\n thread of the process where the Java call will take place."] pub fn GameActivity_showSoftInput(activity: *mut GameActivity, flags: u32); } extern "C" { - #[doc = " Set the text entry state (see documentation of the GameTextInputState struct"] - #[doc = " in the Game Text Input library reference)."] - #[doc = ""] - #[doc = " Ownership of the state is maintained by the caller."] + #[doc = " Restarts the input method. Calls InputMethodManager.restartInput().\n Note that this method can be called from *any* thread; it will send a message\n to the main thread of the process where the Java call will take place."] + pub fn GameActivity_restartInput(activity: *mut GameActivity); +} +extern "C" { + #[doc = " Set the text entry state (see documentation of the GameTextInputState struct\n in the Game Text Input library reference).\n\n Ownership of the state is maintained by the caller."] pub fn GameActivity_setTextInputState( activity: *mut GameActivity, state: *const GameTextInputState, ); } extern "C" { - #[doc = " Get the last-received text entry state (see documentation of the"] - #[doc = " GameTextInputState struct in the Game Text Input library reference)."] - #[doc = ""] + #[doc = " Get the last-received text entry state (see documentation of the\n GameTextInputState struct in the Game Text Input library reference).\n"] pub fn GameActivity_getTextInputState( activity: *mut GameActivity, callback: GameTextInputGetStateCallback, @@ -3854,29 +3318,20 @@ extern "C" { #[doc = " Get a pointer to the GameTextInput library instance."] pub fn GameActivity_getTextInput(activity: *const GameActivity) -> *mut GameTextInput; } -#[doc = " The soft input window should only be hidden if it was not"] -#[doc = " explicitly shown by the user."] +#[doc = " The soft input window should only be hidden if it was not\n explicitly shown by the user."] pub const GameActivityHideSoftInputFlags_GAMEACTIVITY_HIDE_SOFT_INPUT_IMPLICIT_ONLY: GameActivityHideSoftInputFlags = 1; -#[doc = " The soft input window should normally be hidden, unless it was"] -#[doc = " originally shown with {@link GAMEACTIVITY_SHOW_SOFT_INPUT_FORCED}."] +#[doc = " The soft input window should normally be hidden, unless it was\n originally shown with {@link GAMEACTIVITY_SHOW_SOFT_INPUT_FORCED}."] pub const GameActivityHideSoftInputFlags_GAMEACTIVITY_HIDE_SOFT_INPUT_NOT_ALWAYS: GameActivityHideSoftInputFlags = 2; -#[doc = " Flags for GameActivity_hideSoftInput; see the Java InputMethodManager"] -#[doc = " API for documentation."] -pub type GameActivityHideSoftInputFlags = ::std::os::raw::c_uint; -extern "C" { - #[doc = " Hide the IME while in the given activity. Calls"] - #[doc = " InputMethodManager.hideSoftInput() for the given activity. Note that this"] - #[doc = " method can be called from *any* thread; it will send a message to the main"] - #[doc = " thread of the process where the Java finish call will take place."] +#[doc = " Flags for GameActivity_hideSoftInput; see the Java InputMethodManager\n API for documentation."] +pub type GameActivityHideSoftInputFlags = u16; +extern "C" { + #[doc = " Hide the IME while in the given activity. Calls\n InputMethodManager.hideSoftInput() for the given activity. Note that this\n method can be called from *any* thread; it will send a message to the main\n thread of the process where the Java finish call will take place."] pub fn GameActivity_hideSoftInput(activity: *mut GameActivity, flags: u32); } extern "C" { - #[doc = " Get the current window insets of the particular component. See"] - #[doc = " https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat.Type"] - #[doc = " for more details."] - #[doc = " You can use these insets to influence what you show on the screen."] + #[doc = " Get the current window insets of the particular component. See\n https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat.Type\n for more details.\n You can use these insets to influence what you show on the screen."] pub fn GameActivity_getWindowInsets( activity: *mut GameActivity, type_: GameCommonInsetsType, @@ -3884,107 +3339,200 @@ extern "C" { ); } extern "C" { - #[doc = " Set options on how the IME behaves when it is requested for text input."] - #[doc = " See"] - #[doc = " https://developer.android.com/reference/android/view/inputmethod/EditorInfo"] - #[doc = " for the meaning of inputType, actionId and imeOptions."] - #[doc = ""] - #[doc = " Note that this function will attach the current thread to the JVM if it is"] - #[doc = " not already attached, so the caller must detach the thread from the JVM"] - #[doc = " before the thread is destroyed using DetachCurrentThread."] + #[doc = " Tells whether the software keyboard is visible or not."] + pub fn GameActivity_isSoftwareKeyboardVisible(activity: *mut GameActivity) -> bool; +} +extern "C" { + #[doc = " Set options on how the IME behaves when it is requested for text input.\n See\n https://developer.android.com/reference/android/view/inputmethod/EditorInfo\n for the meaning of inputType, actionId and imeOptions.\n\n Note: currently only TYPE_NULL AND TYPE_CLASS_NUMBER are supported."] pub fn GameActivity_setImeEditorInfo( activity: *mut GameActivity, - inputType: ::std::os::raw::c_int, - actionId: ::std::os::raw::c_int, - imeOptions: ::std::os::raw::c_int, - ); -} -pub const ACONFIGURATION_ORIENTATION_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_ORIENTATION_PORT: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_ORIENTATION_LAND: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_ORIENTATION_SQUARE: ::std::os::raw::c_uint = 3; -pub const ACONFIGURATION_TOUCHSCREEN_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_TOUCHSCREEN_NOTOUCH: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_TOUCHSCREEN_STYLUS: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_TOUCHSCREEN_FINGER: ::std::os::raw::c_uint = 3; -pub const ACONFIGURATION_DENSITY_DEFAULT: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_DENSITY_LOW: ::std::os::raw::c_uint = 120; -pub const ACONFIGURATION_DENSITY_MEDIUM: ::std::os::raw::c_uint = 160; -pub const ACONFIGURATION_DENSITY_TV: ::std::os::raw::c_uint = 213; -pub const ACONFIGURATION_DENSITY_HIGH: ::std::os::raw::c_uint = 240; -pub const ACONFIGURATION_DENSITY_XHIGH: ::std::os::raw::c_uint = 320; -pub const ACONFIGURATION_DENSITY_XXHIGH: ::std::os::raw::c_uint = 480; -pub const ACONFIGURATION_DENSITY_XXXHIGH: ::std::os::raw::c_uint = 640; -pub const ACONFIGURATION_DENSITY_ANY: ::std::os::raw::c_uint = 65534; -pub const ACONFIGURATION_DENSITY_NONE: ::std::os::raw::c_uint = 65535; -pub const ACONFIGURATION_KEYBOARD_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_KEYBOARD_NOKEYS: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_KEYBOARD_QWERTY: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_KEYBOARD_12KEY: ::std::os::raw::c_uint = 3; -pub const ACONFIGURATION_NAVIGATION_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_NAVIGATION_NONAV: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_NAVIGATION_DPAD: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_NAVIGATION_TRACKBALL: ::std::os::raw::c_uint = 3; -pub const ACONFIGURATION_NAVIGATION_WHEEL: ::std::os::raw::c_uint = 4; -pub const ACONFIGURATION_KEYSHIDDEN_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_KEYSHIDDEN_NO: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_KEYSHIDDEN_YES: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_KEYSHIDDEN_SOFT: ::std::os::raw::c_uint = 3; -pub const ACONFIGURATION_NAVHIDDEN_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_NAVHIDDEN_NO: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_NAVHIDDEN_YES: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_SCREENSIZE_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_SCREENSIZE_SMALL: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_SCREENSIZE_NORMAL: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_SCREENSIZE_LARGE: ::std::os::raw::c_uint = 3; -pub const ACONFIGURATION_SCREENSIZE_XLARGE: ::std::os::raw::c_uint = 4; -pub const ACONFIGURATION_SCREENLONG_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_SCREENLONG_NO: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_SCREENLONG_YES: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_SCREENROUND_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_SCREENROUND_NO: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_SCREENROUND_YES: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_WIDE_COLOR_GAMUT_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_WIDE_COLOR_GAMUT_NO: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_WIDE_COLOR_GAMUT_YES: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_HDR_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_HDR_NO: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_HDR_YES: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_UI_MODE_TYPE_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_UI_MODE_TYPE_NORMAL: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_UI_MODE_TYPE_DESK: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_UI_MODE_TYPE_CAR: ::std::os::raw::c_uint = 3; -pub const ACONFIGURATION_UI_MODE_TYPE_TELEVISION: ::std::os::raw::c_uint = 4; -pub const ACONFIGURATION_UI_MODE_TYPE_APPLIANCE: ::std::os::raw::c_uint = 5; -pub const ACONFIGURATION_UI_MODE_TYPE_WATCH: ::std::os::raw::c_uint = 6; -pub const ACONFIGURATION_UI_MODE_TYPE_VR_HEADSET: ::std::os::raw::c_uint = 7; -pub const ACONFIGURATION_UI_MODE_NIGHT_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_UI_MODE_NIGHT_NO: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_UI_MODE_NIGHT_YES: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_SCREEN_WIDTH_DP_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_SCREEN_HEIGHT_DP_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_LAYOUTDIR_ANY: ::std::os::raw::c_uint = 0; -pub const ACONFIGURATION_LAYOUTDIR_LTR: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_LAYOUTDIR_RTL: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_MCC: ::std::os::raw::c_uint = 1; -pub const ACONFIGURATION_MNC: ::std::os::raw::c_uint = 2; -pub const ACONFIGURATION_LOCALE: ::std::os::raw::c_uint = 4; -pub const ACONFIGURATION_TOUCHSCREEN: ::std::os::raw::c_uint = 8; -pub const ACONFIGURATION_KEYBOARD: ::std::os::raw::c_uint = 16; -pub const ACONFIGURATION_KEYBOARD_HIDDEN: ::std::os::raw::c_uint = 32; -pub const ACONFIGURATION_NAVIGATION: ::std::os::raw::c_uint = 64; -pub const ACONFIGURATION_ORIENTATION: ::std::os::raw::c_uint = 128; -pub const ACONFIGURATION_DENSITY: ::std::os::raw::c_uint = 256; -pub const ACONFIGURATION_SCREEN_SIZE: ::std::os::raw::c_uint = 512; -pub const ACONFIGURATION_VERSION: ::std::os::raw::c_uint = 1024; -pub const ACONFIGURATION_SCREEN_LAYOUT: ::std::os::raw::c_uint = 2048; -pub const ACONFIGURATION_UI_MODE: ::std::os::raw::c_uint = 4096; -pub const ACONFIGURATION_SMALLEST_SCREEN_SIZE: ::std::os::raw::c_uint = 8192; -pub const ACONFIGURATION_LAYOUTDIR: ::std::os::raw::c_uint = 16384; -pub const ACONFIGURATION_SCREEN_ROUND: ::std::os::raw::c_uint = 32768; -pub const ACONFIGURATION_COLOR_MODE: ::std::os::raw::c_uint = 65536; -pub const ACONFIGURATION_MNC_ZERO: ::std::os::raw::c_uint = 65535; + inputType: GameTextInputType, + actionId: GameTextInputActionType, + imeOptions: GameTextInputImeOptions, + ); +} +extern "C" { + #[doc = " These are getters for Configuration class members. They may be called from\n any thread."] + pub fn GameActivity_getOrientation(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getColorMode(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getDensityDpi(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getFontScale(activity: *mut GameActivity) -> f32; +} +extern "C" { + pub fn GameActivity_getFontWeightAdjustment( + activity: *mut GameActivity, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getHardKeyboardHidden(activity: *mut GameActivity) + -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getKeyboard(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getKeyboardHidden(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getLocalesCount(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getMcc(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getMnc(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getNavigation(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getNavigationHidden(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getScreenHeightDp(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getScreenLayout(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getScreenWidthDp(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getSmallestScreenWidthDp( + activity: *mut GameActivity, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getTouchscreen(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getUIMode(activity: *mut GameActivity) -> ::std::os::raw::c_int; +} +extern "C" { + #[doc = " The functions below return Java locale information.\n\n In simple cases there will be just one locale, but it's possible tha\n there are more than one locale objects. Users are encouraged to write code\n that handles all locales and not just the first one.\n\n The functions in the block below return string values in the provided buffer.\n Return value is zero if there were no errors, otherwise it's non-zero.\n If the return value is zero, `dst` will contain a null-terminated string:\n strlen(dst) <= dst_size - 1.\n If the return value is non-zero, the content of dst is undefined.\n\n Parameters:\n\n dst, dst_size: define a receiver buffer. Locale string can be something\n short like \"EN/EN\", but it may be longer. You should be safe with a buffer\n size of 256 bytes.\n\n If the buffer is too small, ENOBUFS is returned. Try allocating a larger\n buffer in this case.\n\n localeIdx must be between 0 and the value of GameActivity_getLocalesCount().\n If localeIdx is out of range, EINVAL is returned.\n\n Refer to Java documentation of locales for more information."] + pub fn GameActivity_getLocaleLanguage( + dst: *mut ::std::os::raw::c_char, + dst_size: usize, + activity: *mut GameActivity, + localeIdx: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getLocaleScript( + dst: *mut ::std::os::raw::c_char, + dst_size: usize, + activity: *mut GameActivity, + localeIdx: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getLocaleCountry( + dst: *mut ::std::os::raw::c_char, + dst_size: usize, + activity: *mut GameActivity, + localeIdx: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn GameActivity_getLocaleVariant( + dst: *mut ::std::os::raw::c_char, + dst_size: usize, + activity: *mut GameActivity, + localeIdx: usize, + ) -> ::std::os::raw::c_int; +} +pub const ACONFIGURATION_ORIENTATION_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_ORIENTATION_PORT: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_ORIENTATION_LAND: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_ORIENTATION_SQUARE: _bindgen_ty_21 = 3; +pub const ACONFIGURATION_TOUCHSCREEN_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_TOUCHSCREEN_NOTOUCH: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_TOUCHSCREEN_STYLUS: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_TOUCHSCREEN_FINGER: _bindgen_ty_21 = 3; +pub const ACONFIGURATION_DENSITY_DEFAULT: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_DENSITY_LOW: _bindgen_ty_21 = 120; +pub const ACONFIGURATION_DENSITY_MEDIUM: _bindgen_ty_21 = 160; +pub const ACONFIGURATION_DENSITY_TV: _bindgen_ty_21 = 213; +pub const ACONFIGURATION_DENSITY_HIGH: _bindgen_ty_21 = 240; +pub const ACONFIGURATION_DENSITY_XHIGH: _bindgen_ty_21 = 320; +pub const ACONFIGURATION_DENSITY_XXHIGH: _bindgen_ty_21 = 480; +pub const ACONFIGURATION_DENSITY_XXXHIGH: _bindgen_ty_21 = 640; +pub const ACONFIGURATION_DENSITY_ANY: _bindgen_ty_21 = 65534; +pub const ACONFIGURATION_DENSITY_NONE: _bindgen_ty_21 = 65535; +pub const ACONFIGURATION_KEYBOARD_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_KEYBOARD_NOKEYS: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_KEYBOARD_QWERTY: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_KEYBOARD_12KEY: _bindgen_ty_21 = 3; +pub const ACONFIGURATION_NAVIGATION_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_NAVIGATION_NONAV: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_NAVIGATION_DPAD: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_NAVIGATION_TRACKBALL: _bindgen_ty_21 = 3; +pub const ACONFIGURATION_NAVIGATION_WHEEL: _bindgen_ty_21 = 4; +pub const ACONFIGURATION_KEYSHIDDEN_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_KEYSHIDDEN_NO: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_KEYSHIDDEN_YES: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_KEYSHIDDEN_SOFT: _bindgen_ty_21 = 3; +pub const ACONFIGURATION_NAVHIDDEN_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_NAVHIDDEN_NO: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_NAVHIDDEN_YES: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_SCREENSIZE_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_SCREENSIZE_SMALL: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_SCREENSIZE_NORMAL: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_SCREENSIZE_LARGE: _bindgen_ty_21 = 3; +pub const ACONFIGURATION_SCREENSIZE_XLARGE: _bindgen_ty_21 = 4; +pub const ACONFIGURATION_SCREENLONG_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_SCREENLONG_NO: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_SCREENLONG_YES: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_SCREENROUND_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_SCREENROUND_NO: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_SCREENROUND_YES: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_WIDE_COLOR_GAMUT_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_WIDE_COLOR_GAMUT_NO: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_WIDE_COLOR_GAMUT_YES: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_HDR_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_HDR_NO: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_HDR_YES: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_UI_MODE_TYPE_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_UI_MODE_TYPE_NORMAL: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_UI_MODE_TYPE_DESK: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_UI_MODE_TYPE_CAR: _bindgen_ty_21 = 3; +pub const ACONFIGURATION_UI_MODE_TYPE_TELEVISION: _bindgen_ty_21 = 4; +pub const ACONFIGURATION_UI_MODE_TYPE_APPLIANCE: _bindgen_ty_21 = 5; +pub const ACONFIGURATION_UI_MODE_TYPE_WATCH: _bindgen_ty_21 = 6; +pub const ACONFIGURATION_UI_MODE_TYPE_VR_HEADSET: _bindgen_ty_21 = 7; +pub const ACONFIGURATION_UI_MODE_NIGHT_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_UI_MODE_NIGHT_NO: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_UI_MODE_NIGHT_YES: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_SCREEN_WIDTH_DP_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_SCREEN_HEIGHT_DP_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_LAYOUTDIR_ANY: _bindgen_ty_21 = 0; +pub const ACONFIGURATION_LAYOUTDIR_LTR: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_LAYOUTDIR_RTL: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_MCC: _bindgen_ty_21 = 1; +pub const ACONFIGURATION_MNC: _bindgen_ty_21 = 2; +pub const ACONFIGURATION_LOCALE: _bindgen_ty_21 = 4; +pub const ACONFIGURATION_TOUCHSCREEN: _bindgen_ty_21 = 8; +pub const ACONFIGURATION_KEYBOARD: _bindgen_ty_21 = 16; +pub const ACONFIGURATION_KEYBOARD_HIDDEN: _bindgen_ty_21 = 32; +pub const ACONFIGURATION_NAVIGATION: _bindgen_ty_21 = 64; +pub const ACONFIGURATION_ORIENTATION: _bindgen_ty_21 = 128; +pub const ACONFIGURATION_DENSITY: _bindgen_ty_21 = 256; +pub const ACONFIGURATION_SCREEN_SIZE: _bindgen_ty_21 = 512; +pub const ACONFIGURATION_VERSION: _bindgen_ty_21 = 1024; +pub const ACONFIGURATION_SCREEN_LAYOUT: _bindgen_ty_21 = 2048; +pub const ACONFIGURATION_UI_MODE: _bindgen_ty_21 = 4096; +pub const ACONFIGURATION_SMALLEST_SCREEN_SIZE: _bindgen_ty_21 = 8192; +pub const ACONFIGURATION_LAYOUTDIR: _bindgen_ty_21 = 16384; +pub const ACONFIGURATION_SCREEN_ROUND: _bindgen_ty_21 = 32768; +pub const ACONFIGURATION_COLOR_MODE: _bindgen_ty_21 = 65536; +pub const ACONFIGURATION_MNC_ZERO: _bindgen_ty_21 = 65535; pub type _bindgen_ty_21 = ::std::os::raw::c_uint; #[repr(C)] #[derive(Debug, Copy, Clone)] @@ -3995,45 +3543,28 @@ pub struct pollfd { } #[test] fn bindgen_test_layout_pollfd() { - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(pollfd)) - ); + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!(::std::mem::size_of::(), 8usize, "Size of pollfd"); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(pollfd)) + "Alignment of pollfd" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fd as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fd) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(pollfd), - "::", - stringify!(fd) - ) + "Offset of field: pollfd::fd" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).events as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).events) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(pollfd), - "::", - stringify!(events) - ) + "Offset of field: pollfd::events" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).revents as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).revents) as usize - ptr as usize }, 6usize, - concat!( - "Offset of field: ", - stringify!(pollfd), - "::", - stringify!(revents) - ) + "Offset of field: pollfd::revents" ); } #[repr(C)] @@ -4047,65 +3578,42 @@ pub struct _fpx_sw_bytes { } #[test] fn bindgen_test_layout__fpx_sw_bytes() { + const UNINIT: ::std::mem::MaybeUninit<_fpx_sw_bytes> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<_fpx_sw_bytes>(), 48usize, - concat!("Size of: ", stringify!(_fpx_sw_bytes)) + "Size of _fpx_sw_bytes" ); assert_eq!( ::std::mem::align_of::<_fpx_sw_bytes>(), 8usize, - concat!("Alignment of ", stringify!(_fpx_sw_bytes)) + "Alignment of _fpx_sw_bytes" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpx_sw_bytes>())).magic1 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).magic1) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_fpx_sw_bytes), - "::", - stringify!(magic1) - ) + "Offset of field: _fpx_sw_bytes::magic1" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpx_sw_bytes>())).extended_size as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).extended_size) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(_fpx_sw_bytes), - "::", - stringify!(extended_size) - ) + "Offset of field: _fpx_sw_bytes::extended_size" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpx_sw_bytes>())).xfeatures as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).xfeatures) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(_fpx_sw_bytes), - "::", - stringify!(xfeatures) - ) + "Offset of field: _fpx_sw_bytes::xfeatures" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpx_sw_bytes>())).xstate_size as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).xstate_size) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(_fpx_sw_bytes), - "::", - stringify!(xstate_size) - ) + "Offset of field: _fpx_sw_bytes::xstate_size" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpx_sw_bytes>())).padding as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).padding) as usize - ptr as usize }, 20usize, - concat!( - "Offset of field: ", - stringify!(_fpx_sw_bytes), - "::", - stringify!(padding) - ) + "Offset of field: _fpx_sw_bytes::padding" ); } #[repr(C)] @@ -4116,35 +3624,23 @@ pub struct _fpreg { } #[test] fn bindgen_test_layout__fpreg() { - assert_eq!( - ::std::mem::size_of::<_fpreg>(), - 10usize, - concat!("Size of: ", stringify!(_fpreg)) - ); + const UNINIT: ::std::mem::MaybeUninit<_fpreg> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!(::std::mem::size_of::<_fpreg>(), 10usize, "Size of _fpreg"); assert_eq!( ::std::mem::align_of::<_fpreg>(), 2usize, - concat!("Alignment of ", stringify!(_fpreg)) + "Alignment of _fpreg" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpreg>())).significand as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).significand) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_fpreg), - "::", - stringify!(significand) - ) + "Offset of field: _fpreg::significand" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpreg>())).exponent as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).exponent) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(_fpreg), - "::", - stringify!(exponent) - ) + "Offset of field: _fpreg::exponent" ); } #[repr(C)] @@ -4156,45 +3652,28 @@ pub struct _fpxreg { } #[test] fn bindgen_test_layout__fpxreg() { - assert_eq!( - ::std::mem::size_of::<_fpxreg>(), - 16usize, - concat!("Size of: ", stringify!(_fpxreg)) - ); + const UNINIT: ::std::mem::MaybeUninit<_fpxreg> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!(::std::mem::size_of::<_fpxreg>(), 16usize, "Size of _fpxreg"); assert_eq!( ::std::mem::align_of::<_fpxreg>(), 2usize, - concat!("Alignment of ", stringify!(_fpxreg)) + "Alignment of _fpxreg" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpxreg>())).significand as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).significand) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_fpxreg), - "::", - stringify!(significand) - ) + "Offset of field: _fpxreg::significand" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpxreg>())).exponent as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).exponent) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(_fpxreg), - "::", - stringify!(exponent) - ) + "Offset of field: _fpxreg::exponent" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpxreg>())).padding as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).padding) as usize - ptr as usize }, 10usize, - concat!( - "Offset of field: ", - stringify!(_fpxreg), - "::", - stringify!(padding) - ) + "Offset of field: _fpxreg::padding" ); } #[repr(C)] @@ -4204,25 +3683,18 @@ pub struct _xmmreg { } #[test] fn bindgen_test_layout__xmmreg() { - assert_eq!( - ::std::mem::size_of::<_xmmreg>(), - 16usize, - concat!("Size of: ", stringify!(_xmmreg)) - ); + const UNINIT: ::std::mem::MaybeUninit<_xmmreg> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!(::std::mem::size_of::<_xmmreg>(), 16usize, "Size of _xmmreg"); assert_eq!( ::std::mem::align_of::<_xmmreg>(), 4usize, - concat!("Alignment of ", stringify!(_xmmreg)) + "Alignment of _xmmreg" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_xmmreg>())).element as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).element) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_xmmreg), - "::", - stringify!(element) - ) + "Offset of field: _xmmreg::element" ); } #[repr(C)] @@ -4254,39 +3726,28 @@ pub union _fpstate_32__bindgen_ty_1 { } #[test] fn bindgen_test_layout__fpstate_32__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit<_fpstate_32__bindgen_ty_1> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<_fpstate_32__bindgen_ty_1>(), 176usize, - concat!("Size of: ", stringify!(_fpstate_32__bindgen_ty_1)) + "Size of _fpstate_32__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::<_fpstate_32__bindgen_ty_1>(), 4usize, - concat!("Alignment of ", stringify!(_fpstate_32__bindgen_ty_1)) + "Alignment of _fpstate_32__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<_fpstate_32__bindgen_ty_1>())).padding1 as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).padding1) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32__bindgen_ty_1), - "::", - stringify!(padding1) - ) + "Offset of field: _fpstate_32__bindgen_ty_1::padding1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<_fpstate_32__bindgen_ty_1>())).padding as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).padding) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32__bindgen_ty_1), - "::", - stringify!(padding) - ) + "Offset of field: _fpstate_32__bindgen_ty_1::padding" ); } #[repr(C)] @@ -4297,202 +3758,118 @@ pub union _fpstate_32__bindgen_ty_2 { } #[test] fn bindgen_test_layout__fpstate_32__bindgen_ty_2() { + const UNINIT: ::std::mem::MaybeUninit<_fpstate_32__bindgen_ty_2> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<_fpstate_32__bindgen_ty_2>(), 48usize, - concat!("Size of: ", stringify!(_fpstate_32__bindgen_ty_2)) + "Size of _fpstate_32__bindgen_ty_2" ); assert_eq!( ::std::mem::align_of::<_fpstate_32__bindgen_ty_2>(), 8usize, - concat!("Alignment of ", stringify!(_fpstate_32__bindgen_ty_2)) + "Alignment of _fpstate_32__bindgen_ty_2" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<_fpstate_32__bindgen_ty_2>())).padding2 as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).padding2) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32__bindgen_ty_2), - "::", - stringify!(padding2) - ) + "Offset of field: _fpstate_32__bindgen_ty_2::padding2" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<_fpstate_32__bindgen_ty_2>())).sw_reserved as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).sw_reserved) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32__bindgen_ty_2), - "::", - stringify!(sw_reserved) - ) + "Offset of field: _fpstate_32__bindgen_ty_2::sw_reserved" ); } #[test] fn bindgen_test_layout__fpstate_32() { + const UNINIT: ::std::mem::MaybeUninit<_fpstate_32> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<_fpstate_32>(), 624usize, - concat!("Size of: ", stringify!(_fpstate_32)) + "Size of _fpstate_32" ); assert_eq!( ::std::mem::align_of::<_fpstate_32>(), 8usize, - concat!("Alignment of ", stringify!(_fpstate_32)) + "Alignment of _fpstate_32" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_32>())).cw as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).cw) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32), - "::", - stringify!(cw) - ) + "Offset of field: _fpstate_32::cw" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_32>())).sw as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sw) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32), - "::", - stringify!(sw) - ) + "Offset of field: _fpstate_32::sw" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_32>())).tag as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tag) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32), - "::", - stringify!(tag) - ) + "Offset of field: _fpstate_32::tag" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_32>())).ipoff as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ipoff) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32), - "::", - stringify!(ipoff) - ) + "Offset of field: _fpstate_32::ipoff" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_32>())).cssel as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).cssel) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32), - "::", - stringify!(cssel) - ) + "Offset of field: _fpstate_32::cssel" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_32>())).dataoff as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).dataoff) as usize - ptr as usize }, 20usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32), - "::", - stringify!(dataoff) - ) + "Offset of field: _fpstate_32::dataoff" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_32>())).datasel as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).datasel) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32), - "::", - stringify!(datasel) - ) + "Offset of field: _fpstate_32::datasel" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_32>()))._st as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._st) as usize - ptr as usize }, 28usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32), - "::", - stringify!(_st) - ) + "Offset of field: _fpstate_32::_st" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_32>())).status as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).status) as usize - ptr as usize }, 108usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32), - "::", - stringify!(status) - ) + "Offset of field: _fpstate_32::status" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_32>())).magic as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).magic) as usize - ptr as usize }, 110usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32), - "::", - stringify!(magic) - ) + "Offset of field: _fpstate_32::magic" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_32>()))._fxsr_env as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._fxsr_env) as usize - ptr as usize }, 112usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32), - "::", - stringify!(_fxsr_env) - ) + "Offset of field: _fpstate_32::_fxsr_env" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_32>())).mxcsr as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).mxcsr) as usize - ptr as usize }, 136usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32), - "::", - stringify!(mxcsr) - ) + "Offset of field: _fpstate_32::mxcsr" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_32>())).reserved as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).reserved) as usize - ptr as usize }, 140usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32), - "::", - stringify!(reserved) - ) + "Offset of field: _fpstate_32::reserved" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_32>()))._fxsr_st as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._fxsr_st) as usize - ptr as usize }, 144usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32), - "::", - stringify!(_fxsr_st) - ) + "Offset of field: _fpstate_32::_fxsr_st" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_32>()))._xmm as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._xmm) as usize - ptr as usize }, 272usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_32), - "::", - stringify!(_xmm) - ) + "Offset of field: _fpstate_32::_xmm" ); } #[repr(C)] @@ -4519,162 +3896,98 @@ pub union _fpstate_64__bindgen_ty_1 { } #[test] fn bindgen_test_layout__fpstate_64__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit<_fpstate_64__bindgen_ty_1> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<_fpstate_64__bindgen_ty_1>(), 48usize, - concat!("Size of: ", stringify!(_fpstate_64__bindgen_ty_1)) + "Size of _fpstate_64__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::<_fpstate_64__bindgen_ty_1>(), 8usize, - concat!("Alignment of ", stringify!(_fpstate_64__bindgen_ty_1)) + "Alignment of _fpstate_64__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<_fpstate_64__bindgen_ty_1>())).reserved3 as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).reserved3) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_64__bindgen_ty_1), - "::", - stringify!(reserved3) - ) + "Offset of field: _fpstate_64__bindgen_ty_1::reserved3" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<_fpstate_64__bindgen_ty_1>())).sw_reserved as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).sw_reserved) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_64__bindgen_ty_1), - "::", - stringify!(sw_reserved) - ) + "Offset of field: _fpstate_64__bindgen_ty_1::sw_reserved" ); } #[test] fn bindgen_test_layout__fpstate_64() { + const UNINIT: ::std::mem::MaybeUninit<_fpstate_64> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<_fpstate_64>(), 512usize, - concat!("Size of: ", stringify!(_fpstate_64)) + "Size of _fpstate_64" ); assert_eq!( ::std::mem::align_of::<_fpstate_64>(), 8usize, - concat!("Alignment of ", stringify!(_fpstate_64)) + "Alignment of _fpstate_64" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_64>())).cwd as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).cwd) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_64), - "::", - stringify!(cwd) - ) + "Offset of field: _fpstate_64::cwd" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_64>())).swd as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).swd) as usize - ptr as usize }, 2usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_64), - "::", - stringify!(swd) - ) + "Offset of field: _fpstate_64::swd" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_64>())).twd as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).twd) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_64), - "::", - stringify!(twd) - ) + "Offset of field: _fpstate_64::twd" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_64>())).fop as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fop) as usize - ptr as usize }, 6usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_64), - "::", - stringify!(fop) - ) + "Offset of field: _fpstate_64::fop" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_64>())).rip as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rip) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_64), - "::", - stringify!(rip) - ) + "Offset of field: _fpstate_64::rip" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_64>())).rdp as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rdp) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_64), - "::", - stringify!(rdp) - ) + "Offset of field: _fpstate_64::rdp" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_64>())).mxcsr as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).mxcsr) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_64), - "::", - stringify!(mxcsr) - ) + "Offset of field: _fpstate_64::mxcsr" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_64>())).mxcsr_mask as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).mxcsr_mask) as usize - ptr as usize }, 28usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_64), - "::", - stringify!(mxcsr_mask) - ) + "Offset of field: _fpstate_64::mxcsr_mask" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_64>())).st_space as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).st_space) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_64), - "::", - stringify!(st_space) - ) + "Offset of field: _fpstate_64::st_space" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_64>())).xmm_space as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).xmm_space) as usize - ptr as usize }, 160usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_64), - "::", - stringify!(xmm_space) - ) + "Offset of field: _fpstate_64::xmm_space" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_fpstate_64>())).reserved2 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).reserved2) as usize - ptr as usize }, 416usize, - concat!( - "Offset of field: ", - stringify!(_fpstate_64), - "::", - stringify!(reserved2) - ) + "Offset of field: _fpstate_64::reserved2" ); } #[repr(C)] @@ -4686,45 +3999,28 @@ pub struct _header { } #[test] fn bindgen_test_layout__header() { - assert_eq!( - ::std::mem::size_of::<_header>(), - 64usize, - concat!("Size of: ", stringify!(_header)) - ); + const UNINIT: ::std::mem::MaybeUninit<_header> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!(::std::mem::size_of::<_header>(), 64usize, "Size of _header"); assert_eq!( ::std::mem::align_of::<_header>(), 8usize, - concat!("Alignment of ", stringify!(_header)) + "Alignment of _header" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_header>())).xfeatures as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).xfeatures) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_header), - "::", - stringify!(xfeatures) - ) + "Offset of field: _header::xfeatures" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_header>())).reserved1 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).reserved1) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(_header), - "::", - stringify!(reserved1) - ) + "Offset of field: _header::reserved1" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_header>())).reserved2 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).reserved2) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(_header), - "::", - stringify!(reserved2) - ) + "Offset of field: _header::reserved2" ); } #[repr(C)] @@ -4734,25 +4030,22 @@ pub struct _ymmh_state { } #[test] fn bindgen_test_layout__ymmh_state() { + const UNINIT: ::std::mem::MaybeUninit<_ymmh_state> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<_ymmh_state>(), 256usize, - concat!("Size of: ", stringify!(_ymmh_state)) + "Size of _ymmh_state" ); assert_eq!( ::std::mem::align_of::<_ymmh_state>(), 4usize, - concat!("Alignment of ", stringify!(_ymmh_state)) + "Alignment of _ymmh_state" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_ymmh_state>())).ymmh_space as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ymmh_space) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_ymmh_state), - "::", - stringify!(ymmh_space) - ) + "Offset of field: _ymmh_state::ymmh_space" ); } #[repr(C)] @@ -4764,45 +4057,32 @@ pub struct _xstate { } #[test] fn bindgen_test_layout__xstate() { + const UNINIT: ::std::mem::MaybeUninit<_xstate> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<_xstate>(), 832usize, - concat!("Size of: ", stringify!(_xstate)) + "Size of _xstate" ); assert_eq!( ::std::mem::align_of::<_xstate>(), 8usize, - concat!("Alignment of ", stringify!(_xstate)) + "Alignment of _xstate" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_xstate>())).fpstate as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fpstate) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_xstate), - "::", - stringify!(fpstate) - ) + "Offset of field: _xstate::fpstate" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_xstate>())).xstate_hdr as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).xstate_hdr) as usize - ptr as usize }, 512usize, - concat!( - "Offset of field: ", - stringify!(_xstate), - "::", - stringify!(xstate_hdr) - ) + "Offset of field: _xstate::xstate_hdr" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_xstate>())).ymmh as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ymmh) as usize - ptr as usize }, 576usize, - concat!( - "Offset of field: ", - stringify!(_xstate), - "::", - stringify!(ymmh) - ) + "Offset of field: _xstate::ymmh" ); } #[repr(C)] @@ -4839,295 +4119,157 @@ pub struct sigcontext_32 { } #[test] fn bindgen_test_layout_sigcontext_32() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 88usize, - concat!("Size of: ", stringify!(sigcontext_32)) + "Size of sigcontext_32" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(sigcontext_32)) + "Alignment of sigcontext_32" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).gs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).gs) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(gs) - ) + "Offset of field: sigcontext_32::gs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).__gsh as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).__gsh) as usize - ptr as usize }, 2usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(__gsh) - ) + "Offset of field: sigcontext_32::__gsh" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fs) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(fs) - ) + "Offset of field: sigcontext_32::fs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).__fsh as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).__fsh) as usize - ptr as usize }, 6usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(__fsh) - ) + "Offset of field: sigcontext_32::__fsh" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).es as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).es) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(es) - ) + "Offset of field: sigcontext_32::es" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).__esh as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).__esh) as usize - ptr as usize }, 10usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(__esh) - ) + "Offset of field: sigcontext_32::__esh" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ds as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ds) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(ds) - ) + "Offset of field: sigcontext_32::ds" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).__dsh as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).__dsh) as usize - ptr as usize }, 14usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(__dsh) - ) + "Offset of field: sigcontext_32::__dsh" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).di as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).di) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(di) - ) + "Offset of field: sigcontext_32::di" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).si as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).si) as usize - ptr as usize }, 20usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(si) - ) + "Offset of field: sigcontext_32::si" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).bp as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).bp) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(bp) - ) + "Offset of field: sigcontext_32::bp" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sp as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sp) as usize - ptr as usize }, 28usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(sp) - ) + "Offset of field: sigcontext_32::sp" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).bx as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).bx) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(bx) - ) + "Offset of field: sigcontext_32::bx" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).dx as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).dx) as usize - ptr as usize }, 36usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(dx) - ) + "Offset of field: sigcontext_32::dx" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).cx as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).cx) as usize - ptr as usize }, 40usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(cx) - ) + "Offset of field: sigcontext_32::cx" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ax as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ax) as usize - ptr as usize }, 44usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(ax) - ) + "Offset of field: sigcontext_32::ax" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).trapno as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).trapno) as usize - ptr as usize }, 48usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(trapno) - ) + "Offset of field: sigcontext_32::trapno" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).err as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).err) as usize - ptr as usize }, 52usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(err) - ) + "Offset of field: sigcontext_32::err" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ip as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ip) as usize - ptr as usize }, 56usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(ip) - ) + "Offset of field: sigcontext_32::ip" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).cs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).cs) as usize - ptr as usize }, 60usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(cs) - ) + "Offset of field: sigcontext_32::cs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).__csh as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).__csh) as usize - ptr as usize }, 62usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(__csh) - ) + "Offset of field: sigcontext_32::__csh" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, 64usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(flags) - ) + "Offset of field: sigcontext_32::flags" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sp_at_signal as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sp_at_signal) as usize - ptr as usize }, 68usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(sp_at_signal) - ) + "Offset of field: sigcontext_32::sp_at_signal" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ss as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ss) as usize - ptr as usize }, 72usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(ss) - ) + "Offset of field: sigcontext_32::ss" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).__ssh as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).__ssh) as usize - ptr as usize }, 74usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(__ssh) - ) + "Offset of field: sigcontext_32::__ssh" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fpstate as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fpstate) as usize - ptr as usize }, 76usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(fpstate) - ) + "Offset of field: sigcontext_32::fpstate" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).oldmask as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).oldmask) as usize - ptr as usize }, 80usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(oldmask) - ) + "Offset of field: sigcontext_32::oldmask" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).cr2 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).cr2) as usize - ptr as usize }, 84usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_32), - "::", - stringify!(cr2) - ) + "Offset of field: sigcontext_32::cr2" ); } #[repr(C)] @@ -5164,295 +4306,157 @@ pub struct sigcontext_64 { } #[test] fn bindgen_test_layout_sigcontext_64() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 256usize, - concat!("Size of: ", stringify!(sigcontext_64)) + "Size of sigcontext_64" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(sigcontext_64)) + "Alignment of sigcontext_64" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).r8 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).r8) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(r8) - ) + "Offset of field: sigcontext_64::r8" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).r9 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).r9) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(r9) - ) + "Offset of field: sigcontext_64::r9" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).r10 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).r10) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(r10) - ) + "Offset of field: sigcontext_64::r10" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).r11 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).r11) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(r11) - ) + "Offset of field: sigcontext_64::r11" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).r12 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).r12) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(r12) - ) + "Offset of field: sigcontext_64::r12" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).r13 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).r13) as usize - ptr as usize }, 40usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(r13) - ) + "Offset of field: sigcontext_64::r13" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).r14 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).r14) as usize - ptr as usize }, 48usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(r14) - ) + "Offset of field: sigcontext_64::r14" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).r15 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).r15) as usize - ptr as usize }, 56usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(r15) - ) + "Offset of field: sigcontext_64::r15" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).di as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).di) as usize - ptr as usize }, 64usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(di) - ) + "Offset of field: sigcontext_64::di" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).si as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).si) as usize - ptr as usize }, 72usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(si) - ) + "Offset of field: sigcontext_64::si" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).bp as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).bp) as usize - ptr as usize }, 80usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(bp) - ) + "Offset of field: sigcontext_64::bp" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).bx as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).bx) as usize - ptr as usize }, 88usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(bx) - ) + "Offset of field: sigcontext_64::bx" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).dx as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).dx) as usize - ptr as usize }, 96usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(dx) - ) + "Offset of field: sigcontext_64::dx" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ax as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ax) as usize - ptr as usize }, 104usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(ax) - ) + "Offset of field: sigcontext_64::ax" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).cx as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).cx) as usize - ptr as usize }, 112usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(cx) - ) + "Offset of field: sigcontext_64::cx" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sp as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sp) as usize - ptr as usize }, 120usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(sp) - ) + "Offset of field: sigcontext_64::sp" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ip as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ip) as usize - ptr as usize }, 128usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(ip) - ) + "Offset of field: sigcontext_64::ip" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, 136usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(flags) - ) + "Offset of field: sigcontext_64::flags" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).cs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).cs) as usize - ptr as usize }, 144usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(cs) - ) + "Offset of field: sigcontext_64::cs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).gs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).gs) as usize - ptr as usize }, 146usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(gs) - ) + "Offset of field: sigcontext_64::gs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fs) as usize - ptr as usize }, 148usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(fs) - ) + "Offset of field: sigcontext_64::fs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ss as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ss) as usize - ptr as usize }, 150usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(ss) - ) + "Offset of field: sigcontext_64::ss" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).err as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).err) as usize - ptr as usize }, 152usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(err) - ) + "Offset of field: sigcontext_64::err" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).trapno as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).trapno) as usize - ptr as usize }, 160usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(trapno) - ) + "Offset of field: sigcontext_64::trapno" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).oldmask as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).oldmask) as usize - ptr as usize }, 168usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(oldmask) - ) + "Offset of field: sigcontext_64::oldmask" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).cr2 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).cr2) as usize - ptr as usize }, 176usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(cr2) - ) + "Offset of field: sigcontext_64::cr2" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fpstate as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fpstate) as usize - ptr as usize }, 184usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(fpstate) - ) + "Offset of field: sigcontext_64::fpstate" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).reserved1 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).reserved1) as usize - ptr as usize }, 192usize, - concat!( - "Offset of field: ", - stringify!(sigcontext_64), - "::", - stringify!(reserved1) - ) + "Offset of field: sigcontext_64::reserved1" ); } #[repr(C)] @@ -5495,591 +4499,362 @@ pub union sigcontext__bindgen_ty_1 { } #[test] fn bindgen_test_layout_sigcontext__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 2usize, - concat!("Size of: ", stringify!(sigcontext__bindgen_ty_1)) + "Size of sigcontext__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::(), 2usize, - concat!("Alignment of ", stringify!(sigcontext__bindgen_ty_1)) + "Alignment of sigcontext__bindgen_ty_1" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ss as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ss) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigcontext__bindgen_ty_1), - "::", - stringify!(ss) - ) + "Offset of field: sigcontext__bindgen_ty_1::ss" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).__pad0 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).__pad0) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigcontext__bindgen_ty_1), - "::", - stringify!(__pad0) - ) + "Offset of field: sigcontext__bindgen_ty_1::__pad0" ); } #[test] fn bindgen_test_layout_sigcontext() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 256usize, - concat!("Size of: ", stringify!(sigcontext)) + "Size of sigcontext" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(sigcontext)) + "Alignment of sigcontext" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).r8 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).r8) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(r8) - ) + "Offset of field: sigcontext::r8" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).r9 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).r9) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(r9) - ) + "Offset of field: sigcontext::r9" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).r10 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).r10) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(r10) - ) + "Offset of field: sigcontext::r10" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).r11 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).r11) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(r11) - ) + "Offset of field: sigcontext::r11" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).r12 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).r12) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(r12) - ) + "Offset of field: sigcontext::r12" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).r13 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).r13) as usize - ptr as usize }, 40usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(r13) - ) + "Offset of field: sigcontext::r13" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).r14 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).r14) as usize - ptr as usize }, 48usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(r14) - ) + "Offset of field: sigcontext::r14" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).r15 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).r15) as usize - ptr as usize }, 56usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(r15) - ) + "Offset of field: sigcontext::r15" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rdi as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rdi) as usize - ptr as usize }, 64usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(rdi) - ) + "Offset of field: sigcontext::rdi" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rsi as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rsi) as usize - ptr as usize }, 72usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(rsi) - ) + "Offset of field: sigcontext::rsi" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rbp as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rbp) as usize - ptr as usize }, 80usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(rbp) - ) + "Offset of field: sigcontext::rbp" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rbx as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rbx) as usize - ptr as usize }, 88usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(rbx) - ) + "Offset of field: sigcontext::rbx" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rdx as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rdx) as usize - ptr as usize }, 96usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(rdx) - ) + "Offset of field: sigcontext::rdx" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rax as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rax) as usize - ptr as usize }, 104usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(rax) - ) + "Offset of field: sigcontext::rax" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rcx as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rcx) as usize - ptr as usize }, 112usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(rcx) - ) + "Offset of field: sigcontext::rcx" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rsp as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rsp) as usize - ptr as usize }, 120usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(rsp) - ) + "Offset of field: sigcontext::rsp" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rip as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rip) as usize - ptr as usize }, 128usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(rip) - ) + "Offset of field: sigcontext::rip" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).eflags as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).eflags) as usize - ptr as usize }, 136usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(eflags) - ) + "Offset of field: sigcontext::eflags" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).cs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).cs) as usize - ptr as usize }, 144usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(cs) - ) + "Offset of field: sigcontext::cs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).gs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).gs) as usize - ptr as usize }, 146usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(gs) - ) + "Offset of field: sigcontext::gs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fs) as usize - ptr as usize }, 148usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(fs) - ) + "Offset of field: sigcontext::fs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).err as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).err) as usize - ptr as usize }, 152usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(err) - ) + "Offset of field: sigcontext::err" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).trapno as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).trapno) as usize - ptr as usize }, 160usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(trapno) - ) + "Offset of field: sigcontext::trapno" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).oldmask as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).oldmask) as usize - ptr as usize }, 168usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(oldmask) - ) + "Offset of field: sigcontext::oldmask" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).cr2 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).cr2) as usize - ptr as usize }, 176usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(cr2) - ) + "Offset of field: sigcontext::cr2" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fpstate as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fpstate) as usize - ptr as usize }, 184usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(fpstate) - ) + "Offset of field: sigcontext::fpstate" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).reserved1 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).reserved1) as usize - ptr as usize }, 192usize, - concat!( - "Offset of field: ", - stringify!(sigcontext), - "::", - stringify!(reserved1) - ) + "Offset of field: sigcontext::reserved1" ); } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct __kernel_timespec { - pub tv_sec: __kernel_time64_t, - pub tv_nsec: ::std::os::raw::c_longlong, +pub struct timespec { + pub tv_sec: time_t, + pub tv_nsec: ::std::os::raw::c_long, } #[test] -fn bindgen_test_layout___kernel_timespec() { +fn bindgen_test_layout_timespec() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - ::std::mem::size_of::<__kernel_timespec>(), + ::std::mem::size_of::(), 16usize, - concat!("Size of: ", stringify!(__kernel_timespec)) + "Size of timespec" ); assert_eq!( - ::std::mem::align_of::<__kernel_timespec>(), + ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(__kernel_timespec)) + "Alignment of timespec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_timespec>())).tv_sec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tv_sec) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__kernel_timespec), - "::", - stringify!(tv_sec) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_timespec>())).tv_nsec as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(__kernel_timespec), - "::", - stringify!(tv_nsec) - ) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct __kernel_itimerspec { - pub it_interval: __kernel_timespec, - pub it_value: __kernel_timespec, -} -#[test] -fn bindgen_test_layout___kernel_itimerspec() { - assert_eq!( - ::std::mem::size_of::<__kernel_itimerspec>(), - 32usize, - concat!("Size of: ", stringify!(__kernel_itimerspec)) + "Offset of field: timespec::tv_sec" ); assert_eq!( - ::std::mem::align_of::<__kernel_itimerspec>(), + unsafe { ::std::ptr::addr_of!((*ptr).tv_nsec) as usize - ptr as usize }, 8usize, - concat!("Alignment of ", stringify!(__kernel_itimerspec)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_itimerspec>())).it_interval as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__kernel_itimerspec), - "::", - stringify!(it_interval) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_itimerspec>())).it_value as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(__kernel_itimerspec), - "::", - stringify!(it_value) - ) + "Offset of field: timespec::tv_nsec" ); } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct __kernel_old_timeval { - pub tv_sec: __kernel_long_t, - pub tv_usec: __kernel_long_t, +pub struct __kernel_timespec { + pub tv_sec: __kernel_time64_t, + pub tv_nsec: ::std::os::raw::c_longlong, } #[test] -fn bindgen_test_layout___kernel_old_timeval() { +fn bindgen_test_layout___kernel_timespec() { + const UNINIT: ::std::mem::MaybeUninit<__kernel_timespec> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - ::std::mem::size_of::<__kernel_old_timeval>(), + ::std::mem::size_of::<__kernel_timespec>(), 16usize, - concat!("Size of: ", stringify!(__kernel_old_timeval)) + "Size of __kernel_timespec" ); assert_eq!( - ::std::mem::align_of::<__kernel_old_timeval>(), + ::std::mem::align_of::<__kernel_timespec>(), 8usize, - concat!("Alignment of ", stringify!(__kernel_old_timeval)) + "Alignment of __kernel_timespec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_old_timeval>())).tv_sec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tv_sec) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__kernel_old_timeval), - "::", - stringify!(tv_sec) - ) + "Offset of field: __kernel_timespec::tv_sec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_old_timeval>())).tv_usec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tv_nsec) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__kernel_old_timeval), - "::", - stringify!(tv_usec) - ) + "Offset of field: __kernel_timespec::tv_nsec" ); } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct __kernel_sock_timeval { - pub tv_sec: __s64, - pub tv_usec: __s64, +pub struct __kernel_itimerspec { + pub it_interval: __kernel_timespec, + pub it_value: __kernel_timespec, } #[test] -fn bindgen_test_layout___kernel_sock_timeval() { +fn bindgen_test_layout___kernel_itimerspec() { + const UNINIT: ::std::mem::MaybeUninit<__kernel_itimerspec> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - ::std::mem::size_of::<__kernel_sock_timeval>(), - 16usize, - concat!("Size of: ", stringify!(__kernel_sock_timeval)) + ::std::mem::size_of::<__kernel_itimerspec>(), + 32usize, + "Size of __kernel_itimerspec" ); assert_eq!( - ::std::mem::align_of::<__kernel_sock_timeval>(), + ::std::mem::align_of::<__kernel_itimerspec>(), 8usize, - concat!("Alignment of ", stringify!(__kernel_sock_timeval)) + "Alignment of __kernel_itimerspec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_sock_timeval>())).tv_sec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).it_interval) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__kernel_sock_timeval), - "::", - stringify!(tv_sec) - ) + "Offset of field: __kernel_itimerspec::it_interval" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_sock_timeval>())).tv_usec as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(__kernel_sock_timeval), - "::", - stringify!(tv_usec) - ) + unsafe { ::std::ptr::addr_of!((*ptr).it_value) as usize - ptr as usize }, + 16usize, + "Offset of field: __kernel_itimerspec::it_value" ); } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct timespec { - pub tv_sec: __kernel_time_t, +pub struct __kernel_old_timespec { + pub tv_sec: __kernel_old_time_t, pub tv_nsec: ::std::os::raw::c_long, } #[test] -fn bindgen_test_layout_timespec() { +fn bindgen_test_layout___kernel_old_timespec() { + const UNINIT: ::std::mem::MaybeUninit<__kernel_old_timespec> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - ::std::mem::size_of::(), + ::std::mem::size_of::<__kernel_old_timespec>(), 16usize, - concat!("Size of: ", stringify!(timespec)) + "Size of __kernel_old_timespec" ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::<__kernel_old_timespec>(), 8usize, - concat!("Alignment of ", stringify!(timespec)) + "Alignment of __kernel_old_timespec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tv_sec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tv_sec) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(timespec), - "::", - stringify!(tv_sec) - ) + "Offset of field: __kernel_old_timespec::tv_sec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tv_nsec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tv_nsec) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(timespec), - "::", - stringify!(tv_nsec) - ) + "Offset of field: __kernel_old_timespec::tv_nsec" ); } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct timeval { - pub tv_sec: __kernel_time_t, - pub tv_usec: __kernel_suseconds_t, +pub struct __kernel_sock_timeval { + pub tv_sec: __s64, + pub tv_usec: __s64, } #[test] -fn bindgen_test_layout_timeval() { +fn bindgen_test_layout___kernel_sock_timeval() { + const UNINIT: ::std::mem::MaybeUninit<__kernel_sock_timeval> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - ::std::mem::size_of::(), + ::std::mem::size_of::<__kernel_sock_timeval>(), 16usize, - concat!("Size of: ", stringify!(timeval)) + "Size of __kernel_sock_timeval" ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::<__kernel_sock_timeval>(), 8usize, - concat!("Alignment of ", stringify!(timeval)) + "Alignment of __kernel_sock_timeval" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tv_sec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tv_sec) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(timeval), - "::", - stringify!(tv_sec) - ) + "Offset of field: __kernel_sock_timeval::tv_sec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tv_usec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tv_usec) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(timeval), - "::", - stringify!(tv_usec) - ) + "Offset of field: __kernel_sock_timeval::tv_usec" ); } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct timezone { - pub tz_minuteswest: ::std::os::raw::c_int, - pub tz_dsttime: ::std::os::raw::c_int, +pub struct timeval { + pub tv_sec: __kernel_old_time_t, + pub tv_usec: __kernel_suseconds_t, } #[test] -fn bindgen_test_layout_timezone() { +fn bindgen_test_layout_timeval() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!(::std::mem::size_of::(), 16usize, "Size of timeval"); assert_eq!( - ::std::mem::size_of::(), + ::std::mem::align_of::(), 8usize, - concat!("Size of: ", stringify!(timezone)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(timezone)) + "Alignment of timeval" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tz_minuteswest as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tv_sec) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(timezone), - "::", - stringify!(tz_minuteswest) - ) + "Offset of field: timeval::tv_sec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tz_dsttime as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(timezone), - "::", - stringify!(tz_dsttime) - ) + unsafe { ::std::ptr::addr_of!((*ptr).tv_usec) as usize - ptr as usize }, + 8usize, + "Offset of field: timeval::tv_usec" ); } #[repr(C)] @@ -6090,35 +4865,27 @@ pub struct itimerspec { } #[test] fn bindgen_test_layout_itimerspec() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 32usize, - concat!("Size of: ", stringify!(itimerspec)) + "Size of itimerspec" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(itimerspec)) + "Alignment of itimerspec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).it_interval as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).it_interval) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(itimerspec), - "::", - stringify!(it_interval) - ) + "Offset of field: itimerspec::it_interval" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).it_value as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).it_value) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(itimerspec), - "::", - stringify!(it_value) - ) + "Offset of field: itimerspec::it_value" ); } #[repr(C)] @@ -6129,35 +4896,58 @@ pub struct itimerval { } #[test] fn bindgen_test_layout_itimerval() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 32usize, - concat!("Size of: ", stringify!(itimerval)) + "Size of itimerval" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(itimerval)) + "Alignment of itimerval" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).it_interval as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).it_interval) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(itimerval), - "::", - stringify!(it_interval) - ) + "Offset of field: itimerval::it_interval" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).it_value as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).it_value) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(itimerval), - "::", - stringify!(it_value) - ) + "Offset of field: itimerval::it_value" + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct timezone { + pub tz_minuteswest: ::std::os::raw::c_int, + pub tz_dsttime: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_timezone() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 8usize, + "Size of timezone" + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + "Alignment of timezone" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).tz_minuteswest) as usize - ptr as usize }, + 0usize, + "Offset of field: timezone::tz_minuteswest" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).tz_dsttime) as usize - ptr as usize }, + 4usize, + "Offset of field: timezone::tz_dsttime" ); } pub type sigset_t = ::std::os::raw::c_ulong; @@ -6175,104 +4965,74 @@ pub struct __kernel_sigaction { } #[test] fn bindgen_test_layout___kernel_sigaction() { + const UNINIT: ::std::mem::MaybeUninit<__kernel_sigaction> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__kernel_sigaction>(), 32usize, - concat!("Size of: ", stringify!(__kernel_sigaction)) + "Size of __kernel_sigaction" ); assert_eq!( ::std::mem::align_of::<__kernel_sigaction>(), 8usize, - concat!("Alignment of ", stringify!(__kernel_sigaction)) + "Alignment of __kernel_sigaction" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_sigaction>())).sa_handler as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_handler) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__kernel_sigaction), - "::", - stringify!(sa_handler) - ) + "Offset of field: __kernel_sigaction::sa_handler" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_sigaction>())).sa_flags as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_flags) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__kernel_sigaction), - "::", - stringify!(sa_flags) - ) + "Offset of field: __kernel_sigaction::sa_flags" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_sigaction>())).sa_restorer as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_restorer) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(__kernel_sigaction), - "::", - stringify!(sa_restorer) - ) + "Offset of field: __kernel_sigaction::sa_restorer" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__kernel_sigaction>())).sa_mask as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_mask) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(__kernel_sigaction), - "::", - stringify!(sa_mask) - ) + "Offset of field: __kernel_sigaction::sa_mask" ); } #[repr(C)] +#[derive(Debug, Copy, Clone)] pub struct sigaltstack { pub ss_sp: *mut ::std::os::raw::c_void, pub ss_flags: ::std::os::raw::c_int, - pub ss_size: size_t, + pub ss_size: __kernel_size_t, } #[test] fn bindgen_test_layout_sigaltstack() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 24usize, - concat!("Size of: ", stringify!(sigaltstack)) + "Size of sigaltstack" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(sigaltstack)) + "Alignment of sigaltstack" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ss_sp as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ss_sp) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigaltstack), - "::", - stringify!(ss_sp) - ) + "Offset of field: sigaltstack::ss_sp" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ss_flags as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ss_flags) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(sigaltstack), - "::", - stringify!(ss_flags) - ) + "Offset of field: sigaltstack::ss_flags" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ss_size as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ss_size) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(sigaltstack), - "::", - stringify!(ss_size) - ) + "Offset of field: sigaltstack::ss_size" ); } pub type stack_t = sigaltstack; @@ -6284,35 +5044,23 @@ pub union sigval { } #[test] fn bindgen_test_layout_sigval() { - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(sigval)) - ); + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!(::std::mem::size_of::(), 8usize, "Size of sigval"); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(sigval)) + "Alignment of sigval" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sival_int as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sival_int) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigval), - "::", - stringify!(sival_int) - ) + "Offset of field: sigval::sival_int" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sival_ptr as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sival_ptr) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigval), - "::", - stringify!(sival_ptr) - ) + "Offset of field: sigval::sival_ptr" ); } pub type sigval_t = sigval; @@ -6335,35 +5083,28 @@ pub struct __sifields__bindgen_ty_1 { } #[test] fn bindgen_test_layout___sifields__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_1> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_1>(), 8usize, - concat!("Size of: ", stringify!(__sifields__bindgen_ty_1)) + "Size of __sifields__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_1>(), 4usize, - concat!("Alignment of ", stringify!(__sifields__bindgen_ty_1)) + "Alignment of __sifields__bindgen_ty_1" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_1>()))._pid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._pid) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_1), - "::", - stringify!(_pid) - ) + "Offset of field: __sifields__bindgen_ty_1::_pid" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_1>()))._uid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._uid) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_1), - "::", - stringify!(_uid) - ) + "Offset of field: __sifields__bindgen_ty_1::_uid" ); } #[repr(C)] @@ -6376,61 +5117,38 @@ pub struct __sifields__bindgen_ty_2 { } #[test] fn bindgen_test_layout___sifields__bindgen_ty_2() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_2> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_2>(), 24usize, - concat!("Size of: ", stringify!(__sifields__bindgen_ty_2)) + "Size of __sifields__bindgen_ty_2" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_2>(), 8usize, - concat!("Alignment of ", stringify!(__sifields__bindgen_ty_2)) + "Alignment of __sifields__bindgen_ty_2" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_2>()))._tid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._tid) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_2), - "::", - stringify!(_tid) - ) + "Offset of field: __sifields__bindgen_ty_2::_tid" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_2>()))._overrun as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._overrun) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_2), - "::", - stringify!(_overrun) - ) + "Offset of field: __sifields__bindgen_ty_2::_overrun" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_2>()))._sigval as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._sigval) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_2), - "::", - stringify!(_sigval) - ) + "Offset of field: __sifields__bindgen_ty_2::_sigval" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_2>()))._sys_private as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._sys_private) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_2), - "::", - stringify!(_sys_private) - ) + "Offset of field: __sifields__bindgen_ty_2::_sys_private" ); } #[repr(C)] @@ -6442,47 +5160,33 @@ pub struct __sifields__bindgen_ty_3 { } #[test] fn bindgen_test_layout___sifields__bindgen_ty_3() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_3> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_3>(), 16usize, - concat!("Size of: ", stringify!(__sifields__bindgen_ty_3)) + "Size of __sifields__bindgen_ty_3" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_3>(), 8usize, - concat!("Alignment of ", stringify!(__sifields__bindgen_ty_3)) + "Alignment of __sifields__bindgen_ty_3" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_3>()))._pid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._pid) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_3), - "::", - stringify!(_pid) - ) + "Offset of field: __sifields__bindgen_ty_3::_pid" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_3>()))._uid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._uid) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_3), - "::", - stringify!(_uid) - ) + "Offset of field: __sifields__bindgen_ty_3::_uid" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_3>()))._sigval as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._sigval) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_3), - "::", - stringify!(_sigval) - ) + "Offset of field: __sifields__bindgen_ty_3::_sigval" ); } #[repr(C)] @@ -6496,67 +5200,43 @@ pub struct __sifields__bindgen_ty_4 { } #[test] fn bindgen_test_layout___sifields__bindgen_ty_4() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_4> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_4>(), 32usize, - concat!("Size of: ", stringify!(__sifields__bindgen_ty_4)) + "Size of __sifields__bindgen_ty_4" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_4>(), 8usize, - concat!("Alignment of ", stringify!(__sifields__bindgen_ty_4)) + "Alignment of __sifields__bindgen_ty_4" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_4>()))._pid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._pid) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_4), - "::", - stringify!(_pid) - ) + "Offset of field: __sifields__bindgen_ty_4::_pid" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_4>()))._uid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._uid) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_4), - "::", - stringify!(_uid) - ) + "Offset of field: __sifields__bindgen_ty_4::_uid" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_4>()))._status as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._status) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_4), - "::", - stringify!(_status) - ) + "Offset of field: __sifields__bindgen_ty_4::_status" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_4>()))._utime as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._utime) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_4), - "::", - stringify!(_utime) - ) + "Offset of field: __sifields__bindgen_ty_4::_utime" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_4>()))._stime as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._stime) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_4), - "::", - stringify!(_stime) - ) + "Offset of field: __sifields__bindgen_ty_4::_stime" ); } #[repr(C)] @@ -6568,9 +5248,11 @@ pub struct __sifields__bindgen_ty_5 { #[repr(C)] #[derive(Copy, Clone)] pub union __sifields__bindgen_ty_5__bindgen_ty_1 { + pub _trapno: ::std::os::raw::c_int, pub _addr_lsb: ::std::os::raw::c_short, pub _addr_bnd: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1, pub _addr_pkey: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2, + pub _perf: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3, } #[repr(C)] #[derive(Debug, Copy, Clone)] @@ -6581,60 +5263,33 @@ pub struct __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1 { } #[test] fn bindgen_test_layout___sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1>(), 24usize, - concat!( - "Size of: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1) - ) + "Size of __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1>(), 8usize, - concat!( - "Alignment of ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1) - ) + "Alignment of __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1>())) - ._dummy_bnd as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._dummy_bnd) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(_dummy_bnd) - ) + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1::_dummy_bnd" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1>()))._lower - as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._lower) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(_lower) - ) + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1::_lower" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1>()))._upper - as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._upper) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(_upper) - ) + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_1::_upper" ); } #[repr(C)] @@ -6645,128 +5300,128 @@ pub struct __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2 { } #[test] fn bindgen_test_layout___sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2>(), 12usize, - concat!( - "Size of: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2) - ) + "Size of __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2>(), 4usize, - concat!( - "Alignment of ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2) - ) + "Alignment of __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2>())) - ._dummy_pkey as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._dummy_pkey) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2), - "::", - stringify!(_dummy_pkey) - ) + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2::_dummy_pkey" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2>()))._pkey - as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._pkey) as usize - ptr as usize }, + 8usize, + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2::_pkey" + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3 { + pub _data: ::std::os::raw::c_ulong, + pub _type: __u32, + pub _flags: __u32, +} +#[test] +fn bindgen_test_layout___sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3>(), + 16usize, + "Size of __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3" + ); + assert_eq!( + ::std::mem::align_of::<__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3>(), + 8usize, + "Alignment of __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._data) as usize - ptr as usize }, + 0usize, + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3::_data" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._type) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_2), - "::", - stringify!(_pkey) - ) + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3::_type" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._flags) as usize - ptr as usize }, + 12usize, + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1__bindgen_ty_3::_flags" ); } #[test] fn bindgen_test_layout___sifields__bindgen_ty_5__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_5__bindgen_ty_1> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_5__bindgen_ty_1>(), 24usize, - concat!( - "Size of: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1) - ) + "Size of __sifields__bindgen_ty_5__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_5__bindgen_ty_1>(), 8usize, - concat!( - "Alignment of ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1) - ) + "Alignment of __sifields__bindgen_ty_5__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_5__bindgen_ty_1>()))._addr_lsb as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._trapno) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1), - "::", - stringify!(_addr_lsb) - ) + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1::_trapno" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_5__bindgen_ty_1>()))._addr_bnd as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._addr_lsb) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1), - "::", - stringify!(_addr_bnd) - ) + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1::_addr_lsb" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_5__bindgen_ty_1>()))._addr_pkey - as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._addr_bnd) as usize - ptr as usize }, + 0usize, + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1::_addr_bnd" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._addr_pkey) as usize - ptr as usize }, + 0usize, + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1::_addr_pkey" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._perf) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5__bindgen_ty_1), - "::", - stringify!(_addr_pkey) - ) + "Offset of field: __sifields__bindgen_ty_5__bindgen_ty_1::_perf" ); } #[test] fn bindgen_test_layout___sifields__bindgen_ty_5() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_5> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_5>(), 32usize, - concat!("Size of: ", stringify!(__sifields__bindgen_ty_5)) + "Size of __sifields__bindgen_ty_5" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_5>(), 8usize, - concat!("Alignment of ", stringify!(__sifields__bindgen_ty_5)) + "Alignment of __sifields__bindgen_ty_5" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_5>()))._addr as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._addr) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_5), - "::", - stringify!(_addr) - ) + "Offset of field: __sifields__bindgen_ty_5::_addr" ); } #[repr(C)] @@ -6777,35 +5432,28 @@ pub struct __sifields__bindgen_ty_6 { } #[test] fn bindgen_test_layout___sifields__bindgen_ty_6() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_6> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_6>(), 16usize, - concat!("Size of: ", stringify!(__sifields__bindgen_ty_6)) + "Size of __sifields__bindgen_ty_6" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_6>(), 8usize, - concat!("Alignment of ", stringify!(__sifields__bindgen_ty_6)) + "Alignment of __sifields__bindgen_ty_6" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_6>()))._band as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._band) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_6), - "::", - stringify!(_band) - ) + "Offset of field: __sifields__bindgen_ty_6::_band" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_6>()))._fd as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._fd) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_6), - "::", - stringify!(_fd) - ) + "Offset of field: __sifields__bindgen_ty_6::_fd" ); } #[repr(C)] @@ -6817,132 +5465,83 @@ pub struct __sifields__bindgen_ty_7 { } #[test] fn bindgen_test_layout___sifields__bindgen_ty_7() { + const UNINIT: ::std::mem::MaybeUninit<__sifields__bindgen_ty_7> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields__bindgen_ty_7>(), 16usize, - concat!("Size of: ", stringify!(__sifields__bindgen_ty_7)) + "Size of __sifields__bindgen_ty_7" ); assert_eq!( ::std::mem::align_of::<__sifields__bindgen_ty_7>(), 8usize, - concat!("Alignment of ", stringify!(__sifields__bindgen_ty_7)) + "Alignment of __sifields__bindgen_ty_7" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_7>()))._call_addr as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._call_addr) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_7), - "::", - stringify!(_call_addr) - ) + "Offset of field: __sifields__bindgen_ty_7::_call_addr" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__sifields__bindgen_ty_7>()))._syscall as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._syscall) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_7), - "::", - stringify!(_syscall) - ) + "Offset of field: __sifields__bindgen_ty_7::_syscall" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields__bindgen_ty_7>()))._arch as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._arch) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(__sifields__bindgen_ty_7), - "::", - stringify!(_arch) - ) + "Offset of field: __sifields__bindgen_ty_7::_arch" ); } #[test] fn bindgen_test_layout___sifields() { + const UNINIT: ::std::mem::MaybeUninit<__sifields> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__sifields>(), 32usize, - concat!("Size of: ", stringify!(__sifields)) + "Size of __sifields" ); assert_eq!( ::std::mem::align_of::<__sifields>(), 8usize, - concat!("Alignment of ", stringify!(__sifields)) + "Alignment of __sifields" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields>()))._kill as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._kill) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields), - "::", - stringify!(_kill) - ) + "Offset of field: __sifields::_kill" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields>()))._timer as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._timer) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields), - "::", - stringify!(_timer) - ) + "Offset of field: __sifields::_timer" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields>()))._rt as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._rt) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields), - "::", - stringify!(_rt) - ) + "Offset of field: __sifields::_rt" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields>()))._sigchld as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._sigchld) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields), - "::", - stringify!(_sigchld) - ) + "Offset of field: __sifields::_sigchld" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields>()))._sigfault as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._sigfault) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields), - "::", - stringify!(_sigfault) - ) + "Offset of field: __sifields::_sigfault" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields>()))._sigpoll as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._sigpoll) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields), - "::", - stringify!(_sigpoll) - ) + "Offset of field: __sifields::_sigpoll" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__sifields>()))._sigsys as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._sigsys) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__sifields), - "::", - stringify!(_sigsys) - ) + "Offset of field: __sifields::_sigsys" ); } #[repr(C)] @@ -6966,93 +5565,59 @@ pub struct siginfo__bindgen_ty_1__bindgen_ty_1 { } #[test] fn bindgen_test_layout_siginfo__bindgen_ty_1__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 48usize, - concat!("Size of: ", stringify!(siginfo__bindgen_ty_1__bindgen_ty_1)) + "Size of siginfo__bindgen_ty_1__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!( - "Alignment of ", - stringify!(siginfo__bindgen_ty_1__bindgen_ty_1) - ) + "Alignment of siginfo__bindgen_ty_1__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).si_signo as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).si_signo) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(siginfo__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(si_signo) - ) + "Offset of field: siginfo__bindgen_ty_1__bindgen_ty_1::si_signo" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).si_errno as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).si_errno) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(siginfo__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(si_errno) - ) + "Offset of field: siginfo__bindgen_ty_1__bindgen_ty_1::si_errno" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).si_code as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).si_code) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(siginfo__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(si_code) - ) + "Offset of field: siginfo__bindgen_ty_1__bindgen_ty_1::si_code" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::()))._sifields as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._sifields) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(siginfo__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(_sifields) - ) + "Offset of field: siginfo__bindgen_ty_1__bindgen_ty_1::_sifields" ); } #[test] fn bindgen_test_layout_siginfo__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 128usize, - concat!("Size of: ", stringify!(siginfo__bindgen_ty_1)) + "Size of siginfo__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(siginfo__bindgen_ty_1)) + "Alignment of siginfo__bindgen_ty_1" ); assert_eq!( - unsafe { &(*(::std::ptr::null::()))._si_pad as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._si_pad) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(siginfo__bindgen_ty_1), - "::", - stringify!(_si_pad) - ) + "Offset of field: siginfo__bindgen_ty_1::_si_pad" ); } #[test] @@ -7060,12 +5625,12 @@ fn bindgen_test_layout_siginfo() { assert_eq!( ::std::mem::size_of::(), 128usize, - concat!("Size of: ", stringify!(siginfo)) + "Size of siginfo" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(siginfo)) + "Alignment of siginfo" ); } pub type siginfo_t = siginfo; @@ -7092,145 +5657,94 @@ pub struct sigevent__bindgen_ty_1__bindgen_ty_1 { } #[test] fn bindgen_test_layout_sigevent__bindgen_ty_1__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 16usize, - concat!( - "Size of: ", - stringify!(sigevent__bindgen_ty_1__bindgen_ty_1) - ) + "Size of sigevent__bindgen_ty_1__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!( - "Alignment of ", - stringify!(sigevent__bindgen_ty_1__bindgen_ty_1) - ) + "Alignment of sigevent__bindgen_ty_1__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::()))._function as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._function) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigevent__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(_function) - ) + "Offset of field: sigevent__bindgen_ty_1__bindgen_ty_1::_function" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::()))._attribute as *const _ - as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._attribute) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(sigevent__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(_attribute) - ) + "Offset of field: sigevent__bindgen_ty_1__bindgen_ty_1::_attribute" ); } #[test] fn bindgen_test_layout_sigevent__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 48usize, - concat!("Size of: ", stringify!(sigevent__bindgen_ty_1)) + "Size of sigevent__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(sigevent__bindgen_ty_1)) + "Alignment of sigevent__bindgen_ty_1" ); assert_eq!( - unsafe { &(*(::std::ptr::null::()))._pad as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._pad) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigevent__bindgen_ty_1), - "::", - stringify!(_pad) - ) + "Offset of field: sigevent__bindgen_ty_1::_pad" ); assert_eq!( - unsafe { &(*(::std::ptr::null::()))._tid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._tid) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigevent__bindgen_ty_1), - "::", - stringify!(_tid) - ) + "Offset of field: sigevent__bindgen_ty_1::_tid" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::()))._sigev_thread as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._sigev_thread) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigevent__bindgen_ty_1), - "::", - stringify!(_sigev_thread) - ) + "Offset of field: sigevent__bindgen_ty_1::_sigev_thread" ); } #[test] fn bindgen_test_layout_sigevent() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 64usize, - concat!("Size of: ", stringify!(sigevent)) + "Size of sigevent" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(sigevent)) + "Alignment of sigevent" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sigev_value as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sigev_value) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigevent), - "::", - stringify!(sigev_value) - ) + "Offset of field: sigevent::sigev_value" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sigev_signo as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sigev_signo) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(sigevent), - "::", - stringify!(sigev_signo) - ) + "Offset of field: sigevent::sigev_signo" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sigev_notify as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sigev_notify) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(sigevent), - "::", - stringify!(sigev_notify) - ) + "Offset of field: sigevent::sigev_notify" ); assert_eq!( - unsafe { &(*(::std::ptr::null::()))._sigev_un as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._sigev_un) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(sigevent), - "::", - stringify!(_sigev_un) - ) + "Offset of field: sigevent::_sigev_un" ); } pub type sigevent_t = sigevent; @@ -7260,82 +5774,58 @@ pub union sigaction__bindgen_ty_1 { } #[test] fn bindgen_test_layout_sigaction__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 8usize, - concat!("Size of: ", stringify!(sigaction__bindgen_ty_1)) + "Size of sigaction__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(sigaction__bindgen_ty_1)) + "Alignment of sigaction__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).sa_handler as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_handler) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigaction__bindgen_ty_1), - "::", - stringify!(sa_handler) - ) + "Offset of field: sigaction__bindgen_ty_1::sa_handler" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).sa_sigaction as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_sigaction) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigaction__bindgen_ty_1), - "::", - stringify!(sa_sigaction) - ) + "Offset of field: sigaction__bindgen_ty_1::sa_sigaction" ); } #[test] fn bindgen_test_layout_sigaction() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 32usize, - concat!("Size of: ", stringify!(sigaction)) + "Size of sigaction" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(sigaction)) + "Alignment of sigaction" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sa_flags as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_flags) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigaction), - "::", - stringify!(sa_flags) - ) + "Offset of field: sigaction::sa_flags" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sa_mask as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_mask) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(sigaction), - "::", - stringify!(sa_mask) - ) + "Offset of field: sigaction::sa_mask" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sa_restorer as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_restorer) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(sigaction), - "::", - stringify!(sa_restorer) - ) + "Offset of field: sigaction::sa_restorer" ); } #[repr(C)] @@ -7360,82 +5850,58 @@ pub union sigaction64__bindgen_ty_1 { } #[test] fn bindgen_test_layout_sigaction64__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 8usize, - concat!("Size of: ", stringify!(sigaction64__bindgen_ty_1)) + "Size of sigaction64__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(sigaction64__bindgen_ty_1)) + "Alignment of sigaction64__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).sa_handler as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_handler) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigaction64__bindgen_ty_1), - "::", - stringify!(sa_handler) - ) + "Offset of field: sigaction64__bindgen_ty_1::sa_handler" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).sa_sigaction as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_sigaction) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigaction64__bindgen_ty_1), - "::", - stringify!(sa_sigaction) - ) + "Offset of field: sigaction64__bindgen_ty_1::sa_sigaction" ); } #[test] fn bindgen_test_layout_sigaction64() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 32usize, - concat!("Size of: ", stringify!(sigaction64)) + "Size of sigaction64" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(sigaction64)) + "Alignment of sigaction64" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sa_flags as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_flags) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sigaction64), - "::", - stringify!(sa_flags) - ) + "Offset of field: sigaction64::sa_flags" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sa_mask as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_mask) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(sigaction64), - "::", - stringify!(sa_mask) - ) + "Offset of field: sigaction64::sa_mask" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sa_restorer as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sa_restorer) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(sigaction64), - "::", - stringify!(sa_restorer) - ) + "Offset of field: sigaction64::sa_restorer" ); } #[repr(C)] @@ -7455,125 +5921,72 @@ pub struct user_fpregs_struct { } #[test] fn bindgen_test_layout_user_fpregs_struct() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 512usize, - concat!("Size of: ", stringify!(user_fpregs_struct)) + "Size of user_fpregs_struct" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(user_fpregs_struct)) + "Alignment of user_fpregs_struct" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).cwd as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).cwd) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(user_fpregs_struct), - "::", - stringify!(cwd) - ) + "Offset of field: user_fpregs_struct::cwd" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).swd as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).swd) as usize - ptr as usize }, 2usize, - concat!( - "Offset of field: ", - stringify!(user_fpregs_struct), - "::", - stringify!(swd) - ) + "Offset of field: user_fpregs_struct::swd" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ftw as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ftw) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(user_fpregs_struct), - "::", - stringify!(ftw) - ) + "Offset of field: user_fpregs_struct::ftw" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fop as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fop) as usize - ptr as usize }, 6usize, - concat!( - "Offset of field: ", - stringify!(user_fpregs_struct), - "::", - stringify!(fop) - ) + "Offset of field: user_fpregs_struct::fop" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rip as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rip) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(user_fpregs_struct), - "::", - stringify!(rip) - ) + "Offset of field: user_fpregs_struct::rip" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rdp as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rdp) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(user_fpregs_struct), - "::", - stringify!(rdp) - ) + "Offset of field: user_fpregs_struct::rdp" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mxcsr as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).mxcsr) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(user_fpregs_struct), - "::", - stringify!(mxcsr) - ) + "Offset of field: user_fpregs_struct::mxcsr" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mxcr_mask as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).mxcr_mask) as usize - ptr as usize }, 28usize, - concat!( - "Offset of field: ", - stringify!(user_fpregs_struct), - "::", - stringify!(mxcr_mask) - ) + "Offset of field: user_fpregs_struct::mxcr_mask" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).st_space as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).st_space) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(user_fpregs_struct), - "::", - stringify!(st_space) - ) + "Offset of field: user_fpregs_struct::st_space" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).xmm_space as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).xmm_space) as usize - ptr as usize }, 160usize, - concat!( - "Offset of field: ", - stringify!(user_fpregs_struct), - "::", - stringify!(xmm_space) - ) + "Offset of field: user_fpregs_struct::xmm_space" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).padding) as usize - ptr as usize }, 416usize, - concat!( - "Offset of field: ", - stringify!(user_fpregs_struct), - "::", - stringify!(padding) - ) + "Offset of field: user_fpregs_struct::padding" ); } #[repr(C)] @@ -7609,285 +6022,152 @@ pub struct user_regs_struct { } #[test] fn bindgen_test_layout_user_regs_struct() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 216usize, - concat!("Size of: ", stringify!(user_regs_struct)) + "Size of user_regs_struct" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(user_regs_struct)) + "Alignment of user_regs_struct" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).r15 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).r15) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(r15) - ) + "Offset of field: user_regs_struct::r15" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).r14 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).r14) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(r14) - ) + "Offset of field: user_regs_struct::r14" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).r13 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).r13) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(r13) - ) + "Offset of field: user_regs_struct::r13" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).r12 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).r12) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(r12) - ) + "Offset of field: user_regs_struct::r12" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rbp as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rbp) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(rbp) - ) + "Offset of field: user_regs_struct::rbp" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rbx as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rbx) as usize - ptr as usize }, 40usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(rbx) - ) + "Offset of field: user_regs_struct::rbx" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).r11 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).r11) as usize - ptr as usize }, 48usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(r11) - ) + "Offset of field: user_regs_struct::r11" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).r10 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).r10) as usize - ptr as usize }, 56usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(r10) - ) + "Offset of field: user_regs_struct::r10" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).r9 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).r9) as usize - ptr as usize }, 64usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(r9) - ) + "Offset of field: user_regs_struct::r9" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).r8 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).r8) as usize - ptr as usize }, 72usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(r8) - ) + "Offset of field: user_regs_struct::r8" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rax as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rax) as usize - ptr as usize }, 80usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(rax) - ) + "Offset of field: user_regs_struct::rax" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rcx as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rcx) as usize - ptr as usize }, 88usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(rcx) - ) + "Offset of field: user_regs_struct::rcx" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rdx as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rdx) as usize - ptr as usize }, 96usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(rdx) - ) + "Offset of field: user_regs_struct::rdx" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rsi as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rsi) as usize - ptr as usize }, 104usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(rsi) - ) + "Offset of field: user_regs_struct::rsi" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rdi as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rdi) as usize - ptr as usize }, 112usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(rdi) - ) + "Offset of field: user_regs_struct::rdi" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).orig_rax as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).orig_rax) as usize - ptr as usize }, 120usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(orig_rax) - ) + "Offset of field: user_regs_struct::orig_rax" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rip as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rip) as usize - ptr as usize }, 128usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(rip) - ) + "Offset of field: user_regs_struct::rip" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).cs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).cs) as usize - ptr as usize }, 136usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(cs) - ) + "Offset of field: user_regs_struct::cs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).eflags as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).eflags) as usize - ptr as usize }, 144usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(eflags) - ) + "Offset of field: user_regs_struct::eflags" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rsp as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rsp) as usize - ptr as usize }, 152usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(rsp) - ) + "Offset of field: user_regs_struct::rsp" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ss as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ss) as usize - ptr as usize }, 160usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(ss) - ) + "Offset of field: user_regs_struct::ss" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fs_base as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fs_base) as usize - ptr as usize }, 168usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(fs_base) - ) + "Offset of field: user_regs_struct::fs_base" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).gs_base as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).gs_base) as usize - ptr as usize }, 176usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(gs_base) - ) + "Offset of field: user_regs_struct::gs_base" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ds as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ds) as usize - ptr as usize }, 184usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(ds) - ) + "Offset of field: user_regs_struct::ds" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).es as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).es) as usize - ptr as usize }, 192usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(es) - ) + "Offset of field: user_regs_struct::es" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fs) as usize - ptr as usize }, 200usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(fs) - ) + "Offset of field: user_regs_struct::fs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).gs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).gs) as usize - ptr as usize }, 208usize, - concat!( - "Offset of field: ", - stringify!(user_regs_struct), - "::", - stringify!(gs) - ) + "Offset of field: user_regs_struct::gs" ); } #[repr(C)] @@ -7915,231 +6195,130 @@ pub struct user { } #[test] fn bindgen_test_layout_user() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!(::std::mem::size_of::(), 928usize, "Size of user"); + assert_eq!(::std::mem::align_of::(), 8usize, "Alignment of user"); assert_eq!( - ::std::mem::size_of::(), - 928usize, - concat!("Size of: ", stringify!(user)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(user)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).regs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).regs) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(regs) - ) + "Offset of field: user::regs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).u_fpvalid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).u_fpvalid) as usize - ptr as usize }, 216usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(u_fpvalid) - ) + "Offset of field: user::u_fpvalid" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).pad0 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).pad0) as usize - ptr as usize }, 220usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(pad0) - ) + "Offset of field: user::pad0" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).i387 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).i387) as usize - ptr as usize }, 224usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(i387) - ) + "Offset of field: user::i387" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).u_tsize as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).u_tsize) as usize - ptr as usize }, 736usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(u_tsize) - ) + "Offset of field: user::u_tsize" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).u_dsize as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).u_dsize) as usize - ptr as usize }, 744usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(u_dsize) - ) + "Offset of field: user::u_dsize" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).u_ssize as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).u_ssize) as usize - ptr as usize }, 752usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(u_ssize) - ) + "Offset of field: user::u_ssize" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).start_code as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).start_code) as usize - ptr as usize }, 760usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(start_code) - ) + "Offset of field: user::start_code" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).start_stack as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).start_stack) as usize - ptr as usize }, 768usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(start_stack) - ) + "Offset of field: user::start_stack" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).signal as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).signal) as usize - ptr as usize }, 776usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(signal) - ) + "Offset of field: user::signal" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).reserved) as usize - ptr as usize }, 784usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(reserved) - ) + "Offset of field: user::reserved" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).pad1 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).pad1) as usize - ptr as usize }, 788usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(pad1) - ) + "Offset of field: user::pad1" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).u_ar0 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).u_ar0) as usize - ptr as usize }, 792usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(u_ar0) - ) + "Offset of field: user::u_ar0" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).u_fpstate as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).u_fpstate) as usize - ptr as usize }, 800usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(u_fpstate) - ) + "Offset of field: user::u_fpstate" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).magic as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).magic) as usize - ptr as usize }, 808usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(magic) - ) + "Offset of field: user::magic" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).u_comm as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).u_comm) as usize - ptr as usize }, 816usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(u_comm) - ) + "Offset of field: user::u_comm" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).u_debugreg as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).u_debugreg) as usize - ptr as usize }, 848usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(u_debugreg) - ) + "Offset of field: user::u_debugreg" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).error_code as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).error_code) as usize - ptr as usize }, 912usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(error_code) - ) + "Offset of field: user::error_code" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fault_address as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fault_address) as usize - ptr as usize }, 920usize, - concat!( - "Offset of field: ", - stringify!(user), - "::", - stringify!(fault_address) - ) - ); -} -pub const REG_R8: ::std::os::raw::c_uint = 0; -pub const REG_R9: ::std::os::raw::c_uint = 1; -pub const REG_R10: ::std::os::raw::c_uint = 2; -pub const REG_R11: ::std::os::raw::c_uint = 3; -pub const REG_R12: ::std::os::raw::c_uint = 4; -pub const REG_R13: ::std::os::raw::c_uint = 5; -pub const REG_R14: ::std::os::raw::c_uint = 6; -pub const REG_R15: ::std::os::raw::c_uint = 7; -pub const REG_RDI: ::std::os::raw::c_uint = 8; -pub const REG_RSI: ::std::os::raw::c_uint = 9; -pub const REG_RBP: ::std::os::raw::c_uint = 10; -pub const REG_RBX: ::std::os::raw::c_uint = 11; -pub const REG_RDX: ::std::os::raw::c_uint = 12; -pub const REG_RAX: ::std::os::raw::c_uint = 13; -pub const REG_RCX: ::std::os::raw::c_uint = 14; -pub const REG_RSP: ::std::os::raw::c_uint = 15; -pub const REG_RIP: ::std::os::raw::c_uint = 16; -pub const REG_EFL: ::std::os::raw::c_uint = 17; -pub const REG_CSGSFS: ::std::os::raw::c_uint = 18; -pub const REG_ERR: ::std::os::raw::c_uint = 19; -pub const REG_TRAPNO: ::std::os::raw::c_uint = 20; -pub const REG_OLDMASK: ::std::os::raw::c_uint = 21; -pub const REG_CR2: ::std::os::raw::c_uint = 22; -pub const NGREG: ::std::os::raw::c_uint = 23; + "Offset of field: user::fault_address" + ); +} +pub const REG_R8: _bindgen_ty_22 = 0; +pub const REG_R9: _bindgen_ty_22 = 1; +pub const REG_R10: _bindgen_ty_22 = 2; +pub const REG_R11: _bindgen_ty_22 = 3; +pub const REG_R12: _bindgen_ty_22 = 4; +pub const REG_R13: _bindgen_ty_22 = 5; +pub const REG_R14: _bindgen_ty_22 = 6; +pub const REG_R15: _bindgen_ty_22 = 7; +pub const REG_RDI: _bindgen_ty_22 = 8; +pub const REG_RSI: _bindgen_ty_22 = 9; +pub const REG_RBP: _bindgen_ty_22 = 10; +pub const REG_RBX: _bindgen_ty_22 = 11; +pub const REG_RDX: _bindgen_ty_22 = 12; +pub const REG_RAX: _bindgen_ty_22 = 13; +pub const REG_RCX: _bindgen_ty_22 = 14; +pub const REG_RSP: _bindgen_ty_22 = 15; +pub const REG_RIP: _bindgen_ty_22 = 16; +pub const REG_EFL: _bindgen_ty_22 = 17; +pub const REG_CSGSFS: _bindgen_ty_22 = 18; +pub const REG_ERR: _bindgen_ty_22 = 19; +pub const REG_TRAPNO: _bindgen_ty_22 = 20; +pub const REG_OLDMASK: _bindgen_ty_22 = 21; +pub const REG_CR2: _bindgen_ty_22 = 22; +pub const NGREG: _bindgen_ty_22 = 23; pub type _bindgen_ty_22 = ::std::os::raw::c_uint; pub type greg_t = ::std::os::raw::c_long; pub type gregset_t = [greg_t; 23usize]; @@ -8152,45 +6331,32 @@ pub struct _libc_fpxreg { } #[test] fn bindgen_test_layout__libc_fpxreg() { + const UNINIT: ::std::mem::MaybeUninit<_libc_fpxreg> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<_libc_fpxreg>(), 16usize, - concat!("Size of: ", stringify!(_libc_fpxreg)) + "Size of _libc_fpxreg" ); assert_eq!( ::std::mem::align_of::<_libc_fpxreg>(), 2usize, - concat!("Alignment of ", stringify!(_libc_fpxreg)) + "Alignment of _libc_fpxreg" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_libc_fpxreg>())).significand as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).significand) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_libc_fpxreg), - "::", - stringify!(significand) - ) + "Offset of field: _libc_fpxreg::significand" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_libc_fpxreg>())).exponent as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).exponent) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(_libc_fpxreg), - "::", - stringify!(exponent) - ) + "Offset of field: _libc_fpxreg::exponent" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_libc_fpxreg>())).padding as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).padding) as usize - ptr as usize }, 10usize, - concat!( - "Offset of field: ", - stringify!(_libc_fpxreg), - "::", - stringify!(padding) - ) + "Offset of field: _libc_fpxreg::padding" ); } #[repr(C)] @@ -8200,25 +6366,22 @@ pub struct _libc_xmmreg { } #[test] fn bindgen_test_layout__libc_xmmreg() { + const UNINIT: ::std::mem::MaybeUninit<_libc_xmmreg> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<_libc_xmmreg>(), 16usize, - concat!("Size of: ", stringify!(_libc_xmmreg)) + "Size of _libc_xmmreg" ); assert_eq!( ::std::mem::align_of::<_libc_xmmreg>(), 4usize, - concat!("Alignment of ", stringify!(_libc_xmmreg)) + "Alignment of _libc_xmmreg" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_libc_xmmreg>())).element as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).element) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_libc_xmmreg), - "::", - stringify!(element) - ) + "Offset of field: _libc_xmmreg::element" ); } #[repr(C)] @@ -8238,125 +6401,72 @@ pub struct _libc_fpstate { } #[test] fn bindgen_test_layout__libc_fpstate() { + const UNINIT: ::std::mem::MaybeUninit<_libc_fpstate> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<_libc_fpstate>(), 512usize, - concat!("Size of: ", stringify!(_libc_fpstate)) + "Size of _libc_fpstate" ); assert_eq!( ::std::mem::align_of::<_libc_fpstate>(), 8usize, - concat!("Alignment of ", stringify!(_libc_fpstate)) + "Alignment of _libc_fpstate" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_libc_fpstate>())).cwd as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).cwd) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(_libc_fpstate), - "::", - stringify!(cwd) - ) + "Offset of field: _libc_fpstate::cwd" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_libc_fpstate>())).swd as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).swd) as usize - ptr as usize }, 2usize, - concat!( - "Offset of field: ", - stringify!(_libc_fpstate), - "::", - stringify!(swd) - ) + "Offset of field: _libc_fpstate::swd" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_libc_fpstate>())).ftw as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).ftw) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(_libc_fpstate), - "::", - stringify!(ftw) - ) + "Offset of field: _libc_fpstate::ftw" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_libc_fpstate>())).fop as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fop) as usize - ptr as usize }, 6usize, - concat!( - "Offset of field: ", - stringify!(_libc_fpstate), - "::", - stringify!(fop) - ) + "Offset of field: _libc_fpstate::fop" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_libc_fpstate>())).rip as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rip) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(_libc_fpstate), - "::", - stringify!(rip) - ) + "Offset of field: _libc_fpstate::rip" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_libc_fpstate>())).rdp as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).rdp) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(_libc_fpstate), - "::", - stringify!(rdp) - ) + "Offset of field: _libc_fpstate::rdp" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_libc_fpstate>())).mxcsr as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).mxcsr) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(_libc_fpstate), - "::", - stringify!(mxcsr) - ) + "Offset of field: _libc_fpstate::mxcsr" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_libc_fpstate>())).mxcr_mask as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).mxcr_mask) as usize - ptr as usize }, 28usize, - concat!( - "Offset of field: ", - stringify!(_libc_fpstate), - "::", - stringify!(mxcr_mask) - ) + "Offset of field: _libc_fpstate::mxcr_mask" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_libc_fpstate>()))._st as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._st) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(_libc_fpstate), - "::", - stringify!(_st) - ) + "Offset of field: _libc_fpstate::_st" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_libc_fpstate>()))._xmm as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr)._xmm) as usize - ptr as usize }, 160usize, - concat!( - "Offset of field: ", - stringify!(_libc_fpstate), - "::", - stringify!(_xmm) - ) + "Offset of field: _libc_fpstate::_xmm" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_libc_fpstate>())).padding as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).padding) as usize - ptr as usize }, 416usize, - concat!( - "Offset of field: ", - stringify!(_libc_fpstate), - "::", - stringify!(padding) - ) + "Offset of field: _libc_fpstate::padding" ); } pub type fpregset_t = *mut _libc_fpstate; @@ -8369,48 +6479,36 @@ pub struct mcontext_t { } #[test] fn bindgen_test_layout_mcontext_t() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 256usize, - concat!("Size of: ", stringify!(mcontext_t)) + "Size of mcontext_t" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(mcontext_t)) + "Alignment of mcontext_t" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).gregs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).gregs) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(mcontext_t), - "::", - stringify!(gregs) - ) + "Offset of field: mcontext_t::gregs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fpregs as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fpregs) as usize - ptr as usize }, 184usize, - concat!( - "Offset of field: ", - stringify!(mcontext_t), - "::", - stringify!(fpregs) - ) + "Offset of field: mcontext_t::fpregs" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).__reserved1 as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).__reserved1) as usize - ptr as usize }, 192usize, - concat!( - "Offset of field: ", - stringify!(mcontext_t), - "::", - stringify!(__reserved1) - ) + "Offset of field: mcontext_t::__reserved1" ); } #[repr(C)] +#[derive(Copy, Clone)] pub struct ucontext { pub uc_flags: ::std::os::raw::c_ulong, pub uc_link: *mut ucontext, @@ -8427,102 +6525,68 @@ pub union ucontext__bindgen_ty_1 { } #[test] fn bindgen_test_layout_ucontext__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 8usize, - concat!("Size of: ", stringify!(ucontext__bindgen_ty_1)) + "Size of ucontext__bindgen_ty_1" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(ucontext__bindgen_ty_1)) + "Alignment of ucontext__bindgen_ty_1" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).uc_sigmask as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).uc_sigmask) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(ucontext__bindgen_ty_1), - "::", - stringify!(uc_sigmask) - ) + "Offset of field: ucontext__bindgen_ty_1::uc_sigmask" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).uc_sigmask64 as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).uc_sigmask64) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(ucontext__bindgen_ty_1), - "::", - stringify!(uc_sigmask64) - ) + "Offset of field: ucontext__bindgen_ty_1::uc_sigmask64" ); } #[test] fn bindgen_test_layout_ucontext() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 816usize, - concat!("Size of: ", stringify!(ucontext)) + "Size of ucontext" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(ucontext)) + "Alignment of ucontext" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).uc_flags as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).uc_flags) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(ucontext), - "::", - stringify!(uc_flags) - ) + "Offset of field: ucontext::uc_flags" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).uc_link as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).uc_link) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(ucontext), - "::", - stringify!(uc_link) - ) + "Offset of field: ucontext::uc_link" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).uc_stack as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).uc_stack) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(ucontext), - "::", - stringify!(uc_stack) - ) + "Offset of field: ucontext::uc_stack" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).uc_mcontext as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).uc_mcontext) as usize - ptr as usize }, 40usize, - concat!( - "Offset of field: ", - stringify!(ucontext), - "::", - stringify!(uc_mcontext) - ) + "Offset of field: ucontext::uc_mcontext" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).__fpregs_mem as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).__fpregs_mem) as usize - ptr as usize }, 304usize, - concat!( - "Offset of field: ", - stringify!(ucontext), - "::", - stringify!(__fpregs_mem) - ) + "Offset of field: ucontext::__fpregs_mem" ); } pub type ucontext_t = ucontext; @@ -8729,43 +6793,36 @@ pub struct fd_set { } #[test] fn bindgen_test_layout_fd_set() { - assert_eq!( - ::std::mem::size_of::(), - 128usize, - concat!("Size of: ", stringify!(fd_set)) - ); + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!(::std::mem::size_of::(), 128usize, "Size of fd_set"); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(fd_set)) + "Alignment of fd_set" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fds_bits as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fds_bits) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(fd_set), - "::", - stringify!(fds_bits) - ) + "Offset of field: fd_set::fds_bits" ); } extern "C" { - pub fn __FD_CLR_chk(arg1: ::std::os::raw::c_int, arg2: *mut fd_set, arg3: size_t); + pub fn __FD_CLR_chk(arg1: ::std::os::raw::c_int, arg2: *mut fd_set, arg3: usize); } extern "C" { - pub fn __FD_SET_chk(arg1: ::std::os::raw::c_int, arg2: *mut fd_set, arg3: size_t); + pub fn __FD_SET_chk(arg1: ::std::os::raw::c_int, arg2: *mut fd_set, arg3: usize); } extern "C" { pub fn __FD_ISSET_chk( arg1: ::std::os::raw::c_int, arg2: *const fd_set, - arg3: size_t, + arg3: usize, ) -> ::std::os::raw::c_int; } extern "C" { pub fn select( - __fd_count: ::std::os::raw::c_int, + __max_fd_plus_one: ::std::os::raw::c_int, __read_fds: *mut fd_set, __write_fds: *mut fd_set, __exception_fds: *mut fd_set, @@ -8774,7 +6831,7 @@ extern "C" { } extern "C" { pub fn pselect( - __fd_count: ::std::os::raw::c_int, + __max_fd_plus_one: ::std::os::raw::c_int, __read_fds: *mut fd_set, __write_fds: *mut fd_set, __exception_fds: *mut fd_set, @@ -8784,7 +6841,7 @@ extern "C" { } extern "C" { pub fn pselect64( - __fd_count: ::std::os::raw::c_int, + __max_fd_plus_one: ::std::os::raw::c_int, __read_fds: *mut fd_set, __write_fds: *mut fd_set, __exception_fds: *mut fd_set, @@ -8849,125 +6906,64 @@ pub struct tm { } #[test] fn bindgen_test_layout_tm() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!(::std::mem::size_of::(), 56usize, "Size of tm"); + assert_eq!(::std::mem::align_of::(), 8usize, "Alignment of tm"); assert_eq!( - ::std::mem::size_of::(), - 56usize, - concat!("Size of: ", stringify!(tm)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(tm)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_sec as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_sec) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_sec) - ) + "Offset of field: tm::tm_sec" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_min as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_min) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_min) - ) + "Offset of field: tm::tm_min" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_hour as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_hour) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_hour) - ) + "Offset of field: tm::tm_hour" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_mday as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_mday) as usize - ptr as usize }, 12usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_mday) - ) + "Offset of field: tm::tm_mday" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_mon as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_mon) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_mon) - ) + "Offset of field: tm::tm_mon" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_year as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_year) as usize - ptr as usize }, 20usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_year) - ) + "Offset of field: tm::tm_year" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_wday as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_wday) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_wday) - ) + "Offset of field: tm::tm_wday" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_yday as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_yday) as usize - ptr as usize }, 28usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_yday) - ) + "Offset of field: tm::tm_yday" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_isdst as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_isdst) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_isdst) - ) + "Offset of field: tm::tm_isdst" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_gmtoff as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_gmtoff) as usize - ptr as usize }, 40usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_gmtoff) - ) + "Offset of field: tm::tm_gmtoff" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tm_zone as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tm_zone) as usize - ptr as usize }, 48usize, - concat!( - "Offset of field: ", - stringify!(tm), - "::", - stringify!(tm_zone) - ) + "Offset of field: tm::tm_zone" ); } extern "C" { @@ -9000,12 +6996,18 @@ extern "C" { extern "C" { pub fn localtime_r(__t: *const time_t, __tm: *mut tm) -> *mut tm; } +extern "C" { + pub fn timelocal(__tm: *mut tm) -> time_t; +} extern "C" { pub fn gmtime(__t: *const time_t) -> *mut tm; } extern "C" { pub fn gmtime_r(__t: *const time_t, __tm: *mut tm) -> *mut tm; } +extern "C" { + pub fn timegm(__tm: *mut tm) -> time_t; +} extern "C" { pub fn strptime( __s: *const ::std::os::raw::c_char, @@ -9024,19 +7026,19 @@ extern "C" { extern "C" { pub fn strftime( __buf: *mut ::std::os::raw::c_char, - __n: size_t, + __n: usize, __fmt: *const ::std::os::raw::c_char, __tm: *const tm, - ) -> size_t; + ) -> usize; } extern "C" { pub fn strftime_l( __buf: *mut ::std::os::raw::c_char, - __n: size_t, + __n: usize, __fmt: *const ::std::os::raw::c_char, __tm: *const tm, __l: locale_t, - ) -> size_t; + ) -> usize; } extern "C" { pub fn ctime(__t: *const time_t) -> *mut ::std::os::raw::c_char; @@ -9092,19 +7094,19 @@ extern "C" { ) -> ::std::os::raw::c_int; } extern "C" { - pub fn timer_gettime(__timer: timer_t, __ts: *mut itimerspec) -> ::std::os::raw::c_int; + pub fn timer_gettime(_timer: timer_t, __ts: *mut itimerspec) -> ::std::os::raw::c_int; } extern "C" { pub fn timer_getoverrun(__timer: timer_t) -> ::std::os::raw::c_int; } extern "C" { - pub fn timelocal(__tm: *mut tm) -> time_t; -} -extern "C" { - pub fn timegm(__tm: *mut tm) -> time_t; + pub fn timespec_get( + __ts: *mut timespec, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; } extern "C" { - pub fn timespec_get( + pub fn timespec_getres( __ts: *mut timespec, __base: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; @@ -9144,98 +7146,78 @@ pub struct clone_args { pub stack: __u64, pub stack_size: __u64, pub tls: __u64, + pub set_tid: __u64, + pub set_tid_size: __u64, + pub cgroup: __u64, } #[test] fn bindgen_test_layout_clone_args() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), - 64usize, - concat!("Size of: ", stringify!(clone_args)) + 88usize, + "Size of clone_args" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(clone_args)) + "Alignment of clone_args" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(clone_args), - "::", - stringify!(flags) - ) + "Offset of field: clone_args::flags" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).pidfd as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).pidfd) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(clone_args), - "::", - stringify!(pidfd) - ) + "Offset of field: clone_args::pidfd" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).child_tid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).child_tid) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(clone_args), - "::", - stringify!(child_tid) - ) + "Offset of field: clone_args::child_tid" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).parent_tid as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).parent_tid) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(clone_args), - "::", - stringify!(parent_tid) - ) + "Offset of field: clone_args::parent_tid" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).exit_signal as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).exit_signal) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(clone_args), - "::", - stringify!(exit_signal) - ) + "Offset of field: clone_args::exit_signal" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).stack as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).stack) as usize - ptr as usize }, 40usize, - concat!( - "Offset of field: ", - stringify!(clone_args), - "::", - stringify!(stack) - ) + "Offset of field: clone_args::stack" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).stack_size as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).stack_size) as usize - ptr as usize }, 48usize, - concat!( - "Offset of field: ", - stringify!(clone_args), - "::", - stringify!(stack_size) - ) + "Offset of field: clone_args::stack_size" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tls as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tls) as usize - ptr as usize }, 56usize, - concat!( - "Offset of field: ", - stringify!(clone_args), - "::", - stringify!(tls) - ) + "Offset of field: clone_args::tls" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).set_tid) as usize - ptr as usize }, + 64usize, + "Offset of field: clone_args::set_tid" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).set_tid_size) as usize - ptr as usize }, + 72usize, + "Offset of field: clone_args::set_tid_size" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).cgroup) as usize - ptr as usize }, + 80usize, + "Offset of field: clone_args::cgroup" ); } #[repr(C)] @@ -9245,25 +7227,22 @@ pub struct sched_param { } #[test] fn bindgen_test_layout_sched_param() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 4usize, - concat!("Size of: ", stringify!(sched_param)) + "Size of sched_param" ); assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(sched_param)) + "Alignment of sched_param" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sched_priority as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).sched_priority) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(sched_param), - "::", - stringify!(sched_priority) - ) + "Offset of field: sched_param::sched_priority" ); } extern "C" { @@ -9294,356 +7273,207 @@ extern "C" { extern "C" { pub fn sched_rr_get_interval(__pid: pid_t, __quantum: *mut timespec) -> ::std::os::raw::c_int; } -pub const PTHREAD_MUTEX_NORMAL: ::std::os::raw::c_uint = 0; -pub const PTHREAD_MUTEX_RECURSIVE: ::std::os::raw::c_uint = 1; -pub const PTHREAD_MUTEX_ERRORCHECK: ::std::os::raw::c_uint = 2; -pub const PTHREAD_MUTEX_ERRORCHECK_NP: ::std::os::raw::c_uint = 2; -pub const PTHREAD_MUTEX_RECURSIVE_NP: ::std::os::raw::c_uint = 1; -pub const PTHREAD_MUTEX_DEFAULT: ::std::os::raw::c_uint = 0; +pub const PTHREAD_MUTEX_NORMAL: _bindgen_ty_23 = 0; +pub const PTHREAD_MUTEX_RECURSIVE: _bindgen_ty_23 = 1; +pub const PTHREAD_MUTEX_ERRORCHECK: _bindgen_ty_23 = 2; +pub const PTHREAD_MUTEX_ERRORCHECK_NP: _bindgen_ty_23 = 2; +pub const PTHREAD_MUTEX_RECURSIVE_NP: _bindgen_ty_23 = 1; +pub const PTHREAD_MUTEX_DEFAULT: _bindgen_ty_23 = 0; pub type _bindgen_ty_23 = ::std::os::raw::c_uint; -pub const PTHREAD_RWLOCK_PREFER_READER_NP: ::std::os::raw::c_uint = 0; -pub const PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP: ::std::os::raw::c_uint = 1; +pub const PTHREAD_RWLOCK_PREFER_READER_NP: _bindgen_ty_24 = 0; +pub const PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP: _bindgen_ty_24 = 1; pub type _bindgen_ty_24 = ::std::os::raw::c_uint; -pub type __pthread_cleanup_func_t = - ::std::option::Option; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct __pthread_cleanup_t { pub __cleanup_prev: *mut __pthread_cleanup_t, - pub __cleanup_routine: __pthread_cleanup_func_t, + pub __cleanup_routine: + ::std::option::Option, pub __cleanup_arg: *mut ::std::os::raw::c_void, } #[test] fn bindgen_test_layout___pthread_cleanup_t() { + const UNINIT: ::std::mem::MaybeUninit<__pthread_cleanup_t> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__pthread_cleanup_t>(), 24usize, - concat!("Size of: ", stringify!(__pthread_cleanup_t)) + "Size of __pthread_cleanup_t" ); assert_eq!( ::std::mem::align_of::<__pthread_cleanup_t>(), 8usize, - concat!("Alignment of ", stringify!(__pthread_cleanup_t)) + "Alignment of __pthread_cleanup_t" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__pthread_cleanup_t>())).__cleanup_prev as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).__cleanup_prev) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__pthread_cleanup_t), - "::", - stringify!(__cleanup_prev) - ) + "Offset of field: __pthread_cleanup_t::__cleanup_prev" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__pthread_cleanup_t>())).__cleanup_routine as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).__cleanup_routine) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__pthread_cleanup_t), - "::", - stringify!(__cleanup_routine) - ) + "Offset of field: __pthread_cleanup_t::__cleanup_routine" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<__pthread_cleanup_t>())).__cleanup_arg as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).__cleanup_arg) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(__pthread_cleanup_t), - "::", - stringify!(__cleanup_arg) - ) + "Offset of field: __pthread_cleanup_t::__cleanup_arg" ); } extern "C" { pub fn __pthread_cleanup_push( c: *mut __pthread_cleanup_t, - arg1: __pthread_cleanup_func_t, + arg1: ::std::option::Option, arg2: *mut ::std::os::raw::c_void, ); } extern "C" { pub fn __pthread_cleanup_pop(arg1: *mut __pthread_cleanup_t, arg2: ::std::os::raw::c_int); } -#[doc = " Data associated with an ALooper fd that will be returned as the \"outData\""] -#[doc = " when that source has data ready."] +#[doc = " Data associated with an ALooper fd that will be returned as the \"outData\"\n when that source has data ready."] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct android_poll_source { - #[doc = " The identifier of this source. May be LOOPER_ID_MAIN or"] - #[doc = " LOOPER_ID_INPUT."] + #[doc = " The identifier of this source. May be LOOPER_ID_MAIN or\n LOOPER_ID_INPUT."] pub id: i32, #[doc = " The android_app this ident is associated with."] pub app: *mut android_app, - #[doc = " Function to call to perform the standard processing of data from"] - #[doc = " this source."] + #[doc = " Function to call to perform the standard processing of data from\n this source."] pub process: ::std::option::Option< unsafe extern "C" fn(app: *mut android_app, source: *mut android_poll_source), >, } #[test] fn bindgen_test_layout_android_poll_source() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 24usize, - concat!("Size of: ", stringify!(android_poll_source)) + "Size of android_poll_source" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(android_poll_source)) + "Alignment of android_poll_source" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).id as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).id) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(android_poll_source), - "::", - stringify!(id) - ) + "Offset of field: android_poll_source::id" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).app as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).app) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(android_poll_source), - "::", - stringify!(app) - ) + "Offset of field: android_poll_source::app" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).process as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).process) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(android_poll_source), - "::", - stringify!(process) - ) + "Offset of field: android_poll_source::process" ); } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct android_input_buffer { - #[doc = " Pointer to a read-only array of pointers to GameActivityMotionEvent."] - #[doc = " Only the first motionEventsCount events are valid."] - pub motionEvents: [GameActivityMotionEvent; 16usize], + #[doc = " Pointer to a read-only array of GameActivityMotionEvent.\n Only the first motionEventsCount events are valid."] + pub motionEvents: *mut GameActivityMotionEvent, #[doc = " The number of valid motion events in `motionEvents`."] pub motionEventsCount: u64, - #[doc = " Pointer to a read-only array of pointers to GameActivityHistoricalPointerAxes."] - #[doc = ""] - #[doc = " Only the first historicalSamplesCount samples are valid."] - #[doc = " Refer to event->historicalStart, event->pointerCount and event->historicalCount"] - #[doc = " to access the specific samples that relate to an event."] - #[doc = ""] - #[doc = " Each slice of samples for one event has a length of"] - #[doc = " (event->pointerCount and event->historicalCount) and is in pointer-major"] - #[doc = " order so the historic samples for each pointer are contiguous."] - #[doc = " E.g. you would access historic sample index 3 for pointer 2 of an event with:"] - #[doc = ""] - #[doc = " historicalAxisSamples[event->historicalStart + (event->historicalCount * 2) + 3];"] - pub historicalAxisSamples: [GameActivityHistoricalPointerAxes; 64usize], - #[doc = " The number of valid historical samples in `historicalAxisSamples`."] - pub historicalSamplesCount: u64, - #[doc = " Pointer to a read-only array of pointers to GameActivityKeyEvent."] - #[doc = " Only the first keyEventsCount events are valid."] - pub keyEvents: [GameActivityKeyEvent; 4usize], + #[doc = " The size of the `motionEvents` buffer."] + pub motionEventsBufferSize: u64, + #[doc = " Pointer to a read-only array of GameActivityKeyEvent.\n Only the first keyEventsCount events are valid."] + pub keyEvents: *mut GameActivityKeyEvent, #[doc = " The number of valid \"Key\" events in `keyEvents`."] pub keyEventsCount: u64, + #[doc = " The size of the `keyEvents` buffer."] + pub keyEventsBufferSize: u64, } #[test] fn bindgen_test_layout_android_input_buffer() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), - 40824usize, - concat!("Size of: ", stringify!(android_input_buffer)) + 48usize, + "Size of android_input_buffer" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(android_input_buffer)) + "Alignment of android_input_buffer" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).motionEvents as *const _ as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).motionEvents) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(android_input_buffer), - "::", - stringify!(motionEvents) - ) + "Offset of field: android_input_buffer::motionEvents" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).motionEventsCount as *const _ as usize - }, - 27776usize, - concat!( - "Offset of field: ", - stringify!(android_input_buffer), - "::", - stringify!(motionEventsCount) - ) + unsafe { ::std::ptr::addr_of!((*ptr).motionEventsCount) as usize - ptr as usize }, + 8usize, + "Offset of field: android_input_buffer::motionEventsCount" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).historicalAxisSamples as *const _ - as usize - }, - 27784usize, - concat!( - "Offset of field: ", - stringify!(android_input_buffer), - "::", - stringify!(historicalAxisSamples) - ) + unsafe { ::std::ptr::addr_of!((*ptr).motionEventsBufferSize) as usize - ptr as usize }, + 16usize, + "Offset of field: android_input_buffer::motionEventsBufferSize" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).historicalSamplesCount as *const _ - as usize - }, - 40584usize, - concat!( - "Offset of field: ", - stringify!(android_input_buffer), - "::", - stringify!(historicalSamplesCount) - ) + unsafe { ::std::ptr::addr_of!((*ptr).keyEvents) as usize - ptr as usize }, + 24usize, + "Offset of field: android_input_buffer::keyEvents" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).keyEvents as *const _ as usize }, - 40592usize, - concat!( - "Offset of field: ", - stringify!(android_input_buffer), - "::", - stringify!(keyEvents) - ) + unsafe { ::std::ptr::addr_of!((*ptr).keyEventsCount) as usize - ptr as usize }, + 32usize, + "Offset of field: android_input_buffer::keyEventsCount" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).keyEventsCount as *const _ as usize - }, - 40816usize, - concat!( - "Offset of field: ", - stringify!(android_input_buffer), - "::", - stringify!(keyEventsCount) - ) - ); -} -#[doc = " Function pointer declaration for the filtering of key events."] -#[doc = " A function with this signature should be passed to"] -#[doc = " android_app_set_key_event_filter and return false for any events that should"] -#[doc = " not be handled by android_native_app_glue. These events will be handled by"] -#[doc = " the system instead."] + unsafe { ::std::ptr::addr_of!((*ptr).keyEventsBufferSize) as usize - ptr as usize }, + 40usize, + "Offset of field: android_input_buffer::keyEventsBufferSize" + ); +} +#[doc = " Function pointer declaration for the filtering of key events.\n A function with this signature should be passed to\n android_app_set_key_event_filter and return false for any events that should\n not be handled by android_native_app_glue. These events will be handled by\n the system instead."] pub type android_key_event_filter = ::std::option::Option bool>; -#[doc = " Function pointer definition for the filtering of motion events."] -#[doc = " A function with this signature should be passed to"] -#[doc = " android_app_set_motion_event_filter and return false for any events that"] -#[doc = " should not be handled by android_native_app_glue. These events will be"] -#[doc = " handled by the system instead."] +#[doc = " Function pointer definition for the filtering of motion events.\n A function with this signature should be passed to\n android_app_set_motion_event_filter and return false for any events that\n should not be handled by android_native_app_glue. These events will be\n handled by the system instead."] pub type android_motion_event_filter = ::std::option::Option bool>; -#[doc = " The GameActivity interface provided by "] -#[doc = " is based on a set of application-provided callbacks that will be called"] -#[doc = " by the Activity's main thread when certain events occur."] -#[doc = ""] -#[doc = " This means that each one of this callbacks _should_ _not_ block, or they"] -#[doc = " risk having the system force-close the application. This programming"] -#[doc = " model is direct, lightweight, but constraining."] -#[doc = ""] -#[doc = " The 'android_native_app_glue' static library is used to provide a different"] -#[doc = " execution model where the application can implement its own main event"] -#[doc = " loop in a different thread instead. Here's how it works:"] -#[doc = ""] -#[doc = " 1/ The application must provide a function named \"android_main()\" that"] -#[doc = " will be called when the activity is created, in a new thread that is"] -#[doc = " distinct from the activity's main thread."] -#[doc = ""] -#[doc = " 2/ android_main() receives a pointer to a valid \"android_app\" structure"] -#[doc = " that contains references to other important objects, e.g. the"] -#[doc = " GameActivity obejct instance the application is running in."] -#[doc = ""] -#[doc = " 3/ the \"android_app\" object holds an ALooper instance that already"] -#[doc = " listens to activity lifecycle events (e.g. \"pause\", \"resume\")."] -#[doc = " See APP_CMD_XXX declarations below."] -#[doc = ""] -#[doc = " This corresponds to an ALooper identifier returned by"] -#[doc = " ALooper_pollOnce with value LOOPER_ID_MAIN."] -#[doc = ""] -#[doc = " Your application can use the same ALooper to listen to additional"] -#[doc = " file-descriptors. They can either be callback based, or with return"] -#[doc = " identifiers starting with LOOPER_ID_USER."] -#[doc = ""] -#[doc = " 4/ Whenever you receive a LOOPER_ID_MAIN event,"] -#[doc = " the returned data will point to an android_poll_source structure. You"] -#[doc = " can call the process() function on it, and fill in android_app->onAppCmd"] -#[doc = " to be called for your own processing of the event."] -#[doc = ""] -#[doc = " Alternatively, you can call the low-level functions to read and process"] -#[doc = " the data directly... look at the process_cmd() and process_input()"] -#[doc = " implementations in the glue to see how to do this."] -#[doc = ""] -#[doc = " See the sample named \"native-activity\" that comes with the NDK with a"] -#[doc = " full usage example. Also look at the documentation of GameActivity."] +#[doc = " The GameActivity interface provided by \n is based on a set of application-provided callbacks that will be called\n by the Activity's main thread when certain events occur.\n\n This means that each one of this callbacks _should_ _not_ block, or they\n risk having the system force-close the application. This programming\n model is direct, lightweight, but constraining.\n\n The 'android_native_app_glue' static library is used to provide a different\n execution model where the application can implement its own main event\n loop in a different thread instead. Here's how it works:\n\n 1/ The application must provide a function named \"android_main()\" that\n will be called when the activity is created, in a new thread that is\n distinct from the activity's main thread.\n\n 2/ android_main() receives a pointer to a valid \"android_app\" structure\n that contains references to other important objects, e.g. the\n GameActivity obejct instance the application is running in.\n\n 3/ the \"android_app\" object holds an ALooper instance that already\n listens to activity lifecycle events (e.g. \"pause\", \"resume\").\n See APP_CMD_XXX declarations below.\n\n This corresponds to an ALooper identifier returned by\n ALooper_pollOnce with value LOOPER_ID_MAIN.\n\n Your application can use the same ALooper to listen to additional\n file-descriptors. They can either be callback based, or with return\n identifiers starting with LOOPER_ID_USER.\n\n 4/ Whenever you receive a LOOPER_ID_MAIN event,\n the returned data will point to an android_poll_source structure. You\n can call the process() function on it, and fill in android_app->onAppCmd\n to be called for your own processing of the event.\n\n Alternatively, you can call the low-level functions to read and process\n the data directly... look at the process_cmd() and process_input()\n implementations in the glue to see how to do this.\n\n See the sample named \"native-activity\" that comes with the NDK with a\n full usage example. Also look at the documentation of GameActivity."] #[repr(C)] pub struct android_app { #[doc = " An optional pointer to application-defined state."] pub userData: *mut ::std::os::raw::c_void, - #[doc = " A required callback for processing main app commands (`APP_CMD_*`)."] - #[doc = " This is called each frame if there are app commands that need processing."] + #[doc = " A required callback for processing main app commands (`APP_CMD_*`).\n This is called each frame if there are app commands that need processing."] pub onAppCmd: ::std::option::Option, #[doc = " The GameActivity object instance that this app is running in."] pub activity: *mut GameActivity, #[doc = " The current configuration the app is running in."] pub config: *mut AConfiguration, - #[doc = " The last activity saved state, as provided at creation time."] - #[doc = " It is NULL if there was no state. You can use this as you need; the"] - #[doc = " memory will remain around until you call android_app_exec_cmd() for"] - #[doc = " APP_CMD_RESUME, at which point it will be freed and savedState set to"] - #[doc = " NULL. These variables should only be changed when processing a"] - #[doc = " APP_CMD_SAVE_STATE, at which point they will be initialized to NULL and"] - #[doc = " you can malloc your state and place the information here. In that case"] - #[doc = " the memory will be freed for you later."] + #[doc = " The last activity saved state, as provided at creation time.\n It is NULL if there was no state. You can use this as you need; the\n memory will remain around until you call android_app_exec_cmd() for\n APP_CMD_RESUME, at which point it will be freed and savedState set to\n NULL. These variables should only be changed when processing a\n APP_CMD_SAVE_STATE, at which point they will be initialized to NULL and\n you can malloc your state and place the information here. In that case\n the memory will be freed for you later."] pub savedState: *mut ::std::os::raw::c_void, #[doc = " The size of the activity saved state. It is 0 if `savedState` is NULL."] - pub savedStateSize: size_t, + pub savedStateSize: usize, #[doc = " The ALooper associated with the app's thread."] pub looper: *mut ALooper, #[doc = " When non-NULL, this is the window surface that the app can draw in."] pub window: *mut ANativeWindow, - #[doc = " Current content rectangle of the window; this is the area where the"] - #[doc = " window's content should be placed to be seen by the user."] + #[doc = " Current content rectangle of the window; this is the area where the\n window's content should be placed to be seen by the user."] pub contentRect: ARect, - #[doc = " Current state of the app's activity. May be either APP_CMD_START,"] - #[doc = " APP_CMD_RESUME, APP_CMD_PAUSE, or APP_CMD_STOP."] + #[doc = " Whether the software keyboard is visible or not."] + 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 = " 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"] - #[doc = " destroyed and waiting for the app thread to complete."] + #[doc = " This is non-zero when the application's GameActivity is being\n destroyed and waiting for the app thread to complete."] pub destroyRequested: ::std::os::raw::c_int, - #[doc = " This is used for buffering input from GameActivity. Once ready, the"] - #[doc = " application thread switches the buffers and processes what was"] - #[doc = " accumulated."] + #[doc = " This is used for buffering input from GameActivity. Once ready, the\n application thread switches the buffers and processes what was\n accumulated."] pub inputBuffers: [android_input_buffer; 2usize], pub currentInputBuffer: ::std::os::raw::c_int, - #[doc = " 0 if no text input event is outstanding, 1 if it is."] - #[doc = " Use `GameActivity_getTextInputState` to get information"] - #[doc = " about the text entered by the user."] + #[doc = " 0 if no text input event is outstanding, 1 if it is.\n Use `GameActivity_getTextInputState` to get information\n about the text entered by the user."] pub textInputState: ::std::os::raw::c_int, #[doc = " @cond INTERNAL"] pub mutex: pthread_mutex_t, @@ -9665,457 +7495,273 @@ pub struct android_app { } #[test] fn bindgen_test_layout_android_app() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), - 81936usize, - concat!("Size of: ", stringify!(android_app)) + 392usize, + "Size of android_app" ); assert_eq!( ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(android_app)) + "Alignment of android_app" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).userData as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).userData) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(userData) - ) + "Offset of field: android_app::userData" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).onAppCmd as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).onAppCmd) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(onAppCmd) - ) + "Offset of field: android_app::onAppCmd" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).activity as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).activity) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(activity) - ) + "Offset of field: android_app::activity" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).config as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).config) as usize - ptr as usize }, 24usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(config) - ) + "Offset of field: android_app::config" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).savedState as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).savedState) as usize - ptr as usize }, 32usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(savedState) - ) + "Offset of field: android_app::savedState" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).savedStateSize as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).savedStateSize) as usize - ptr as usize }, 40usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(savedStateSize) - ) + "Offset of field: android_app::savedStateSize" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).looper as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).looper) as usize - ptr as usize }, 48usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(looper) - ) + "Offset of field: android_app::looper" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).window as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).window) as usize - ptr as usize }, 56usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(window) - ) + "Offset of field: android_app::window" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).contentRect as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).contentRect) as usize - ptr as usize }, 64usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(contentRect) - ) + "Offset of field: android_app::contentRect" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).activityState as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).softwareKeyboardVisible) as usize - ptr as usize }, 80usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(activityState) - ) + "Offset of field: android_app::softwareKeyboardVisible" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).destroyRequested as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).editorAction) as usize - ptr as usize }, 84usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(destroyRequested) - ) + "Offset of field: android_app::editorAction" ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).inputBuffers as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).activityState) as usize - ptr as usize }, 88usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(inputBuffers) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).currentInputBuffer as *const _ as usize }, - 81736usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(currentInputBuffer) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).textInputState as *const _ as usize }, - 81740usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(textInputState) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).mutex as *const _ as usize }, - 81744usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(mutex) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).cond as *const _ as usize }, - 81784usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(cond) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).msgread as *const _ as usize }, - 81832usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(msgread) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).msgwrite as *const _ as usize }, - 81836usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(msgwrite) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).thread as *const _ as usize }, - 81840usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(thread) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).cmdPollSource as *const _ as usize }, - 81848usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(cmdPollSource) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).running as *const _ as usize }, - 81872usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(running) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).stateSaved as *const _ as usize }, - 81876usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(stateSaved) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).destroyed as *const _ as usize }, - 81880usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(destroyed) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).redrawNeeded as *const _ as usize }, - 81884usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(redrawNeeded) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).pendingWindow as *const _ as usize }, - 81888usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(pendingWindow) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).pendingContentRect as *const _ as usize }, - 81896usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(pendingContentRect) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).keyEventFilter as *const _ as usize }, - 81912usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(keyEventFilter) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).motionEventFilter as *const _ as usize }, - 81920usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(motionEventFilter) - ) + "Offset of field: android_app::activityState" ); assert_eq!( - unsafe { - &(*(::std::ptr::null::())).inputAvailableWakeUp as *const _ as usize - }, - 81928usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(inputAvailableWakeUp) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).inputSwapPending as *const _ as usize }, - 81929usize, - concat!( - "Offset of field: ", - stringify!(android_app), - "::", - stringify!(inputSwapPending) - ) - ); -} -#[doc = " Looper data ID of commands coming from the app's main thread, which"] -#[doc = " is returned as an identifier from ALooper_pollOnce(). The data for this"] -#[doc = " identifier is a pointer to an android_poll_source structure."] -#[doc = " These can be retrieved and processed with android_app_read_cmd()"] -#[doc = " and android_app_exec_cmd()."] + unsafe { ::std::ptr::addr_of!((*ptr).destroyRequested) as usize - ptr as usize }, + 92usize, + "Offset of field: android_app::destroyRequested" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).inputBuffers) as usize - ptr as usize }, + 96usize, + "Offset of field: android_app::inputBuffers" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).currentInputBuffer) as usize - ptr as usize }, + 192usize, + "Offset of field: android_app::currentInputBuffer" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).textInputState) as usize - ptr as usize }, + 196usize, + "Offset of field: android_app::textInputState" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mutex) as usize - ptr as usize }, + 200usize, + "Offset of field: android_app::mutex" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).cond) as usize - ptr as usize }, + 240usize, + "Offset of field: android_app::cond" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).msgread) as usize - ptr as usize }, + 288usize, + "Offset of field: android_app::msgread" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).msgwrite) as usize - ptr as usize }, + 292usize, + "Offset of field: android_app::msgwrite" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).thread) as usize - ptr as usize }, + 296usize, + "Offset of field: android_app::thread" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).cmdPollSource) as usize - ptr as usize }, + 304usize, + "Offset of field: android_app::cmdPollSource" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).running) as usize - ptr as usize }, + 328usize, + "Offset of field: android_app::running" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).stateSaved) as usize - ptr as usize }, + 332usize, + "Offset of field: android_app::stateSaved" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).destroyed) as usize - ptr as usize }, + 336usize, + "Offset of field: android_app::destroyed" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).redrawNeeded) as usize - ptr as usize }, + 340usize, + "Offset of field: android_app::redrawNeeded" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pendingWindow) as usize - ptr as usize }, + 344usize, + "Offset of field: android_app::pendingWindow" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pendingContentRect) as usize - ptr as usize }, + 352usize, + "Offset of field: android_app::pendingContentRect" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).keyEventFilter) as usize - ptr as usize }, + 368usize, + "Offset of field: android_app::keyEventFilter" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).motionEventFilter) as usize - ptr as usize }, + 376usize, + "Offset of field: android_app::motionEventFilter" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).inputAvailableWakeUp) as usize - ptr as usize }, + 384usize, + "Offset of field: android_app::inputAvailableWakeUp" + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).inputSwapPending) as usize - ptr as usize }, + 385usize, + "Offset of field: android_app::inputSwapPending" + ); +} +#[doc = " Looper data ID of commands coming from the app's main thread, which\n is returned as an identifier from ALooper_pollOnce(). The data for this\n identifier is a pointer to an android_poll_source structure.\n These can be retrieved and processed with android_app_read_cmd()\n and android_app_exec_cmd()."] pub const NativeAppGlueLooperId_LOOPER_ID_MAIN: NativeAppGlueLooperId = 1; -#[doc = " Unused. Reserved for future use when usage of AInputQueue will be"] -#[doc = " supported."] +#[doc = " Unused. Reserved for future use when usage of AInputQueue will be\n supported."] pub const NativeAppGlueLooperId_LOOPER_ID_INPUT: NativeAppGlueLooperId = 2; #[doc = " Start of user-defined ALooper identifiers."] pub const NativeAppGlueLooperId_LOOPER_ID_USER: NativeAppGlueLooperId = 3; -#[doc = " Looper ID of commands coming from the app's main thread, an AInputQueue or"] -#[doc = " user-defined sources."] -pub type NativeAppGlueLooperId = ::std::os::raw::c_uint; -#[doc = " Unused. Reserved for future use when usage of AInputQueue will be"] -#[doc = " supported."] +#[doc = " Looper ID of commands coming from the app's main thread, an AInputQueue or\n user-defined sources."] +pub type NativeAppGlueLooperId = i8; +#[doc = " Unused. Reserved for future use when usage of AInputQueue will be\n supported."] pub const NativeAppGlueAppCmd_UNUSED_APP_CMD_INPUT_CHANGED: NativeAppGlueAppCmd = 0; -#[doc = " Command from main thread: a new ANativeWindow is ready for use. Upon"] -#[doc = " receiving this command, android_app->window will contain the new window"] -#[doc = " surface."] +#[doc = " Command from main thread: a new ANativeWindow is ready for use. Upon\n receiving this command, android_app->window will contain the new window\n surface."] pub const NativeAppGlueAppCmd_APP_CMD_INIT_WINDOW: NativeAppGlueAppCmd = 1; -#[doc = " Command from main thread: the existing ANativeWindow needs to be"] -#[doc = " terminated. Upon receiving this command, android_app->window still"] -#[doc = " contains the existing window; after calling android_app_exec_cmd"] -#[doc = " it will be set to NULL."] +#[doc = " Command from main thread: the existing ANativeWindow needs to be\n terminated. Upon receiving this command, android_app->window still\n contains the existing window; after calling android_app_exec_cmd\n it will be set to NULL."] pub const NativeAppGlueAppCmd_APP_CMD_TERM_WINDOW: NativeAppGlueAppCmd = 2; -#[doc = " Command from main thread: the current ANativeWindow has been resized."] -#[doc = " Please redraw with its new size."] +#[doc = " Command from main thread: the current ANativeWindow has been resized.\n Please redraw with its new size."] pub const NativeAppGlueAppCmd_APP_CMD_WINDOW_RESIZED: NativeAppGlueAppCmd = 3; -#[doc = " Command from main thread: the system needs that the current ANativeWindow"] -#[doc = " be redrawn. You should redraw the window before handing this to"] -#[doc = " android_app_exec_cmd() in order to avoid transient drawing glitches."] +#[doc = " Command from main thread: the system needs that the current ANativeWindow\n be redrawn. You should redraw the window before handing this to\n android_app_exec_cmd() in order to avoid transient drawing glitches."] pub const NativeAppGlueAppCmd_APP_CMD_WINDOW_REDRAW_NEEDED: NativeAppGlueAppCmd = 4; -#[doc = " Command from main thread: the content area of the window has changed,"] -#[doc = " such as from the soft input window being shown or hidden. You can"] -#[doc = " find the new content rect in android_app::contentRect."] +#[doc = " Command from main thread: the content area of the window has changed,\n such as from the soft input window being shown or hidden. You can\n find the new content rect in android_app::contentRect."] pub const NativeAppGlueAppCmd_APP_CMD_CONTENT_RECT_CHANGED: NativeAppGlueAppCmd = 5; -#[doc = " Command from main thread: the app's activity window has gained"] -#[doc = " input focus."] -pub const NativeAppGlueAppCmd_APP_CMD_GAINED_FOCUS: NativeAppGlueAppCmd = 6; -#[doc = " Command from main thread: the app's activity window has lost"] -#[doc = " input focus."] -pub const NativeAppGlueAppCmd_APP_CMD_LOST_FOCUS: NativeAppGlueAppCmd = 7; +#[doc = " Command from main thread: the software keyboard was shown or hidden."] +pub const NativeAppGlueAppCmd_APP_CMD_SOFTWARE_KB_VIS_CHANGED: NativeAppGlueAppCmd = 6; +#[doc = " Command from main thread: the app's activity window has gained\n input focus."] +pub const NativeAppGlueAppCmd_APP_CMD_GAINED_FOCUS: NativeAppGlueAppCmd = 7; +#[doc = " Command from main thread: the app's activity window has lost\n input focus."] +pub const NativeAppGlueAppCmd_APP_CMD_LOST_FOCUS: NativeAppGlueAppCmd = 8; #[doc = " Command from main thread: the current device configuration has changed."] -pub const NativeAppGlueAppCmd_APP_CMD_CONFIG_CHANGED: NativeAppGlueAppCmd = 8; -#[doc = " Command from main thread: the system is running low on memory."] -#[doc = " Try to reduce your memory use."] -pub const NativeAppGlueAppCmd_APP_CMD_LOW_MEMORY: NativeAppGlueAppCmd = 9; +pub const NativeAppGlueAppCmd_APP_CMD_CONFIG_CHANGED: NativeAppGlueAppCmd = 9; +#[doc = " Command from main thread: the system is running low on memory.\n Try to reduce your memory use."] +pub const NativeAppGlueAppCmd_APP_CMD_LOW_MEMORY: NativeAppGlueAppCmd = 10; #[doc = " Command from main thread: the app's activity has been started."] -pub const NativeAppGlueAppCmd_APP_CMD_START: NativeAppGlueAppCmd = 10; +pub const NativeAppGlueAppCmd_APP_CMD_START: NativeAppGlueAppCmd = 11; #[doc = " Command from main thread: the app's activity has been resumed."] -pub const NativeAppGlueAppCmd_APP_CMD_RESUME: NativeAppGlueAppCmd = 11; -#[doc = " Command from main thread: the app should generate a new saved state"] -#[doc = " for itself, to restore from later if needed. If you have saved state,"] -#[doc = " allocate it with malloc and place it in android_app.savedState with"] -#[doc = " the size in android_app.savedStateSize. The will be freed for you"] -#[doc = " later."] -pub const NativeAppGlueAppCmd_APP_CMD_SAVE_STATE: NativeAppGlueAppCmd = 12; +pub const NativeAppGlueAppCmd_APP_CMD_RESUME: NativeAppGlueAppCmd = 12; +#[doc = " Command from main thread: the app should generate a new saved state\n for itself, to restore from later if needed. If you have saved state,\n allocate it with malloc and place it in android_app.savedState with\n the size in android_app.savedStateSize. The will be freed for you\n later."] +pub const NativeAppGlueAppCmd_APP_CMD_SAVE_STATE: NativeAppGlueAppCmd = 13; #[doc = " Command from main thread: the app's activity has been paused."] -pub const NativeAppGlueAppCmd_APP_CMD_PAUSE: NativeAppGlueAppCmd = 13; +pub const NativeAppGlueAppCmd_APP_CMD_PAUSE: NativeAppGlueAppCmd = 14; #[doc = " Command from main thread: the app's activity has been stopped."] -pub const NativeAppGlueAppCmd_APP_CMD_STOP: NativeAppGlueAppCmd = 14; -#[doc = " Command from main thread: the app's activity is being destroyed,"] -#[doc = " and waiting for the app thread to clean up and exit before proceeding."] -pub const NativeAppGlueAppCmd_APP_CMD_DESTROY: NativeAppGlueAppCmd = 15; +pub const NativeAppGlueAppCmd_APP_CMD_STOP: NativeAppGlueAppCmd = 15; +#[doc = " Command from main thread: the app's activity is being destroyed,\n and waiting for the app thread to clean up and exit before proceeding."] +pub const NativeAppGlueAppCmd_APP_CMD_DESTROY: NativeAppGlueAppCmd = 16; #[doc = " Command from main thread: the app's insets have changed."] -pub const NativeAppGlueAppCmd_APP_CMD_WINDOW_INSETS_CHANGED: NativeAppGlueAppCmd = 16; -#[doc = " Commands passed from the application's main Java thread to the game's thread."] -pub type NativeAppGlueAppCmd = ::std::os::raw::c_uint; +pub const NativeAppGlueAppCmd_APP_CMD_WINDOW_INSETS_CHANGED: NativeAppGlueAppCmd = 17; +#[doc = " Commands passed from the application's main Java thread to the game's thread.\n\n Values from 0 to 127 are reserved for this library; values from -128 to -1\n can be used for custom user's events."] +pub type NativeAppGlueAppCmd = i8; extern "C" { - #[doc = " Call when ALooper_pollAll() returns LOOPER_ID_MAIN, reading the next"] - #[doc = " app command message."] + #[doc = " Call when ALooper_pollAll() returns LOOPER_ID_MAIN, reading the next\n app command message."] pub fn android_app_read_cmd(android_app: *mut android_app) -> i8; } extern "C" { - #[doc = " Call with the command returned by android_app_read_cmd() to do the"] - #[doc = " initial pre-processing of the given command. You can perform your own"] - #[doc = " actions for the command after calling this function."] + #[doc = " Call with the command returned by android_app_read_cmd() to do the\n initial pre-processing of the given command. You can perform your own\n actions for the command after calling this function."] pub fn android_app_pre_exec_cmd(android_app: *mut android_app, cmd: i8); } extern "C" { - #[doc = " Call with the command returned by android_app_read_cmd() to do the"] - #[doc = " final post-processing of the given command. You must have done your own"] - #[doc = " actions for the command before calling this function."] + #[doc = " Call with the command returned by android_app_read_cmd() to do the\n final post-processing of the given command. You must have done your own\n actions for the command before calling this function."] pub fn android_app_post_exec_cmd(android_app: *mut android_app, cmd: i8); } extern "C" { - #[doc = " Call this before processing input events to get the events buffer."] - #[doc = " The function returns NULL if there are no events to process."] + #[doc = " Call this before processing input events to get the events buffer.\n The function returns NULL if there are no events to process."] pub fn android_app_swap_input_buffers( android_app: *mut android_app, ) -> *mut android_input_buffer; } extern "C" { - #[doc = " Clear the array of motion events that were waiting to be handled, and release"] - #[doc = " each of them."] - #[doc = ""] - #[doc = " This method should be called after you have processed the motion events in"] - #[doc = " your game loop. You should handle events at each iteration of your game loop."] + #[doc = " Clear the array of motion events that were waiting to be handled, and release\n each of them.\n\n This method should be called after you have processed the motion events in\n your game loop. You should handle events at each iteration of your game loop."] pub fn android_app_clear_motion_events(inputBuffer: *mut android_input_buffer); } extern "C" { - #[doc = " Clear the array of key events that were waiting to be handled, and release"] - #[doc = " each of them."] - #[doc = ""] - #[doc = " This method should be called after you have processed the key up events in"] - #[doc = " your game loop. You should handle events at each iteration of your game loop."] + #[doc = " Clear the array of key events that were waiting to be handled, and release\n each of them.\n\n This method should be called after you have processed the key up events in\n your game loop. You should handle events at each iteration of your game loop."] pub fn android_app_clear_key_events(inputBuffer: *mut android_input_buffer); } extern "C" { - #[doc = " This is a springboard into the Rust glue layer that wraps calling the"] - #[doc = " main entry for the app itself."] + #[doc = " This is a springboard into the Rust glue layer that wraps calling the\n main entry for the app itself."] pub fn _rust_glue_entry(app: *mut android_app); } extern "C" { - #[doc = " Set the filter to use when processing key events."] - #[doc = " Any events for which the filter returns false will be ignored by"] - #[doc = " android_native_app_glue. If filter is set to NULL, no filtering is done."] - #[doc = ""] - #[doc = " The default key filter will filter out volume and camera button presses."] + #[doc = " Set the filter to use when processing key events.\n Any events for which the filter returns false will be ignored by\n android_native_app_glue. If filter is set to NULL, no filtering is done.\n\n The default key filter will filter out volume and camera button presses."] pub fn android_app_set_key_event_filter( app: *mut android_app, filter: android_key_event_filter, ); } extern "C" { - #[doc = " Set the filter to use when processing touch and motion events."] - #[doc = " Any events for which the filter returns false will be ignored by"] - #[doc = " android_native_app_glue. If filter is set to NULL, no filtering is done."] - #[doc = ""] - #[doc = " Note that the default motion event filter will only allow touchscreen events"] - #[doc = " through, in order to mimic NativeActivity's behaviour, so for controller"] - #[doc = " events to be passed to the app, set the filter to NULL."] + #[doc = " Set the filter to use when processing touch and motion events.\n Any events for which the filter returns false will be ignored by\n android_native_app_glue. If filter is set to NULL, no filtering is done.\n\n Note that the default motion event filter will only allow touchscreen events\n through, in order to mimic NativeActivity's behaviour, so for controller\n events to be passed to the app, set the filter to NULL."] pub fn android_app_set_motion_event_filter( app: *mut android_app, filter: android_motion_event_filter, ); } +extern "C" { + #[doc = " You can send your custom events using the function below.\n\n Make sure your custom codes do not overlap with this library's ones.\n\n Values from 0 to 127 are reserved for this library; values from -128 to -1\n can be used for custom user's events."] + pub fn android_app_write_cmd(android_app: *mut android_app, cmd: i8); +} extern "C" { #[doc = " Determines if a looper wake up was due to new input becoming available"] pub fn android_app_input_available_wake_up(app: *mut android_app) -> bool; @@ -10131,54 +7777,36 @@ pub struct __va_list_tag { } #[test] fn bindgen_test_layout___va_list_tag() { + const UNINIT: ::std::mem::MaybeUninit<__va_list_tag> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<__va_list_tag>(), 24usize, - concat!("Size of: ", stringify!(__va_list_tag)) + "Size of __va_list_tag" ); assert_eq!( ::std::mem::align_of::<__va_list_tag>(), 8usize, - concat!("Alignment of ", stringify!(__va_list_tag)) + "Alignment of __va_list_tag" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__va_list_tag>())).gp_offset as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).gp_offset) as usize - ptr as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(__va_list_tag), - "::", - stringify!(gp_offset) - ) + "Offset of field: __va_list_tag::gp_offset" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__va_list_tag>())).fp_offset as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).fp_offset) as usize - ptr as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(__va_list_tag), - "::", - stringify!(fp_offset) - ) + "Offset of field: __va_list_tag::fp_offset" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__va_list_tag>())).overflow_arg_area as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).overflow_arg_area) as usize - ptr as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(__va_list_tag), - "::", - stringify!(overflow_arg_area) - ) + "Offset of field: __va_list_tag::overflow_arg_area" ); assert_eq!( - unsafe { &(*(::std::ptr::null::<__va_list_tag>())).reg_save_area as *const _ as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).reg_save_area) as usize - ptr as usize }, 16usize, - concat!( - "Offset of field: ", - stringify!(__va_list_tag), - "::", - stringify!(reg_save_area) - ) + "Offset of field: __va_list_tag::reg_save_area" ); } diff --git a/android-activity/src/game_activity/input.rs b/android-activity/src/game_activity/input.rs index ac951be2..f8fac2b3 100644 --- a/android-activity/src/game_activity/input.rs +++ b/android-activity/src/game_activity/input.rs @@ -13,11 +13,13 @@ // The `Class` was also bound differently to `android-ndk-rs` considering how the class is defined // by masking bits from the `Source`. -use num_enum::{IntoPrimitive, TryFromPrimitive}; -use std::{convert::TryInto, ops::Deref}; +use ndk::event::ButtonState; -use crate::game_activity::ffi::{GameActivityKeyEvent, GameActivityMotionEvent}; -use crate::input::{Class, Source}; +use crate::activity_impl::ffi::{GameActivityKeyEvent, GameActivityMotionEvent}; +use crate::input::{ + Axis, Button, EdgeFlags, KeyAction, KeyEventFlags, Keycode, MetaState, MotionAction, + MotionEventFlags, Pointer, PointersIter, Source, ToolType, +}; // Note: try to keep this wrapper API compatible with the AInputEvent API if possible @@ -26,83 +28,7 @@ use crate::input::{Class, Source}; pub enum InputEvent<'a> { MotionEvent(MotionEvent<'a>), KeyEvent(KeyEvent<'a>), -} - -/// A bitfield representing the state of modifier keys during an event. -/// -/// See [the NDK docs](https://developer.android.com/ndk/reference/group/input#anonymous-enum-25) -#[derive(Copy, Clone, Debug, PartialEq, Eq)] -pub struct MetaState(pub u32); - -impl MetaState { - #[inline] - pub fn alt_on(self) -> bool { - self.0 & ndk_sys::AMETA_ALT_ON != 0 - } - #[inline] - pub fn alt_left_on(self) -> bool { - self.0 & ndk_sys::AMETA_ALT_LEFT_ON != 0 - } - #[inline] - pub fn alt_right_on(self) -> bool { - self.0 & ndk_sys::AMETA_ALT_RIGHT_ON != 0 - } - #[inline] - pub fn shift_on(self) -> bool { - self.0 & ndk_sys::AMETA_SHIFT_ON != 0 - } - #[inline] - pub fn shift_left_on(self) -> bool { - self.0 & ndk_sys::AMETA_SHIFT_LEFT_ON != 0 - } - #[inline] - pub fn shift_right_on(self) -> bool { - self.0 & ndk_sys::AMETA_SHIFT_RIGHT_ON != 0 - } - #[inline] - pub fn sym_on(self) -> bool { - self.0 & ndk_sys::AMETA_SYM_ON != 0 - } - #[inline] - pub fn function_on(self) -> bool { - self.0 & ndk_sys::AMETA_FUNCTION_ON != 0 - } - #[inline] - pub fn ctrl_on(self) -> bool { - self.0 & ndk_sys::AMETA_CTRL_ON != 0 - } - #[inline] - pub fn ctrl_left_on(self) -> bool { - self.0 & ndk_sys::AMETA_CTRL_LEFT_ON != 0 - } - #[inline] - pub fn ctrl_right_on(self) -> bool { - self.0 & ndk_sys::AMETA_CTRL_RIGHT_ON != 0 - } - #[inline] - pub fn meta_on(self) -> bool { - self.0 & ndk_sys::AMETA_META_ON != 0 - } - #[inline] - pub fn meta_left_on(self) -> bool { - self.0 & ndk_sys::AMETA_META_LEFT_ON != 0 - } - #[inline] - pub fn meta_right_on(self) -> bool { - self.0 & ndk_sys::AMETA_META_RIGHT_ON != 0 - } - #[inline] - pub fn caps_lock_on(self) -> bool { - self.0 & ndk_sys::AMETA_CAPS_LOCK_ON != 0 - } - #[inline] - pub fn num_lock_on(self) -> bool { - self.0 & ndk_sys::AMETA_NUM_LOCK_ON != 0 - } - #[inline] - pub fn scroll_lock_on(self) -> bool { - self.0 & ndk_sys::AMETA_SCROLL_LOCK_ON != 0 - } + TextEvent(crate::input::TextInputState), } /// A motion event. @@ -114,178 +40,6 @@ pub struct MotionEvent<'a> { ga_event: &'a GameActivityMotionEvent, } -impl<'a> Deref for MotionEvent<'a> { - type Target = GameActivityMotionEvent; - - fn deref(&self) -> &Self::Target { - self.ga_event - } -} - -/// A motion action. -/// -/// See [the NDK -/// docs](https://developer.android.com/ndk/reference/group/input#anonymous-enum-29) -#[derive(Copy, Clone, Debug, PartialEq, Eq, TryFromPrimitive, IntoPrimitive)] -#[repr(u32)] -pub enum MotionAction { - Down = ndk_sys::AMOTION_EVENT_ACTION_DOWN, - Up = ndk_sys::AMOTION_EVENT_ACTION_UP, - Move = ndk_sys::AMOTION_EVENT_ACTION_MOVE, - Cancel = ndk_sys::AMOTION_EVENT_ACTION_CANCEL, - Outside = ndk_sys::AMOTION_EVENT_ACTION_OUTSIDE, - PointerDown = ndk_sys::AMOTION_EVENT_ACTION_POINTER_DOWN, - PointerUp = ndk_sys::AMOTION_EVENT_ACTION_POINTER_UP, - HoverMove = ndk_sys::AMOTION_EVENT_ACTION_HOVER_MOVE, - Scroll = ndk_sys::AMOTION_EVENT_ACTION_SCROLL, - HoverEnter = ndk_sys::AMOTION_EVENT_ACTION_HOVER_ENTER, - HoverExit = ndk_sys::AMOTION_EVENT_ACTION_HOVER_EXIT, - ButtonPress = ndk_sys::AMOTION_EVENT_ACTION_BUTTON_PRESS, - ButtonRelease = ndk_sys::AMOTION_EVENT_ACTION_BUTTON_RELEASE, -} - -/// An axis of a motion event. -/// -/// See [the NDK docs](https://developer.android.com/ndk/reference/group/input#anonymous-enum-32) -#[derive(Copy, Clone, Debug, PartialEq, Eq, TryFromPrimitive, IntoPrimitive)] -#[repr(u32)] -pub enum Axis { - X = ndk_sys::AMOTION_EVENT_AXIS_X, - Y = ndk_sys::AMOTION_EVENT_AXIS_Y, - Pressure = ndk_sys::AMOTION_EVENT_AXIS_PRESSURE, - Size = ndk_sys::AMOTION_EVENT_AXIS_SIZE, - TouchMajor = ndk_sys::AMOTION_EVENT_AXIS_TOUCH_MAJOR, - TouchMinor = ndk_sys::AMOTION_EVENT_AXIS_TOUCH_MINOR, - ToolMajor = ndk_sys::AMOTION_EVENT_AXIS_TOOL_MAJOR, - ToolMinor = ndk_sys::AMOTION_EVENT_AXIS_TOOL_MINOR, - Orientation = ndk_sys::AMOTION_EVENT_AXIS_ORIENTATION, - Vscroll = ndk_sys::AMOTION_EVENT_AXIS_VSCROLL, - Hscroll = ndk_sys::AMOTION_EVENT_AXIS_HSCROLL, - Z = ndk_sys::AMOTION_EVENT_AXIS_Z, - Rx = ndk_sys::AMOTION_EVENT_AXIS_RX, - Ry = ndk_sys::AMOTION_EVENT_AXIS_RY, - Rz = ndk_sys::AMOTION_EVENT_AXIS_RZ, - HatX = ndk_sys::AMOTION_EVENT_AXIS_HAT_X, - HatY = ndk_sys::AMOTION_EVENT_AXIS_HAT_Y, - Ltrigger = ndk_sys::AMOTION_EVENT_AXIS_LTRIGGER, - Rtrigger = ndk_sys::AMOTION_EVENT_AXIS_RTRIGGER, - Throttle = ndk_sys::AMOTION_EVENT_AXIS_THROTTLE, - Rudder = ndk_sys::AMOTION_EVENT_AXIS_RUDDER, - Wheel = ndk_sys::AMOTION_EVENT_AXIS_WHEEL, - Gas = ndk_sys::AMOTION_EVENT_AXIS_GAS, - Brake = ndk_sys::AMOTION_EVENT_AXIS_BRAKE, - Distance = ndk_sys::AMOTION_EVENT_AXIS_DISTANCE, - Tilt = ndk_sys::AMOTION_EVENT_AXIS_TILT, - Scroll = ndk_sys::AMOTION_EVENT_AXIS_SCROLL, - RelativeX = ndk_sys::AMOTION_EVENT_AXIS_RELATIVE_X, - RelativeY = ndk_sys::AMOTION_EVENT_AXIS_RELATIVE_Y, - Generic1 = ndk_sys::AMOTION_EVENT_AXIS_GENERIC_1, - Generic2 = ndk_sys::AMOTION_EVENT_AXIS_GENERIC_2, - Generic3 = ndk_sys::AMOTION_EVENT_AXIS_GENERIC_3, - Generic4 = ndk_sys::AMOTION_EVENT_AXIS_GENERIC_4, - Generic5 = ndk_sys::AMOTION_EVENT_AXIS_GENERIC_5, - Generic6 = ndk_sys::AMOTION_EVENT_AXIS_GENERIC_6, - Generic7 = ndk_sys::AMOTION_EVENT_AXIS_GENERIC_7, - Generic8 = ndk_sys::AMOTION_EVENT_AXIS_GENERIC_8, - Generic9 = ndk_sys::AMOTION_EVENT_AXIS_GENERIC_9, - Generic10 = ndk_sys::AMOTION_EVENT_AXIS_GENERIC_10, - Generic11 = ndk_sys::AMOTION_EVENT_AXIS_GENERIC_11, - Generic12 = ndk_sys::AMOTION_EVENT_AXIS_GENERIC_12, - Generic13 = ndk_sys::AMOTION_EVENT_AXIS_GENERIC_13, - Generic14 = ndk_sys::AMOTION_EVENT_AXIS_GENERIC_14, - Generic15 = ndk_sys::AMOTION_EVENT_AXIS_GENERIC_15, - Generic16 = ndk_sys::AMOTION_EVENT_AXIS_GENERIC_16, -} - -/// The tool type of a pointer. -/// -/// See [the NDK docs](https://developer.android.com/ndk/reference/group/input#anonymous-enum-48) -#[derive(Copy, Clone, Debug, PartialEq, Eq, TryFromPrimitive, IntoPrimitive)] -#[repr(u32)] -pub enum ToolType { - Unknown = ndk_sys::AMOTION_EVENT_TOOL_TYPE_UNKNOWN, - Finger = ndk_sys::AMOTION_EVENT_TOOL_TYPE_FINGER, - Stylus = ndk_sys::AMOTION_EVENT_TOOL_TYPE_STYLUS, - Mouse = ndk_sys::AMOTION_EVENT_TOOL_TYPE_MOUSE, - Eraser = ndk_sys::AMOTION_EVENT_TOOL_TYPE_ERASER, - Palm = ndk_sys::AMOTION_EVENT_TOOL_TYPE_PALM, -} - -/// A bitfield representing the state of buttons during a motion event. -/// -/// See [the NDK docs](https://developer.android.com/ndk/reference/group/input#anonymous-enum-33) -#[derive(Copy, Clone, Debug, PartialEq, Eq)] -pub struct ButtonState(pub u32); - -impl ButtonState { - #[inline] - pub fn primary(self) -> bool { - self.0 & ndk_sys::AMOTION_EVENT_BUTTON_PRIMARY != 0 - } - #[inline] - pub fn secondary(self) -> bool { - self.0 & ndk_sys::AMOTION_EVENT_BUTTON_SECONDARY != 0 - } - #[inline] - pub fn teriary(self) -> bool { - self.0 & ndk_sys::AMOTION_EVENT_BUTTON_TERTIARY != 0 - } - #[inline] - pub fn back(self) -> bool { - self.0 & ndk_sys::AMOTION_EVENT_BUTTON_BACK != 0 - } - #[inline] - pub fn forward(self) -> bool { - self.0 & ndk_sys::AMOTION_EVENT_BUTTON_FORWARD != 0 - } - #[inline] - pub fn stylus_primary(self) -> bool { - self.0 & ndk_sys::AMOTION_EVENT_BUTTON_STYLUS_PRIMARY != 0 - } - #[inline] - pub fn stylus_secondary(self) -> bool { - self.0 & ndk_sys::AMOTION_EVENT_BUTTON_STYLUS_SECONDARY != 0 - } -} - -/// A bitfield representing which edges were touched by a motion event. -/// -/// See [the NDK docs](https://developer.android.com/ndk/reference/group/input#anonymous-enum-31) -#[derive(Copy, Clone, Debug, PartialEq, Eq)] -pub struct EdgeFlags(pub u32); - -impl EdgeFlags { - #[inline] - pub fn top(self) -> bool { - self.0 & ndk_sys::AMOTION_EVENT_EDGE_FLAG_TOP != 0 - } - #[inline] - pub fn bottom(self) -> bool { - self.0 & ndk_sys::AMOTION_EVENT_EDGE_FLAG_BOTTOM != 0 - } - #[inline] - pub fn left(self) -> bool { - self.0 & ndk_sys::AMOTION_EVENT_EDGE_FLAG_LEFT != 0 - } - #[inline] - pub fn right(self) -> bool { - self.0 & ndk_sys::AMOTION_EVENT_EDGE_FLAG_RIGHT != 0 - } -} - -/// Flags associated with this [`MotionEvent`]. -/// -/// See [the NDK docs](https://developer.android.com/ndk/reference/group/input#anonymous-enum-30) -#[derive(Copy, Clone, Debug, PartialEq, Eq)] -pub struct MotionEventFlags(pub u32); - -impl MotionEventFlags { - #[inline] - pub fn window_is_obscured(self) -> bool { - self.0 & ndk_sys::AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED != 0 - } -} - impl<'a> MotionEvent<'a> { pub(crate) fn new(ga_event: &'a GameActivityMotionEvent) -> Self { Self { ga_event } @@ -295,22 +49,15 @@ impl<'a> MotionEvent<'a> { /// #[inline] pub fn source(&self) -> Source { - let source = self.source as u32; - source.try_into().unwrap_or(Source::Unknown) - } - - /// Get the class of the event source. - /// - #[inline] - pub fn class(&self) -> Class { - Class::from(self.source()) + let source = self.ga_event.source; + source.into() } /// Get the device id associated with the event. /// #[inline] pub fn device_id(&self) -> i32 { - self.deviceId + self.ga_event.deviceId } /// Returns the motion action associated with the event. @@ -318,8 +65,20 @@ impl<'a> MotionEvent<'a> { /// See [the MotionEvent docs](https://developer.android.com/reference/android/view/MotionEvent#getActionMasked()) #[inline] pub fn action(&self) -> MotionAction { - let action = self.action as u32 & ndk_sys::AMOTION_EVENT_ACTION_MASK; - action.try_into().unwrap() + let action = self.ga_event.action & ndk_sys::AMOTION_EVENT_ACTION_MASK as i32; + action.into() + } + + /// Returns which button has been modified during a press or release action. + /// + /// For actions other than [`MotionAction::ButtonPress`] and + /// [`MotionAction::ButtonRelease`] the returned value is undefined. + /// + /// See [the MotionEvent docs](https://developer.android.com/reference/android/view/MotionEvent#getActionButton()) + #[inline] + pub fn action_button(&self) -> Button { + let action = self.ga_event.actionButton as u32; + action.into() } /// Returns the pointer index of an `Up` or `Down` event. @@ -327,12 +86,12 @@ impl<'a> MotionEvent<'a> { /// Pointer indices can change per motion event. For an identifier that stays the same, see /// [`Pointer::pointer_id()`]. /// - /// This only has a meaning when the [action](Self::action) is one of [`Up`](MotionAction::Up), + /// This only has a meaning when the [action](self::action) is one of [`Up`](MotionAction::Up), /// [`Down`](MotionAction::Down), [`PointerUp`](MotionAction::PointerUp), /// or [`PointerDown`](MotionAction::PointerDown). #[inline] pub fn pointer_index(&self) -> usize { - let action = self.action as u32 & ndk_sys::AMOTION_EVENT_ACTION_MASK; + let action = self.ga_event.action as u32; let index = (action & ndk_sys::AMOTION_EVENT_ACTION_POINTER_INDEX_MASK) >> ndk_sys::AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT; index as usize @@ -345,8 +104,8 @@ impl<'a> MotionEvent<'a> { /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_getpointerid) // TODO: look at output with out-of-range pointer index // Probably -1 though - pub fn pointer_id_for(&self, pointer_index: usize) -> i32 { - unsafe { ndk_sys::AMotionEvent_getPointerId(self.ptr.as_ptr(), pointer_index) } + pub fn pointer_id_for(&self.ga_event, pointer_index: usize) -> i32 { + unsafe { ndk_sys::AMotionEvent_getPointerId(self.ga_event.ptr.as_ptr(), pointer_index) } } */ @@ -355,28 +114,32 @@ impl<'a> MotionEvent<'a> { /// See [the MotionEvent docs](https://developer.android.com/reference/android/view/MotionEvent#getPointerCount()) #[inline] pub fn pointer_count(&self) -> usize { - self.pointerCount as usize + self.ga_event.pointerCount as usize } /// An iterator over the pointers in this motion event #[inline] pub fn pointers(&self) -> PointersIter<'_> { PointersIter { - event: self, - next_index: 0, - count: self.pointer_count(), + inner: PointersIterImpl { + event: self, + next_index: 0, + count: self.pointer_count(), + }, } } /// The pointer at a given pointer index. Panics if the pointer index is out of bounds. /// - /// If you need to loop over all the pointers, prefer the [`pointers()`](Self::pointers) method. + /// If you need to loop over all the pointers, prefer the [`pointers()`](self::pointers) method. #[inline] pub fn pointer_at_index(&self, index: usize) -> Pointer<'_> { if index >= self.pointer_count() { panic!("Pointer index {} is out of bounds", index); } - Pointer { event: self, index } + Pointer { + inner: PointerImpl { event: self, index }, + } } /* @@ -386,14 +149,14 @@ impl<'a> MotionEvent<'a> { /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_gethistorysize) #[inline] pub fn history_size(&self) -> usize { - unsafe { ndk_sys::AMotionEvent_getHistorySize(self.ptr.as_ptr()) as usize } + unsafe { ndk_sys::AMotionEvent_getHistorySize(self.ga_event.ptr.as_ptr()) as usize } } /// An iterator over the historical events contained in this event. #[inline] pub fn history(&self) -> HistoricalMotionEventsIter<'_> { HistoricalMotionEventsIter { - event: self.ptr, + event: self.ga_event.ptr, next_history_index: 0, history_size: self.history_size(), _marker: std::marker::PhantomData, @@ -407,7 +170,7 @@ impl<'a> MotionEvent<'a> { /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_getmetastate) #[inline] pub fn meta_state(&self) -> MetaState { - MetaState(self.metaState as u32) + MetaState(self.ga_event.metaState as u32) } /// Returns the button state during this event, as a bitfield. @@ -415,8 +178,9 @@ impl<'a> MotionEvent<'a> { /// See [the NDK /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_getbuttonstate) #[inline] + // TODO: Button enum to signify only one bitflag can be set? pub fn button_state(&self) -> ButtonState { - ButtonState(self.buttonState as u32) + ButtonState(self.ga_event.buttonState as u32) } /// Returns the time of the start of this gesture, in the `java.lang.System.nanoTime()` time @@ -426,7 +190,7 @@ impl<'a> MotionEvent<'a> { /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_getdowntime) #[inline] pub fn down_time(&self) -> i64 { - self.downTime + self.ga_event.downTime } /// Returns a bitfield indicating which edges were touched by this event. @@ -435,7 +199,7 @@ impl<'a> MotionEvent<'a> { /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_getedgeflags) #[inline] pub fn edge_flags(&self) -> EdgeFlags { - EdgeFlags(self.edgeFlags as u32) + EdgeFlags(self.ga_event.edgeFlags as u32) } /// Returns the time of this event, in the `java.lang.System.nanoTime()` time base @@ -444,7 +208,7 @@ impl<'a> MotionEvent<'a> { /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_geteventtime) #[inline] pub fn event_time(&self) -> i64 { - self.eventTime + self.ga_event.eventTime } /// The flags associated with a motion event. @@ -453,7 +217,7 @@ impl<'a> MotionEvent<'a> { /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_getflags) #[inline] pub fn flags(&self) -> MotionEventFlags { - MotionEventFlags(self.flags as u32) + MotionEventFlags(self.ga_event.flags as u32) } /* Missing from GameActivity currently... @@ -462,8 +226,8 @@ impl<'a> MotionEvent<'a> { /// See [the NDK /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_getxoffset) #[inline] - pub fn x_offset(&self) -> f32 { - self.x_offset + pub fn x_offset(&self.ga_event) -> f32 { + self.ga_event.x_offset } /// Returns the offset in the y direction between the coordinates and the raw coordinates @@ -471,8 +235,8 @@ impl<'a> MotionEvent<'a> { /// See [the NDK /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_getyoffset) #[inline] - pub fn y_offset(&self) -> f32 { - self.y_offset + pub fn y_offset(&self.ga_event) -> f32 { + self.ga_event.y_offset } */ @@ -482,7 +246,7 @@ impl<'a> MotionEvent<'a> { /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_getxprecision) #[inline] pub fn x_precision(&self) -> f32 { - self.precisionX + self.ga_event.precisionX } /// Returns the precision of the y value of the coordinates @@ -491,18 +255,18 @@ impl<'a> MotionEvent<'a> { /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_getyprecision) #[inline] pub fn y_precision(&self) -> f32 { - self.precisionY + self.ga_event.precisionY } } /// A view into the data of a specific pointer in a motion event. #[derive(Debug)] -pub struct Pointer<'a> { +pub(crate) struct PointerImpl<'a> { event: &'a MotionEvent<'a>, index: usize, } -impl<'a> Pointer<'a> { +impl PointerImpl<'_> { #[inline] pub fn pointer_index(&self) -> usize { self.index @@ -510,96 +274,53 @@ impl<'a> Pointer<'a> { #[inline] pub fn pointer_id(&self) -> i32 { - let pointer = &self.event.pointers[self.index]; + let pointer = &self.event.ga_event.pointers[self.index]; pointer.id } #[inline] pub fn axis_value(&self, axis: Axis) -> f32 { - let pointer = &self.event.pointers[self.index]; - pointer.axisValues[axis as u32 as usize] - } - - #[inline] - pub fn orientation(&self) -> f32 { - self.axis_value(Axis::Orientation) - } - - #[inline] - pub fn pressure(&self) -> f32 { - self.axis_value(Axis::Pressure) + let pointer = &self.event.ga_event.pointers[self.index]; + let axis: i32 = axis.into(); + pointer.axisValues[axis as usize] } #[inline] pub fn raw_x(&self) -> f32 { - let pointer = &self.event.pointers[self.index]; + let pointer = &self.event.ga_event.pointers[self.index]; pointer.rawX } #[inline] pub fn raw_y(&self) -> f32 { - let pointer = &self.event.pointers[self.index]; + let pointer = &self.event.ga_event.pointers[self.index]; pointer.rawY } - #[inline] - pub fn x(&self) -> f32 { - self.axis_value(Axis::X) - } - - #[inline] - pub fn y(&self) -> f32 { - self.axis_value(Axis::Y) - } - - #[inline] - pub fn size(&self) -> f32 { - self.axis_value(Axis::Size) - } - - #[inline] - pub fn tool_major(&self) -> f32 { - self.axis_value(Axis::ToolMajor) - } - - #[inline] - pub fn tool_minor(&self) -> f32 { - self.axis_value(Axis::ToolMinor) - } - - #[inline] - pub fn touch_major(&self) -> f32 { - self.axis_value(Axis::TouchMajor) - } - - #[inline] - pub fn touch_minor(&self) -> f32 { - self.axis_value(Axis::TouchMinor) - } - #[inline] pub fn tool_type(&self) -> ToolType { - let pointer = &self.event.pointers[self.index]; - let tool_type = pointer.toolType as u32; - tool_type.try_into().unwrap() + let pointer = &self.event.ga_event.pointers[self.index]; + pointer.toolType.into() } } /// An iterator over the pointers in a [`MotionEvent`]. #[derive(Debug)] -pub struct PointersIter<'a> { +pub(crate) struct PointersIterImpl<'a> { event: &'a MotionEvent<'a>, next_index: usize, count: usize, } -impl<'a> Iterator for PointersIter<'a> { +impl<'a> Iterator for PointersIterImpl<'a> { type Item = Pointer<'a>; fn next(&mut self) -> Option> { if self.next_index < self.count { let ptr = Pointer { - event: self.event, - index: self.next_index, + inner: PointerImpl { + event: self.event, + index: self.next_index, + }, }; self.next_index += 1; Some(ptr) @@ -614,7 +335,7 @@ impl<'a> Iterator for PointersIter<'a> { } } -impl<'a> ExactSizeIterator for PointersIter<'a> { +impl ExactSizeIterator for PointersIterImpl<'_> { fn len(&self) -> usize { self.count - self.next_index } @@ -937,322 +658,6 @@ pub struct KeyEvent<'a> { ga_event: &'a GameActivityKeyEvent, } -impl<'a> Deref for KeyEvent<'a> { - type Target = GameActivityKeyEvent; - - fn deref(&self) -> &Self::Target { - self.ga_event - } -} - -/// Key actions. -/// -/// See [the NDK docs](https://developer.android.com/ndk/reference/group/input#anonymous-enum-27) -#[derive(Copy, Clone, Debug, PartialEq, Eq, TryFromPrimitive, IntoPrimitive)] -#[repr(u32)] -pub enum KeyAction { - Down = ndk_sys::AKEY_EVENT_ACTION_DOWN, - Up = ndk_sys::AKEY_EVENT_ACTION_UP, - Multiple = ndk_sys::AKEY_EVENT_ACTION_MULTIPLE, -} - -/// Key codes. -/// -/// See [the NDK docs](https://developer.android.com/ndk/reference/group/input#anonymous-enum-39) -#[derive(Copy, Clone, Debug, PartialEq, Eq, TryFromPrimitive, IntoPrimitive)] -#[repr(u32)] -pub enum Keycode { - Unknown = ndk_sys::AKEYCODE_UNKNOWN, - SoftLeft = ndk_sys::AKEYCODE_SOFT_LEFT, - SoftRight = ndk_sys::AKEYCODE_SOFT_RIGHT, - Home = ndk_sys::AKEYCODE_HOME, - Back = ndk_sys::AKEYCODE_BACK, - Call = ndk_sys::AKEYCODE_CALL, - Endcall = ndk_sys::AKEYCODE_ENDCALL, - Keycode0 = ndk_sys::AKEYCODE_0, - Keycode1 = ndk_sys::AKEYCODE_1, - Keycode2 = ndk_sys::AKEYCODE_2, - Keycode3 = ndk_sys::AKEYCODE_3, - Keycode4 = ndk_sys::AKEYCODE_4, - Keycode5 = ndk_sys::AKEYCODE_5, - Keycode6 = ndk_sys::AKEYCODE_6, - Keycode7 = ndk_sys::AKEYCODE_7, - Keycode8 = ndk_sys::AKEYCODE_8, - Keycode9 = ndk_sys::AKEYCODE_9, - Star = ndk_sys::AKEYCODE_STAR, - Pound = ndk_sys::AKEYCODE_POUND, - DpadUp = ndk_sys::AKEYCODE_DPAD_UP, - DpadDown = ndk_sys::AKEYCODE_DPAD_DOWN, - DpadLeft = ndk_sys::AKEYCODE_DPAD_LEFT, - DpadRight = ndk_sys::AKEYCODE_DPAD_RIGHT, - DpadCenter = ndk_sys::AKEYCODE_DPAD_CENTER, - VolumeUp = ndk_sys::AKEYCODE_VOLUME_UP, - VolumeDown = ndk_sys::AKEYCODE_VOLUME_DOWN, - Power = ndk_sys::AKEYCODE_POWER, - Camera = ndk_sys::AKEYCODE_CAMERA, - Clear = ndk_sys::AKEYCODE_CLEAR, - A = ndk_sys::AKEYCODE_A, - B = ndk_sys::AKEYCODE_B, - C = ndk_sys::AKEYCODE_C, - D = ndk_sys::AKEYCODE_D, - E = ndk_sys::AKEYCODE_E, - F = ndk_sys::AKEYCODE_F, - G = ndk_sys::AKEYCODE_G, - H = ndk_sys::AKEYCODE_H, - I = ndk_sys::AKEYCODE_I, - J = ndk_sys::AKEYCODE_J, - K = ndk_sys::AKEYCODE_K, - L = ndk_sys::AKEYCODE_L, - M = ndk_sys::AKEYCODE_M, - N = ndk_sys::AKEYCODE_N, - O = ndk_sys::AKEYCODE_O, - P = ndk_sys::AKEYCODE_P, - Q = ndk_sys::AKEYCODE_Q, - R = ndk_sys::AKEYCODE_R, - S = ndk_sys::AKEYCODE_S, - T = ndk_sys::AKEYCODE_T, - U = ndk_sys::AKEYCODE_U, - V = ndk_sys::AKEYCODE_V, - W = ndk_sys::AKEYCODE_W, - X = ndk_sys::AKEYCODE_X, - Y = ndk_sys::AKEYCODE_Y, - Z = ndk_sys::AKEYCODE_Z, - Comma = ndk_sys::AKEYCODE_COMMA, - Period = ndk_sys::AKEYCODE_PERIOD, - AltLeft = ndk_sys::AKEYCODE_ALT_LEFT, - AltRight = ndk_sys::AKEYCODE_ALT_RIGHT, - ShiftLeft = ndk_sys::AKEYCODE_SHIFT_LEFT, - ShiftRight = ndk_sys::AKEYCODE_SHIFT_RIGHT, - Tab = ndk_sys::AKEYCODE_TAB, - Space = ndk_sys::AKEYCODE_SPACE, - Sym = ndk_sys::AKEYCODE_SYM, - Explorer = ndk_sys::AKEYCODE_EXPLORER, - Envelope = ndk_sys::AKEYCODE_ENVELOPE, - Enter = ndk_sys::AKEYCODE_ENTER, - Del = ndk_sys::AKEYCODE_DEL, - Grave = ndk_sys::AKEYCODE_GRAVE, - Minus = ndk_sys::AKEYCODE_MINUS, - Equals = ndk_sys::AKEYCODE_EQUALS, - LeftBracket = ndk_sys::AKEYCODE_LEFT_BRACKET, - RightBracket = ndk_sys::AKEYCODE_RIGHT_BRACKET, - Backslash = ndk_sys::AKEYCODE_BACKSLASH, - Semicolon = ndk_sys::AKEYCODE_SEMICOLON, - Apostrophe = ndk_sys::AKEYCODE_APOSTROPHE, - Slash = ndk_sys::AKEYCODE_SLASH, - At = ndk_sys::AKEYCODE_AT, - Num = ndk_sys::AKEYCODE_NUM, - Headsethook = ndk_sys::AKEYCODE_HEADSETHOOK, - Focus = ndk_sys::AKEYCODE_FOCUS, - Plus = ndk_sys::AKEYCODE_PLUS, - Menu = ndk_sys::AKEYCODE_MENU, - Notification = ndk_sys::AKEYCODE_NOTIFICATION, - Search = ndk_sys::AKEYCODE_SEARCH, - MediaPlayPause = ndk_sys::AKEYCODE_MEDIA_PLAY_PAUSE, - MediaStop = ndk_sys::AKEYCODE_MEDIA_STOP, - MediaNext = ndk_sys::AKEYCODE_MEDIA_NEXT, - MediaPrevious = ndk_sys::AKEYCODE_MEDIA_PREVIOUS, - MediaRewind = ndk_sys::AKEYCODE_MEDIA_REWIND, - MediaFastForward = ndk_sys::AKEYCODE_MEDIA_FAST_FORWARD, - Mute = ndk_sys::AKEYCODE_MUTE, - PageUp = ndk_sys::AKEYCODE_PAGE_UP, - PageDown = ndk_sys::AKEYCODE_PAGE_DOWN, - Pictsymbols = ndk_sys::AKEYCODE_PICTSYMBOLS, - SwitchCharset = ndk_sys::AKEYCODE_SWITCH_CHARSET, - ButtonA = ndk_sys::AKEYCODE_BUTTON_A, - ButtonB = ndk_sys::AKEYCODE_BUTTON_B, - ButtonC = ndk_sys::AKEYCODE_BUTTON_C, - ButtonX = ndk_sys::AKEYCODE_BUTTON_X, - ButtonY = ndk_sys::AKEYCODE_BUTTON_Y, - ButtonZ = ndk_sys::AKEYCODE_BUTTON_Z, - ButtonL1 = ndk_sys::AKEYCODE_BUTTON_L1, - ButtonR1 = ndk_sys::AKEYCODE_BUTTON_R1, - ButtonL2 = ndk_sys::AKEYCODE_BUTTON_L2, - ButtonR2 = ndk_sys::AKEYCODE_BUTTON_R2, - ButtonThumbl = ndk_sys::AKEYCODE_BUTTON_THUMBL, - ButtonThumbr = ndk_sys::AKEYCODE_BUTTON_THUMBR, - ButtonStart = ndk_sys::AKEYCODE_BUTTON_START, - ButtonSelect = ndk_sys::AKEYCODE_BUTTON_SELECT, - ButtonMode = ndk_sys::AKEYCODE_BUTTON_MODE, - Escape = ndk_sys::AKEYCODE_ESCAPE, - ForwardDel = ndk_sys::AKEYCODE_FORWARD_DEL, - CtrlLeft = ndk_sys::AKEYCODE_CTRL_LEFT, - CtrlRight = ndk_sys::AKEYCODE_CTRL_RIGHT, - CapsLock = ndk_sys::AKEYCODE_CAPS_LOCK, - ScrollLock = ndk_sys::AKEYCODE_SCROLL_LOCK, - MetaLeft = ndk_sys::AKEYCODE_META_LEFT, - MetaRight = ndk_sys::AKEYCODE_META_RIGHT, - Function = ndk_sys::AKEYCODE_FUNCTION, - Sysrq = ndk_sys::AKEYCODE_SYSRQ, - Break = ndk_sys::AKEYCODE_BREAK, - MoveHome = ndk_sys::AKEYCODE_MOVE_HOME, - MoveEnd = ndk_sys::AKEYCODE_MOVE_END, - Insert = ndk_sys::AKEYCODE_INSERT, - Forward = ndk_sys::AKEYCODE_FORWARD, - MediaPlay = ndk_sys::AKEYCODE_MEDIA_PLAY, - MediaPause = ndk_sys::AKEYCODE_MEDIA_PAUSE, - MediaClose = ndk_sys::AKEYCODE_MEDIA_CLOSE, - MediaEject = ndk_sys::AKEYCODE_MEDIA_EJECT, - MediaRecord = ndk_sys::AKEYCODE_MEDIA_RECORD, - F1 = ndk_sys::AKEYCODE_F1, - F2 = ndk_sys::AKEYCODE_F2, - F3 = ndk_sys::AKEYCODE_F3, - F4 = ndk_sys::AKEYCODE_F4, - F5 = ndk_sys::AKEYCODE_F5, - F6 = ndk_sys::AKEYCODE_F6, - F7 = ndk_sys::AKEYCODE_F7, - F8 = ndk_sys::AKEYCODE_F8, - F9 = ndk_sys::AKEYCODE_F9, - F10 = ndk_sys::AKEYCODE_F10, - F11 = ndk_sys::AKEYCODE_F11, - F12 = ndk_sys::AKEYCODE_F12, - NumLock = ndk_sys::AKEYCODE_NUM_LOCK, - Numpad0 = ndk_sys::AKEYCODE_NUMPAD_0, - Numpad1 = ndk_sys::AKEYCODE_NUMPAD_1, - Numpad2 = ndk_sys::AKEYCODE_NUMPAD_2, - Numpad3 = ndk_sys::AKEYCODE_NUMPAD_3, - Numpad4 = ndk_sys::AKEYCODE_NUMPAD_4, - Numpad5 = ndk_sys::AKEYCODE_NUMPAD_5, - Numpad6 = ndk_sys::AKEYCODE_NUMPAD_6, - Numpad7 = ndk_sys::AKEYCODE_NUMPAD_7, - Numpad8 = ndk_sys::AKEYCODE_NUMPAD_8, - Numpad9 = ndk_sys::AKEYCODE_NUMPAD_9, - NumpadDivide = ndk_sys::AKEYCODE_NUMPAD_DIVIDE, - NumpadMultiply = ndk_sys::AKEYCODE_NUMPAD_MULTIPLY, - NumpadSubtract = ndk_sys::AKEYCODE_NUMPAD_SUBTRACT, - NumpadAdd = ndk_sys::AKEYCODE_NUMPAD_ADD, - NumpadDot = ndk_sys::AKEYCODE_NUMPAD_DOT, - NumpadComma = ndk_sys::AKEYCODE_NUMPAD_COMMA, - NumpadEnter = ndk_sys::AKEYCODE_NUMPAD_ENTER, - NumpadEquals = ndk_sys::AKEYCODE_NUMPAD_EQUALS, - NumpadLeftParen = ndk_sys::AKEYCODE_NUMPAD_LEFT_PAREN, - NumpadRightParen = ndk_sys::AKEYCODE_NUMPAD_RIGHT_PAREN, - VolumeMute = ndk_sys::AKEYCODE_VOLUME_MUTE, - Info = ndk_sys::AKEYCODE_INFO, - ChannelUp = ndk_sys::AKEYCODE_CHANNEL_UP, - ChannelDown = ndk_sys::AKEYCODE_CHANNEL_DOWN, - ZoomIn = ndk_sys::AKEYCODE_ZOOM_IN, - ZoomOut = ndk_sys::AKEYCODE_ZOOM_OUT, - Tv = ndk_sys::AKEYCODE_TV, - Window = ndk_sys::AKEYCODE_WINDOW, - Guide = ndk_sys::AKEYCODE_GUIDE, - Dvr = ndk_sys::AKEYCODE_DVR, - Bookmark = ndk_sys::AKEYCODE_BOOKMARK, - Captions = ndk_sys::AKEYCODE_CAPTIONS, - Settings = ndk_sys::AKEYCODE_SETTINGS, - TvPower = ndk_sys::AKEYCODE_TV_POWER, - TvInput = ndk_sys::AKEYCODE_TV_INPUT, - StbPower = ndk_sys::AKEYCODE_STB_POWER, - StbInput = ndk_sys::AKEYCODE_STB_INPUT, - AvrPower = ndk_sys::AKEYCODE_AVR_POWER, - AvrInput = ndk_sys::AKEYCODE_AVR_INPUT, - ProgRed = ndk_sys::AKEYCODE_PROG_RED, - ProgGreen = ndk_sys::AKEYCODE_PROG_GREEN, - ProgYellow = ndk_sys::AKEYCODE_PROG_YELLOW, - ProgBlue = ndk_sys::AKEYCODE_PROG_BLUE, - AppSwitch = ndk_sys::AKEYCODE_APP_SWITCH, - Button1 = ndk_sys::AKEYCODE_BUTTON_1, - Button2 = ndk_sys::AKEYCODE_BUTTON_2, - Button3 = ndk_sys::AKEYCODE_BUTTON_3, - Button4 = ndk_sys::AKEYCODE_BUTTON_4, - Button5 = ndk_sys::AKEYCODE_BUTTON_5, - Button6 = ndk_sys::AKEYCODE_BUTTON_6, - Button7 = ndk_sys::AKEYCODE_BUTTON_7, - Button8 = ndk_sys::AKEYCODE_BUTTON_8, - Button9 = ndk_sys::AKEYCODE_BUTTON_9, - Button10 = ndk_sys::AKEYCODE_BUTTON_10, - Button11 = ndk_sys::AKEYCODE_BUTTON_11, - Button12 = ndk_sys::AKEYCODE_BUTTON_12, - Button13 = ndk_sys::AKEYCODE_BUTTON_13, - Button14 = ndk_sys::AKEYCODE_BUTTON_14, - Button15 = ndk_sys::AKEYCODE_BUTTON_15, - Button16 = ndk_sys::AKEYCODE_BUTTON_16, - LanguageSwitch = ndk_sys::AKEYCODE_LANGUAGE_SWITCH, - MannerMode = ndk_sys::AKEYCODE_MANNER_MODE, - Keycode3dMode = ndk_sys::AKEYCODE_3D_MODE, - Contacts = ndk_sys::AKEYCODE_CONTACTS, - Calendar = ndk_sys::AKEYCODE_CALENDAR, - Music = ndk_sys::AKEYCODE_MUSIC, - Calculator = ndk_sys::AKEYCODE_CALCULATOR, - ZenkakuHankaku = ndk_sys::AKEYCODE_ZENKAKU_HANKAKU, - Eisu = ndk_sys::AKEYCODE_EISU, - Muhenkan = ndk_sys::AKEYCODE_MUHENKAN, - Henkan = ndk_sys::AKEYCODE_HENKAN, - KatakanaHiragana = ndk_sys::AKEYCODE_KATAKANA_HIRAGANA, - Yen = ndk_sys::AKEYCODE_YEN, - Ro = ndk_sys::AKEYCODE_RO, - Kana = ndk_sys::AKEYCODE_KANA, - Assist = ndk_sys::AKEYCODE_ASSIST, - BrightnessDown = ndk_sys::AKEYCODE_BRIGHTNESS_DOWN, - BrightnessUp = ndk_sys::AKEYCODE_BRIGHTNESS_UP, - MediaAudioTrack = ndk_sys::AKEYCODE_MEDIA_AUDIO_TRACK, - Sleep = ndk_sys::AKEYCODE_SLEEP, - Wakeup = ndk_sys::AKEYCODE_WAKEUP, - Pairing = ndk_sys::AKEYCODE_PAIRING, - MediaTopMenu = ndk_sys::AKEYCODE_MEDIA_TOP_MENU, - Keycode11 = ndk_sys::AKEYCODE_11, - Keycode12 = ndk_sys::AKEYCODE_12, - LastChannel = ndk_sys::AKEYCODE_LAST_CHANNEL, - TvDataService = ndk_sys::AKEYCODE_TV_DATA_SERVICE, - VoiceAssist = ndk_sys::AKEYCODE_VOICE_ASSIST, - TvRadioService = ndk_sys::AKEYCODE_TV_RADIO_SERVICE, - TvTeletext = ndk_sys::AKEYCODE_TV_TELETEXT, - TvNumberEntry = ndk_sys::AKEYCODE_TV_NUMBER_ENTRY, - TvTerrestrialAnalog = ndk_sys::AKEYCODE_TV_TERRESTRIAL_ANALOG, - TvTerrestrialDigital = ndk_sys::AKEYCODE_TV_TERRESTRIAL_DIGITAL, - TvSatellite = ndk_sys::AKEYCODE_TV_SATELLITE, - TvSatelliteBs = ndk_sys::AKEYCODE_TV_SATELLITE_BS, - TvSatelliteCs = ndk_sys::AKEYCODE_TV_SATELLITE_CS, - TvSatelliteService = ndk_sys::AKEYCODE_TV_SATELLITE_SERVICE, - TvNetwork = ndk_sys::AKEYCODE_TV_NETWORK, - TvAntennaCable = ndk_sys::AKEYCODE_TV_ANTENNA_CABLE, - TvInputHdmi1 = ndk_sys::AKEYCODE_TV_INPUT_HDMI_1, - TvInputHdmi2 = ndk_sys::AKEYCODE_TV_INPUT_HDMI_2, - TvInputHdmi3 = ndk_sys::AKEYCODE_TV_INPUT_HDMI_3, - TvInputHdmi4 = ndk_sys::AKEYCODE_TV_INPUT_HDMI_4, - TvInputComposite1 = ndk_sys::AKEYCODE_TV_INPUT_COMPOSITE_1, - TvInputComposite2 = ndk_sys::AKEYCODE_TV_INPUT_COMPOSITE_2, - TvInputComponent1 = ndk_sys::AKEYCODE_TV_INPUT_COMPONENT_1, - TvInputComponent2 = ndk_sys::AKEYCODE_TV_INPUT_COMPONENT_2, - TvInputVga1 = ndk_sys::AKEYCODE_TV_INPUT_VGA_1, - TvAudioDescription = ndk_sys::AKEYCODE_TV_AUDIO_DESCRIPTION, - TvAudioDescriptionMixUp = ndk_sys::AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_UP, - TvAudioDescriptionMixDown = ndk_sys::AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_DOWN, - TvZoomMode = ndk_sys::AKEYCODE_TV_ZOOM_MODE, - TvContentsMenu = ndk_sys::AKEYCODE_TV_CONTENTS_MENU, - TvMediaContextMenu = ndk_sys::AKEYCODE_TV_MEDIA_CONTEXT_MENU, - TvTimerProgramming = ndk_sys::AKEYCODE_TV_TIMER_PROGRAMMING, - Help = ndk_sys::AKEYCODE_HELP, - NavigatePrevious = ndk_sys::AKEYCODE_NAVIGATE_PREVIOUS, - NavigateNext = ndk_sys::AKEYCODE_NAVIGATE_NEXT, - NavigateIn = ndk_sys::AKEYCODE_NAVIGATE_IN, - NavigateOut = ndk_sys::AKEYCODE_NAVIGATE_OUT, - StemPrimary = ndk_sys::AKEYCODE_STEM_PRIMARY, - Stem1 = ndk_sys::AKEYCODE_STEM_1, - Stem2 = ndk_sys::AKEYCODE_STEM_2, - Stem3 = ndk_sys::AKEYCODE_STEM_3, - DpadUpLeft = ndk_sys::AKEYCODE_DPAD_UP_LEFT, - DpadDownLeft = ndk_sys::AKEYCODE_DPAD_DOWN_LEFT, - DpadUpRight = ndk_sys::AKEYCODE_DPAD_UP_RIGHT, - DpadDownRight = ndk_sys::AKEYCODE_DPAD_DOWN_RIGHT, - MediaSkipForward = ndk_sys::AKEYCODE_MEDIA_SKIP_FORWARD, - MediaSkipBackward = ndk_sys::AKEYCODE_MEDIA_SKIP_BACKWARD, - MediaStepForward = ndk_sys::AKEYCODE_MEDIA_STEP_FORWARD, - MediaStepBackward = ndk_sys::AKEYCODE_MEDIA_STEP_BACKWARD, - SoftSleep = ndk_sys::AKEYCODE_SOFT_SLEEP, - Cut = ndk_sys::AKEYCODE_CUT, - Copy = ndk_sys::AKEYCODE_COPY, - Paste = ndk_sys::AKEYCODE_PASTE, - SystemNavigationUp = ndk_sys::AKEYCODE_SYSTEM_NAVIGATION_UP, - SystemNavigationDown = ndk_sys::AKEYCODE_SYSTEM_NAVIGATION_DOWN, - SystemNavigationLeft = ndk_sys::AKEYCODE_SYSTEM_NAVIGATION_LEFT, - SystemNavigationRight = ndk_sys::AKEYCODE_SYSTEM_NAVIGATION_RIGHT, - AllApps = ndk_sys::AKEYCODE_ALL_APPS, - Refresh = ndk_sys::AKEYCODE_REFRESH, - ThumbsUp = ndk_sys::AKEYCODE_THUMBS_UP, - ThumbsDown = ndk_sys::AKEYCODE_THUMBS_DOWN, - ProfileSwitch = ndk_sys::AKEYCODE_PROFILE_SWITCH, -} - impl<'a> KeyEvent<'a> { pub(crate) fn new(ga_event: &'a GameActivityKeyEvent) -> Self { Self { ga_event } @@ -1262,22 +667,15 @@ impl<'a> KeyEvent<'a> { /// #[inline] pub fn source(&self) -> Source { - let source = self.source as u32; - source.try_into().unwrap_or(Source::Unknown) - } - - /// Get the class of the event source. - /// - #[inline] - pub fn class(&self) -> Class { - Class::from(self.source()) + let source = self.ga_event.source; + source.into() } /// Get the device id associated with the event. /// #[inline] pub fn device_id(&self) -> i32 { - self.deviceId + self.ga_event.deviceId } /// Returns the key action associated with the event. @@ -1285,8 +683,14 @@ impl<'a> KeyEvent<'a> { /// See [the KeyEvent docs](https://developer.android.com/reference/android/view/KeyEvent#getAction()) #[inline] pub fn action(&self) -> KeyAction { - let action = self.action as u32; - action.try_into().unwrap() + let action = self.ga_event.action; + action.into() + } + + #[inline] + pub fn action_button(&self) -> KeyAction { + let action = self.ga_event.action; + action.into() } /// Returns the last time the key was pressed. This is on the scale of @@ -1296,7 +700,7 @@ impl<'a> KeyEvent<'a> { /// docs](https://developer.android.com/ndk/reference/group/input#akeyevent_getdowntime) #[inline] pub fn down_time(&self) -> i64 { - self.downTime + self.ga_event.downTime } /// Returns the time this event occured. This is on the scale of @@ -1306,7 +710,7 @@ impl<'a> KeyEvent<'a> { /// docs](https://developer.android.com/ndk/reference/group/input#akeyevent_geteventtime) #[inline] pub fn event_time(&self) -> i64 { - self.eventTime + self.ga_event.eventTime } /// Returns the keycode associated with this key event @@ -1315,8 +719,8 @@ impl<'a> KeyEvent<'a> { /// docs](https://developer.android.com/ndk/reference/group/input#akeyevent_getkeycode) #[inline] pub fn key_code(&self) -> Keycode { - let keycode = self.keyCode as u32; - keycode.try_into().unwrap_or(Keycode::Unknown) + let keycode = self.ga_event.keyCode; + keycode.into() } /// Returns the number of repeats of a key. @@ -1325,7 +729,7 @@ impl<'a> KeyEvent<'a> { /// docs](https://developer.android.com/ndk/reference/group/input#akeyevent_getrepeatcount) #[inline] pub fn repeat_count(&self) -> i32 { - self.repeatCount + self.ga_event.repeatCount } /// Returns the hardware keycode of a key. This varies from device to device. @@ -1334,70 +738,17 @@ impl<'a> KeyEvent<'a> { /// docs](https://developer.android.com/ndk/reference/group/input#akeyevent_getscancode) #[inline] pub fn scan_code(&self) -> i32 { - self.scanCode - } -} - -/// Flags associated with [`KeyEvent`]. -/// -/// See [the NDK docs](https://developer.android.com/ndk/reference/group/input#anonymous-enum-28) -#[derive(Copy, Clone, Debug, PartialEq, Eq)] -pub struct KeyEventFlags(pub u32); - -impl KeyEventFlags { - #[inline] - pub fn cancelled(&self) -> bool { - self.0 & ndk_sys::AKEY_EVENT_FLAG_CANCELED != 0 - } - #[inline] - pub fn cancelled_long_press(&self) -> bool { - self.0 & ndk_sys::AKEY_EVENT_FLAG_CANCELED_LONG_PRESS != 0 - } - #[inline] - pub fn editor_action(&self) -> bool { - self.0 & ndk_sys::AKEY_EVENT_FLAG_EDITOR_ACTION != 0 - } - #[inline] - pub fn fallback(&self) -> bool { - self.0 & ndk_sys::AKEY_EVENT_FLAG_FALLBACK != 0 - } - #[inline] - pub fn from_system(&self) -> bool { - self.0 & ndk_sys::AKEY_EVENT_FLAG_FROM_SYSTEM != 0 - } - #[inline] - pub fn keep_touch_mode(&self) -> bool { - self.0 & ndk_sys::AKEY_EVENT_FLAG_KEEP_TOUCH_MODE != 0 - } - #[inline] - pub fn long_press(&self) -> bool { - self.0 & ndk_sys::AKEY_EVENT_FLAG_LONG_PRESS != 0 - } - #[inline] - pub fn soft_keyboard(&self) -> bool { - self.0 & ndk_sys::AKEY_EVENT_FLAG_SOFT_KEYBOARD != 0 - } - #[inline] - pub fn tracking(&self) -> bool { - self.0 & ndk_sys::AKEY_EVENT_FLAG_TRACKING != 0 - } - #[inline] - pub fn virtual_hard_key(&self) -> bool { - self.0 & ndk_sys::AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY != 0 - } - #[inline] - pub fn woke_here(&self) -> bool { - self.0 & ndk_sys::AKEY_EVENT_FLAG_WOKE_HERE != 0 + self.ga_event.scanCode } } -impl<'a> KeyEvent<'a> { +impl KeyEvent<'_> { /// Flags associated with this [`KeyEvent`]. /// /// See [the NDK docs](https://developer.android.com/ndk/reference/group/input#akeyevent_getflags) #[inline] pub fn flags(&self) -> KeyEventFlags { - KeyEventFlags(self.flags as u32) + KeyEventFlags(self.ga_event.flags as u32) } /// Returns the state of the modifiers during this key event, represented by a bitmask. @@ -1406,6 +757,6 @@ impl<'a> KeyEvent<'a> { /// docs](https://developer.android.com/ndk/reference/group/input#akeyevent_getmetastate) #[inline] pub fn meta_state(&self) -> MetaState { - MetaState(self.metaState as u32) + MetaState(self.ga_event.metaState as u32) } } diff --git a/android-activity/src/game_activity/mod.rs b/android-activity/src/game_activity/mod.rs index 82bc3e31..129175d8 100644 --- a/android-activity/src/game_activity/mod.rs +++ b/android-activity/src/game_activity/mod.rs @@ -1,18 +1,15 @@ -#![cfg(feature = "game-activity")] - -use std::ffi::{CStr, CString}; -use std::fs::File; -use std::io::{BufRead, BufReader}; +use std::collections::HashMap; use std::marker::PhantomData; use std::ops::Deref; -use std::os::unix::prelude::*; +use std::panic::catch_unwind; +use std::ptr; use std::ptr::NonNull; -use std::sync::{Arc, RwLock}; +use std::sync::Weak; +use std::sync::{Arc, Mutex, RwLock}; use std::time::Duration; -use std::{ptr, thread}; use libc::c_void; -use log::{error, trace, Level}; +use log::{error, trace}; use jni_sys::*; @@ -23,15 +20,19 @@ use ndk::asset::AssetManager; use ndk::configuration::Configuration; use ndk::native_window::NativeWindow; -use crate::util::{abort_on_panic, android_log}; +use crate::error::InternalResult; +use crate::input::{Axis, KeyCharacterMap, KeyCharacterMapBinding}; +use crate::jni_utils::{self, CloneJavaVM}; +use crate::util::{abort_on_panic, forward_stdio_to_logcat, log_panic, try_get_path_from_ptr}; use crate::{ - util, AndroidApp, ConfigurationRef, InputStatus, MainEvent, PollEvent, Rect, WindowManagerFlags, + AndroidApp, ConfigurationRef, InputStatus, MainEvent, PollEvent, Rect, WindowManagerFlags, }; mod ffi; pub mod input; -use input::{Axis, InputEvent, KeyEvent, MotionEvent}; +use crate::input::{TextInputState, TextSpan}; +use input::{InputEvent, KeyEvent, MotionEvent}; // The only time it's safe to update the android_app->savedState pointer is // while handling a SaveState event, so this API is only exposed for those @@ -81,14 +82,14 @@ impl<'a> StateSaver<'a> { pub struct StateLoader<'a> { app: &'a AndroidAppInner, } -impl<'a> StateLoader<'a> { +impl StateLoader<'_> { pub fn load(&self) -> Option> { unsafe { let app_ptr = self.app.native_app.as_ptr(); if !(*app_ptr).savedState.is_null() && (*app_ptr).savedStateSize > 0 { let buf: &mut [u8] = std::slice::from_raw_parts_mut( (*app_ptr).savedState.cast(), - (*app_ptr).savedStateSize as usize, + (*app_ptr).savedStateSize, ); let state = buf.to_vec(); Some(state) @@ -118,7 +119,16 @@ impl AndroidAppWaker { } impl AndroidApp { - pub(crate) unsafe fn from_ptr(ptr: NonNull) -> Self { + pub(crate) unsafe fn from_ptr(ptr: NonNull, jvm: CloneJavaVM) -> Self { + let mut env = jvm.get_env().unwrap(); // We attach to the thread before creating the AndroidApp + + let key_map_binding = match KeyCharacterMapBinding::new(&mut env) { + Ok(b) => b, + Err(err) => { + panic!("Failed to create KeyCharacterMap JNI bindings: {err:?}"); + } + }; + // Note: we don't use from_ptr since we don't own the android_app.config // and need to keep in mind that the Drop handler is going to call // AConfiguration_delete() @@ -126,15 +136,19 @@ impl AndroidApp { Self { inner: Arc::new(RwLock::new(AndroidAppInner { + jvm, native_app: NativeAppGlue { ptr }, config: ConfigurationRef::new(config), native_window: Default::default(), + key_map_binding: Arc::new(key_map_binding), + key_maps: Mutex::new(HashMap::new()), + input_receiver: Mutex::new(None), })), } } } -#[derive(Debug)] +#[derive(Debug, Clone)] struct NativeAppGlue { ptr: NonNull, } @@ -148,11 +162,112 @@ impl Deref for NativeAppGlue { unsafe impl Send for NativeAppGlue {} unsafe impl Sync for NativeAppGlue {} +impl NativeAppGlue { + // TODO: move into a trait + pub fn text_input_state(&self) -> TextInputState { + unsafe { + let activity = (*self.as_ptr()).activity; + let mut out_state = TextInputState { + text: String::new(), + selection: TextSpan { start: 0, end: 0 }, + compose_region: None, + }; + let out_ptr = &mut out_state as *mut TextInputState; + + let app_ptr = self.as_ptr(); + (*app_ptr).textInputState = 0; + + // NEON WARNING: + // + // It's not clearly documented but the GameActivity API over the + // GameTextInput library directly exposes _modified_ UTF8 text + // from Java so we need to be careful to convert text to and + // from UTF8 + // + // GameTextInput also uses a pre-allocated, fixed-sized buffer for + // the current text state and has shared `currentState_` that + // appears to have no lock to guard access from multiple threads. + // + // There's also no locking at the GameActivity level, so I'm fairly + // certain that `GameActivity_getTextInputState` isn't thread + // safe: https://issuetracker.google.com/issues/294112477 + // + // Overall this is all quite gnarly - and probably a good reminder + // of why we want to use Rust instead of C/C++. + ffi::GameActivity_getTextInputState( + activity, + Some(AndroidAppInner::map_input_state_to_text_event_callback), + out_ptr.cast(), + ); + + out_state + } + } + + // TODO: move into a trait + pub fn set_text_input_state(&self, state: TextInputState) { + unsafe { + let activity = (*self.as_ptr()).activity; + let modified_utf8 = cesu8::to_java_cesu8(&state.text); + let text_length = modified_utf8.len() as i32; + let modified_utf8_bytes = modified_utf8.as_ptr(); + let ffi_state = ffi::GameTextInputState { + text_UTF8: modified_utf8_bytes.cast(), // NB: may be signed or unsigned depending on target + text_length, + selection: ffi::GameTextInputSpan { + start: state.selection.start as i32, + end: state.selection.end as i32, + }, + composingRegion: match state.compose_region { + Some(span) => { + // The GameText subclass of InputConnection only has a special case for removing the + // compose region if `start == -1` but the docs for `setComposingRegion` imply that + // the region should effectively be removed if any empty region is given (unlike for the + // selection region, it's not meaningful to maintain an empty compose region) + // + // We aim for more consistent behaviour by normalizing any empty region into `(-1, -1)` + // to remove the compose region. + // + // NB `setComposingRegion` itself is documented to clamp start/end to the text bounds + // so apart from this special-case handling in GameText's implementation of + // `setComposingRegion` then there's nothing special about `(-1, -1)` - it's just an empty + // region that should get clamped to `(0, 0)` and then get removed. + if span.start == span.end { + ffi::GameTextInputSpan { start: -1, end: -1 } + } else { + ffi::GameTextInputSpan { + start: span.start as i32, + end: span.end as i32, + } + } + } + None => ffi::GameTextInputSpan { start: -1, end: -1 }, + }, + }; + ffi::GameActivity_setTextInputState(activity, &ffi_state as *const _); + } + } +} + #[derive(Debug)] pub struct AndroidAppInner { + pub(crate) jvm: CloneJavaVM, native_app: NativeAppGlue, config: ConfigurationRef, native_window: RwLock>, + + /// Shared JNI bindings for the `KeyCharacterMap` class + key_map_binding: Arc, + + /// A table of `KeyCharacterMap`s per `InputDevice` ID + /// these are used to be able to map key presses to unicode + /// characters + key_maps: Mutex>, + + /// While an app is reading input events it holds an + /// InputReceiver reference which we track to ensure + /// we don't hand out more than one receiver at a time + input_receiver: Mutex>>, } impl AndroidAppInner { @@ -178,6 +293,11 @@ impl AndroidAppInner { unsafe { let native_app = &self.native_app; + assert_eq!( + ndk_sys::ALooper_forThread(), + (*native_app.as_ptr()).looper, + "Application tried to poll events from non-main thread" + ); let mut fd: i32 = 0; let mut events: i32 = 0; @@ -221,14 +341,14 @@ impl AndroidAppInner { panic!("ALooper_pollAll returned POLL_ERROR"); } id if id >= 0 => { - match id as u32 { + match id as ffi::NativeAppGlueLooperId { ffi::NativeAppGlueLooperId_LOOPER_ID_MAIN => { trace!("ALooper_pollAll returned ID_MAIN"); let source: *mut ffi::android_poll_source = source.cast(); if !source.is_null() { let cmd_i = ffi::android_app_read_cmd(native_app.as_ptr()); - let cmd = match cmd_i as u32 { + let cmd = match cmd_i as ffi::NativeAppGlueAppCmd { //NativeAppGlueAppCmd_UNUSED_APP_CMD_INPUT_CHANGED => AndroidAppMainEvent::InputChanged, ffi::NativeAppGlueAppCmd_APP_CMD_INIT_WINDOW => { MainEvent::InitWindow {} @@ -359,12 +479,79 @@ impl AndroidAppInner { } } + unsafe extern "C" fn map_input_state_to_text_event_callback( + context: *mut c_void, + state: *const ffi::GameTextInputState, + ) { + // Java uses a modified UTF-8 format, which is a modified cesu8 format + let out_ptr: *mut TextInputState = context.cast(); + let text_modified_utf8: *const u8 = (*state).text_UTF8.cast(); + let text_modified_utf8 = + std::slice::from_raw_parts(text_modified_utf8, (*state).text_length as usize); + match cesu8::from_java_cesu8(text_modified_utf8) { + Ok(str) => { + let len = str.len(); + (*out_ptr).text = String::from(str); + + let selection_start = (*state).selection.start.clamp(0, len as i32 + 1); + let selection_end = (*state).selection.end.clamp(0, len as i32 + 1); + (*out_ptr).selection = TextSpan { + start: selection_start as usize, + end: selection_end as usize, + }; + if (*state).composingRegion.start < 0 || (*state).composingRegion.end < 0 { + (*out_ptr).compose_region = None; + } else { + (*out_ptr).compose_region = Some(TextSpan { + start: (*state).composingRegion.start as usize, + end: (*state).composingRegion.end as usize, + }); + } + } + Err(err) => { + log::error!("Invalid UTF8 text in TextEvent: {}", err); + } + } + } + + // TODO: move into a trait + pub fn text_input_state(&self) -> TextInputState { + self.native_app.text_input_state() + } + + // TODO: move into a trait + pub fn set_text_input_state(&self, state: TextInputState) { + self.native_app.set_text_input_state(state); + } + + pub(crate) fn device_key_character_map( + &self, + device_id: i32, + ) -> InternalResult { + let mut guard = self.key_maps.lock().unwrap(); + + let key_map = match guard.entry(device_id) { + std::collections::hash_map::Entry::Occupied(occupied) => occupied.get().clone(), + std::collections::hash_map::Entry::Vacant(vacant) => { + let character_map = jni_utils::device_key_character_map( + self.jvm.clone(), + self.key_map_binding.clone(), + device_id, + )?; + vacant.insert(character_map.clone()); + character_map + } + }; + + Ok(key_map) + } + pub fn enable_motion_axis(&mut self, axis: Axis) { - unsafe { ffi::GameActivityPointerAxes_enableAxis(axis as i32) } + unsafe { ffi::GameActivityPointerAxes_enableAxis(axis.into()) } } pub fn disable_motion_axis(&mut self, axis: Axis) { - unsafe { ffi::GameActivityPointerAxes_disableAxis(axis as i32) } + unsafe { ffi::GameActivityPointerAxes_disableAxis(axis.into()) } } pub fn create_waker(&self) -> AndroidAppWaker { @@ -402,71 +589,75 @@ impl AndroidAppInner { } } - pub fn input_events(&self, mut callback: F) - where - F: FnMut(&InputEvent) -> InputStatus, - { - let buf = unsafe { - let app_ptr = self.native_app.as_ptr(); - let input_buffer = ffi::android_app_swap_input_buffers(app_ptr); - if input_buffer.is_null() { - return; - } - InputBuffer::from_ptr(NonNull::new_unchecked(input_buffer)) - }; + pub(crate) fn input_events_receiver(&self) -> InternalResult> { + let mut guard = self.input_receiver.lock().unwrap(); - let mut keys_iter = KeyEventsLendingIterator::new(&buf); - while let Some(key_event) = keys_iter.next() { - callback(&InputEvent::KeyEvent(key_event)); - } - let mut motion_iter = MotionEventsLendingIterator::new(&buf); - while let Some(motion_event) = motion_iter.next() { - callback(&InputEvent::MotionEvent(motion_event)); + // Make sure we don't hand out more than one receiver at a time because + // turning the receiver into an iterator will perform a swap_buffers + // for the buffered input events which shouldn't happen while we're in + // the middle of iterating events + if let Some(receiver) = &*guard { + if receiver.strong_count() > 0 { + return Err(crate::error::InternalAppError::InputUnavailable); + } } + *guard = None; + + let receiver = Arc::new(InputReceiver { + native_app: self.native_app.clone(), + }); + + *guard = Some(Arc::downgrade(&receiver)); + Ok(receiver) } pub fn internal_data_path(&self) -> Option { unsafe { let app_ptr = self.native_app.as_ptr(); - util::try_get_path_from_ptr((*(*app_ptr).activity).internalDataPath) + try_get_path_from_ptr((*(*app_ptr).activity).internalDataPath) } } pub fn external_data_path(&self) -> Option { unsafe { let app_ptr = self.native_app.as_ptr(); - util::try_get_path_from_ptr((*(*app_ptr).activity).externalDataPath) + try_get_path_from_ptr((*(*app_ptr).activity).externalDataPath) } } pub fn obb_path(&self) -> Option { unsafe { let app_ptr = self.native_app.as_ptr(); - util::try_get_path_from_ptr((*(*app_ptr).activity).obbPath) + try_get_path_from_ptr((*(*app_ptr).activity).obbPath) } } } -struct MotionEventsLendingIterator<'a> { +struct MotionEventsLendingIterator { pos: usize, count: usize, - buffer: &'a InputBuffer<'a>, } -// A kind of lending iterator but since our MSRV is 1.60 we can't handle this -// via a generic trait. The iteration of motion events is entirely private -// though so this is ok for now. -impl<'a> MotionEventsLendingIterator<'a> { - fn new(buffer: &'a InputBuffer<'a>) -> Self { +impl MotionEventsLendingIterator { + fn new(buffer: &InputBuffer) -> Self { Self { pos: 0, count: buffer.motion_events_count(), - buffer, } } - fn next(&mut self) -> Option> { + fn next<'buf>(&mut self, buffer: &'buf InputBuffer) -> Option> { if self.pos < self.count { - let ga_event = unsafe { &(*self.buffer.ptr.as_ptr()).motionEvents[self.pos] }; + // Safety: + // - This iterator currently has exclusive access to the front buffer of events + // - We know the buffer is non-null + // - `pos` is less than the number of events stored in the buffer + let ga_event = unsafe { + (*buffer.ptr.as_ptr()) + .motionEvents + .add(self.pos) + .as_ref() + .unwrap() + }; let event = MotionEvent::new(ga_event); self.pos += 1; Some(event) @@ -476,26 +667,31 @@ impl<'a> MotionEventsLendingIterator<'a> { } } -struct KeyEventsLendingIterator<'a> { +struct KeyEventsLendingIterator { pos: usize, count: usize, - buffer: &'a InputBuffer<'a>, } -// A kind of lending iterator but since our MSRV is 1.60 we can't handle this -// via a generic trait. The iteration of key events is entirely private -// though so this is ok for now. -impl<'a> KeyEventsLendingIterator<'a> { - fn new(buffer: &'a InputBuffer<'a>) -> Self { +impl KeyEventsLendingIterator { + fn new(buffer: &InputBuffer) -> Self { Self { pos: 0, count: buffer.key_events_count(), - buffer, } } - fn next(&mut self) -> Option> { + fn next<'buf>(&mut self, buffer: &'buf InputBuffer) -> Option> { if self.pos < self.count { - let ga_event = unsafe { &(*self.buffer.ptr.as_ptr()).keyEvents[self.pos] }; + // Safety: + // - This iterator currently has exclusive access to the front buffer of events + // - We know the buffer is non-null + // - `pos` is less than the number of events stored in the buffer + let ga_event = unsafe { + (*buffer.ptr.as_ptr()) + .keyEvents + .add(self.pos) + .as_ref() + .unwrap() + }; let event = KeyEvent::new(ga_event); self.pos += 1; Some(event) @@ -514,7 +710,7 @@ impl<'a> InputBuffer<'a> { pub(crate) fn from_ptr(ptr: NonNull) -> InputBuffer<'a> { Self { ptr, - _lifetime: PhantomData::default(), + _lifetime: PhantomData, } } @@ -527,7 +723,7 @@ impl<'a> InputBuffer<'a> { } } -impl<'a> Drop for InputBuffer<'a> { +impl Drop for InputBuffer<'_> { fn drop(&mut self) { unsafe { ffi::android_app_clear_motion_events(self.ptr.as_ptr()); @@ -536,22 +732,131 @@ impl<'a> Drop for InputBuffer<'a> { } } +/// Conceptually we can think of this like the receiver end of an +/// input events channel. +/// +/// After being passed back to AndroidApp it gets turned into a +/// lending iterator for pending input events. +/// +/// It serves two purposes: +/// 1. It represents an exclusive access to input events (the application +/// can only have one receiver at a time) and it's intended to support +/// the double-buffering design for input events in GameActivity where +/// we issue a swap_buffers before iterating events and wouldn't want +/// another swap to be possible before finishing - especially since +/// we want to borrow directly from the buffer while dispatching. +/// 2. It doesn't borrow from AndroidAppInner so we can pass it back to +/// AndroidApp which can drop its lock around AndroidAppInner and +/// it can then be turned into a lending iterator. (We wouldn't +/// be able to pass the iterator back to the application if it +/// borrowed from within the lock and we need to drop the lock +/// because otherwise the app wouldn't be able to access the AndroidApp +/// API in any way while iterating events) +#[derive(Debug)] +pub(crate) struct InputReceiver { + // Safety: the native_app effectively has a static lifetime and it + // has its own internal locking when calling + // `android_app_swap_input_buffers` + native_app: NativeAppGlue, +} + +impl<'a> From> for InputIteratorInner<'a> { + fn from(receiver: Arc) -> Self { + let buffered = unsafe { + let app_ptr = receiver.native_app.as_ptr(); + let input_buffer = ffi::android_app_swap_input_buffers(app_ptr); + NonNull::new(input_buffer).map(|input_buffer| { + let buffer = InputBuffer::from_ptr(input_buffer); + let keys_iter = KeyEventsLendingIterator::new(&buffer); + let motion_iter = MotionEventsLendingIterator::new(&buffer); + BufferedEvents::<'a> { + buffer, + keys_iter, + motion_iter, + } + }) + }; + + let native_app = receiver.native_app.clone(); + Self { + _receiver: receiver, + buffered, + native_app, + text_event_checked: false, + } + } +} + +struct BufferedEvents<'a> { + buffer: InputBuffer<'a>, + keys_iter: KeyEventsLendingIterator, + motion_iter: MotionEventsLendingIterator, +} + +pub(crate) struct InputIteratorInner<'a> { + // Held to maintain exclusive access to buffered input events + _receiver: Arc, + + buffered: Option>, + native_app: NativeAppGlue, + text_event_checked: bool, +} + +impl InputIteratorInner<'_> { + pub(crate) fn next(&mut self, callback: F) -> bool + where + F: FnOnce(&input::InputEvent) -> InputStatus, + { + if let Some(buffered) = &mut self.buffered { + if let Some(key_event) = buffered.keys_iter.next(&buffered.buffer) { + let _ = callback(&InputEvent::KeyEvent(key_event)); + return true; + } + if let Some(motion_event) = buffered.motion_iter.next(&buffered.buffer) { + let _ = callback(&InputEvent::MotionEvent(motion_event)); + return true; + } + self.buffered = None; + } + + if !self.text_event_checked { + self.text_event_checked = true; + unsafe { + let app_ptr = self.native_app.as_ptr(); + + // XXX: It looks like the GameActivity implementation should + // be using atomic ops to set this flag, and require us to + // use atomics to check and clear it too. + // + // We currently just hope that with the lack of atomic ops that + // the compiler isn't reordering code so this gets flagged + // before the java main thread really updates the state. + if (*app_ptr).textInputState != 0 { + let state = self.native_app.text_input_state(); // Will clear .textInputState + let _ = callback(&InputEvent::TextEvent(state)); + return true; + } + } + } + false + } +} + // Rust doesn't give us a clean way to directly export symbols from C/C++ // so we rename the C/C++ symbols and re-export these JNI entrypoints from // Rust... // // https://github.com/rust-lang/rfcs/issues/2771 extern "C" { - pub fn Java_com_google_androidgamesdk_GameActivity_loadNativeCode_C( + pub fn Java_com_google_androidgamesdk_GameActivity_initializeNativeCode_C( env: *mut JNIEnv, javaGameActivity: jobject, - path: jstring, - funcName: jstring, internalDataDir: jstring, obbDir: jstring, externalDataDir: jstring, jAssetMgr: jobject, savedState: jbyteArray, + javaConfig: jobject, ) -> jlong; pub fn GameActivity_onCreate_C( @@ -562,27 +867,25 @@ extern "C" { } #[no_mangle] -pub unsafe extern "C" fn Java_com_google_androidgamesdk_GameActivity_loadNativeCode( +pub unsafe extern "C" fn Java_com_google_androidgamesdk_GameActivity_initializeNativeCode( env: *mut JNIEnv, java_game_activity: jobject, - path: jstring, - func_name: jstring, internal_data_dir: jstring, obb_dir: jstring, external_data_dir: jstring, jasset_mgr: jobject, saved_state: jbyteArray, + java_config: jobject, ) -> jni_sys::jlong { - Java_com_google_androidgamesdk_GameActivity_loadNativeCode_C( + Java_com_google_androidgamesdk_GameActivity_initializeNativeCode_C( env, java_game_activity, - path, - func_name, internal_data_dir, obb_dir, external_data_dir, jasset_mgr, saved_state, + java_config, ) } @@ -603,58 +906,57 @@ extern "Rust" { // `app_main` function. This is run on a dedicated thread spawned // by android_native_app_glue. #[no_mangle] -pub unsafe extern "C" fn _rust_glue_entry(app: *mut ffi::android_app) { +pub unsafe extern "C" fn _rust_glue_entry(native_app: *mut ffi::android_app) { abort_on_panic(|| { - // Maybe make this stdout/stderr redirection an optional / opt-in feature?... - let mut logpipe: [RawFd; 2] = Default::default(); - libc::pipe(logpipe.as_mut_ptr()); - libc::dup2(logpipe[1], libc::STDOUT_FILENO); - libc::dup2(logpipe[1], libc::STDERR_FILENO); - thread::spawn(move || { - let tag = CStr::from_bytes_with_nul(b"RustStdoutStderr\0").unwrap(); - let file = File::from_raw_fd(logpipe[0]); - let mut reader = BufReader::new(file); - let mut buffer = String::new(); - loop { - buffer.clear(); - if let Ok(len) = reader.read_line(&mut buffer) { - if len == 0 { - break; - } else if let Ok(msg) = CString::new(buffer.clone()) { - android_log(Level::Info, tag, &msg); - } - } - } - }); - - let jvm: *mut JavaVM = (*(*app).activity).vm; - let activity: jobject = (*(*app).activity).javaGameActivity; - ndk_context::initialize_android_context(jvm.cast(), activity.cast()); + let _join_log_forwarder = forward_stdio_to_logcat(); + + let jvm = unsafe { + let jvm = (*(*native_app).activity).vm; + let activity: jobject = (*(*native_app).activity).javaGameActivity; + ndk_context::initialize_android_context(jvm.cast(), activity.cast()); + + let jvm = CloneJavaVM::from_raw(jvm).unwrap(); + // Since this is a newly spawned thread then the JVM hasn't been attached + // to the thread yet. Attach before calling the applications main function + // so they can safely make JNI calls + jvm.attach_current_thread_permanently().unwrap(); + jvm + }; - let app = AndroidApp::from_ptr(NonNull::new(app).unwrap()); + unsafe { + // Name thread - this needs to happen here after attaching to a JVM thread, + // since that changes the thread name to something like "Thread-2". + let thread_name = std::ffi::CStr::from_bytes_with_nul(b"android_main\0").unwrap(); + libc::pthread_setname_np(libc::pthread_self(), thread_name.as_ptr()); + + let app = AndroidApp::from_ptr(NonNull::new(native_app).unwrap(), jvm.clone()); + + // We want to specifically catch any panic from the application's android_main + // so we can finish + destroy the Activity gracefully via the JVM + catch_unwind(|| { + // XXX: If we were in control of the Java Activity subclass then + // we could potentially run the android_main function via a Java native method + // springboard (e.g. call an Activity subclass method that calls a jni native + // method that then just calls android_main()) that would make sure there was + // a Java frame at the base of our call stack which would then be recognised + // when calling FindClass to lookup a suitable classLoader, instead of + // defaulting to the system loader. Without this then it's difficult for native + // code to look up non-standard Java classes. + android_main(app); + }) + .unwrap_or_else(log_panic); + + // Let JVM know that our Activity can be destroyed before detaching from the JVM + // + // "Note that this method can be called from any thread; it will send a message + // to the main thread of the process where the Java finish call will take place" + ffi::GameActivity_finish((*native_app).activity); - // Since this is a newly spawned thread then the JVM hasn't been attached - // to the thread yet. Attach before calling the applications main function - // so they can safely make JNI calls - let mut jenv_out: *mut core::ffi::c_void = std::ptr::null_mut(); - if let Some(attach_current_thread) = (*(*jvm)).AttachCurrentThread { - attach_current_thread(jvm, &mut jenv_out, std::ptr::null_mut()); - } + // This should detach automatically but lets detach explicitly to avoid depending + // on the TLS trickery in `jni-rs` + jvm.detach_current_thread(); - // XXX: If we were in control of the Java Activity subclass then - // we could potentially run the android_main function via a Java native method - // springboard (e.g. call an Activity subclass method that calls a jni native - // method that then just calls android_main()) that would make sure there was - // a Java frame at the base of our call stack which would then be recognised - // when calling FindClass to lookup a suitable classLoader, instead of - // defaulting to the system loader. Without this then it's difficult for native - // code to look up non-standard Java classes. - android_main(app); - - if let Some(detach_current_thread) = (*(*jvm)).DetachCurrentThread { - detach_current_thread(jvm); + ndk_context::release_android_context(); } - - ndk_context::release_android_context(); }) } diff --git a/android-activity/src/input.rs b/android-activity/src/input.rs index 3653260c..909f8950 100644 --- a/android-activity/src/input.rs +++ b/android-activity/src/input.rs @@ -1,83 +1,204 @@ -use bitflags::bitflags; -use num_enum::{IntoPrimitive, TryFromPrimitive}; +pub use ndk::event::{ + Axis, EdgeFlags, KeyAction, KeyEventFlags, Keycode, MetaState, MotionAction, MotionEventFlags, + Source, SourceClass, ToolType, +}; pub use crate::activity_impl::input::*; +use crate::InputStatus; -/// An enum representing the source of an [`MotionEvent`] or [`KeyEvent`] +mod sdk; +pub use sdk::*; + +/// Identifies buttons that are associated with motion events. +/// +/// See [the NDK +/// docs](https://developer.android.com/ndk/reference/group/input#anonymous-enum-47) +/// +/// # Android Extensible Enum +/// +/// This is a runtime [extensible enum](`crate#android-extensible-enums`) and +/// should be handled similar to a `#[non_exhaustive]` enum to maintain +/// forwards compatibility. /// -/// See [the InputDevice docs](https://developer.android.com/reference/android/view/InputDevice#SOURCE_ANY) -#[derive(Debug, Clone, Copy, PartialEq, Eq, TryFromPrimitive, IntoPrimitive)] +/// This implements `Into` and `From` for converting to/from Android +/// SDK integer values. +/// +#[derive(Copy, Clone, Debug, PartialEq, Eq, num_enum::FromPrimitive, num_enum::IntoPrimitive)] +#[non_exhaustive] #[repr(u32)] -pub enum Source { - BluetoothStylus = 0x0000c002, - Dpad = 0x00000201, - /// Either a gamepad or a joystick - Gamepad = 0x00000401, - Hdmi = 0x02000001, - /// Either a gamepad or a joystick - Joystick = 0x01000010, - /// Pretty much any device with buttons. Query the keyboard type to determine - /// if it has alphabetic keys and can be used for text entry. - Keyboard = 0x00000101, - /// A pointing device, such as a mouse or trackpad - Mouse = 0x00002002, - /// A pointing device, such as a mouse or trackpad whose relative motions should be treated as navigation events - MouseRelative = 0x00020004, - /// An input device akin to a scroll wheel - RotaryEncoder = 0x00400000, - Sensor = 0x04000000, - Stylus = 0x00004002, - Touchpad = 0x00100008, - Touchscreen = 0x00001002, - TouchNavigation = 0x00200000, - Trackball = 0x00010004, - - Unknown = 0, +pub enum Button { + Back = ndk_sys::AMOTION_EVENT_BUTTON_BACK, + Forward = ndk_sys::AMOTION_EVENT_BUTTON_FORWARD, + Primary = ndk_sys::AMOTION_EVENT_BUTTON_PRIMARY, + Secondary = ndk_sys::AMOTION_EVENT_BUTTON_SECONDARY, + StylusPrimary = ndk_sys::AMOTION_EVENT_BUTTON_STYLUS_PRIMARY, + StylusSecondary = ndk_sys::AMOTION_EVENT_BUTTON_STYLUS_SECONDARY, + Tertiary = ndk_sys::AMOTION_EVENT_BUTTON_TERTIARY, + + #[doc(hidden)] + #[num_enum(catch_all)] + __Unknown(u32), +} + +/// This struct holds a span within a region of text from `start` to `end`. +/// +/// The `start` index may be greater than the `end` index (swapping `start` and `end` will represent the same span) +/// +/// The lower index is inclusive and the higher index is exclusive. +/// +/// An empty span or cursor position is specified with `start == end`. +/// +#[derive(Debug, Clone, Copy)] +pub struct TextSpan { + /// The start of the span (inclusive) + pub start: usize, + + /// The end of the span (exclusive) + pub end: usize, } -bitflags! { - struct SourceFlags: u32 { - const CLASS_MASK = 0x000000ff; +#[derive(Debug, Clone)] +pub struct TextInputState { + pub text: String, + + /// A selection defined on the text. + /// + /// To set the cursor position, start and end should have the same value. + /// + /// Changing the selection has no effect on the compose_region. + pub selection: TextSpan, - const BUTTON = 0x00000001; - const POINTER = 0x00000002; - const TRACKBALL = 0x00000004; - const POSITION = 0x00000008; - const JOYSTICK = 0x00000010; - const NONE = 0; + /// A composing region defined on the text. + /// + /// When being set, then if there was a composing region, the region is replaced. + /// + /// The given indices will be clamped to the `text` bounds + /// + /// If the resulting region is zero-sized, no region is marked (equivalent to passing `None`) + pub compose_region: Option, +} + +/// An exclusive, lending iterator for input events +pub struct InputIterator<'a> { + pub(crate) inner: crate::activity_impl::InputIteratorInner<'a>, +} + +impl InputIterator<'_> { + /// Reads and handles the next input event by passing it to the given `callback` + /// + /// `callback` should return [`InputStatus::Unhandled`] for any input events that aren't directly + /// handled by the application, or else [`InputStatus::Handled`]. Unhandled events may lead to a + /// fallback interpretation of the event. + pub fn next(&mut self, callback: F) -> bool + where + F: FnOnce(&crate::activity_impl::input::InputEvent) -> InputStatus, + { + self.inner.next(callback) } } -/// An enum representing the class of a [`MotionEvent`] or [`KeyEvent`] source -/// -/// See [the InputDevice docs](https://developer.android.com/reference/android/view/InputDevice#SOURCE_CLASS_MASK) -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum Class { - None, - Button, - Pointer, - Trackball, - Position, - Joystick, +/// A view into the data of a specific pointer in a motion event. +#[derive(Debug)] +pub struct Pointer<'a> { + pub(crate) inner: PointerImpl<'a>, +} + +impl Pointer<'_> { + #[inline] + pub fn pointer_index(&self) -> usize { + self.inner.pointer_index() + } + + #[inline] + pub fn pointer_id(&self) -> i32 { + self.inner.pointer_id() + } + + #[inline] + pub fn axis_value(&self, axis: Axis) -> f32 { + self.inner.axis_value(axis) + } + + #[inline] + pub fn orientation(&self) -> f32 { + self.axis_value(Axis::Orientation) + } + + #[inline] + pub fn pressure(&self) -> f32 { + self.axis_value(Axis::Pressure) + } + + #[inline] + pub fn raw_x(&self) -> f32 { + self.inner.raw_x() + } + + #[inline] + pub fn raw_y(&self) -> f32 { + self.inner.raw_y() + } + + #[inline] + pub fn x(&self) -> f32 { + self.axis_value(Axis::X) + } + + #[inline] + pub fn y(&self) -> f32 { + self.axis_value(Axis::Y) + } + + #[inline] + pub fn size(&self) -> f32 { + self.axis_value(Axis::Size) + } + + #[inline] + pub fn tool_major(&self) -> f32 { + self.axis_value(Axis::ToolMajor) + } + + #[inline] + pub fn tool_minor(&self) -> f32 { + self.axis_value(Axis::ToolMinor) + } + + #[inline] + pub fn touch_major(&self) -> f32 { + self.axis_value(Axis::TouchMajor) + } + + #[inline] + pub fn touch_minor(&self) -> f32 { + self.axis_value(Axis::TouchMinor) + } + + #[inline] + pub fn tool_type(&self) -> ToolType { + self.inner.tool_type() + } +} + +/// An iterator over the pointers in a [`MotionEvent`]. +#[derive(Debug)] +pub struct PointersIter<'a> { + pub(crate) inner: PointersIterImpl<'a>, } -impl From for Class { - fn from(source: u32) -> Self { - let class = SourceFlags::from_bits_truncate(source as u32); - match class { - SourceFlags::BUTTON => Class::Button, - SourceFlags::POINTER => Class::Pointer, - SourceFlags::TRACKBALL => Class::Trackball, - SourceFlags::POSITION => Class::Position, - SourceFlags::JOYSTICK => Class::Joystick, - _ => Class::None, - } +impl<'a> Iterator for PointersIter<'a> { + type Item = Pointer<'a>; + fn next(&mut self) -> Option> { + self.inner.next() + } + + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() } } -impl From for Class { - fn from(source: Source) -> Self { - let source: u32 = source.into(); - source.into() +impl ExactSizeIterator for PointersIter<'_> { + fn len(&self) -> usize { + self.inner.len() } } diff --git a/android-activity/src/input/sdk.rs b/android-activity/src/input/sdk.rs new file mode 100644 index 00000000..978ad5a8 --- /dev/null +++ b/android-activity/src/input/sdk.rs @@ -0,0 +1,348 @@ +use std::sync::Arc; + +use jni::{ + objects::{GlobalRef, JClass, JMethodID, JObject, JStaticMethodID, JValue}, + signature::{Primitive, ReturnType}, + JNIEnv, +}; +use jni_sys::jint; + +use crate::{ + input::{Keycode, MetaState}, + jni_utils::CloneJavaVM, +}; + +use crate::{ + error::{AppError, InternalAppError}, + jni_utils, +}; + +/// An enum representing the types of keyboards that may generate key events +/// +/// See [getKeyboardType() docs](https://developer.android.com/reference/android/view/KeyCharacterMap#getKeyboardType()) +/// +/// # Android Extensible Enum +/// +/// This is a runtime [extensible enum](`crate#android-extensible-enums`) and +/// should be handled similar to a `#[non_exhaustive]` enum to maintain +/// forwards compatibility. +/// +/// This implements `Into` and `From` for converting to/from Android +/// SDK integer values. +#[derive( + Debug, Clone, Copy, PartialEq, Eq, Hash, num_enum::FromPrimitive, num_enum::IntoPrimitive, +)] +#[non_exhaustive] +#[repr(u32)] +pub enum KeyboardType { + /// A numeric (12-key) keyboard. + /// + /// A numeric keyboard supports text entry using a multi-tap approach. It may be necessary to tap a key multiple times to generate the desired letter or symbol. + /// + /// This type of keyboard is generally designed for thumb typing. + Numeric, + + /// A keyboard with all the letters, but with more than one letter per key. + /// + /// This type of keyboard is generally designed for thumb typing. + Predictive, + + /// A keyboard with all the letters, and maybe some numbers. + /// + /// An alphabetic keyboard supports text entry directly but may have a condensed layout with a small form factor. In contrast to a full keyboard, some symbols may only be accessible using special on-screen character pickers. In addition, to improve typing speed and accuracy, the framework provides special affordances for alphabetic keyboards such as auto-capitalization and toggled / locked shift and alt keys. + /// + /// This type of keyboard is generally designed for thumb typing. + Alpha, + + /// A full PC-style keyboard. + /// + /// A full keyboard behaves like a PC keyboard. All symbols are accessed directly by pressing keys on the keyboard without on-screen support or affordances such as auto-capitalization. + /// + /// This type of keyboard is generally designed for full two hand typing. + Full, + + /// A keyboard that is only used to control special functions rather than for typing. + /// + /// A special function keyboard consists only of non-printing keys such as HOME and POWER that are not actually used for typing. + SpecialFunction, + + #[doc(hidden)] + #[num_enum(catch_all)] + __Unknown(u32), +} + +/// Either represents, a unicode character or combining accent from a +/// [`KeyCharacterMap`], or `None` for non-printable keys. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +pub enum KeyMapChar { + None, + Unicode(char), + CombiningAccent(char), +} + +// I've also tried to think here about how to we could potentially automatically +// generate a binding struct like `KeyCharacterMapBinding` with a procmacro and +// so have intentionally limited the `Binding` being a very thin, un-opinionated +// wrapper based on basic JNI types. + +/// Lower-level JNI binding for `KeyCharacterMap` class only holds 'static state +/// and can be shared with an `Arc` ref count. +/// +/// The separation here also neatly helps us separate `InternalAppError` from +/// `AppError` for mapping JNI errors without exposing any `jni-rs` types in the +/// public API. +#[derive(Debug)] +pub(crate) struct KeyCharacterMapBinding { + //vm: JavaVM, + klass: GlobalRef, + get_method_id: JMethodID, + get_dead_char_method_id: JStaticMethodID, + get_keyboard_type_method_id: JMethodID, +} + +impl KeyCharacterMapBinding { + pub(crate) fn new(env: &mut JNIEnv) -> Result { + let binding = env.with_local_frame::<_, _, InternalAppError>(10, |env| { + let klass = env.find_class("android/view/KeyCharacterMap")?; // Creates a local ref + Ok(Self { + get_method_id: env.get_method_id(&klass, "get", "(II)I")?, + get_dead_char_method_id: env.get_static_method_id( + &klass, + "getDeadChar", + "(II)I", + )?, + get_keyboard_type_method_id: env.get_method_id(&klass, "getKeyboardType", "()I")?, + klass: env.new_global_ref(&klass)?, + }) + })?; + Ok(binding) + } + + pub fn get<'local>( + &self, + env: &'local mut JNIEnv, + key_map: impl AsRef>, + key_code: jint, + meta_state: jint, + ) -> Result { + let key_map = key_map.as_ref(); + + // Safety: + // - we know our global `key_map` reference is non-null and valid. + // - we know `get_method_id` remains valid + // - we know that the signature of KeyCharacterMap::get is `(int, int) -> int` + // - we know this won't leak any local references as a side effect + // + // We know it's ok to unwrap the `.i()` value since we explicitly + // specify the return type as `Int` + let unicode = unsafe { + env.call_method_unchecked( + key_map, + self.get_method_id, + ReturnType::Primitive(Primitive::Int), + &[ + JValue::Int(key_code).as_jni(), + JValue::Int(meta_state).as_jni(), + ], + ) + } + .map_err(|err| jni_utils::clear_and_map_exception_to_err(env, err))?; + Ok(unicode.i().unwrap()) + } + + pub fn get_dead_char( + &self, + env: &mut JNIEnv, + accent_char: jint, + base_char: jint, + ) -> Result { + // Safety: + // - we know `get_dead_char_method_id` remains valid + // - we know that KeyCharacterMap::getDeadKey is a static method + // - we know that the signature of KeyCharacterMap::getDeadKey is `(int, int) -> int` + // - we know this won't leak any local references as a side effect + // + // We know it's ok to unwrap the `.i()` value since we explicitly + // specify the return type as `Int` + + // Urgh, it's pretty terrible that there's no ergonomic/safe way to get a JClass reference from a GlobalRef + // Safety: we don't do anything that would try to delete the JClass as if it were a real local reference + let klass = unsafe { JClass::from_raw(self.klass.as_obj().as_raw()) }; + let unicode = unsafe { + env.call_static_method_unchecked( + &klass, + self.get_dead_char_method_id, + ReturnType::Primitive(Primitive::Int), + &[ + JValue::Int(accent_char).as_jni(), + JValue::Int(base_char).as_jni(), + ], + ) + } + .map_err(|err| jni_utils::clear_and_map_exception_to_err(env, err))?; + Ok(unicode.i().unwrap()) + } + + pub fn get_keyboard_type<'local>( + &self, + env: &'local mut JNIEnv, + key_map: impl AsRef>, + ) -> Result { + let key_map = key_map.as_ref(); + + // Safety: + // - we know our global `key_map` reference is non-null and valid. + // - we know `get_keyboard_type_method_id` remains valid + // - we know that the signature of KeyCharacterMap::getKeyboardType is `() -> int` + // - we know this won't leak any local references as a side effect + // + // We know it's ok to unwrap the `.i()` value since we explicitly + // specify the return type as `Int` + Ok(unsafe { + env.call_method_unchecked( + key_map, + self.get_keyboard_type_method_id, + ReturnType::Primitive(Primitive::Int), + &[], + ) + } + .map_err(|err| jni_utils::clear_and_map_exception_to_err(env, err))? + .i() + .unwrap()) + } +} + +/// Describes the keys provided by a keyboard device and their associated labels. +#[derive(Clone, Debug)] +pub struct KeyCharacterMap { + jvm: CloneJavaVM, + binding: Arc, + key_map: GlobalRef, +} + +impl KeyCharacterMap { + pub(crate) fn new( + jvm: CloneJavaVM, + binding: Arc, + key_map: GlobalRef, + ) -> Self { + Self { + jvm, + binding, + key_map, + } + } + + /// Gets the Unicode character generated by the specified [`Keycode`] and [`MetaState`] combination. + /// + /// Returns [`KeyMapChar::None`] if the key is not one that is used to type Unicode characters. + /// + /// Returns [`KeyMapChar::CombiningAccent`] if the key is a "dead key" that should be combined with + /// another to actually produce a character -- see [`KeyCharacterMap::get_dead_char`]. + /// + /// # Errors + /// + /// Since this API needs to use JNI internally to call into the Android JVM it may return + /// a [`AppError::JavaError`] in case there is a spurious JNI error or an exception + /// is caught. + pub fn get(&self, key_code: Keycode, meta_state: MetaState) -> Result { + let key_code = key_code.into(); + let meta_state = meta_state.0 as i32; + + // Since we expect this API to be called from the `main` thread then we expect to already be + // attached to the JVM + // + // Safety: there's no other JNIEnv in scope so this env can't be used to subvert the mutable + // borrow rules that ensure we can only add local references to the top JNI frame. + let mut env = self.jvm.get_env().map_err(|err| { + let err: InternalAppError = err.into(); + err + })?; + let unicode = self + .binding + .get(&mut env, self.key_map.as_obj(), key_code, meta_state)?; + let unicode = unicode as u32; + + const COMBINING_ACCENT: u32 = 0x80000000; + const COMBINING_ACCENT_MASK: u32 = !COMBINING_ACCENT; + + if unicode == 0 { + Ok(KeyMapChar::None) + } else if unicode & COMBINING_ACCENT == COMBINING_ACCENT { + let accent = unicode & COMBINING_ACCENT_MASK; + // Safety: assumes Android key maps don't contain invalid unicode characters + Ok(KeyMapChar::CombiningAccent(unsafe { + char::from_u32_unchecked(accent) + })) + } else { + // Safety: assumes Android key maps don't contain invalid unicode characters + Ok(KeyMapChar::Unicode(unsafe { + char::from_u32_unchecked(unicode) + })) + } + } + + /// Get the character that is produced by combining the dead key producing accent with the key producing character c. + /// + /// For example, ``get_dead_char('`', 'e')`` returns `'è'`. `get_dead_char('^', ' ')` returns `'^'` and `get_dead_char('^', '^')` returns `'^'`. + /// + /// # Errors + /// + /// Since this API needs to use JNI internally to call into the Android JVM it may return a + /// [`AppError::JavaError`] in case there is a spurious JNI error or an exception is caught. + pub fn get_dead_char( + &self, + accent_char: char, + base_char: char, + ) -> Result, AppError> { + let accent_char = accent_char as jni_sys::jint; + let base_char = base_char as jni_sys::jint; + + // Since we expect this API to be called from the `main` thread then we expect to already be + // attached to the JVM + // + // Safety: there's no other JNIEnv in scope so this env can't be used to subvert the mutable + // borrow rules that ensure we can only add local references to the top JNI frame. + let mut env = self.jvm.get_env().map_err(|err| { + let err: InternalAppError = err.into(); + err + })?; + let unicode = self + .binding + .get_dead_char(&mut env, accent_char, base_char)?; + let unicode = unicode as u32; + + // Safety: assumes Android key maps don't contain invalid unicode characters + Ok(if unicode == 0 { + None + } else { + Some(unsafe { char::from_u32_unchecked(unicode) }) + }) + } + + /// Gets the keyboard type. + /// + /// Different keyboard types have different semantics. See [`KeyboardType`] for details. + /// + /// # Errors + /// + /// Since this API needs to use JNI internally to call into the Android JVM it may return + /// a [`AppError::JavaError`] in case there is a spurious JNI error or an exception + /// is caught. + pub fn get_keyboard_type(&self) -> Result { + // Since we expect this API to be called from the `main` thread then we expect to already be + // attached to the JVM + // + // Safety: there's no other JNIEnv in scope so this env can't be used to subvert the mutable + // borrow rules that ensure we can only add local references to the top JNI frame. + let mut env = self.jvm.get_env().map_err(|err| { + let err: InternalAppError = err.into(); + err + })?; + let keyboard_type = self + .binding + .get_keyboard_type(&mut env, self.key_map.as_obj())?; + let keyboard_type = keyboard_type as u32; + Ok(keyboard_type.into()) + } +} diff --git a/android-activity/src/jni_utils.rs b/android-activity/src/jni_utils.rs new file mode 100644 index 00000000..dcf60837 --- /dev/null +++ b/android-activity/src/jni_utils.rs @@ -0,0 +1,151 @@ +//! The JNI calls we make in this crate are often not part of a Java native +//! method implementation and so we can't assume we have a JNI local frame that +//! is going to unwind and free local references, and we also can't just leave +//! exceptions to get thrown when returning to Java. +//! +//! These utilities help us check + clear exceptions and map them into Rust Errors. + +use std::{ops::Deref, sync::Arc}; + +use jni::{ + objects::{JObject, JString}, + JavaVM, +}; + +use crate::{ + error::{InternalAppError, InternalResult}, + input::{KeyCharacterMap, KeyCharacterMapBinding}, +}; + +// TODO: JavaVM should implement Clone +#[derive(Debug)] +pub(crate) struct CloneJavaVM { + pub jvm: JavaVM, +} +impl Clone for CloneJavaVM { + fn clone(&self) -> Self { + Self { + jvm: unsafe { JavaVM::from_raw(self.jvm.get_java_vm_pointer()).unwrap() }, + } + } +} +impl CloneJavaVM { + pub unsafe fn from_raw(jvm: *mut jni_sys::JavaVM) -> InternalResult { + Ok(Self { + jvm: JavaVM::from_raw(jvm)?, + }) + } +} +unsafe impl Send for CloneJavaVM {} +unsafe impl Sync for CloneJavaVM {} + +impl Deref for CloneJavaVM { + type Target = JavaVM; + + fn deref(&self) -> &Self::Target { + &self.jvm + } +} + +/// Use with `.map_err()` to map `jni::errors::Error::JavaException` into a +/// richer error based on the actual contents of the `JThrowable` +/// +/// (The `jni` crate doesn't do that automatically since it's more +/// common to let the exception get thrown when returning to Java) +/// +/// This will also clear the exception +pub(crate) fn clear_and_map_exception_to_err( + env: &mut jni::JNIEnv<'_>, + err: jni::errors::Error, +) -> InternalAppError { + if matches!(err, jni::errors::Error::JavaException) { + let result = env.with_local_frame::<_, _, InternalAppError>(5, |env| { + let e = env.exception_occurred()?; + assert!(!e.is_null()); // should only be called after receiving a JavaException Result + env.exception_clear()?; + + let class = env.get_object_class(&e)?; + //let get_stack_trace_method = env.get_method_id(&class, "getStackTrace", "()[Ljava/lang/StackTraceElement;")?; + let get_message_method = + env.get_method_id(&class, "getMessage", "()Ljava/lang/String;")?; + + let msg = unsafe { + env.call_method_unchecked( + &e, + get_message_method, + jni::signature::ReturnType::Object, + &[], + )? + .l() + .unwrap() + }; + let msg = unsafe { JString::from_raw(JObject::into_raw(msg)) }; + let msg = env.get_string(&msg)?; + let msg: String = msg.into(); + + // TODO: get Java backtrace: + /* + if let JValue::Object(elements) = env.call_method_unchecked(&e, get_stack_trace_method, jni::signature::ReturnType::Array, &[])? { + let elements = env.auto_local(elements); + + } + */ + + Ok(msg) + }); + + match result { + Ok(msg) => InternalAppError::JniException(msg), + Err(err) => InternalAppError::JniException(format!( + "UNKNOWN (Failed to query JThrowable: {err:?})" + )), + } + } else { + err.into() + } +} + +pub(crate) fn device_key_character_map( + jvm: CloneJavaVM, + key_map_binding: Arc, + device_id: i32, +) -> InternalResult { + // Don't really need to 'attach' since this should be called from the app's main thread that + // should already be attached, but the redundancy should be fine + // + // Attach 'permanently' to avoid any chance of detaching the thread from the VM + let mut env = jvm.attach_current_thread_permanently()?; + + // We don't want to accidentally leak any local references while we + // aren't going to be returning from here back to the JVM, to unwind, so + // we make a local frame + let character_map = env.with_local_frame::<_, _, jni::errors::Error>(10, |env| { + let input_device_class = env.find_class("android/view/InputDevice")?; // Creates a local ref + let device = env + .call_static_method( + input_device_class, + "getDevice", + "(I)Landroid/view/InputDevice;", + &[device_id.into()], + )? + .l()?; // Creates a local ref + + let character_map = env + .call_method( + &device, + "getKeyCharacterMap", + "()Landroid/view/KeyCharacterMap;", + &[], + )? + .l()?; + let character_map = env.new_global_ref(character_map)?; + + Ok(character_map) + })?; + + Ok(KeyCharacterMap::new( + jvm.clone(), + key_map_binding, + character_map, + )) +} diff --git a/android-activity/src/lib.rs b/android-activity/src/lib.rs index 6ae6b0c7..7a050789 100644 --- a/android-activity/src/lib.rs +++ b/android-activity/src/lib.rs @@ -13,15 +13,15 @@ //! a wider range of devices. //! //! Standalone applications based on this crate need to be built as `cdylib` libraries, like: -//! ``` +//! ```toml //! [lib] //! crate_type=["cdylib"] //! ``` //! //! and implement a `#[no_mangle]` `android_main` entry point like this: -//! ```rust +//! ```no_run //! #[no_mangle] -//! fn android_main(app: AndroidApp) { +//! fn android_main(app: android_activity::AndroidApp) { //! //! } //! ``` @@ -35,6 +35,18 @@ //! marshalled between the Java thread that owns the `Activity` and the native //! thread that runs the `android_main()` code. //! +//! # Cheaply Clonable [`AndroidApp`] +//! +//! [`AndroidApp`] is intended to be something that can be cheaply passed around +//! by referenced within an application. It is reference counted and can be +//! cheaply cloned. +//! +//! # `Send` and `Sync` [`AndroidApp`] +//! +//! Although an [`AndroidApp`] implements `Send` and `Sync` you do need to take +//! into consideration that some APIs, such as [`AndroidApp::poll_events()`] are +//! explicitly documented to only be usable from your `android_main()` thread. +//! //! # Main Thread Initialization //! //! Before `android_main()` is called, the following application state @@ -51,22 +63,74 @@ //! //! These are undone after `android_main()` returns //! +//! # Android Extensible Enums +// TODO: Move this to the NDK crate, which now implements this for most of the code? +//! +//! There are numerous enums in the `android-activity` API which are effectively +//! bindings to enums declared in the Android SDK which need to be considered +//! _runtime_ extensible. +//! +//! Any enum variants that come from the Android SDK may be extended in future +//! versions of Android and your code could be exposed to new variants if you +//! build an application that might be installed on new versions of Android. +//! +//! This crate follows a convention of adding a hidden `__Unknown(u32)` variant +//! to these enum to ensure we can always do lossless conversions between the +//! integers from the SDK and our corresponding Rust enums. This can be +//! important in case you need to pass certain variants back to the SDK +//! regardless of whether you knew about that variants specific semantics at +//! compile time. +//! +//! You should never include this `__Unknown(u32)` variant within any exhaustive +//! pattern match and should instead treat the enums like `#[non_exhaustive]` +//! enums that require you to add a catch-all for any `unknown => {}` values. +//! +//! Any code that would exhaustively include the `__Unknown(u32)` variant when +//! pattern matching can not be guaranteed to be forwards compatible with new +//! releases of `android-activity` which may add new Rust variants to these +//! enums without requiring a breaking semver bump. +//! +//! You can (infallibly) convert these enums to and from primitive `u32` values +//! using `.into()`: +//! +//! For example, here is how you could ensure forwards compatibility with both +//! compile-time and runtime extensions of a `SomeEnum` enum: +//! +//! ```ignore +//! match some_enum { +//! SomeEnum::Foo => {}, +//! SomeEnum::Bar => {}, +//! unhandled => { +//! let sdk_val: u32 = unhandled.into(); +//! println!("Unhandled enum variant {some_enum:?} has SDK value: {sdk_val}"); +//! } +//! } +//! ``` +//! //! [`Activity`]: https://developer.android.com/reference/android/app/Activity //! [`NativeActivity`]: https://developer.android.com/reference/android/app/NativeActivity //! [ndk_concepts]: https://developer.android.com/ndk/guides/concepts#naa //! [`GameActivity`]: https://developer.android.com/games/agdk/integrate-game-activity //! [Looper]: https://developer.android.com/reference/android/os/Looper +#![deny(clippy::manual_let_else)] + use std::hash::Hash; use std::sync::Arc; use std::sync::RwLock; use std::time::Duration; +use bitflags::bitflags; use libc::c_void; + use ndk::asset::AssetManager; use ndk::native_window::NativeWindow; -use bitflags::bitflags; +// Since we expose `ndk` types in our public API it's convenient if crates can +// defer to these re-exported APIs and avoid having to bump explicit +// dependencies when they pull in new releases of android-activity. +pub use ndk; +pub use ndk_sys; #[cfg(not(target_os = "android"))] compile_error!("android-activity only supports compiling for Android"); @@ -77,7 +141,7 @@ compile_error!( ); #[cfg(all( not(any(feature = "game-activity", feature = "native-activity")), - not(doc) + not(any(doc, used_on_docsrs)), ))] compile_error!( r#"Either "game-activity" or "native-activity" must be enabled as features @@ -96,23 +160,33 @@ You may need to add a `[patch]` into your Cargo.toml to ensure a specific versio android-activity is used across all of your application's crates."# ); -#[cfg(any(feature = "native-activity", doc))] -mod native_activity; -#[cfg(any(feature = "native-activity", doc))] -use native_activity as activity_impl; - -#[cfg(feature = "game-activity")] -mod game_activity; -#[cfg(feature = "game-activity")] -use game_activity as activity_impl; +#[cfg_attr(feature = "native-activity", path = "native_activity/mod.rs")] +#[cfg_attr(feature = "game-activity", path = "game_activity/mod.rs")] +#[cfg_attr( + all( + // No activities enabled. + not(any(feature = "native-activity", feature = "game-activity")), + // And building docs. + any(doc, used_on_docsrs), + ), + // Fall back to documenting native activity. + path = "native_activity/mod.rs" +)] +pub(crate) mod activity_impl; + +pub mod error; +use error::Result; pub mod input; +use input::KeyCharacterMap; mod config; pub use config::ConfigurationRef; mod util; +mod jni_utils; + /// A rectangle with integer edge coordinates. Used to represent window insets, for example. #[derive(Clone, Debug, Default, Eq, PartialEq)] pub struct Rect { @@ -163,14 +237,14 @@ pub use activity_impl::StateSaver; #[non_exhaustive] #[derive(Debug)] pub enum MainEvent<'a> { - /// New input events are available via [`AndroidApp::input_events()`] + /// New input events are available via [`AndroidApp::input_events_iter()`] /// /// _Note: Even if more input is received this event will not be resent - /// until [`AndroidApp::input_events()`] has been called, which enables + /// until [`AndroidApp::input_events_iter()`] has been called, which enables /// applications to batch up input processing without there being lots of /// redundant event loop wake ups._ /// - /// [`AndroidApp::input_events()`]: AndroidApp::input_events + /// [`AndroidApp::input_events_iter()`]: AndroidApp::input_events_iter InputAvailable, /// Command from main thread: a new [`NativeWindow`] is ready for use. Upon @@ -211,9 +285,9 @@ pub enum MainEvent<'a> { /// input focus. LostFocus, - /// Command from main thread: the current device configuration has changed. - /// You can get a copy of the latest [`ndk::configuration::Configuration`] by calling - /// [`AndroidApp::config()`] + /// Command from main thread: the current device configuration has changed. Any + /// reference gotten via [`AndroidApp::config()`] will automatically contain the latest + /// [`ndk::configuration::Configuration`]. #[non_exhaustive] ConfigChanged {}, @@ -275,6 +349,7 @@ pub use activity_impl::AndroidAppWaker; bitflags! { /// Flags for [`AndroidApp::set_window_flags`] /// as per the [android.view.WindowManager.LayoutParams Java API](https://developer.android.com/reference/android/view/WindowManager.LayoutParams) + #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] pub struct WindowManagerFlags: u32 { /// As long as this window is visible to the user, allow the lock /// screen to activate while the screen is on. This can be used @@ -445,6 +520,18 @@ bitflags! { /// marshalled between the Java thread that owns the `Activity` and the native /// thread that runs the `android_main()` code. /// +/// # Cheaply Clonable [`AndroidApp`] +/// +/// [`AndroidApp`] is intended to be something that can be cheaply passed around +/// by referenced within an application. It is reference counted and can be +/// cheaply cloned. +/// +/// # `Send` and `Sync` [`AndroidApp`] +/// +/// Although an [`AndroidApp`] implements `Send` and `Sync` you do need to take +/// into consideration that some APIs, such as [`AndroidApp::poll_events()`] are +/// explicitly documented to only be usable from your `android_main()` thread. +/// #[derive(Debug, Clone)] pub struct AndroidApp { pub(crate) inner: Arc>, @@ -480,10 +567,10 @@ impl AndroidApp { /// between native Rust code and Java/Kotlin code running within the JVM. /// /// If you use the [`jni`] crate you can wrap this as a [`JavaVM`] via: - /// ```ignore + /// ```no_run /// # use jni::JavaVM; - /// # let app: AndroidApp = todo!(); - /// let vm = unsafe { JavaVM::from_raw(app.vm_as_ptr()) }; + /// # let app: android_activity::AndroidApp = todo!(); + /// let vm = unsafe { JavaVM::from_raw(app.vm_as_ptr().cast()) }; /// ``` /// /// [`jni`]: https://crates.io/crates/jni @@ -495,10 +582,10 @@ impl AndroidApp { /// Returns a JNI object reference for this application's JVM `Activity` as a pointer /// /// If you use the [`jni`] crate you can wrap this as an object reference via: - /// ```ignore + /// ```no_run /// # use jni::objects::JObject; - /// # let app: AndroidApp = todo!(); - /// let activity = unsafe { JObject::from_raw(app.activity_as_ptr()) }; + /// # let app: android_activity::AndroidApp = todo!(); + /// let activity = unsafe { JObject::from_raw(app.activity_as_ptr().cast()) }; /// ``` /// /// # JNI Safety @@ -536,18 +623,25 @@ impl AndroidApp { /// [`ALooper_pollAll`]: ndk::looper::ThreadLooper::poll_all pub fn poll_events(&self, timeout: Option, callback: F) where - F: FnMut(PollEvent), + F: FnMut(PollEvent<'_>), { self.inner.read().unwrap().poll_events(timeout, callback); } /// Creates a means to wake up the main loop while it is blocked waiting for /// events within [`AndroidApp::poll_events()`]. - pub fn create_waker(&self) -> activity_impl::AndroidAppWaker { + pub fn create_waker(&self) -> AndroidAppWaker { self.inner.read().unwrap().create_waker() } - /// Returns a (cheaply clonable) reference to this application's [`ndk::configuration::Configuration`] + /// Returns a **reference** to this application's [`ndk::configuration::Configuration`]. + /// + /// # Warning + /// + /// The value held by this reference **will change** with every [`MainEvent::ConfigChanged`] + /// event that is raised. You should **not** [`Clone`] this type to compare it against a + /// "new" [`AndroidApp::config()`] when that event is raised, since both point to the same + /// internal [`ndk::configuration::Configuration`] and will be identical. pub fn config(&self) -> ConfigurationRef { self.inner.read().unwrap().config() } @@ -618,24 +712,155 @@ impl AndroidApp { .hide_soft_input(hide_implicit_only); } - /// Query and process all out-standing input event + /// Fetch the current input text state, as updated by any active IME. + pub fn text_input_state(&self) -> input::TextInputState { + self.inner.read().unwrap().text_input_state() + } + + /// Forward the given input text `state` to any active IME. + pub fn set_text_input_state(&self, state: input::TextInputState) { + self.inner.read().unwrap().set_text_input_state(state); + } + + /// Get an exclusive, lending iterator over buffered input events /// - /// `callback` should return [`InputStatus::Unhandled`] for any input events that aren't directly - /// handled by the application, or else [`InputStatus::Handled`]. Unhandled events may lead to a - /// fallback interpretation of the event. + /// Applications are expected to call this in-sync with their rendering or + /// in response to a [`MainEvent::InputAvailable`] event being delivered. /// - /// Applications are generally either expected to call this in-sync with their rendering or - /// in response to a [`MainEvent::InputAvailable`] event being delivered. _Note though that your - /// application is will only be delivered a single [`MainEvent::InputAvailable`] event between calls - /// to this API._ + /// _**Note:** your application is will only be delivered a single + /// [`MainEvent::InputAvailable`] event between calls to this API._ /// - /// To reduce overhead, by default only [`input::Axis::X`] and [`input::Axis::Y`] are enabled + /// To reduce overhead, by default, only [`input::Axis::X`] and [`input::Axis::Y`] are enabled /// and other axis should be enabled explicitly via [`Self::enable_motion_axis`]. - pub fn input_events(&self, callback: F) - where - F: FnMut(&input::InputEvent) -> InputStatus, - { - self.inner.read().unwrap().input_events(callback) + /// + /// This isn't the most ergonomic iteration API since we can't return a standard `Iterator`: + /// - This API returns a lending iterator may borrow from the internal buffer + /// of pending events without copying them. + /// - For each event we want to ensure the application reports whether the + /// event was handled. + /// + /// # Example + /// Code to iterate all pending input events would look something like this: + /// + /// ```no_run + /// # use android_activity::{AndroidApp, InputStatus, input::InputEvent}; + /// # let app: AndroidApp = todo!(); + /// match app.input_events_iter() { + /// Ok(mut iter) => { + /// loop { + /// let read_input = iter.next(|event| { + /// let handled = match event { + /// InputEvent::KeyEvent(key_event) => { + /// // Snip + /// InputStatus::Handled + /// } + /// InputEvent::MotionEvent(motion_event) => { + /// InputStatus::Unhandled + /// } + /// event => { + /// InputStatus::Unhandled + /// } + /// }; + /// + /// handled + /// }); + /// + /// if !read_input { + /// break; + /// } + /// } + /// } + /// Err(err) => { + /// log::error!("Failed to get input events iterator: {err:?}"); + /// } + /// } + /// ``` + /// + /// # Panics + /// + /// This must only be called from your `android_main()` thread and it may panic if called + /// from another thread. + pub fn input_events_iter(&self) -> Result> { + let receiver = { + let guard = self.inner.read().unwrap(); + guard.input_events_receiver()? + }; + + Ok(input::InputIterator { + inner: receiver.into(), + }) + } + + /// Lookup the [`KeyCharacterMap`] for the given input `device_id` + /// + /// Use [`KeyCharacterMap::get`] to map key codes + meta state into unicode characters + /// or dead keys that compose with the next key. + /// + /// # Example + /// + /// Code to handle unicode character mapping as well as combining dead keys could look some thing like: + /// + /// ```no_run + /// # use android_activity::{AndroidApp, input::{InputEvent, KeyEvent, KeyMapChar}}; + /// # let app: AndroidApp = todo!(); + /// # let key_event: KeyEvent = todo!(); + /// let mut combining_accent = None; + /// // Snip + /// + /// let combined_key_char = if let Ok(map) = app.device_key_character_map(key_event.device_id()) { + /// match map.get(key_event.key_code(), key_event.meta_state()) { + /// Ok(KeyMapChar::Unicode(unicode)) => { + /// let combined_unicode = if let Some(accent) = combining_accent { + /// match map.get_dead_char(accent, unicode) { + /// Ok(Some(key)) => { + /// println!("KeyEvent: Combined '{unicode}' with accent '{accent}' to give '{key}'"); + /// Some(key) + /// } + /// Ok(None) => None, + /// Err(err) => { + /// eprintln!("KeyEvent: Failed to combine 'dead key' accent '{accent}' with '{unicode}': {err:?}"); + /// None + /// } + /// } + /// } else { + /// println!("KeyEvent: Pressed '{unicode}'"); + /// Some(unicode) + /// }; + /// combining_accent = None; + /// combined_unicode.map(|unicode| KeyMapChar::Unicode(unicode)) + /// } + /// Ok(KeyMapChar::CombiningAccent(accent)) => { + /// println!("KeyEvent: Pressed 'dead key' combining accent '{accent}'"); + /// combining_accent = Some(accent); + /// Some(KeyMapChar::CombiningAccent(accent)) + /// } + /// Ok(KeyMapChar::None) => { + /// println!("KeyEvent: Pressed non-unicode key"); + /// combining_accent = None; + /// None + /// } + /// Err(err) => { + /// eprintln!("KeyEvent: Failed to get key map character: {err:?}"); + /// combining_accent = None; + /// None + /// } + /// } + /// } else { + /// None + /// }; + /// ``` + /// + /// # Errors + /// + /// Since this API needs to use JNI internally to call into the Android JVM it may return + /// a [`error::AppError::JavaError`] in case there is a spurious JNI error or an exception + /// is caught. + pub fn device_key_character_map(&self, device_id: i32) -> Result { + Ok(self + .inner + .read() + .unwrap() + .device_key_character_map(device_id)?) } /// The user-visible SDK version of the framework diff --git a/android-activity/src/native_activity/glue.rs b/android-activity/src/native_activity/glue.rs index 6af66af8..82672a5a 100644 --- a/android-activity/src/native_activity/glue.rs +++ b/android-activity/src/native_activity/glue.rs @@ -3,19 +3,19 @@ //! synchronization between the two threads. use std::{ - ffi::{CStr, CString}, - fs::File, - io::{BufRead, BufReader}, ops::Deref, - os::unix::prelude::{FromRawFd, RawFd}, + panic::catch_unwind, ptr::{self, NonNull}, sync::{Arc, Condvar, Mutex, Weak}, }; -use log::Level; use ndk::{configuration::Configuration, input_queue::InputQueue, native_window::NativeWindow}; -use crate::{util::abort_on_panic, util::android_log, ConfigurationRef}; +use crate::{ + jni_utils::CloneJavaVM, + util::{abort_on_panic, forward_stdio_to_logcat, log_panic}, + ConfigurationRef, +}; use super::{AndroidApp, Rect}; @@ -81,12 +81,14 @@ pub struct WaitableNativeActivityState { pub cond: Condvar, } +// SAFETY: ndk::NativeActivity is also SendSync. +unsafe impl Send for WaitableNativeActivityState {} +unsafe impl Sync for WaitableNativeActivityState {} + #[derive(Debug, Clone)] pub struct NativeActivityGlue { pub inner: Arc, } -unsafe impl Send for NativeActivityGlue {} -unsafe impl Sync for NativeActivityGlue {} impl Deref for NativeActivityGlue { type Target = WaitableNativeActivityState; @@ -194,21 +196,35 @@ impl NativeActivityGlue { } } +/// The status of the native thread that's created to run +/// `android_main` +#[derive(Copy, Clone, Debug, PartialEq, Eq)] +pub enum NativeThreadState { + /// The `android_main` thread hasn't been created yet + Init, + /// The `android_main` thread has been spawned and started running + Running, + /// The `android_main` thread has finished + Stopped, +} + #[derive(Debug)] pub struct NativeActivityState { pub msg_read: libc::c_int, pub msg_write: libc::c_int, - pub config: super::ConfigurationRef, + pub config: ConfigurationRef, pub saved_state: Vec, pub input_queue: *mut ndk_sys::AInputQueue, pub window: Option, pub content_rect: ndk_sys::ARect, pub activity_state: State, pub destroy_requested: bool, - pub running: bool, + pub thread_state: NativeThreadState, pub app_has_saved_state: bool, + + /// Set as soon as the Java main thread notifies us of an + /// `onDestroyed` callback. pub destroyed: bool, - pub redraw_needed: bool, pub pending_input_queue: *mut ndk_sys::AInputQueue, pub pending_window: Option, } @@ -298,8 +314,6 @@ impl Drop for WaitableNativeActivityState { unsafe { let mut guard = self.mutex.lock().unwrap(); guard.detach_input_queue_from_looper(); - guard.destroyed = true; - self.cond.notify_one(); } } } @@ -324,8 +338,11 @@ impl WaitableNativeActivityState { } } - let saved_state = unsafe { - std::slice::from_raw_parts(saved_state_in as *const u8, saved_state_size as _) + let saved_state = if saved_state_in.is_null() { + Vec::new() + } else { + unsafe { std::slice::from_raw_parts(saved_state_in as *const u8, saved_state_size) } + .to_vec() }; let config = unsafe { @@ -345,16 +362,15 @@ impl WaitableNativeActivityState { msg_read: msgpipe[0], msg_write: msgpipe[1], config, - saved_state: saved_state.into(), + saved_state, input_queue: ptr::null_mut(), window: None, content_rect: Rect::empty().into(), activity_state: State::Init, destroy_requested: false, - running: false, + thread_state: NativeThreadState::Init, app_has_saved_state: false, destroyed: false, - redraw_needed: false, pending_input_queue: ptr::null_mut(), pending_window: None, }), @@ -364,10 +380,11 @@ impl WaitableNativeActivityState { pub fn notify_destroyed(&self) { let mut guard = self.mutex.lock().unwrap(); + guard.destroyed = true; unsafe { guard.write_cmd(AppCmd::Destroy); - while !guard.destroyed { + while guard.thread_state != NativeThreadState::Stopped { guard = self.cond.wait(guard).unwrap(); } @@ -430,7 +447,9 @@ impl WaitableNativeActivityState { guard.pending_input_queue = input_queue; guard.write_cmd(AppCmd::InputQueueChanged); - while guard.input_queue != guard.pending_input_queue { + while guard.thread_state == NativeThreadState::Running + && guard.input_queue != guard.pending_input_queue + { guard = self.cond.wait(guard).unwrap(); } guard.pending_input_queue = ptr::null_mut(); @@ -451,7 +470,9 @@ impl WaitableNativeActivityState { if guard.pending_window.is_some() { guard.write_cmd(AppCmd::InitWindow); } - while guard.window != guard.pending_window { + while guard.thread_state == NativeThreadState::Running + && guard.window != guard.pending_window + { guard = self.cond.wait(guard).unwrap(); } guard.pending_window = None; @@ -475,7 +496,7 @@ impl WaitableNativeActivityState { }; guard.write_cmd(cmd); - while guard.activity_state != state { + while guard.thread_state == NativeThreadState::Running && guard.activity_state != state { guard = self.cond.wait(guard).unwrap(); } } @@ -488,7 +509,7 @@ impl WaitableNativeActivityState { // this to be None debug_assert!(!guard.app_has_saved_state, "SaveState request clash"); guard.write_cmd(AppCmd::SaveState); - while !guard.app_has_saved_state { + while guard.thread_state == NativeThreadState::Running && !guard.app_has_saved_state { guard = self.cond.wait(guard).unwrap(); } guard.app_has_saved_state = false; @@ -497,7 +518,7 @@ impl WaitableNativeActivityState { // given via a `malloc()` allocated pointer since it will automatically // `free()` the state after it has been converted to a buffer for the JVM. if !guard.saved_state.is_empty() { - let saved_state_size = guard.saved_state.len() as _; + let saved_state_size = guard.saved_state.len(); let saved_state_src_ptr = guard.saved_state.as_ptr(); unsafe { let saved_state = libc::malloc(saved_state_size); @@ -536,10 +557,18 @@ impl WaitableNativeActivityState { pub fn notify_main_thread_running(&self) { let mut guard = self.mutex.lock().unwrap(); - guard.running = true; + guard.thread_state = NativeThreadState::Running; self.cond.notify_one(); } + pub fn notify_main_thread_stopped_running(&self) { + let mut guard = self.mutex.lock().unwrap(); + guard.thread_state = NativeThreadState::Stopped; + // Notify all waiters to unblock any Android callbacks that would otherwise be waiting + // indefinitely for the now-stopped (!) main thread. + self.cond.notify_all(); + } + pub unsafe fn pre_exec_cmd( &self, cmd: AppCmd, @@ -655,7 +684,7 @@ unsafe extern "C" fn on_resume(activity: *mut ndk_sys::ANativeActivity) { unsafe extern "C" fn on_save_instance_state( activity: *mut ndk_sys::ANativeActivity, - out_len: *mut ndk_sys::size_t, + out_len: *mut usize, ) -> *mut libc::c_void { abort_on_panic(|| { log::debug!("SaveInstanceState: {:p}\n", activity); @@ -663,7 +692,7 @@ unsafe extern "C" fn on_save_instance_state( let mut ret = ptr::null_mut(); try_with_waitable_activity_ref(activity, |waitable_activity| { let (state, len) = waitable_activity.request_save_state(); - *out_len = len as ndk_sys::size_t; + *out_len = len; ret = state }); @@ -809,29 +838,7 @@ extern "C" fn ANativeActivity_onCreate( saved_state_size: libc::size_t, ) { abort_on_panic(|| { - // Maybe make this stdout/stderr redirection an optional / opt-in feature?... - unsafe { - let mut logpipe: [RawFd; 2] = Default::default(); - libc::pipe(logpipe.as_mut_ptr()); - libc::dup2(logpipe[1], libc::STDOUT_FILENO); - libc::dup2(logpipe[1], libc::STDERR_FILENO); - std::thread::spawn(move || { - let tag = CStr::from_bytes_with_nul(b"RustStdoutStderr\0").unwrap(); - let file = File::from_raw_fd(logpipe[0]); - let mut reader = BufReader::new(file); - let mut buffer = String::new(); - loop { - buffer.clear(); - if let Ok(len) = reader.read_line(&mut buffer) { - if len == 0 { - break; - } else if let Ok(msg) = CString::new(buffer.clone()) { - android_log(Level::Info, tag, &msg); - } - } - } - }); - } + let _join_log_forwarder = forward_stdio_to_logcat(); log::trace!( "Creating: {:p}, saved_state = {:p}, save_state_size = {}", @@ -852,49 +859,67 @@ extern "C" fn ANativeActivity_onCreate( std::thread::spawn(move || { let activity: *mut ndk_sys::ANativeActivity = activity_ptr as *mut _; - let jvm = unsafe { + let jvm = abort_on_panic(|| unsafe { let na = activity; - let jvm = (*na).vm; + let jvm: *mut jni_sys::JavaVM = (*na).vm; let activity = (*na).clazz; // Completely bogus name; this is the _instance_ not class pointer ndk_context::initialize_android_context(jvm.cast(), activity.cast()); + let jvm = CloneJavaVM::from_raw(jvm).unwrap(); // Since this is a newly spawned thread then the JVM hasn't been attached // to the thread yet. Attach before calling the applications main function // so they can safely make JNI calls - let mut jenv_out: *mut core::ffi::c_void = std::ptr::null_mut(); - if let Some(attach_current_thread) = (*(*jvm)).AttachCurrentThread { - attach_current_thread(jvm, &mut jenv_out, std::ptr::null_mut()); - } - + jvm.attach_current_thread_permanently().unwrap(); jvm - }; + }); - let app = AndroidApp::new(rust_glue.clone()); + let app = AndroidApp::new(rust_glue.clone(), jvm.clone()); rust_glue.notify_main_thread_running(); unsafe { - // XXX: If we were in control of the Java Activity subclass then - // we could potentially run the android_main function via a Java native method - // springboard (e.g. call an Activity subclass method that calls a jni native - // method that then just calls android_main()) that would make sure there was - // a Java frame at the base of our call stack which would then be recognised - // when calling FindClass to lookup a suitable classLoader, instead of - // defaulting to the system loader. Without this then it's difficult for native - // code to look up non-standard Java classes. - android_main(app); - - if let Some(detach_current_thread) = (*(*jvm)).DetachCurrentThread { - detach_current_thread(jvm); - } + // Name thread - this needs to happen here after attaching to a JVM thread, + // since that changes the thread name to something like "Thread-2". + let thread_name = std::ffi::CStr::from_bytes_with_nul(b"android_main\0").unwrap(); + libc::pthread_setname_np(libc::pthread_self(), thread_name.as_ptr()); + + // We want to specifically catch any panic from the application's android_main + // so we can finish + destroy the Activity gracefully via the JVM + catch_unwind(|| { + // XXX: If we were in control of the Java Activity subclass then + // we could potentially run the android_main function via a Java native method + // springboard (e.g. call an Activity subclass method that calls a jni native + // method that then just calls android_main()) that would make sure there was + // a Java frame at the base of our call stack which would then be recognised + // when calling FindClass to lookup a suitable classLoader, instead of + // defaulting to the system loader. Without this then it's difficult for native + // code to look up non-standard Java classes. + android_main(app); + }) + .unwrap_or_else(log_panic); + + // Let JVM know that our Activity can be destroyed before detaching from the JVM + // + // "Note that this method can be called from any thread; it will send a message + // to the main thread of the process where the Java finish call will take place" + ndk_sys::ANativeActivity_finish(activity); + + // This should detach automatically but lets detach explicitly to avoid depending + // on the TLS trickery in `jni-rs` + jvm.detach_current_thread(); ndk_context::release_android_context(); } + + rust_glue.notify_main_thread_stopped_running(); }); // Wait for thread to start. let mut guard = jvm_glue.mutex.lock().unwrap(); - while !guard.running { + + // Don't specifically wait for `Running` just in case `android_main` returns + // immediately and the state is set to `Stopped` + while guard.thread_state == NativeThreadState::Init { guard = jvm_glue.cond.wait(guard).unwrap(); } }) diff --git a/android-activity/src/native_activity/input.rs b/android-activity/src/native_activity/input.rs index 17e8f4bd..15591086 100644 --- a/android-activity/src/native_activity/input.rs +++ b/android-activity/src/native_activity/input.rs @@ -1,11 +1,11 @@ use std::marker::PhantomData; -pub use ndk::event::{ - Axis, ButtonState, EdgeFlags, KeyAction, KeyEventFlags, Keycode, MetaState, MotionAction, - MotionEventFlags, Pointer, PointersIter, -}; +use ndk::event::ButtonState; -use crate::input::{Class, Source}; +use crate::input::{ + Axis, EdgeFlags, KeyAction, Keycode, MetaState, MotionAction, MotionEventFlags, Pointer, + PointersIter, Source, ToolType, +}; /// A motion event /// @@ -17,7 +17,7 @@ pub struct MotionEvent<'a> { ndk_event: ndk::event::MotionEvent, _lifetime: PhantomData<&'a ndk::event::MotionEvent>, } -impl<'a> MotionEvent<'a> { +impl MotionEvent<'_> { pub(crate) fn new(ndk_event: ndk::event::MotionEvent) -> Self { Self { ndk_event, @@ -32,20 +32,7 @@ impl<'a> MotionEvent<'a> { /// #[inline] pub fn source(&self) -> Source { - // XXX: we use `AInputEvent_getSource` directly (instead of calling - // ndk_event.source()) since we have our own `Source` enum that we - // share between backends, which may not exactly match the ndk crate's - // `Source` enum. - let source = - unsafe { ndk_sys::AInputEvent_getSource(self.ndk_event.ptr().as_ptr()) as u32 }; - source.try_into().unwrap_or(Source::Unknown) - } - - /// Get the class of the event source. - /// - #[inline] - pub fn class(&self) -> Class { - Class::from(self.source()) + self.ndk_event.source() } /// Get the device id associated with the event. @@ -63,6 +50,20 @@ impl<'a> MotionEvent<'a> { self.ndk_event.action() } + /// Returns which button has been modified during a press or release action. + /// + /// For actions other than [`MotionAction::ButtonPress`] and + /// [`MotionAction::ButtonRelease`] the returned value is undefined. + /// + /// See [the MotionEvent docs](https://developer.android.com/reference/android/view/MotionEvent#getActionButton()) + #[inline] + #[cfg(feature = "api-level-33")] + #[doc(alias = "AMotionEvent_getActionButton")] + // TODO: Button enum to signify only one bitflag can be set? + pub fn action_button(&self) -> ButtonState { + self.ndk_event.action_button() + } + /// Returns the pointer index of an `Up` or `Down` event. /// /// Pointer indices can change per motion event. For an identifier that stays the same, see @@ -99,7 +100,11 @@ impl<'a> MotionEvent<'a> { /// An iterator over the pointers in this motion event #[inline] pub fn pointers(&self) -> PointersIter<'_> { - self.ndk_event.pointers() + PointersIter { + inner: PointersIterImpl { + ndk_pointers_iter: self.ndk_event.pointers(), + }, + } } /// The pointer at a given pointer index. Panics if the pointer index is out of bounds. @@ -107,7 +112,11 @@ impl<'a> MotionEvent<'a> { /// If you need to loop over all the pointers, prefer the [`pointers()`](Self::pointers) method. #[inline] pub fn pointer_at_index(&self, index: usize) -> Pointer<'_> { - self.ndk_event.pointer_at_index(index) + Pointer { + inner: PointerImpl { + ndk_pointer: self.ndk_event.pointer_at_index(index), + }, + } } /* @@ -224,6 +233,71 @@ impl<'a> MotionEvent<'a> { } } +/// A view into the data of a specific pointer in a motion event. +#[derive(Debug)] +pub(crate) struct PointerImpl<'a> { + ndk_pointer: ndk::event::Pointer<'a>, +} + +impl PointerImpl<'_> { + #[inline] + pub fn pointer_index(&self) -> usize { + self.ndk_pointer.pointer_index() + } + + #[inline] + pub fn pointer_id(&self) -> i32 { + self.ndk_pointer.pointer_id() + } + + #[inline] + pub fn axis_value(&self, axis: Axis) -> f32 { + let value: i32 = axis.into(); + self.ndk_pointer.axis_value(value.into()) + } + + #[inline] + pub fn raw_x(&self) -> f32 { + self.ndk_pointer.raw_x() + } + + #[inline] + pub fn raw_y(&self) -> f32 { + self.ndk_pointer.raw_y() + } + + #[inline] + pub fn tool_type(&self) -> ToolType { + let value: i32 = self.ndk_pointer.tool_type().into(); + value.into() + } +} + +/// An iterator over the pointers in a [`MotionEvent`]. +#[derive(Debug)] +pub(crate) struct PointersIterImpl<'a> { + ndk_pointers_iter: ndk::event::PointersIter<'a>, +} + +impl<'a> Iterator for PointersIterImpl<'a> { + type Item = Pointer<'a>; + fn next(&mut self) -> Option> { + self.ndk_pointers_iter.next().map(|ndk_pointer| Pointer { + inner: PointerImpl { ndk_pointer }, + }) + } + + fn size_hint(&self) -> (usize, Option) { + self.ndk_pointers_iter.size_hint() + } +} + +impl ExactSizeIterator for PointersIterImpl<'_> { + fn len(&self) -> usize { + self.ndk_pointers_iter.len() + } +} + /// A key event /// /// For general discussion of key events in Android, see [the relevant @@ -234,7 +308,7 @@ pub struct KeyEvent<'a> { ndk_event: ndk::event::KeyEvent, _lifetime: PhantomData<&'a ndk::event::KeyEvent>, } -impl<'a> KeyEvent<'a> { +impl KeyEvent<'_> { pub(crate) fn new(ndk_event: ndk::event::KeyEvent) -> Self { Self { ndk_event, @@ -246,23 +320,9 @@ impl<'a> KeyEvent<'a> { } /// Get the source of the event. - /// #[inline] pub fn source(&self) -> Source { - // XXX: we use `AInputEvent_getSource` directly (instead of calling - // ndk_event.source()) since we have our own `Source` enum that we - // share between backends, which may not exactly match the ndk crate's - // `Source` enum. - let source = - unsafe { ndk_sys::AInputEvent_getSource(self.ndk_event.ptr().as_ptr()) as u32 }; - source.try_into().unwrap_or(Source::Unknown) - } - - /// Get the class of the event source. - /// - #[inline] - pub fn class(&self) -> Class { - Class::from(self.source()) + self.ndk_event.source() } /// Get the device id associated with the event. @@ -326,15 +386,24 @@ impl<'a> KeyEvent<'a> { pub fn scan_code(&self) -> i32 { self.ndk_event.scan_code() } + + /// Returns the state of the modifiers during this key event, represented by a bitmask. + /// + /// See [the NDK + /// docs](https://developer.android.com/ndk/reference/group/input#akeyevent_getmetastate) + #[inline] + pub fn meta_state(&self) -> MetaState { + self.ndk_event.meta_state() + } } // We use our own wrapper type for input events to have better consistency -// with GameActivity and ensure the enum can be extended without needing a -// semver bump +// with GameActivity /// Enum of possible input events #[derive(Debug)] #[non_exhaustive] pub enum InputEvent<'a> { MotionEvent(self::MotionEvent<'a>), KeyEvent(self::KeyEvent<'a>), + TextEvent(crate::input::TextInputState), } diff --git a/android-activity/src/native_activity/mod.rs b/android-activity/src/native_activity/mod.rs index e0bb3303..4fa295d8 100644 --- a/android-activity/src/native_activity/mod.rs +++ b/android-activity/src/native_activity/mod.rs @@ -1,14 +1,20 @@ -#![cfg(any(feature = "native-activity", doc))] - +use std::collections::HashMap; +use std::marker::PhantomData; +use std::panic::AssertUnwindSafe; use std::ptr; use std::ptr::NonNull; -use std::sync::{Arc, RwLock}; +use std::sync::{Arc, Mutex, RwLock, Weak}; use std::time::Duration; use libc::c_void; use log::{error, trace}; +use ndk::input_queue::InputQueue; use ndk::{asset::AssetManager, native_window::NativeWindow}; +use crate::error::InternalResult; +use crate::input::{Axis, KeyCharacterMap, KeyCharacterMapBinding}; +use crate::input::{TextInputState, TextSpan}; +use crate::jni_utils::{self, CloneJavaVM}; use crate::{ util, AndroidApp, ConfigurationRef, InputStatus, MainEvent, PollEvent, Rect, WindowManagerFlags, }; @@ -45,7 +51,7 @@ impl<'a> StateSaver<'a> { pub struct StateLoader<'a> { app: &'a AndroidAppInner, } -impl<'a> StateLoader<'a> { +impl StateLoader<'_> { /// Returns whatever state was saved during the last [MainEvent::SaveState] event or `None` pub fn load(&self) -> Option> { self.app.native_activity.saved_state() @@ -78,13 +84,26 @@ impl AndroidAppWaker { } impl AndroidApp { - pub(crate) fn new(native_activity: NativeActivityGlue) -> Self { + pub(crate) fn new(native_activity: NativeActivityGlue, jvm: CloneJavaVM) -> Self { + let mut env = jvm.get_env().unwrap(); // We attach to the thread before creating the AndroidApp + + let key_map_binding = match KeyCharacterMapBinding::new(&mut env) { + Ok(b) => b, + Err(err) => { + panic!("Failed to create KeyCharacterMap JNI bindings: {err:?}"); + } + }; + let app = Self { inner: Arc::new(RwLock::new(AndroidAppInner { + jvm, native_activity, looper: Looper { ptr: ptr::null_mut(), }, + key_map_binding: Arc::new(key_map_binding), + key_maps: Mutex::new(HashMap::new()), + input_receiver: Mutex::new(None), })), }; @@ -121,8 +140,23 @@ unsafe impl Sync for Looper {} #[derive(Debug)] pub(crate) struct AndroidAppInner { + pub(crate) jvm: CloneJavaVM, + pub(crate) native_activity: NativeActivityGlue, looper: Looper, + + /// Shared JNI bindings for the `KeyCharacterMap` class + key_map_binding: Arc, + + /// A table of `KeyCharacterMap`s per `InputDevice` ID + /// these are used to be able to map key presses to unicode + /// characters + key_maps: Mutex>, + + /// While an app is reading input events it holds an + /// InputReceiver reference which we track to ensure + /// we don't hand out more than one receiver at a time + input_receiver: Mutex>>, } impl AndroidAppInner { @@ -149,14 +183,14 @@ impl AndroidAppInner { pub fn poll_events(&self, timeout: Option, mut callback: F) where - F: FnMut(PollEvent), + F: FnMut(PollEvent<'_>), { trace!("poll_events"); unsafe { let mut fd: i32 = 0; let mut events: i32 = 0; - let mut source: *mut core::ffi::c_void = ptr::null_mut(); + let mut source: *mut c_void = ptr::null_mut(); let timeout_milliseconds = if let Some(timeout) = timeout { timeout.as_millis() as i32 @@ -165,15 +199,16 @@ impl AndroidAppInner { }; trace!("Calling ALooper_pollAll, timeout = {timeout_milliseconds}"); - assert!( - !ndk_sys::ALooper_forThread().is_null(), + assert_eq!( + ndk_sys::ALooper_forThread(), + self.looper.ptr, "Application tried to poll events from non-main thread" ); let id = ndk_sys::ALooper_pollAll( timeout_milliseconds, &mut fd, &mut events, - &mut source as *mut *mut core::ffi::c_void, + &mut source as *mut *mut c_void, ); trace!("pollAll id = {id}"); match id { @@ -341,38 +376,129 @@ impl AndroidAppInner { } } - pub fn enable_motion_axis(&self, _axis: input::Axis) { + // TODO: move into a trait + pub fn text_input_state(&self) -> TextInputState { + TextInputState { + text: String::new(), + selection: TextSpan { start: 0, end: 0 }, + compose_region: None, + } + } + + // TODO: move into a trait + pub fn set_text_input_state(&self, _state: TextInputState) { + // NOP: Unsupported + } + + pub fn device_key_character_map(&self, device_id: i32) -> InternalResult { + let mut guard = self.key_maps.lock().unwrap(); + + let key_map = match guard.entry(device_id) { + std::collections::hash_map::Entry::Occupied(occupied) => occupied.get().clone(), + std::collections::hash_map::Entry::Vacant(vacant) => { + let character_map = jni_utils::device_key_character_map( + self.jvm.clone(), + self.key_map_binding.clone(), + device_id, + )?; + vacant.insert(character_map.clone()); + character_map + } + }; + + Ok(key_map) + } + + pub fn enable_motion_axis(&self, _axis: Axis) { // NOP - The InputQueue API doesn't let us optimize which axis values are read } - pub fn disable_motion_axis(&self, _axis: input::Axis) { + pub fn disable_motion_axis(&self, _axis: Axis) { // NOP - The InputQueue API doesn't let us optimize which axis values are read } - pub fn input_events(&self, mut callback: F) - where - F: FnMut(&input::InputEvent) -> InputStatus, - { + pub fn input_events_receiver(&self) -> InternalResult> { + let mut guard = self.input_receiver.lock().unwrap(); + + if let Some(receiver) = &*guard { + if receiver.strong_count() > 0 { + return Err(crate::error::InternalAppError::InputUnavailable); + } + } + *guard = None; + // Get the InputQueue for the NativeActivity (if there is one) and also ensure // the queue is re-attached to our event Looper (so new input events will again // trigger a wake up) let queue = self .native_activity .looper_attached_input_queue(self.looper(), LOOPER_ID_INPUT); - let queue = match queue { - Some(queue) => queue, - None => return, + + // Note: we don't treat it as an error if there is no queue, so if applications + // iterate input before a queue has been created (e.g. before onStart) then + // it will simply behave like there are no events available currently. + let receiver = Arc::new(InputReceiver { queue }); + + *guard = Some(Arc::downgrade(&receiver)); + Ok(receiver) + } + + pub fn internal_data_path(&self) -> Option { + let na = self.native_activity(); + unsafe { util::try_get_path_from_ptr((*na).internalDataPath) } + } + + pub fn external_data_path(&self) -> Option { + let na = self.native_activity(); + unsafe { util::try_get_path_from_ptr((*na).externalDataPath) } + } + + pub fn obb_path(&self) -> Option { + let na = self.native_activity(); + unsafe { util::try_get_path_from_ptr((*na).obbPath) } + } +} + +#[derive(Debug)] +pub(crate) struct InputReceiver { + queue: Option, +} + +impl From> for InputIteratorInner<'_> { + fn from(receiver: Arc) -> Self { + Self { + receiver, + _lifetime: PhantomData, + } + } +} + +pub(crate) struct InputIteratorInner<'a> { + // Held to maintain exclusive access to buffered input events + receiver: Arc, + _lifetime: PhantomData<&'a ()>, +} + +impl InputIteratorInner<'_> { + pub(crate) fn next(&self, callback: F) -> bool + where + F: FnOnce(&input::InputEvent) -> InputStatus, + { + let Some(queue) = &self.receiver.queue else { + log::trace!("no queue available for events"); + return false; }; - // Note: we basically ignore errors from get_event() currently. Looking - // at the source code for Android's InputQueue, the only error that - // can be returned here is 'WOULD_BLOCK', which we want to just treat as - // meaning the queue is empty. + // Note: we basically ignore errors from event() currently. Looking at the source code for + // Android's InputQueue, the only error that can be returned here is 'WOULD_BLOCK', which we + // want to just treat as meaning the queue is empty. // // ref: https://github.com/aosp-mirror/platform_frameworks_base/blob/master/core/jni/android_view_InputQueue.cpp // - while let Ok(Some(event)) = queue.get_event() { - if let Some(ndk_event) = queue.pre_dispatch(event) { + if let Ok(Some(ndk_event)) = queue.event() { + log::trace!("queue: got event: {ndk_event:?}"); + + if let Some(ndk_event) = queue.pre_dispatch(ndk_event) { let event = match ndk_event { ndk::event::InputEvent::MotionEvent(e) => { input::InputEvent::MotionEvent(input::MotionEvent::new(e)) @@ -380,8 +506,12 @@ impl AndroidAppInner { ndk::event::InputEvent::KeyEvent(e) => { input::InputEvent::KeyEvent(input::KeyEvent::new(e)) } + _ => todo!("NDK added a new type"), }; - let handled = callback(&event); + + // `finish_event` needs to be called for each event otherwise + // the app would likely get an ANR + let result = std::panic::catch_unwind(AssertUnwindSafe(|| callback(&event))); let ndk_event = match event { input::InputEvent::MotionEvent(e) => { @@ -390,24 +520,26 @@ impl AndroidAppInner { input::InputEvent::KeyEvent(e) => { ndk::event::InputEvent::KeyEvent(e.into_ndk_event()) } + _ => unreachable!(), }; - queue.finish_event(ndk_event, matches!(handled, InputStatus::Handled)); - } - } - } - pub fn internal_data_path(&self) -> Option { - let na = self.native_activity(); - unsafe { util::try_get_path_from_ptr((*na).internalDataPath) } - } + let handled = match result { + Ok(handled) => handled, + Err(payload) => { + log::error!("Calling `finish_event` after panic in input event handler, to try and avoid being killed via an ANR"); + queue.finish_event(ndk_event, false); + std::panic::resume_unwind(payload); + } + }; - pub fn external_data_path(&self) -> Option { - let na = self.native_activity(); - unsafe { util::try_get_path_from_ptr((*na).externalDataPath) } - } + log::trace!("queue: finishing event"); + queue.finish_event(ndk_event, handled == InputStatus::Handled); + } - pub fn obb_path(&self) -> Option { - let na = self.native_activity(); - unsafe { util::try_get_path_from_ptr((*na).obbPath) } + true + } else { + log::trace!("queue: no more events"); + false + } } } diff --git a/android-activity/src/util.rs b/android-activity/src/util.rs index c1153287..b7e774dd 100644 --- a/android-activity/src/util.rs +++ b/android-activity/src/util.rs @@ -1,7 +1,12 @@ -use log::Level; +use log::{error, Level}; use std::{ ffi::{CStr, CString}, - os::raw::c_char, + fs::File, + io::{BufRead as _, BufReader, Result}, + os::{ + fd::{FromRawFd as _, RawFd}, + raw::c_char, + }, }; pub fn try_get_path_from_ptr(path: *const c_char) -> Option { @@ -31,6 +36,63 @@ pub(crate) fn android_log(level: Level, tag: &CStr, msg: &CStr) { } } +pub(crate) fn forward_stdio_to_logcat() -> std::thread::JoinHandle> { + // XXX: make this stdout/stderr redirection an optional / opt-in feature?... + + let file = unsafe { + let mut logpipe: [RawFd; 2] = Default::default(); + libc::pipe2(logpipe.as_mut_ptr(), libc::O_CLOEXEC); + libc::dup2(logpipe[1], libc::STDOUT_FILENO); + libc::dup2(logpipe[1], libc::STDERR_FILENO); + libc::close(logpipe[1]); + + File::from_raw_fd(logpipe[0]) + }; + + std::thread::Builder::new() + .name("stdio-to-logcat".to_string()) + .spawn(move || -> Result<()> { + let tag = CStr::from_bytes_with_nul(b"RustStdoutStderr\0").unwrap(); + let mut reader = BufReader::new(file); + let mut buffer = String::new(); + loop { + buffer.clear(); + let len = match reader.read_line(&mut buffer) { + Ok(len) => len, + Err(e) => { + error!("Logcat forwarder failed to read stdin/stderr: {e:?}"); + break Err(e); + } + }; + if len == 0 { + break Ok(()); + } else if let Ok(msg) = CString::new(buffer.clone()) { + android_log(Level::Info, tag, &msg); + } + } + }) + .expect("Failed to start stdout/stderr to logcat forwarder thread") +} + +pub(crate) fn log_panic(panic: Box) { + let rust_panic = unsafe { CStr::from_bytes_with_nul_unchecked(b"RustPanic\0") }; + + if let Some(panic) = panic.downcast_ref::() { + if let Ok(msg) = CString::new(panic.clone()) { + android_log(Level::Error, rust_panic, &msg); + } + } else if let Ok(panic) = panic.downcast::<&str>() { + if let Ok(msg) = CString::new(*panic) { + android_log(Level::Error, rust_panic, &msg); + } + } else { + let unknown_panic = unsafe { CStr::from_bytes_with_nul_unchecked(b"UnknownPanic\0") }; + android_log(Level::Error, unknown_panic, unsafe { + CStr::from_bytes_with_nul_unchecked(b"\0") + }); + } +} + /// Run a closure and abort the program if it panics. /// /// This is generally used to ensure Rust callbacks won't unwind past the JNI boundary, which leads @@ -45,26 +107,7 @@ pub(crate) fn abort_on_panic(f: impl FnOnce() -> R) -> R { // // Just in case our attempt to log a panic could itself cause a panic we use a // second catch_unwind here. - let _ = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| { - // Try logging the panic, but abort if that fails. - let rust_panic = unsafe { CStr::from_bytes_with_nul_unchecked(b"RustPanic\0") }; - - if let Some(panic) = panic.downcast_ref::() { - if let Ok(msg) = CString::new(panic.clone()) { - android_log(Level::Error, rust_panic, &msg); - } - } else if let Ok(panic) = panic.downcast::<&str>() { - if let Ok(msg) = CString::new(*panic) { - android_log(Level::Error, rust_panic, &msg); - } - } else { - let unknown_panic = - unsafe { CStr::from_bytes_with_nul_unchecked(b"UnknownPanic\0") }; - android_log(Level::Error, unknown_panic, unsafe { - CStr::from_bytes_with_nul_unchecked(b"\0") - }); - } - })); + let _ = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| log_panic(panic))); std::process::abort(); }) } diff --git a/examples/agdk-mainloop/.gitignore b/examples/agdk-mainloop/.gitignore index 24ad84c4..9f8412da 100644 --- a/examples/agdk-mainloop/.gitignore +++ b/examples/agdk-mainloop/.gitignore @@ -1,12 +1,8 @@ *.iml +.idea .gradle /local.properties -/.idea/caches -/.idea/libraries -/.idea/modules.xml -/.idea/workspace.xml -/.idea/navEditor.xml -/.idea/assetWizardSettings.xml +/.idea .DS_Store /build /captures diff --git a/examples/agdk-mainloop/.idea/.gitignore b/examples/agdk-mainloop/.idea/.gitignore deleted file mode 100644 index 26d33521..00000000 --- a/examples/agdk-mainloop/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/examples/agdk-mainloop/.idea/compiler.xml b/examples/agdk-mainloop/.idea/compiler.xml deleted file mode 100644 index fb7f4a8a..00000000 --- a/examples/agdk-mainloop/.idea/compiler.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/examples/agdk-mainloop/.idea/gradle.xml b/examples/agdk-mainloop/.idea/gradle.xml deleted file mode 100644 index a2d7c213..00000000 --- a/examples/agdk-mainloop/.idea/gradle.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/agdk-mainloop/.idea/misc.xml b/examples/agdk-mainloop/.idea/misc.xml deleted file mode 100644 index 2a4d5b52..00000000 --- a/examples/agdk-mainloop/.idea/misc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/examples/agdk-mainloop/.idea/vcs.xml b/examples/agdk-mainloop/.idea/vcs.xml deleted file mode 100644 index fdf1fc87..00000000 --- a/examples/agdk-mainloop/.idea/vcs.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/agdk-mainloop/Cargo.toml b/examples/agdk-mainloop/Cargo.toml index 47d30a3c..ebf11973 100644 --- a/examples/agdk-mainloop/Cargo.toml +++ b/examples/agdk-mainloop/Cargo.toml @@ -9,7 +9,9 @@ edition = "2021" log = "0.4" android_logger = "0.11.0" android-activity = { path="../../android-activity", features = ["game-activity"] } +ndk-sys = "0.6.0" +ndk = "0.9.0" [lib] name="main" -crate_type=["cdylib"] \ No newline at end of file +crate_type=["cdylib"] diff --git a/examples/agdk-mainloop/app/build.gradle b/examples/agdk-mainloop/app/build.gradle index 77c1a85a..05368ce7 100644 --- a/examples/agdk-mainloop/app/build.gradle +++ b/examples/agdk-mainloop/app/build.gradle @@ -3,6 +3,7 @@ plugins { } android { + ndkVersion "25.2.9519653" compileSdk 31 defaultConfig { @@ -11,8 +12,6 @@ android { targetSdk 31 versionCode 1 versionName "1.0" - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { @@ -32,16 +31,15 @@ android { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } + namespace 'co.realfit.agdkmainloop' } dependencies { - implementation 'androidx.appcompat:appcompat:1.4.1' - implementation 'com.google.android.material:material:1.5.0' - implementation 'androidx.constraintlayout:constraintlayout:2.1.3' - testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' + implementation "androidx.core:core:1.5.0" + implementation "androidx.constraintlayout:constraintlayout:2.0.4" + implementation 'androidx.fragment:fragment:1.2.5' + implementation 'com.google.oboe:oboe:1.5.0' // To use the Android Frame Pacing library //implementation "androidx.games:games-frame-pacing:1.9.1" @@ -50,12 +48,12 @@ dependencies { //implementation "androidx.games:games-performance-tuner:1.5.0" // To use the Games Activity library - implementation "androidx.games:games-activity:1.1.0" + implementation "androidx.games:games-activity:4.0.0" // To use the Games Controller Library - //implementation "androidx.games:games-controller:1.1.0" + //implementation "androidx.games:games-controller:2.0.2" // To use the Games Text Input Library - //implementation "androidx.games:games-text-input:1.1.0" + //implementation "androidx.games:games-text-input:2.0.2" } diff --git a/examples/agdk-mainloop/app/src/main/AndroidManifest.xml b/examples/agdk-mainloop/app/src/main/AndroidManifest.xml index 7b99a0bd..b9d7563b 100644 --- a/examples/agdk-mainloop/app/src/main/AndroidManifest.xml +++ b/examples/agdk-mainloop/app/src/main/AndroidManifest.xml @@ -1,6 +1,5 @@ - + - - - - - \ No newline at end of file diff --git a/examples/agdk-mainloop/app/src/main/res/values-night/themes.xml b/examples/agdk-mainloop/app/src/main/res/values-night/themes.xml deleted file mode 100644 index 81c68731..00000000 --- a/examples/agdk-mainloop/app/src/main/res/values-night/themes.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - \ No newline at end of file diff --git a/examples/agdk-mainloop/app/src/main/res/values/themes.xml b/examples/agdk-mainloop/app/src/main/res/values/themes.xml index 83a6c4af..96e02419 100644 --- a/examples/agdk-mainloop/app/src/main/res/values/themes.xml +++ b/examples/agdk-mainloop/app/src/main/res/values/themes.xml @@ -1,16 +1,3 @@ - - - + +