cargo fmt
This commit is contained in:
parent
6bc77815ef
commit
4c65853f51
4 changed files with 19 additions and 19 deletions
|
|
@ -81,34 +81,32 @@ fn main() {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
match event {
|
match event {
|
||||||
smithay_clipboard::dnd::DndEvent::Offer(id, OfferEvent::Data {
|
smithay_clipboard::dnd::DndEvent::Offer(id, OfferEvent::Data { data, mime_type }) => {
|
||||||
data, mime_type
|
|
||||||
}) => {
|
|
||||||
let s = smithay_clipboard::text::Text::try_from((data, mime_type)).unwrap();
|
let s = smithay_clipboard::text::Text::try_from((data, mime_type)).unwrap();
|
||||||
println!("Received DnD data for {}: {}", id.unwrap_or_default(), s.0);
|
println!("Received DnD data for {}: {}", id.unwrap_or_default(), s.0);
|
||||||
},
|
},
|
||||||
smithay_clipboard::dnd::DndEvent::Offer(id, OfferEvent::Leave) =>
|
smithay_clipboard::dnd::DndEvent::Offer(id, OfferEvent::Leave) => {
|
||||||
{
|
if state.internal_dnd {
|
||||||
if state.internal_dnd {
|
|
||||||
if state.pointer_focus {
|
if state.pointer_focus {
|
||||||
println!("Internal drop completed!");
|
println!("Internal drop completed!");
|
||||||
} else {
|
} else {
|
||||||
// Internal DnD will be ignored after leaving the window in which it started.
|
// Internal DnD will be ignored after leaving the window in which it
|
||||||
// Another approach might be to allow it to re-enter before some time has passed.
|
// started. Another approach might be to allow it to
|
||||||
|
// re-enter before some time has passed.
|
||||||
state.internal_dnd = false;
|
state.internal_dnd = false;
|
||||||
state.clipboard.end_dnd();
|
state.clipboard.end_dnd();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
println!("Dnd offer left {id:?}.");
|
println!("Dnd offer left {id:?}.");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
smithay_clipboard::dnd::DndEvent::Source(SourceEvent::Finished) => {
|
smithay_clipboard::dnd::DndEvent::Source(SourceEvent::Finished) => {
|
||||||
println!("Finished sending data.");
|
println!("Finished sending data.");
|
||||||
state.internal_dnd = false;
|
state.internal_dnd = false;
|
||||||
},
|
},
|
||||||
e => {
|
e => {
|
||||||
dbg!(e);
|
dbg!(e);
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -153,7 +151,6 @@ fn main() {
|
||||||
actions: DndAction::Move,
|
actions: DndAction::Move,
|
||||||
preferred: DndAction::Move,
|
preferred: DndAction::Move,
|
||||||
},
|
},
|
||||||
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
let mut simple_window = SimpleWindow {
|
let mut simple_window = SimpleWindow {
|
||||||
|
|
@ -387,12 +384,12 @@ impl PointerHandler for SimpleWindow {
|
||||||
DndAction::all(),
|
DndAction::all(),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
PointerEventKind::Leave {..} => {
|
PointerEventKind::Leave { .. } => {
|
||||||
self.pointer_focus = false;
|
self.pointer_focus = false;
|
||||||
}
|
},
|
||||||
PointerEventKind::Enter {..} => {
|
PointerEventKind::Enter { .. } => {
|
||||||
self.pointer_focus = true;
|
self.pointer_focus = true;
|
||||||
}
|
},
|
||||||
_ => {},
|
_ => {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,8 @@ impl RawSurface for WlSurface {
|
||||||
pub trait RawSurface {
|
pub trait RawSurface {
|
||||||
/// # Safety
|
/// # Safety
|
||||||
///
|
///
|
||||||
/// returned pointer must be a valid `*mut wl_surface` pointer, and it must remain
|
/// returned pointer must be a valid `*mut wl_surface` pointer, and it must
|
||||||
/// valid for as long as `RawSurface` object is alive.
|
/// remain valid for as long as `RawSurface` object is alive.
|
||||||
unsafe fn get_ptr(&mut self) -> *mut c_void;
|
unsafe fn get_ptr(&mut self) -> *mut c_void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,8 @@ where
|
||||||
{
|
{
|
||||||
dnd_state.set_actions(action, preferred_action);
|
dnd_state.set_actions(action, preferred_action);
|
||||||
self.dnd_state.selected_mime = Some(mime_type.clone());
|
self.dnd_state.selected_mime = Some(mime_type.clone());
|
||||||
dnd_state.accept_mime_type(self.dnd_state.accept_ctr, Some(mime_type.to_string()));
|
dnd_state
|
||||||
|
.accept_mime_type(self.dnd_state.accept_ctr, Some(mime_type.to_string()));
|
||||||
self.dnd_state.accept_ctr = self.dnd_state.accept_ctr.wrapping_add(1);
|
self.dnd_state.accept_ctr = self.dnd_state.accept_ctr.wrapping_add(1);
|
||||||
}
|
}
|
||||||
(s.clone(), Some(dest))
|
(s.clone(), Some(dest))
|
||||||
|
|
|
||||||
|
|
@ -488,7 +488,9 @@ impl<T: 'static + Clone> DataSourceHandler for State<T> {
|
||||||
#[cfg(feature = "dnd")]
|
#[cfg(feature = "dnd")]
|
||||||
{
|
{
|
||||||
if let Some(s) = self.dnd_state.sender.as_ref() {
|
if let Some(s) = self.dnd_state.sender.as_ref() {
|
||||||
_ = s.send(DndEvent::Source(crate::dnd::SourceEvent::Mime(m.map(|s| MimeType::from(Cow::Owned(s))))));
|
_ = s.send(DndEvent::Source(crate::dnd::SourceEvent::Mime(
|
||||||
|
m.map(|s| MimeType::from(Cow::Owned(s))),
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue