summaryrefslogtreecommitdiffstats
path: root/native/src/widget/operation.rs
diff options
context:
space:
mode:
Diffstat (limited to 'native/src/widget/operation.rs')
-rw-r--r--native/src/widget/operation.rs18
1 files changed, 8 insertions, 10 deletions
diff --git a/native/src/widget/operation.rs b/native/src/widget/operation.rs
index b6c108e0..2cfba005 100644
--- a/native/src/widget/operation.rs
+++ b/native/src/widget/operation.rs
@@ -5,7 +5,7 @@ pub trait Operation<T> {
fn container(
&mut self,
id: Option<&Id>,
- operate_on_children: &dyn Fn(&mut dyn Operation<T>),
+ operate_on_children: &mut dyn FnMut(&mut dyn Operation<T>),
);
fn focusable(
@@ -37,14 +37,12 @@ pub fn focus<T>(target: Id) -> impl Operation<T> {
state: &mut dyn state::Focusable,
id: Option<&Id>,
) {
- if state.is_focused() {
- match id {
- Some(id) if id == &self.target => {
- state.focus();
- }
- _ => {
- state.unfocus();
- }
+ match id {
+ Some(id) if id == &self.target => {
+ state.focus();
+ }
+ _ => {
+ state.unfocus();
}
}
}
@@ -52,7 +50,7 @@ pub fn focus<T>(target: Id) -> impl Operation<T> {
fn container(
&mut self,
_id: Option<&Id>,
- operate_on_children: &dyn Fn(&mut dyn Operation<T>),
+ operate_on_children: &mut dyn FnMut(&mut dyn Operation<T>),
) {
operate_on_children(self)
}