Skip to content

Commit

Permalink
fix: update read and write methods so they don't recurse
Browse files Browse the repository at this point in the history
  • Loading branch information
wash2 authored and mmstick committed May 31, 2024
1 parent dc1fea8 commit 34973a5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions winit/src/clipboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,17 @@ impl<M: Send + 'static> Clipboard<M> {

impl<M> crate::core::Clipboard for Clipboard<M> {
fn read(&self) -> Option<String> {
self.read()
match &self.state {
State::Connected(clipboard, _) => clipboard.read().ok(),
State::Unavailable => None,
}
}

fn write(&mut self, contents: String) {
self.write(contents);
match &mut self.state {
State::Connected(clipboard, _) => _ = clipboard.write(contents),
State::Unavailable => {}
}
}

fn read_primary(&self) -> Option<String> {
Expand Down

0 comments on commit 34973a5

Please sign in to comment.