From 805f49d2aed1ea1727cb680ed86ff1520981e0dc Mon Sep 17 00:00:00 2001 From: Narref Date: Tue, 9 Apr 2024 19:17:48 +0200 Subject: [PATCH 01/10] Fix tooltip behaviour --- src/action.rs | 19 +++++++++++++++++++ src/update.rs | 8 ++++++++ src/views/tooltip.rs | 10 +++++----- src/window_handle.rs | 42 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 74 insertions(+), 5 deletions(-) diff --git a/src/action.rs b/src/action.rs index 12205f3f..801559ce 100644 --- a/src/action.rs +++ b/src/action.rs @@ -146,3 +146,22 @@ pub fn add_overlay( pub fn remove_overlay(id: Id) { add_update_message(UpdateMessage::RemoveOverlay { id }); } + +/// Creates a new tooltip on the current window. +pub fn add_tooltip( + position: Point, + view: impl FnOnce(Id) -> V + 'static, +) -> Id { + let id = Id::next(); + add_update_message(UpdateMessage::AddTooltip { + id, + position, + view: Box::new(move || Box::new(view(id))), + }); + id +} + +/// Removes the tooltip from the current window. +pub fn remove_tooltip(id: Id) { + add_update_message(UpdateMessage::RemoveTooltip { id }); +} \ No newline at end of file diff --git a/src/update.rs b/src/update.rs index c9f6e614..55479563 100644 --- a/src/update.rs +++ b/src/update.rs @@ -121,6 +121,14 @@ pub(crate) enum UpdateMessage { RemoveOverlay { id: Id, }, + AddTooltip { + id: Id, + position: Point, + view: Box Box>, + }, + RemoveTooltip { + id: Id + }, Inspect, ScrollTo { id: Id, diff --git a/src/views/tooltip.rs b/src/views/tooltip.rs index fc5985e8..319b3b34 100644 --- a/src/views/tooltip.rs +++ b/src/views/tooltip.rs @@ -2,7 +2,7 @@ use kurbo::Point; use std::{rc::Rc, time::Duration}; use crate::{ - action::{add_overlay, exec_after, remove_overlay, TimerToken}, + action::{add_tooltip, exec_after, remove_tooltip, TimerToken}, context::{EventCx, UpdateCx}, event::Event, id::Id, @@ -93,7 +93,7 @@ impl Widget for Tooltip { if let Some(window_origin) = self.window_origin { if self.hover.map(|(_, t)| t) == Some(*token) { let tip = self.tip.clone(); - self.overlay = Some(add_overlay( + self.overlay = Some(add_tooltip( window_origin + self.hover.unwrap().0.to_vec2() + (10., 10.), move |_| tip(), )); @@ -119,10 +119,10 @@ impl Widget for Tooltip { self.hover = Some((e.pos, token)); } } - Event::PointerLeave => { + Event::PointerLeave | Event::PointerDown(_) | Event::PointerUp(_) => { self.hover = None; if let Some(id) = self.overlay { - remove_overlay(id); + remove_tooltip(id); self.overlay = None; } } @@ -141,7 +141,7 @@ impl Widget for Tooltip { impl Drop for Tooltip { fn drop(&mut self) { if let Some(id) = self.overlay { - remove_overlay(id) + remove_tooltip(id); } } } diff --git a/src/window_handle.rs b/src/window_handle.rs index 46c91fdc..61bb26c2 100644 --- a/src/window_handle.rs +++ b/src/window_handle.rs @@ -44,6 +44,7 @@ use crate::{ view::{view_children_set_parent_id, view_tab_navigation, AnyView, View, ViewData, Widget}, view_data::{update_data, ChangeFlags}, widgets::{default_theme, Theme}, + action::remove_tooltip }; /// The top-level window handle that owns the winit Window. @@ -124,6 +125,7 @@ impl WindowHandle { data: ViewData::new(id), main: widget, overlays: Default::default(), + tooltip: None }; let window = Arc::new(window); @@ -239,6 +241,11 @@ impl WindowHandle { view_arrow_navigation(name, cx.app_state, &self.view); } } + + if self.view.tooltip.is_some() { + let tooltip_overview = self.view.tooltip.as_mut().unwrap(); + remove_tooltip(tooltip_overview.data.id); + } } let keyboard_trigger_end = cx.app_state.keyboard_navigation @@ -1014,6 +1021,31 @@ impl WindowHandle { overlay.scope.dispose(); cx.app_state.request_all(self.id); } + UpdateMessage::AddTooltip { id, position, view } => { + let scope = self.scope.create_child(); + let view = OverlayView { + data: ViewData::new(id), + position, + scope, + child: with_scope(scope, view), + }; + view.view_data().id().set_parent(self.id); + view_children_set_parent_id(&view); + + self.view.tooltip = Some(view); + cx.app_state.request_all(self.id); + } + UpdateMessage::RemoveTooltip { id } => { + if self.view.tooltip.is_some() { + let tooltip = self.view.tooltip.as_mut().unwrap(); + if tooltip.view_data().id.eq(&id) { + cx.app_state.remove_view(tooltip); + tooltip.scope.dispose(); + cx.app_state.request_all(self.id); + self.view.tooltip = None; + } + } + } } } } @@ -1661,6 +1693,7 @@ struct WindowView { data: ViewData, main: Box, overlays: IndexMap, + tooltip: Option } impl Widget for WindowView { @@ -1681,6 +1714,9 @@ impl Widget for WindowView { for overlay in self.overlays.values() { for_each(overlay); } + if self.tooltip.is_some() { + for_each(self.tooltip.as_ref().unwrap()); + } } fn for_each_child_mut<'a>(&'a mut self, for_each: &mut dyn FnMut(&'a mut dyn Widget) -> bool) { @@ -1688,6 +1724,9 @@ impl Widget for WindowView { for overlay in self.overlays.values_mut() { for_each(overlay); } + if self.tooltip.is_some() { + for_each(self.tooltip.as_mut().unwrap()); + } } fn for_each_child_rev_mut<'a>( @@ -1700,6 +1739,9 @@ impl Widget for WindowView { return; }; } + if self.tooltip.is_some() { + for_each(self.tooltip.as_mut().unwrap()); + } for_each(&mut self.main); } From 1c78c337be5766d250fd6980fad8f3eabd97ef17 Mon Sep 17 00:00:00 2001 From: Narref Date: Tue, 9 Apr 2024 20:30:34 +0200 Subject: [PATCH 02/10] Fix formatting issues --- src/action.rs | 2 +- src/update.rs | 2 +- src/window_handle.rs | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/action.rs b/src/action.rs index 801559ce..41e7c83a 100644 --- a/src/action.rs +++ b/src/action.rs @@ -164,4 +164,4 @@ pub fn add_tooltip( /// Removes the tooltip from the current window. pub fn remove_tooltip(id: Id) { add_update_message(UpdateMessage::RemoveTooltip { id }); -} \ No newline at end of file +} diff --git a/src/update.rs b/src/update.rs index 55479563..7ca4584d 100644 --- a/src/update.rs +++ b/src/update.rs @@ -127,7 +127,7 @@ pub(crate) enum UpdateMessage { view: Box Box>, }, RemoveTooltip { - id: Id + id: Id, }, Inspect, ScrollTo { diff --git a/src/window_handle.rs b/src/window_handle.rs index 61bb26c2..9aa98662 100644 --- a/src/window_handle.rs +++ b/src/window_handle.rs @@ -22,6 +22,7 @@ use crate::unit::UnitExt; #[cfg(target_os = "linux")] use crate::views::{container, stack, Decorators}; use crate::{ + action::remove_tooltip, animate::{AnimPropKind, AnimUpdateMsg, AnimValue, AnimatedProp, SizeUnit}, context::{ AppState, ComputeLayoutCx, EventCx, FrameUpdate, LayoutCx, MoveListener, PaintCx, @@ -44,7 +45,6 @@ use crate::{ view::{view_children_set_parent_id, view_tab_navigation, AnyView, View, ViewData, Widget}, view_data::{update_data, ChangeFlags}, widgets::{default_theme, Theme}, - action::remove_tooltip }; /// The top-level window handle that owns the winit Window. @@ -125,7 +125,7 @@ impl WindowHandle { data: ViewData::new(id), main: widget, overlays: Default::default(), - tooltip: None + tooltip: None, }; let window = Arc::new(window); @@ -241,7 +241,7 @@ impl WindowHandle { view_arrow_navigation(name, cx.app_state, &self.view); } } - + if self.view.tooltip.is_some() { let tooltip_overview = self.view.tooltip.as_mut().unwrap(); remove_tooltip(tooltip_overview.data.id); @@ -1693,7 +1693,7 @@ struct WindowView { data: ViewData, main: Box, overlays: IndexMap, - tooltip: Option + tooltip: Option, } impl Widget for WindowView { From fd3fc4808236224947aa97e954cf70e2d246d9b3 Mon Sep 17 00:00:00 2001 From: Narref Date: Mon, 15 Apr 2024 18:22:21 +0200 Subject: [PATCH 03/10] Fix tooltip shown while dragging --- src/views/tooltip.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/tooltip.rs b/src/views/tooltip.rs index 319b3b34..342ece72 100644 --- a/src/views/tooltip.rs +++ b/src/views/tooltip.rs @@ -110,7 +110,7 @@ impl Widget for Tooltip { ) -> EventPropagation { match &event { Event::PointerMove(e) => { - if self.overlay.is_none() { + if self.overlay.is_none() && !cx.app_state.dragging.is_some() { let id = self.id(); let token = exec_after(Duration::from_secs_f64(self.style.delay()), move |token| { From 989c3ca180f3faee0d530b0a5025d23d40e4c18f Mon Sep 17 00:00:00 2001 From: Long0x0 <51022287+Long0x0@users.noreply.github.com> Date: Fri, 5 Apr 2024 03:00:11 +0800 Subject: [PATCH 04/10] Fix rounded corner rendering (#410) still won't work if border_radius < border_width / 2, since the radius is limited by the stroke width --- src/view.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/view.rs b/src/view.rs index 3df79eb3..9e9a6721 100644 --- a/src/view.rs +++ b/src/view.rs @@ -457,6 +457,7 @@ pub(crate) fn paint_border(cx: &mut PaintCx, style: &ViewStyleProps, size: Size) crate::unit::PxPct::Pct(pct) => size.min_side() * (pct / 100.), }; if radius > 0.0 { + let radius = (radius - half).max(0.0); cx.stroke(&rect.to_rounded_rect(radius), border_color, left); } else { cx.stroke(&rect, border_color, left); From 17ae697d79899a754b3f824a6d9619492a3904f2 Mon Sep 17 00:00:00 2001 From: Ferran Alcaina Date: Tue, 16 Apr 2024 16:49:42 +0200 Subject: [PATCH 05/10] Simplify boolean expression --- src/views/tooltip.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/tooltip.rs b/src/views/tooltip.rs index 342ece72..3e0db1a7 100644 --- a/src/views/tooltip.rs +++ b/src/views/tooltip.rs @@ -110,7 +110,7 @@ impl Widget for Tooltip { ) -> EventPropagation { match &event { Event::PointerMove(e) => { - if self.overlay.is_none() && !cx.app_state.dragging.is_some() { + if self.overlay.is_none() && cx.app_state.dragging.is_none() { let id = self.id(); let token = exec_after(Duration::from_secs_f64(self.style.delay()), move |token| { From 218e7f4c6b8122417af8025bc4ae7015acc3ed41 Mon Sep 17 00:00:00 2001 From: Ferran Alcaina Date: Tue, 16 Apr 2024 16:49:56 +0200 Subject: [PATCH 06/10] Remove tooltip on pointer wheel --- src/views/tooltip.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/views/tooltip.rs b/src/views/tooltip.rs index 3e0db1a7..7ede54de 100644 --- a/src/views/tooltip.rs +++ b/src/views/tooltip.rs @@ -119,7 +119,10 @@ impl Widget for Tooltip { self.hover = Some((e.pos, token)); } } - Event::PointerLeave | Event::PointerDown(_) | Event::PointerUp(_) => { + Event::PointerLeave + | Event::PointerDown(_) + | Event::PointerUp(_) + | Event::PointerWheel(_) => { self.hover = None; if let Some(id) = self.overlay { remove_tooltip(id); From 13ab3dc15e581c70b44ff9c9a271fb05290570ff Mon Sep 17 00:00:00 2001 From: Narref Date: Sat, 27 Apr 2024 10:23:49 +0200 Subject: [PATCH 07/10] Replace add/remove tooltip functions to the possibility to listen keyboard without the view being focused --- src/action.rs | 19 ---------------- src/context.rs | 2 ++ src/id.rs | 4 ++++ src/update.rs | 11 +++------- src/views/decorator.rs | 6 ++++++ src/views/tooltip.rs | 14 +++++++----- src/window_handle.rs | 49 ++++++++++++++++-------------------------- 7 files changed, 42 insertions(+), 63 deletions(-) diff --git a/src/action.rs b/src/action.rs index 41e7c83a..12205f3f 100644 --- a/src/action.rs +++ b/src/action.rs @@ -146,22 +146,3 @@ pub fn add_overlay( pub fn remove_overlay(id: Id) { add_update_message(UpdateMessage::RemoveOverlay { id }); } - -/// Creates a new tooltip on the current window. -pub fn add_tooltip( - position: Point, - view: impl FnOnce(Id) -> V + 'static, -) -> Id { - let id = Id::next(); - add_update_message(UpdateMessage::AddTooltip { - id, - position, - view: Box::new(move || Box::new(view(id))), - }); - id -} - -/// Removes the tooltip from the current window. -pub fn remove_tooltip(id: Id) { - add_update_message(UpdateMessage::RemoveTooltip { id }); -} diff --git a/src/context.rs b/src/context.rs index caa30844..06ba590b 100644 --- a/src/context.rs +++ b/src/context.rs @@ -100,6 +100,7 @@ pub struct AppState { pub(crate) request_paint: bool, pub(crate) disabled: HashSet, pub(crate) keyboard_navigable: HashSet, + pub(crate) keyboard_listenable: HashSet, pub(crate) draggable: HashSet, pub(crate) dragging: Option, pub(crate) drag_start: Option<(Id, Point)>, @@ -145,6 +146,7 @@ impl AppState { request_compute_layout: false, disabled: HashSet::new(), keyboard_navigable: HashSet::new(), + keyboard_listenable: HashSet::new(), draggable: HashSet::new(), dragging: None, drag_start: None, diff --git a/src/id.rs b/src/id.rs index 9e5500c9..d98c7a9d 100644 --- a/src/id.rs +++ b/src/id.rs @@ -170,6 +170,10 @@ impl Id { self.add_update_message(UpdateMessage::KeyboardNavigable { id: *self }); } + pub fn keyboard_listenable(&self) { + self.add_update_message(UpdateMessage::KeyboardListenable { id: *self }); + } + pub fn draggable(&self) { self.add_update_message(UpdateMessage::Draggable { id: *self }); } diff --git a/src/update.rs b/src/update.rs index 7ca4584d..c94b06ba 100644 --- a/src/update.rs +++ b/src/update.rs @@ -65,6 +65,9 @@ pub(crate) enum UpdateMessage { KeyboardNavigable { id: Id, }, + KeyboardListenable { + id: Id, + }, Draggable { id: Id, }, @@ -121,14 +124,6 @@ pub(crate) enum UpdateMessage { RemoveOverlay { id: Id, }, - AddTooltip { - id: Id, - position: Point, - view: Box Box>, - }, - RemoveTooltip { - id: Id, - }, Inspect, ScrollTo { id: Id, diff --git a/src/views/decorator.rs b/src/views/decorator.rs index 49bf464f..8b3179e4 100644 --- a/src/views/decorator.rs +++ b/src/views/decorator.rs @@ -75,6 +75,12 @@ pub trait Decorators: View + Sized { self } + fn keyboard_listenable(self) -> Self { + let id = self.id(); + id.keyboard_listenable(); + self + } + fn draggable(self) -> Self { let id = self.id(); id.draggable(); diff --git a/src/views/tooltip.rs b/src/views/tooltip.rs index 7ede54de..d6503159 100644 --- a/src/views/tooltip.rs +++ b/src/views/tooltip.rs @@ -1,8 +1,9 @@ use kurbo::Point; use std::{rc::Rc, time::Duration}; +use crate::views::Decorators; use crate::{ - action::{add_tooltip, exec_after, remove_tooltip, TimerToken}, + action::{add_overlay, exec_after, remove_overlay, TimerToken}, context::{EventCx, UpdateCx}, event::Event, id::Id, @@ -44,6 +45,7 @@ pub fn tooltip( style: Default::default(), window_origin: None, } + .keyboard_listenable() } impl View for Tooltip { @@ -93,7 +95,7 @@ impl Widget for Tooltip { if let Some(window_origin) = self.window_origin { if self.hover.map(|(_, t)| t) == Some(*token) { let tip = self.tip.clone(); - self.overlay = Some(add_tooltip( + self.overlay = Some(add_overlay( window_origin + self.hover.unwrap().0.to_vec2() + (10., 10.), move |_| tip(), )); @@ -122,10 +124,12 @@ impl Widget for Tooltip { Event::PointerLeave | Event::PointerDown(_) | Event::PointerUp(_) - | Event::PointerWheel(_) => { + | Event::PointerWheel(_) + | Event::KeyUp(_) + | Event::KeyDown(_) => { self.hover = None; if let Some(id) = self.overlay { - remove_tooltip(id); + remove_overlay(id); self.overlay = None; } } @@ -144,7 +148,7 @@ impl Widget for Tooltip { impl Drop for Tooltip { fn drop(&mut self) { if let Some(id) = self.overlay { - remove_tooltip(id); + remove_overlay(id); } } } diff --git a/src/window_handle.rs b/src/window_handle.rs index 9aa98662..90413cbd 100644 --- a/src/window_handle.rs +++ b/src/window_handle.rs @@ -22,7 +22,6 @@ use crate::unit::UnitExt; #[cfg(target_os = "linux")] use crate::views::{container, stack, Decorators}; use crate::{ - action::remove_tooltip, animate::{AnimPropKind, AnimUpdateMsg, AnimValue, AnimatedProp, SizeUnit}, context::{ AppState, ComputeLayoutCx, EventCx, FrameUpdate, LayoutCx, MoveListener, PaintCx, @@ -183,6 +182,21 @@ impl WindowHandle { cx.app_state.focus }; + if matches!(event, Event::KeyUp(_)) || matches!(event, Event::KeyDown(_)) { + for id in cx.app_state.keyboard_listenable.clone().iter() { + let id_path = ID_PATHS.with(|paths| paths.borrow().get(id).cloned()); + if let Some(id_path) = id_path { + cx.unconditional_view_event( + &mut self.view, + Some(id_path.dispatch()), + event.clone(), + ); + } else { + cx.app_state.focus = None; + } + } + } + if event.needs_focus() { let mut processed = false; @@ -241,11 +255,6 @@ impl WindowHandle { view_arrow_navigation(name, cx.app_state, &self.view); } } - - if self.view.tooltip.is_some() { - let tooltip_overview = self.view.tooltip.as_mut().unwrap(); - remove_tooltip(tooltip_overview.data.id); - } } let keyboard_trigger_end = cx.app_state.keyboard_navigation @@ -855,6 +864,9 @@ impl WindowHandle { UpdateMessage::KeyboardNavigable { id } => { cx.app_state.keyboard_navigable.insert(id); } + UpdateMessage::KeyboardListenable { id } => { + cx.app_state.keyboard_listenable.insert(id); + } UpdateMessage::Draggable { id } => { cx.app_state.draggable.insert(id); } @@ -1021,31 +1033,6 @@ impl WindowHandle { overlay.scope.dispose(); cx.app_state.request_all(self.id); } - UpdateMessage::AddTooltip { id, position, view } => { - let scope = self.scope.create_child(); - let view = OverlayView { - data: ViewData::new(id), - position, - scope, - child: with_scope(scope, view), - }; - view.view_data().id().set_parent(self.id); - view_children_set_parent_id(&view); - - self.view.tooltip = Some(view); - cx.app_state.request_all(self.id); - } - UpdateMessage::RemoveTooltip { id } => { - if self.view.tooltip.is_some() { - let tooltip = self.view.tooltip.as_mut().unwrap(); - if tooltip.view_data().id.eq(&id) { - cx.app_state.remove_view(tooltip); - tooltip.scope.dispose(); - cx.app_state.request_all(self.id); - self.view.tooltip = None; - } - } - } } } } From 6c99f0bed1215cbc556c5a8b722445896ea8a76d Mon Sep 17 00:00:00 2001 From: Narref Date: Sat, 27 Apr 2024 11:04:49 +0200 Subject: [PATCH 08/10] Add keyboard listenable example --- examples/keyboard_listener/Cargo.toml | 10 +++++++++ examples/keyboard_listener/src/main.rs | 31 ++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 examples/keyboard_listener/Cargo.toml create mode 100644 examples/keyboard_listener/src/main.rs diff --git a/examples/keyboard_listener/Cargo.toml b/examples/keyboard_listener/Cargo.toml new file mode 100644 index 00000000..46321260 --- /dev/null +++ b/examples/keyboard_listener/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "keyboard_listener" +edition = "2021" +license.workspace = true +version.workspace = true + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +floem = { path = "../.." } diff --git a/examples/keyboard_listener/src/main.rs b/examples/keyboard_listener/src/main.rs new file mode 100644 index 00000000..a0324188 --- /dev/null +++ b/examples/keyboard_listener/src/main.rs @@ -0,0 +1,31 @@ +use floem::event::{Event, EventListener}; +use floem::reactive::create_rw_signal; +use floem::views::label; +use floem::{ + view::View, + views::{v_stack, Decorators}, + widgets::text_input, + EventPropagation, +}; + +fn app_view() -> impl View { + let text = create_rw_signal("".to_string()); + let keyboard_signal = create_rw_signal("".to_string()); + v_stack(( + text_input(text) + .placeholder("Write here") + .keyboard_navigatable(), + label(move || format!("Key Pressed: {}", keyboard_signal.get())) + .keyboard_listenable() + .on_event(EventListener::KeyDown, move |e| { + if let Event::KeyDown(e) = e { + keyboard_signal.set(e.key.logical_key.to_text().unwrap().to_string()); + } + EventPropagation::Continue + }), + )) +} + +fn main() { + floem::launch(app_view); +} From b3a5f425c9a6ddd99cfd93853ee501a69e8b621a Mon Sep 17 00:00:00 2001 From: Narref Date: Sat, 27 Apr 2024 11:05:25 +0200 Subject: [PATCH 09/10] Add keyboard listenable documentation --- src/views/decorator.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/views/decorator.rs b/src/views/decorator.rs index 8b3179e4..c2cb1da4 100644 --- a/src/views/decorator.rs +++ b/src/views/decorator.rs @@ -75,6 +75,7 @@ pub trait Decorators: View + Sized { self } + /// Allows the elements to receive keyboard events without being navigable and without being focused. fn keyboard_listenable(self) -> Self { let id = self.id(); id.keyboard_listenable(); From 4c115b5d2b70de3c87a68cad9711329edcb13da4 Mon Sep 17 00:00:00 2001 From: Narref Date: Sun, 28 Apr 2024 16:15:39 +0200 Subject: [PATCH 10/10] Revert tooltip field --- src/window_handle.rs | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/window_handle.rs b/src/window_handle.rs index 90413cbd..6cb770d3 100644 --- a/src/window_handle.rs +++ b/src/window_handle.rs @@ -124,7 +124,6 @@ impl WindowHandle { data: ViewData::new(id), main: widget, overlays: Default::default(), - tooltip: None, }; let window = Arc::new(window); @@ -1680,7 +1679,6 @@ struct WindowView { data: ViewData, main: Box, overlays: IndexMap, - tooltip: Option, } impl Widget for WindowView { @@ -1701,9 +1699,6 @@ impl Widget for WindowView { for overlay in self.overlays.values() { for_each(overlay); } - if self.tooltip.is_some() { - for_each(self.tooltip.as_ref().unwrap()); - } } fn for_each_child_mut<'a>(&'a mut self, for_each: &mut dyn FnMut(&'a mut dyn Widget) -> bool) { @@ -1711,9 +1706,6 @@ impl Widget for WindowView { for overlay in self.overlays.values_mut() { for_each(overlay); } - if self.tooltip.is_some() { - for_each(self.tooltip.as_mut().unwrap()); - } } fn for_each_child_rev_mut<'a>( @@ -1726,9 +1718,6 @@ impl Widget for WindowView { return; }; } - if self.tooltip.is_some() { - for_each(self.tooltip.as_mut().unwrap()); - } for_each(&mut self.main); }