Current section
Files
Jump to
Current section
Files
native/dala_beam/src/header.rs
// header.rs - Public API for dala's BEAM launcher and UI initialization
// Equivalent to dala_beam.h in Rust
// This module declares the public Rust functions that mirror the C API
use jni::objects::{JObject, JString};
use jni::JNIEnv;
use std::os::raw::{c_char, c_int, c_void};
// ── JNI functions (called from Java/Kotlin) ─────────────────────────────
// Call from JNI_OnLoad (main thread).
// bridge_class: e.g. "com/myapp/DalaBridge"
#[no_mangle]
pub extern "C" fn dala_ui_cache_class(env: *mut JNIEnv, bridge_class: *const c_char) {
// Stub - would call _dala_ui_cache_class_impl from dala_nif
}
// Send a tap event to the BEAM process registered for handle.
// Called from the app's Java_..._DalaBridge_nativeSendTap JNI stub.
#[no_mangle]
pub extern "C" fn dala_send_tap(handle: c_int) {
// Stub - to be implemented
}
// Send a {:change, tag, value} event.
#[no_mangle]
pub extern "C" fn dala_send_change_str(handle: c_int, utf8: *const c_char) {
// Stub
}
#[no_mangle]
pub extern "C" fn dala_send_change_bool(handle: c_int, bool_val: c_int) {
// Stub - 0 = false, 1 = true
}
#[no_mangle]
pub extern "C" fn dala_send_change_float(handle: c_int, value: f64) {
// Stub
}
// Send {:focus, tag}, {:blur, tag}, {:submit, tag} events.
#[no_mangle]
pub extern "C" fn dala_send_focus(handle: c_int) {
// Stub
}
#[no_mangle]
pub extern "C" fn dala_send_blur(handle: c_int) {
// Stub
}
#[no_mangle]
pub extern "C" fn dala_send_submit(handle: c_int) {
// Stub
}
// Send {:select, tag} for pickers, menus, segmented controls.
#[no_mangle]
pub extern "C" fn dala_send_select(handle: c_int) {
// Stub
}
// Send {:compose, tag, %{text, phase}} for IME composition events.
#[no_mangle]
pub extern "C" fn dala_send_compose(handle: c_int, text: *const c_char, phase: *const c_char) {
// Stub
}
// ── Gesture senders (Batch 4) ─────────────────────────────────────────
#[no_mangle]
pub extern "C" fn dala_send_long_press(handle: c_int) {
// Stub
}
#[no_mangle]
pub extern "C" fn dala_send_double_tap(handle: c_int) {
// Stub
}
#[no_mangle]
pub extern "C" fn dala_send_swipe_left(handle: c_int) {
// Stub
}
#[no_mangle]
pub extern "C" fn dala_send_swipe_right(handle: c_int) {
// Stub
}
#[no_mangle]
pub extern "C" fn dala_send_swipe_up(handle: c_int) {
// Stub
}
#[no_mangle]
pub extern "C" fn dala_send_swipe_down(handle: c_int) {
// Stub
}
#[no_mangle]
pub extern "C" fn dala_send_swipe_with_direction(handle: c_int, direction: *const c_char) {
// Stub
}
// ── Batch 5 Tier 1: high-frequency scroll/drag/pinch/rotate/pointer ─────
#[no_mangle]
pub extern "C" fn dala_set_throttle_config(
handle: c_int,
throttle_ms: c_int,
debounce_ms: c_int,
delta_threshold: f64,
leading: c_int,
trailing: c_int,
) {
// Stub
}
#[no_mangle]
pub extern "C" fn dala_send_scroll(
handle: c_int,
x: f64,
y: f64,
dx: f64,
dy: f64,
vx: f64,
vy: f64,
phase: *const c_char,
) {
// Stub
}
#[no_mangle]
pub extern "C" fn dala_send_drag(
handle: c_int,
x: f64,
y: f64,
dx: f64,
dy: f64,
phase: *const c_char,
) {
// Stub
}
#[no_mangle]
pub extern "C" fn dala_send_pinch(handle: c_int, scale: f64, velocity: f64, phase: *const c_char) {
// Stub
}
#[no_mangle]
pub extern "C" fn dala_send_rotate(
handle: c_int,
degrees: f64,
velocity: f64,
phase: *const c_char,
) {
// Stub
}
#[no_mangle]
pub extern "C" fn dala_send_pointer_move(handle: c_int, x: f64, y: f64) {
// Stub
}
// ── Batch 5 Tier 2: semantic single-fire scroll events ──
#[no_mangle]
pub extern "C" fn dala_send_scroll_began(handle: c_int) {
// Stub
}
#[no_mangle]
pub extern "C" fn dala_send_scroll_ended(handle: c_int) {
// Stub
}
#[no_mangle]
pub extern "C" fn dala_send_scroll_settled(handle: c_int) {
// Stub
}
#[no_mangle]
pub extern "C" fn dala_send_top_reached(handle: c_int) {
// Stub
}
#[no_mangle]
pub extern "C" fn dala_send_scrolled_past(handle: c_int) {
// Stub
}
// Signal a system back gesture to the BEAM screen process.
#[no_mangle]
pub extern "C" fn dala_handle_back() {
// Stub
}
// ── Device capability delivery functions ─────────────────────────────────
#[no_mangle]
pub extern "C" fn dala_deliver_atom2(pid: i64, a1: *const c_char, a2: *const c_char) {
// Stub
}
#[no_mangle]
pub extern "C" fn dala_deliver_atom3(
pid: i64,
a1: *const c_char,
a2: *const c_char,
a3: *const c_char,
) {
// Stub
}
#[no_mangle]
pub extern "C" fn dala_deliver_location(pid: i64, lat: f64, lon: f64, acc: f64, alt: f64) {
// Stub
}
#[no_mangle]
pub extern "C" fn dala_deliver_motion(
pid: i64,
ax: f64,
ay: f64,
az: f64,
gx: f64,
gy: f64,
gz: f64,
ts: i64,
) {
// Stub
}
#[no_mangle]
pub extern "C" fn dala_deliver_file_result(
pid: i64,
event: *const c_char,
sub: *const c_char,
json_items: *const c_char,
) {
// Stub
}
#[no_mangle]
pub extern "C" fn dala_deliver_push_token(pid: i64, token: *const c_char) {
// Stub
}
#[no_mangle]
pub extern "C" fn dala_deliver_notification(pid: i64, json: *const c_char) {
// Stub
}
#[no_mangle]
pub extern "C" fn dala_set_launch_notification(json: *const c_char) {
// Stub
}
// Deliver {:alert, action_atom} to the registered :dala_screen process.
#[no_mangle]
pub extern "C" fn dala_deliver_alert_action(action: *const c_char) {
// Stub
}
// Deliver {:component_event, event, payload_json} to a native view component process.
#[no_mangle]
pub extern "C" fn dala_send_component_event(
handle: c_int,
event: *const c_char,
payload_json: *const c_char,
) {
// Stub
}
// Deliver {:dala_device, :color_scheme_changed, :light | :dark}
#[no_mangle]
pub extern "C" fn dala_send_color_scheme_changed(scheme: *const c_char) {
// Stub
}
// Global JVM pointer - defined in lib.rs
extern "C" {
pub static mut g_jvm: *mut c_void;
pub static mut g_activity: *mut c_void;
}