Merge pull request #1231 from TannerRogalsky/allow-the-creation-of-unconnected-clipboard

Allow the creation of a clipboard without a window.
This commit is contained in:
Héctor Ramón 2022-02-07 22:53:10 +07:00 committed by GitHub
commit 880671e104
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -26,6 +26,14 @@ impl Clipboard {
Clipboard { state }
}
/// Creates a new [`Clipboard`] that isn't associated with a window.
/// This clipboard will never contain a copied value.
pub fn unconnected() -> Clipboard {
Clipboard {
state: State::Unavailable,
}
}
/// Reads the current content of the [`Clipboard`] as text.
pub fn read(&self) -> Option<String> {
match &self.state {