1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 13:20:05 -04:00

Update accesskit and accesskit_winit. (#3475)

* Update accesskit and accesskit_winit.

* Remove duplicated `libgtk-3-dev`

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This commit is contained in:
Nolan Darilek
2023-11-10 04:32:30 -06:00
committed by GitHub
parent 7169f28ddf
commit d0ff09ac20
8 changed files with 77 additions and 47 deletions

View File

@@ -66,7 +66,7 @@ winit = { version = "0.28", default-features = false }
#! ### Optional dependencies
# feature accesskit
accesskit_winit = { version = "0.14.0", optional = true }
accesskit_winit = { version = "0.15.0", optional = true }
## Enable this when generating docs.
document-features = { version = "0.2", optional = true }

View File

@@ -85,7 +85,7 @@ ahash = { version = "0.8.1", default-features = false, features = [
nohash-hasher = "0.2"
#! ### Optional dependencies
accesskit = { version = "0.11", optional = true }
accesskit = { version = "0.12", optional = true }
backtrace = { version = "0.3", optional = true }

View File

@@ -1291,7 +1291,6 @@ impl Context {
crate::profile_scope!("accesskit");
let state = self.frame_state_mut(|fs| fs.accesskit_state.take());
if let Some(state) = state {
let has_focus = self.input(|i| i.raw.focused);
let root_id = crate::accesskit_root_id().accesskit_id();
let nodes = self.write(|ctx| {
state
@@ -1305,13 +1304,13 @@ impl Context {
})
.collect()
});
let focus_id = self
.memory(|mem| mem.focus())
.map_or(root_id, |id| id.accesskit_id());
platform_output.accesskit_update = Some(accesskit::TreeUpdate {
nodes,
tree: Some(accesskit::Tree::new(root_id)),
focus: has_focus.then(|| {
let focus_id = self.memory(|mem| mem.focus());
focus_id.map_or(root_id, |id| id.accesskit_id())
}),
focus: focus_id,
});
}
}
@@ -1941,7 +1940,7 @@ impl Context {
NodeBuilder::new(Role::Window).build(&mut ctx.accesskit_node_classes),
)],
tree: Some(Tree::new(root_id)),
focus: None,
focus: root_id,
})
}
}

View File

@@ -72,7 +72,7 @@ impl Id {
#[cfg(feature = "accesskit")]
pub(crate) fn accesskit_id(&self) -> accesskit::NodeId {
std::num::NonZeroU64::new(self.0).unwrap().into()
self.0.into()
}
}

View File

@@ -620,20 +620,20 @@ impl Response {
info: crate::WidgetInfo,
) {
use crate::WidgetType;
use accesskit::{CheckedState, Role};
use accesskit::{Checked, Role};
self.fill_accesskit_node_common(builder);
builder.set_role(match info.typ {
WidgetType::Label => Role::StaticText,
WidgetType::Link => Role::Link,
WidgetType::TextEdit => Role::TextField,
WidgetType::TextEdit => Role::TextInput,
WidgetType::Button | WidgetType::ImageButton | WidgetType::CollapsingHeader => {
Role::Button
}
WidgetType::Checkbox => Role::CheckBox,
WidgetType::RadioButton => Role::RadioButton,
WidgetType::SelectableLabel => Role::ToggleButton,
WidgetType::ComboBox => Role::PopupButton,
WidgetType::ComboBox => Role::ComboBox,
WidgetType::Slider => Role::Slider,
WidgetType::DragValue => Role::SpinButton,
WidgetType::ColorButton => Role::ColorWell,
@@ -649,10 +649,10 @@ impl Response {
builder.set_numeric_value(value);
}
if let Some(selected) = info.selected {
builder.set_checked_state(if selected {
CheckedState::True
builder.set_checked(if selected {
Checked::True
} else {
CheckedState::False
Checked::False
});
}
}

View File

@@ -1,5 +1,7 @@
use std::sync::Arc;
#[cfg(feature = "accesskit")]
use accesskit::Role;
use epaint::text::{cursor::*, Galley, LayoutJob};
use crate::{output::OutputEvent, *};
@@ -751,7 +753,7 @@ impl<'t> TextEdit<'t> {
builder.set_default_action_verb(accesskit::DefaultActionVerb::Focus);
if self.multiline {
builder.set_multiline();
builder.set_role(Role::MultilineTextInput);
}
parent_id
@@ -759,7 +761,7 @@ impl<'t> TextEdit<'t> {
if let Some(parent_id) = parent_id {
// drop ctx lock before further processing
use accesskit::{Role, TextDirection};
use accesskit::TextDirection;
ui.ctx().with_accessibility_parent(parent_id, || {
for (i, row) in galley.rows.iter().enumerate() {