Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions platforms/winit/examples/mixed_handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ const ANNOUNCEMENT_DELAY: Duration = Duration::from_millis(150);

struct UiState {
focus: NodeId,
announcement: Option<String>,
pending_announcement: Option<(String, Instant)>,
announcement: Option<&'static str>,
pending_announcement: Option<(&'static str, Instant)>,
scale_factor: f64,
safe_area_inset: Vec2,
}
Expand Down Expand Up @@ -162,7 +162,7 @@ impl UiState {
};
// On iOS, VoiceOver announces the label of the activated button.
// Postpone the live region update so the messages don't overlap.
self.pending_announcement = Some((text.into(), Instant::now()));
self.pending_announcement = Some((text, Instant::now()));
}

fn flush_announcement(&mut self, adapter: &mut Adapter) -> bool {
Expand All @@ -173,9 +173,9 @@ impl UiState {
return true;
}
if let Some((text, _)) = self.pending_announcement.take() {
self.announcement = Some(text.clone());
self.announcement = Some(text);
adapter.update_if_active(|| {
let announcement = build_announcement(&text);
let announcement = build_announcement(text);
let root = self.build_root();
TreeUpdate {
nodes: vec![(ANNOUNCEMENT_ID, announcement), (WINDOW_ID, root)],
Expand Down
10 changes: 5 additions & 5 deletions platforms/winit/examples/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ const ANNOUNCEMENT_DELAY: Duration = Duration::from_millis(150);

struct UiState {
focus: NodeId,
announcement: Option<String>,
pending_announcement: Option<(String, Instant)>,
announcement: Option<&'static str>,
pending_announcement: Option<(&'static str, Instant)>,
scale_factor: f64,
inset: Vec2,
}
Expand Down Expand Up @@ -156,7 +156,7 @@ impl UiState {
};
// On iOS, VoiceOver announces the label of the activated button.
// Postpone the live region update so the messages don't overlap.
self.pending_announcement = Some((text.into(), Instant::now()));
self.pending_announcement = Some((text, Instant::now()));
}

fn flush_announcement(&mut self, adapter: &mut Adapter) -> bool {
Expand All @@ -167,9 +167,9 @@ impl UiState {
return true;
}
if let Some((text, _)) = self.pending_announcement.take() {
self.announcement = Some(text.clone());
self.announcement = Some(text);
adapter.update_if_active(|| {
let announcement = build_announcement(&text);
let announcement = build_announcement(text);
let root = self.build_root();
TreeUpdate {
nodes: vec![(ANNOUNCEMENT_ID, announcement), (WINDOW_ID, root)],
Expand Down
Loading