Vendor dependencies for 0.3.0 release

This commit is contained in:
2025-09-27 10:29:08 -05:00
parent 0c8d39d483
commit 82ab7f317b
26803 changed files with 16134934 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
// Copyright 2025 The AccessKit Authors. All rights reserved.
// Licensed under the Apache License, Version 2.0 (found in
// the LICENSE-APACHE file).
use accesskit::{ActionHandler, ActivationHandler, DeactivationHandler, TreeUpdate};
use accesskit_android::{
jni::{objects::JObject, JavaVM},
InjectingAdapter,
};
use winit::{
event::WindowEvent, event_loop::ActiveEventLoop, platform::android::ActiveEventLoopExtAndroid,
window::Window,
};
pub struct Adapter {
adapter: InjectingAdapter,
}
impl Adapter {
pub fn new(
event_loop: &ActiveEventLoop,
_window: &Window,
activation_handler: impl 'static + ActivationHandler + Send,
action_handler: impl 'static + ActionHandler + Send,
_deactivation_handler: impl 'static + DeactivationHandler,
) -> Self {
let app = event_loop.android_app();
let vm = unsafe { JavaVM::from_raw(app.vm_as_ptr() as *mut _) }.unwrap();
let mut env = vm.get_env().unwrap();
let activity = unsafe { JObject::from_raw(app.activity_as_ptr() as *mut _) };
let view = env
.get_field(
&activity,
"mSurfaceView",
"Lcom/google/androidgamesdk/GameActivity$InputEnabledSurfaceView;",
)
.unwrap()
.l()
.unwrap();
let adapter =
InjectingAdapter::new(&mut env, &view, activation_handler, action_handler).unwrap();
Self { adapter }
}
pub fn update_if_active(&mut self, updater: impl FnOnce() -> TreeUpdate) {
self.adapter.update_if_active(updater);
}
pub fn process_event(&mut self, _window: &Window, _event: &WindowEvent) {}
}

View File

@@ -0,0 +1,55 @@
// Copyright 2022 The AccessKit Authors. All rights reserved.
// Licensed under the Apache License, Version 2.0 (found in
// the LICENSE-APACHE file).
#[cfg(feature = "rwh_05")]
use crate::raw_window_handle::{HasRawWindowHandle, RawWindowHandle};
#[cfg(feature = "rwh_06")]
use crate::raw_window_handle::{HasWindowHandle, RawWindowHandle};
use accesskit::{ActionHandler, ActivationHandler, DeactivationHandler, TreeUpdate};
use accesskit_macos::SubclassingAdapter;
use winit::{event::WindowEvent, event_loop::ActiveEventLoop, window::Window};
pub struct Adapter {
adapter: SubclassingAdapter,
}
impl Adapter {
pub fn new(
_event_loop: &ActiveEventLoop,
window: &Window,
activation_handler: impl 'static + ActivationHandler,
action_handler: impl 'static + ActionHandler,
_deactivation_handler: impl 'static + DeactivationHandler,
) -> Self {
#[cfg(feature = "rwh_05")]
let view = match window.raw_window_handle() {
RawWindowHandle::AppKit(handle) => handle.ns_view,
RawWindowHandle::UiKit(_) => unimplemented!(),
_ => unreachable!(),
};
#[cfg(feature = "rwh_06")]
let view = match window.window_handle().unwrap().as_raw() {
RawWindowHandle::AppKit(handle) => handle.ns_view.as_ptr(),
RawWindowHandle::UiKit(_) => unimplemented!(),
_ => unreachable!(),
};
let adapter = unsafe { SubclassingAdapter::new(view, activation_handler, action_handler) };
Self { adapter }
}
pub fn update_if_active(&mut self, updater: impl FnOnce() -> TreeUpdate) {
if let Some(events) = self.adapter.update_if_active(updater) {
events.raise();
}
}
pub fn process_event(&mut self, _window: &Window, event: &WindowEvent) {
if let WindowEvent::Focused(is_focused) = event {
if let Some(events) = self.adapter.update_view_focus_state(*is_focused) {
events.raise();
}
}
}
}

View File

@@ -0,0 +1,50 @@
// Copyright 2022 The AccessKit Authors. All rights reserved.
// Licensed under the Apache License, Version 2.0 (found in
// the LICENSE-APACHE file).
// Based loosely on winit's src/platform_impl/mod.rs.
pub use self::platform::*;
#[cfg(target_os = "windows")]
#[path = "windows.rs"]
mod platform;
#[cfg(target_os = "macos")]
#[path = "macos.rs"]
mod platform;
#[cfg(all(
feature = "accesskit_unix",
any(
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd"
)
))]
#[path = "unix.rs"]
mod platform;
#[cfg(all(feature = "accesskit_android", target_os = "android"))]
#[path = "android.rs"]
mod platform;
#[cfg(not(any(
target_os = "windows",
target_os = "macos",
all(
feature = "accesskit_unix",
any(
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd"
)
),
all(feature = "accesskit_android", target_os = "android")
)))]
#[path = "null.rs"]
mod platform;

View File

