diff --git a/src/platform/android.rs b/src/platform/android.rs index c2d460a..885f80d 100644 --- a/src/platform/android.rs +++ b/src/platform/android.rs @@ -1,12 +1,15 @@ use crate::ClipboardProvider; +use crate::dnd::DndProvider; +use dnd::{DndAction, DndDestinationRectangle, DndSurface, Icon}; +use mime::{AllowedMimeTypes, AsMimeTypes}; use raw_window_handle::HasDisplayHandle; -use std::error::Error; +use std::{borrow::Cow, error::Error}; pub fn connect( _window: &W, ) -> Result> { - Ok(Clipboard::new()) + Clipboard::new() } pub struct Clipboard; @@ -36,7 +39,46 @@ impl ClipboardProvider for Clipboard { Err(Box::new(AndroidClipboardError::Unimplemented)) } - fn write(&mut self, contents: String) -> Result<(), Box> { + fn write(&mut self, _contents: String) -> Result<(), Box> { Err(Box::new(AndroidClipboardError::Unimplemented)) } } + +impl DndProvider for Clipboard { + fn init_dnd( + &self, + _tx: Box + Send + Sync + 'static>, + ) { + } + + fn start_dnd( + &self, + _internal: bool, + _source_surface: DndSurface, + _icon_surface: Option, + _content: D, + _actions: DndAction, + ) { + } + + fn end_dnd(&self) {} + + fn register_dnd_destination( + &self, + _surface: DndSurface, + _rectangles: Vec, + ) { + } + + fn set_action(&self, _action: DndAction) {} + + fn peek_offer( + &self, + _mime_type: Option>, + ) -> std::io::Result { + Err(std::io::Error::new( + std::io::ErrorKind::Other, + "DnD not supported", + )) + } +} diff --git a/src/platform/macos.rs b/src/platform/macos.rs index 084ace8..375799f 100644 --- a/src/platform/macos.rs +++ b/src/platform/macos.rs @@ -1,8 +1,11 @@ use crate::ClipboardProvider; +use crate::dnd::DndProvider; pub(crate) use clipboard_macos::Clipboard; +use dnd::{DndAction, DndDestinationRectangle, DndSurface, Icon}; +use mime::{AllowedMimeTypes, AsMimeTypes}; use raw_window_handle::HasDisplayHandle; -use std::error::Error; +use std::{borrow::Cow, error::Error}; pub fn connect( _window: &W, @@ -10,6 +13,45 @@ pub fn connect( Clipboard::new() } +impl DndProvider for Clipboard { + fn init_dnd( + &self, + _tx: Box + Send + Sync + 'static>, + ) { + } + + fn start_dnd( + &self, + _internal: bool, + _source_surface: DndSurface, + _icon_surface: Option, + _content: D, + _actions: DndAction, + ) { + } + + fn end_dnd(&self) {} + + fn register_dnd_destination( + &self, + _surface: DndSurface, + _rectangles: Vec, + ) { + } + + fn set_action(&self, _action: DndAction) {} + + fn peek_offer( + &self, + _mime_type: Option>, + ) -> std::io::Result { + Err(std::io::Error::new( + std::io::ErrorKind::Other, + "DnD not supported", + )) + } +} + impl ClipboardProvider for Clipboard { fn read(&self) -> Result> { self.read() diff --git a/src/platform/windows.rs b/src/platform/windows.rs index f317b10..de79fc6 100644 --- a/src/platform/windows.rs +++ b/src/platform/windows.rs @@ -1,15 +1,55 @@ use crate::ClipboardProvider; +use crate::dnd::DndProvider; use clipboard_win::{get_clipboard_string, set_clipboard_string}; +use dnd::{DndAction, DndDestinationRectangle, DndSurface, Icon}; +use mime::{AllowedMimeTypes, AsMimeTypes}; use raw_window_handle::HasDisplayHandle; - -use std::error::Error; +use std::{borrow::Cow, error::Error}; pub fn connect( _window: &W, ) -> Result> { Ok(Clipboard) } +impl DndProvider for Clipboard { + fn init_dnd( + &self, + _tx: Box + Send + Sync + 'static>, + ) { + } + + fn start_dnd( + &self, + _internal: bool, + _source_surface: DndSurface, + _icon_surface: Option, + _content: D, + _actions: DndAction, + ) { + } + + fn end_dnd(&self) {} + + fn register_dnd_destination( + &self, + _surface: DndSurface, + _rectangles: Vec, + ) { + } + + fn set_action(&self, _action: DndAction) {} + + fn peek_offer( + &self, + _mime_type: Option>, + ) -> std::io::Result { + Err(std::io::Error::new( + std::io::ErrorKind::Other, + "DnD not supported", + )) + } +} pub struct Clipboard;