Skip to content

Commit

Permalink
Revert "feat(clipboard): handle clipboard message"
Browse files Browse the repository at this point in the history
This reverts commit cf357f8.
  • Loading branch information
pewsheen committed Jul 4, 2024
1 parent cf357f8 commit ba9a8f8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 198 deletions.
169 changes: 10 additions & 159 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ crossbeam-channel = "0.5"
getopts = "0.2.17"
surfman = { version = "0.9", features = ["chains", "sm-angle-default", "sm-raw-window-handle"] }
winit = { version = "0.29", features = ["rwh_05"] }
arboard = "3.4.0"

[target."cfg(any(target_os = \"ios\", target_os = \"macos\"))".dependencies]
block = "0.1"
Expand Down
38 changes: 0 additions & 38 deletions src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ use crate::{
Status,
};

use arboard::Clipboard;

/// A Verso window is a Winit window containing several web views.
pub struct Window {
/// Access to Winit window with webrender context.
Expand All @@ -47,10 +45,7 @@ pub struct Window {
webrender_gl: Rc<dyn gl::Gl>,
/// The mouse physical position in the web view.
mouse_position: Cell<PhysicalPosition<f64>>,
/// The current state of the keyboard modifiers.
modifiers_state: Cell<ModifiersState>,
/// The clipboard. `None` if the platform or desktop environment is not support.
clipboard: Option<Clipboard>,
}

impl Window {
Expand Down Expand Up @@ -86,11 +81,6 @@ impl Window {
webrender_gl,
mouse_position: Cell::new(PhysicalPosition::default()),
modifiers_state: Cell::new(ModifiersState::default()),
clipboard: Clipboard::new()
.map_err(|e| {
log::warn!("Failed to create clipboard: {}", e);
})
.ok(),
}
}

Expand Down Expand Up @@ -230,34 +220,6 @@ impl Window {
) -> bool {
let mut need_present = false;
servo.get_events().into_iter().for_each(|(w, m)| {

// Window-wise events
match &m {
EmbedderMsg::GetClipboardContents(sender) => {
if let Some(clipboard) = self.clipboard.as_mut() {
let contents = clipboard.get_text().unwrap_or_else(|e| {
log::warn!("Failed to get clipboard content: {}", e);
String::new()
});
if let Err(e) = sender.send(contents) {
log::warn!("Failed to send clipboard content: {}", e);
}
} else {
log::trace!("Clipboard is not supported on this platform.");
}
},
EmbedderMsg::SetClipboardContents(text) => {
if let Some(clipboard) = self.clipboard.as_mut() {
if let Err(e) = clipboard.set_text(text) {
log::warn!("Failed to set clipboard contents: {}", e);
}
} else {
log::trace!("Clipboard is not supported on this platform.");
}
},
_ => ()
}

match w {
// Handle message in Verso Panel
Some(p) if p == self.panel.id() => {
Expand Down

0 comments on commit ba9a8f8

Please sign in to comment.