@@ -0,0 +1,24 @@
// Copyright 2022 The AccessKit Authors. All rights reserved.
// Licensed under the Apache License, Version 2.0 (found in
// the LICENSE-APACHE file).
use accesskit::{ActionHandler, ActivationHandler, DeactivationHandler, TreeUpdate};
use winit::{event::WindowEvent, event_loop::ActiveEventLoop, window::Window};
pub struct Adapter;
impl Adapter {
pub fn new(
_event_loop: &ActiveEventLoop,
_window: &Window,
_activation_handler: impl 'static + ActivationHandler,
_action_handler: impl 'static + ActionHandler,
_deactivation_handler: impl 'static + DeactivationHandler,
) -> Self {
Self {}
}
pub fn update_if_active(&mut self, _updater: impl FnOnce() -> TreeUpdate) {}
pub fn process_event(&mut self, _window: &Window, _event: &WindowEvent) {}
}

View File

@@ -0,0 +1,77 @@
// Copyright 2022 The AccessKit Authors. All rights reserved.
// Licensed under the Apache License, Version 2.0 (found in
// the LICENSE-APACHE file).
use accesskit::{ActionHandler, ActivationHandler, DeactivationHandler, Rect, TreeUpdate};
use accesskit_unix::Adapter as UnixAdapter;
use winit::{event::WindowEvent, event_loop::ActiveEventLoop, window::Window};
pub struct Adapter {
adapter: UnixAdapter,
}
impl Adapter {
pub fn new(
_event_loop: &ActiveEventLoop,
_window: &Window,
activation_handler: impl 'static + ActivationHandler + Send,
action_handler: impl 'static + ActionHandler + Send,
deactivation_handler: impl 'static + DeactivationHandler + Send,
) -> Self {
let adapter = UnixAdapter::new(activation_handler, action_handler, deactivation_handler);
Self { adapter }
}
fn set_root_window_bounds(&mut self, outer: Rect, inner: Rect) {
self.adapter.set_root_window_bounds(outer, inner);
}
pub fn update_if_active(&mut self, updater: impl FnOnce() -> TreeUpdate) {
self.adapter.update_if_active(updater);
}
fn update_window_focus_state(&mut self, is_focused: bool) {
self.adapter.update_window_focus_state(is_focused);
}
pub fn process_event(&mut self, window: &Window, event: &WindowEvent) {
match event {
WindowEvent::Moved(outer_position) => {
let outer_position: (_, _) = outer_position.cast::<f64>().into();
let outer_size: (_, _) = window.outer_size().cast::<f64>().into();
let inner_position: (_, _) = window
.inner_position()
.unwrap_or_default()
.cast::<f64>()
.into();
let inner_size: (_, _) = window.inner_size().cast::<f64>().into();
self.set_root_window_bounds(
Rect::from_origin_size(outer_position, outer_size),
Rect::from_origin_size(inner_position, inner_size),
)
}
WindowEvent::Resized(inner_size) => {
let outer_position: (_, _) = window
.outer_position()
.unwrap_or_default()
.cast::<f64>()
.into();
let outer_size: (_, _) = window.outer_size().cast::<f64>().into();
let inner_position: (_, _) = window
.inner_position()
.unwrap_or_default()
.cast::<f64>()
.into();
let inner_size: (_, _) = inner_size.cast::<f64>().into();
self.set_root_window_bounds(
Rect::from_origin_size(outer_position, outer_size),
Rect::from_origin_size(inner_position, inner_size),
)
}
WindowEvent::Focused(is_focused) => {
self.update_window_focus_state(*is_focused);
}
_ => (),
}
}
}

View File

@@ -0,0 +1,49 @@
// Copyright 2022 The AccessKit Authors. All rights reserved.
// Licensed under the Apache License, Version 2.0 (found in
// the LICENSE-APACHE file).
#[cfg(feature = "rwh_05")]
use crate::raw_window_handle::{HasRawWindowHandle, RawWindowHandle};
#[cfg(feature = "rwh_06")]
use crate::raw_window_handle::{HasWindowHandle, RawWindowHandle};
use accesskit::{ActionHandler, ActivationHandler, DeactivationHandler, TreeUpdate};
use accesskit_windows::{SubclassingAdapter, HWND};
use winit::{event::WindowEvent, event_loop::ActiveEventLoop, window::Window};
pub struct Adapter {
adapter: SubclassingAdapter,
}
impl Adapter {
pub fn new(
_event_loop: &ActiveEventLoop,
window: &Window,
activation_handler: impl 'static + ActivationHandler,
action_handler: impl 'static + ActionHandler + Send,
_deactivation_handler: impl 'static + DeactivationHandler,
) -> Self {
#[cfg(feature = "rwh_05")]
let hwnd = match window.raw_window_handle() {
RawWindowHandle::Win32(handle) => handle.hwnd,
RawWindowHandle::WinRt(_) => unimplemented!(),
_ => unreachable!(),
};
#[cfg(feature = "rwh_06")]
let hwnd = match window.window_handle().unwrap().as_raw() {
RawWindowHandle::Win32(handle) => handle.hwnd.get() as *mut _,
RawWindowHandle::WinRt(_) => unimplemented!(),
_ => unreachable!(),
};
let adapter = SubclassingAdapter::new(HWND(hwnd), activation_handler, action_handler);
Self { adapter }
}
pub fn update_if_active(&mut self, updater: impl FnOnce() -> TreeUpdate) {
if let Some(events) = self.adapter.update_if_active(updater) {
events.raise();
}
}
pub fn process_event(&mut self, _window: &Window, _event: &WindowEvent) {}
}