feat: somewhere to place extra actions by platform
I have view iced-sckt forked iced, and add the extra actions. and there do are some extra actions, like set margin for layer-shell, set lock for ext-session-shell. I think add an any will be of help maybe
This commit is contained in:
parent
0b2c9db228
commit
6e97595d95
2 changed files with 7 additions and 0 deletions
|
|
@ -5,6 +5,7 @@ use crate::system;
|
||||||
use crate::window;
|
use crate::window;
|
||||||
|
|
||||||
use iced_futures::MaybeSend;
|
use iced_futures::MaybeSend;
|
||||||
|
use std::any::Any;
|
||||||
|
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
@ -43,6 +44,9 @@ pub enum Action<T> {
|
||||||
/// The message to produce when the font has been loaded.
|
/// The message to produce when the font has been loaded.
|
||||||
tagger: Box<dyn Fn(Result<(), font::Error>) -> T>,
|
tagger: Box<dyn Fn(Result<(), font::Error>) -> T>,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/// Pass PlatformSpecific action, for some special platform
|
||||||
|
PlatformSpecific(Box<dyn Any>)
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Action<T> {
|
impl<T> Action<T> {
|
||||||
|
|
@ -72,6 +76,7 @@ impl<T> Action<T> {
|
||||||
bytes,
|
bytes,
|
||||||
tagger: Box::new(move |result| f(tagger(result))),
|
tagger: Box::new(move |result| f(tagger(result))),
|
||||||
},
|
},
|
||||||
|
Self::PlatformSpecific(special) => Action::PlatformSpecific(special)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -90,6 +95,7 @@ impl<T> fmt::Debug for Action<T> {
|
||||||
Self::System(action) => write!(f, "Action::System({action:?})"),
|
Self::System(action) => write!(f, "Action::System({action:?})"),
|
||||||
Self::Widget(_action) => write!(f, "Action::Widget"),
|
Self::Widget(_action) => write!(f, "Action::Widget"),
|
||||||
Self::LoadFont { .. } => write!(f, "Action::LoadFont"),
|
Self::LoadFont { .. } => write!(f, "Action::LoadFont"),
|
||||||
|
Self::PlatformSpecific(_) => write!(f, "Action::PlatformSpecific")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -861,6 +861,7 @@ pub fn run_command<A, C, E>(
|
||||||
.send_event(tagger(Ok(())))
|
.send_event(tagger(Ok(())))
|
||||||
.expect("Send message to event loop");
|
.expect("Send message to event loop");
|
||||||
}
|
}
|
||||||
|
command::Action::PlatformSpecific(_) => unimplemented!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue