Skip to content

Commit

Permalink
refactor: peek_dnd try to parse data
Browse files Browse the repository at this point in the history
  • Loading branch information
wash2 committed Oct 11, 2024
1 parent 67cb1eb commit 7d3b789
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ bytemuck = { version = "1.0", features = ["derive"] }
bytes = "1.6"

cosmic-text = { git = "https://github.com/pop-os/cosmic-text.git" }
# cosmic-text = "0.10"

dark-light = "1.0"
futures = "0.3"
Expand Down Expand Up @@ -195,7 +194,7 @@ rustc-hash = "2.0"
sctk = { package = "smithay-client-toolkit", version = "0.19.1" }
smol = "1.0"
smol_str = "0.2"
softbuffer = { git = "https://github.com/pop-os/softbuffer", tag = "cosmic-4.0" }
softbuffer = { version = "0.4" }
syntect = "5.2"
sysinfo = "0.30"
thiserror = "1.0"
Expand Down
3 changes: 2 additions & 1 deletion runtime/src/dnd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl std::fmt::Debug for DndAction {
}

/// Read the current contents of the Dnd operation.
pub fn peek_dnd<T: AllowedMimeTypes>() -> Task<Option<(Vec<u8>, String)>> {
pub fn peek_dnd<T: AllowedMimeTypes>() -> Task<Option<T>> {
task::oneshot(|tx| {
Action::Dnd(DndAction::PeekDnd(
T::allowed()
Expand All @@ -87,6 +87,7 @@ pub fn peek_dnd<T: AllowedMimeTypes>() -> Task<Option<(Vec<u8>, String)>> {
tx,
))
})
.map(|data| data.and_then(|data| T::try_from(data).ok()))
}

/// Register a Dnd destination.
Expand Down

0 comments on commit 7d3b789

Please sign in to comment.