mirror of
https://github.com/wez/wezterm.git
synced 2024-09-11 14:25:57 +03:00
Handle missing data device manager more gracefully
This commit is contained in:
parent
8fa4ba9ace
commit
0b50725f67
@ -22,15 +22,17 @@ impl DataDeviceHandler for WaylandState {
|
|||||||
&mut self,
|
&mut self,
|
||||||
_conn: &wayland_client::Connection,
|
_conn: &wayland_client::Connection,
|
||||||
_qh: &wayland_client::QueueHandle<Self>,
|
_qh: &wayland_client::QueueHandle<Self>,
|
||||||
_data_device: &WlDataDevice,
|
data_device: &WlDataDevice,
|
||||||
) {
|
) {
|
||||||
let offer = self
|
let data = match self.data_device {
|
||||||
.data_device
|
Some(ref dv) if dv.inner() == data_device => dv.data(),
|
||||||
.as_ref()
|
_ => {
|
||||||
.unwrap()
|
log::warn!("No existing device manager for {:?}", data_device);
|
||||||
.data()
|
return;
|
||||||
.drag_offer()
|
}
|
||||||
.unwrap();
|
};
|
||||||
|
|
||||||
|
let offer = data.drag_offer().unwrap();
|
||||||
|
|
||||||
offer.with_mime_types(|mime_types| {
|
offer.with_mime_types(|mime_types| {
|
||||||
log::trace!(
|
log::trace!(
|
||||||
@ -91,22 +93,22 @@ impl DataDeviceHandler for WaylandState {
|
|||||||
&mut self,
|
&mut self,
|
||||||
_conn: &wayland_client::Connection,
|
_conn: &wayland_client::Connection,
|
||||||
_qh: &wayland_client::QueueHandle<Self>,
|
_qh: &wayland_client::QueueHandle<Self>,
|
||||||
_data_device: &WlDataDevice,
|
data_device: &WlDataDevice,
|
||||||
) {
|
) {
|
||||||
let offer = self
|
let offer = match self.data_device {
|
||||||
.data_device
|
Some(ref dv) if dv.inner() == data_device => dv.data().selection_offer(),
|
||||||
.as_ref()
|
_ => {
|
||||||
.unwrap()
|
return;
|
||||||
.data()
|
}
|
||||||
.selection_offer()
|
};
|
||||||
.unwrap();
|
if let Some(offer) = offer {
|
||||||
|
if !offer.with_mime_types(|mime_types| mime_types.iter().any(|s| s == TEXT_MIME_TYPE)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if !offer.with_mime_types(|mime_types| mime_types.iter().any(|s| s == TEXT_MIME_TYPE)) {
|
if let Some(copy_and_paste) = self.resolve_copy_and_paste() {
|
||||||
return;
|
copy_and_paste.lock().unwrap().confirm_selection(offer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(copy_and_paste) = self.resolve_copy_and_paste() {
|
|
||||||
copy_and_paste.lock().unwrap().confirm_selection(offer);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user