2014-09-11 18:13:50 +02:00
|
|
|
#![allow(dead_code)]
|
|
|
|
|
#![allow(non_snake_case)]
|
|
|
|
|
#![allow(non_camel_case_types)]
|
2014-11-26 15:21:58 +10:00
|
|
|
#![allow(non_upper_case_globals)]
|
2014-09-11 18:13:50 +02:00
|
|
|
|
|
|
|
|
use libc;
|
2016-05-06 00:01:40 +03:00
|
|
|
use std::os::raw;
|
2014-09-11 18:13:50 +02:00
|
|
|
|
|
|
|
|
#[link(name = "android")]
|
|
|
|
|
#[link(name = "EGL")]
|
|
|
|
|
#[link(name = "GLESv2")]
|
2019-06-21 11:33:15 -04:00
|
|
|
extern "C" {}
|
2014-09-11 18:13:50 +02:00
|
|
|
|
|
|
|
|
/**
|
2019-06-21 11:33:15 -04:00
|
|
|
** asset_manager.h
|
|
|
|
|
**/
|
2016-05-06 00:01:40 +03:00
|
|
|
pub type AAssetManager = raw::c_void;
|
2014-09-11 18:13:50 +02:00
|
|
|
|
|
|
|
|
/**
|
2019-06-21 11:33:15 -04:00
|
|
|
** native_window.h
|
|
|
|
|
**/
|
2016-05-06 00:01:40 +03:00
|
|
|
pub type ANativeWindow = raw::c_void;
|
2014-09-11 18:13:50 +02:00
|
|
|
|
2019-06-21 11:33:15 -04:00
|
|
|
extern "C" {
|
2014-09-11 18:13:50 +02:00
|
|
|
pub fn ANativeWindow_getHeight(window: *const ANativeWindow) -> libc::int32_t;
|
|
|
|
|
pub fn ANativeWindow_getWidth(window: *const ANativeWindow) -> libc::int32_t;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2019-06-21 11:33:15 -04:00
|
|
|
** native_activity.h
|
|
|
|
|
**/
|
2014-09-11 18:13:50 +02:00
|
|
|
pub type JavaVM = ();
|
|
|
|
|
pub type JNIEnv = ();
|
|
|
|
|
pub type jobject = *const libc::c_void;
|
|
|
|
|
|
2019-06-21 11:33:15 -04:00
|
|
|
pub type AInputQueue = (); // FIXME: wrong
|
|
|
|
|
pub type ARect = (); // FIXME: wrong
|
2014-09-11 18:13:50 +02:00
|
|
|
|
|
|
|
|
#[repr(C)]
|
|
|
|
|
pub struct ANativeActivity {
|
|
|
|
|
pub callbacks: *mut ANativeActivityCallbacks,
|
|
|
|
|
pub vm: *mut JavaVM,
|
|
|
|
|
pub env: *mut JNIEnv,
|
|
|
|
|
pub clazz: jobject,
|
|
|
|
|
pub internalDataPath: *const libc::c_char,
|
|
|
|
|
pub externalDataPath: *const libc::c_char,
|
|
|
|
|
pub sdkVersion: libc::int32_t,
|
|
|
|
|
pub instance: *mut libc::c_void,
|
|
|
|
|
pub assetManager: *mut AAssetManager,
|
|
|
|
|
pub obbPath: *const libc::c_char,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[repr(C)]
|
|
|
|
|
pub struct ANativeActivityCallbacks {
|
2019-06-21 11:33:15 -04:00
|
|
|
pub onStart: extern "C" fn(*mut ANativeActivity),
|
|
|
|
|
pub onResume: extern "C" fn(*mut ANativeActivity),
|
|
|
|
|
pub onSaveInstanceState: extern "C" fn(*mut ANativeActivity, *mut libc::size_t),
|
|
|
|
|
pub onPause: extern "C" fn(*mut ANativeActivity),
|
|
|
|
|
pub onStop: extern "C" fn(*mut ANativeActivity),
|
|
|
|
|
pub onDestroy: extern "C" fn(*mut ANativeActivity),
|
|
|
|
|
pub onWindowFocusChanged: extern "C" fn(*mut ANativeActivity, libc::c_int),
|
|
|
|
|
pub onNativeWindowCreated: extern "C" fn(*mut ANativeActivity, *const ANativeWindow),
|
|
|
|
|
pub onNativeWindowResized: extern "C" fn(*mut ANativeActivity, *const ANativeWindow),
|
|
|
|
|
pub onNativeWindowRedrawNeeded: extern "C" fn(*mut ANativeActivity, *const ANativeWindow),
|
|
|
|
|
pub onNativeWindowDestroyed: extern "C" fn(*mut ANativeActivity, *const ANativeWindow),
|
|
|
|
|
pub onInputQueueCreated: extern "C" fn(*mut ANativeActivity, *mut AInputQueue),
|
|
|
|
|
pub onInputQueueDestroyed: extern "C" fn(*mut ANativeActivity, *mut AInputQueue),
|
|
|
|
|
pub onContentRectChanged: extern "C" fn(*mut ANativeActivity, *const ARect),
|
|
|
|
|
pub onConfigurationChanged: extern "C" fn(*mut ANativeActivity),
|
|
|
|
|
pub onLowMemory: extern "C" fn(*mut ANativeActivity),
|
2014-09-11 18:13:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2019-06-21 11:33:15 -04:00
|
|
|
** looper.h
|
|
|
|
|
**/
|
2014-09-11 18:13:50 +02:00
|
|
|
pub type ALooper = ();
|
|
|
|
|
|
|
|
|
|
#[link(name = "android")]
|
2019-06-21 11:33:15 -04:00
|
|
|
extern "C" {
|
2014-09-11 18:13:50 +02:00
|
|
|
pub fn ALooper_forThread() -> *const ALooper;
|
|
|
|
|
pub fn ALooper_acquire(looper: *const ALooper);
|
|
|
|
|
pub fn ALooper_release(looper: *const ALooper);
|
|
|
|
|
pub fn ALooper_prepare(opts: libc::c_int) -> *const ALooper;
|
2019-06-21 11:33:15 -04:00
|
|
|
pub fn ALooper_pollOnce(
|
|
|
|
|
timeoutMillis: libc::c_int,
|
|
|
|
|
outFd: *mut libc::c_int,
|
|
|
|
|
outEvents: *mut libc::c_int,
|
|
|
|
|
outData: *mut *mut libc::c_void,
|
|
|
|
|
) -> libc::c_int;
|
|
|
|
|
pub fn ALooper_pollAll(
|
|
|
|
|
timeoutMillis: libc::c_int,
|
|
|
|
|
outFd: *mut libc::c_int,
|
|
|
|
|
outEvents: *mut libc::c_int,
|
|
|
|
|
outData: *mut *mut libc::c_void,
|
|
|
|
|
) -> libc::c_int;
|
2014-09-11 18:13:50 +02:00
|
|
|
pub fn ALooper_wake(looper: *const ALooper);
|
2019-06-21 11:33:15 -04:00
|
|
|
pub fn ALooper_addFd(
|
|
|
|
|
looper: *const ALooper,
|
|
|
|
|
fd: libc::c_int,
|
|
|
|
|
ident: libc::c_int,
|
|
|
|
|
events: libc::c_int,
|
|
|
|
|
callback: ALooper_callbackFunc,
|
|
|
|
|
data: *mut libc::c_void,
|
|
|
|
|
) -> libc::c_int;
|
2014-09-11 18:13:50 +02:00
|
|
|
pub fn ALooper_removeFd(looper: *const ALooper, fd: libc::c_int) -> libc::c_int;
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-10 17:39:11 +02:00
|
|
|
pub const ALOOPER_PREPARE_ALLOW_NON_CALLBACKS: libc::c_int = 1 << 0;
|
2014-09-11 18:13:50 +02:00
|
|
|
|
2014-10-10 17:39:11 +02:00
|
|
|
pub const ALOOPER_POLL_WAKE: libc::c_int = -1;
|
|
|
|
|
pub const ALOOPER_POLL_CALLBACK: libc::c_int = -2;
|
|
|
|
|
pub const ALOOPER_POLL_TIMEOUT: libc::c_int = -3;
|
|
|
|
|
pub const ALOOPER_POLL_ERROR: libc::c_int = -4;
|
2014-09-11 18:13:50 +02:00
|
|
|
|
2014-10-10 17:39:11 +02:00
|
|
|
pub const ALOOPER_EVENT_INPUT: libc::c_int = 1 << 0;
|
|
|
|
|
pub const ALOOPER_EVENT_OUTPUT: libc::c_int = 1 << 1;
|
|
|
|
|
pub const ALOOPER_EVENT_ERROR: libc::c_int = 1 << 2;
|
|
|
|
|
pub const ALOOPER_EVENT_HANGUP: libc::c_int = 1 << 3;
|
|
|
|
|
pub const ALOOPER_EVENT_INVALID: libc::c_int = 1 << 4;
|
2014-09-11 18:13:50 +02:00
|
|
|
|
2019-06-21 11:33:15 -04:00
|
|
|
pub type ALooper_callbackFunc =
|
|
|
|
|
extern "C" fn(libc::c_int, libc::c_int, *mut libc::c_void) -> libc::c_int;
|