Make the Rust client the sole app

This commit is contained in:
iris committed 2026-09-11 01:18:24 -04:00
1 parent 5ca244528f
commit 6dbc800739
27 files changed
+59 -42

No files matched your search

+1 -1
View File
@@ -8,7 +8,7 @@ use iris_core::{AccessTree, UiRenderState, UiRsc, Widgets};
/// The `ActivationHandler` `accesskit_android::Adapter` asks for its
/// initial tree from -- unlike `accesskit_winit`'s handlers (see
/// `default/access.rs`), this one is only ever invoked synchronously from
/// `desktop/access.rs`), this one is only ever invoked synchronously from
/// inside a JNI callback that already holds everything it needs, so it can
/// just borrow `IrisViewPeer`'s own fields for the length of one call
/// rather than going through a channel.
+19 -6
View File
@@ -217,7 +217,11 @@ impl<State: AndroidAppState> IrisViewPeer<State> {
.get_or_insert_with(|| DeviceClock::anchored(Instant::now(), event_time, oldest))
}
fn generic_motion(&mut self, ctx: &mut CallbackCtx, event: &MotionEvent<'_>) -> bool {
fn generic_motion<'local>(
&mut self,
ctx: &mut CallbackCtx<'local>,
event: &MotionEvent<'local>,
) -> bool {
let action = event.action_masked(&mut ctx.env);
let event_time = event.event_time_nanos(&mut ctx.env);
let mut clock = self.device_clock(event_time, event_time);
@@ -539,11 +543,20 @@ impl<State: AndroidAppState> ViewPeer for IrisViewPeer<State> {
let action = event.action(&mut ctx.env);
let x = event.x(&mut ctx.env);
let y = event.y(&mut ctx.env);
let ui = self.state.android_state_mut();
if let Some(events) = ui
.access_adapter
.on_hover_event(&mut NullActionHandler, action, x, y)
{
let access_events = {
let render_handle = self.rsc.ui.render_state();
let render_state = render_handle.get();
let mut source = AndroidAccessSource {
widgets: self.rsc.widgets(),
render: &render_state,
rsc: &self.rsc,
};
self.state
.android_state_mut()
.access_adapter
.on_hover_event(&mut source, action, x, y)
};
if let Some(events) = access_events {
ctx.push_dynamic_deferred_callback(move |env, view| {
raise_if_enabled(env, view, events);
});
+6 -16
View File
@@ -12,24 +12,20 @@ pub mod android;
#[cfg(not(target_os = "android"))]
pub mod desktop;
pub mod attr;
pub mod diagnostics;
pub mod event;
pub mod harness;
pub mod overlay;
pub mod platform;
pub mod runtime;
pub mod sense;
pub mod state;
pub mod task;
pub mod rsc;
pub mod widget;
// Preserve concise public paths while implementation files stay grouped.
pub use rsc::attr;
pub use rsc::{event, overlay, sense, state, task};
#[cfg(test)]
mod access_tests;
#[cfg(test)]
mod layout_tests;
#[cfg(test)]
mod sense_tests;
pub use iris_core as core;
pub use iris_macro as macros;
@@ -41,16 +37,10 @@ pub mod prelude {
#[cfg(not(target_os = "android"))]
pub use desktop::*;
pub use attr::*;
pub use event::*;
pub use iris_core::*;
pub use iris_macro::*;
pub use overlay::*;
pub use platform::*;
pub use runtime::*;
pub use sense::*;
pub use state::*;
pub use task::*;
pub use rsc::*;
pub use widget::*;
pub use iris_core::util::Vec2;
View File
File renamed without changes.
+1 -1
View File
@@ -2,7 +2,7 @@ use iris_core::*;
use iris_macro::*;
use std::sync::Arc;
use crate::task::{TaskCtx, TaskUpdate, Tasks};
use super::task::{TaskCtx, TaskUpdate, Tasks};
#[derive(Eq, PartialEq, Hash, Clone)]
pub struct Submit;
+19
View File
@@ -1,3 +1,22 @@
//! Host-independent resources carried by [`AppRsc`].
pub mod attr;
pub mod event;
pub mod overlay;
pub mod sense;
pub mod state;
pub mod task;
#[cfg(test)]
mod sense_tests;
pub use attr::*;
pub use event::*;
pub use overlay::*;
pub use sense::*;
pub use state::*;
pub use task::*;
use crate::prelude::*;
use std::sync::Arc;
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
+2 -3
View File
@@ -78,9 +78,8 @@ impl<'a, T: 'static> FnOnce<(&'a mut WidgetState,)> for WeakState<T> {
/// What `Rsc[weak_handle]` indexes through -- one impl per kind of handle
/// (a widget, a piece of per-widget state), shared by both backends' `Rsc`
/// types since indexing a widget tree has nothing to do with windowing.
/// Each backend still needs its own `Index`/`IndexMut for ItsRsc<State>`
/// (`default/mod.rs`, `android/view.rs`), because a blanket impl over every
/// `I: RscIdx<Rsc>` for every possible `Rsc` would conflict between crates.
/// `AppRsc` supplies the shared `Index`/`IndexMut` implementation; a blanket
/// implementation over every possible resource type would conflict.
pub trait RscIdx<Rsc> {
type Output;
fn get(self, rsc: &Rsc) -> &Self::Output;
+1 -1
View File
@@ -19,7 +19,7 @@ use tokio::{
/// android-view has no `Window` at all, and the redraw request there is a
/// JNI call (`View::post_frame_callback`) rather than a method call on a
/// value this crate owns. Each backend supplies its own implementation --
/// `default/render.rs` for winit, `android/render.rs` for android-view --
/// `desktop/render.rs` for winit, `android/render.rs` for android-view --
/// and this module never needs to know which one it is holding.
pub trait RequestRedraw: Send + Sync + 'static {
fn request_redraw(&self);
View File
Whitespace-only changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+2 -2
View File
@@ -1,14 +1,14 @@
mod image;
mod layout;
mod mask;
mod position;
mod ptr;
mod rect;
mod text;
mod trait_fns;
pub use image::*;
pub use layout::*;
pub use mask::*;
pub use position::*;
pub use ptr::*;
pub use rect::*;
pub use text::*;