Improve compatibility with Wayland clipboard (#30251)
Closes #26672, #20984 Release Notes: - Fixed issue where some applications won't receive the clipboard contents from Zed Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
This commit is contained in:
parent
c1427ea802
commit
f8097c7c98
2 changed files with 10 additions and 4 deletions
|
@ -75,7 +75,7 @@ use crate::platform::linux::{
|
|||
LinuxClient, get_xkb_compose_state, is_within_click_distance, open_uri_internal, read_fd,
|
||||
reveal_path_internal,
|
||||
wayland::{
|
||||
clipboard::{Clipboard, DataOffer, FILE_LIST_MIME_TYPE, TEXT_MIME_TYPE},
|
||||
clipboard::{Clipboard, DataOffer, FILE_LIST_MIME_TYPE, TEXT_MIME_TYPES},
|
||||
cursor::Cursor,
|
||||
serial::{SerialKind, SerialTracker},
|
||||
window::WaylandWindow,
|
||||
|
@ -778,8 +778,10 @@ impl LinuxClient for WaylandClient {
|
|||
state.clipboard.set_primary(item);
|
||||
let serial = state.serial_tracker.get(SerialKind::KeyPress);
|
||||
let data_source = primary_selection_manager.create_source(&state.globals.qh, ());
|
||||
for mime_type in TEXT_MIME_TYPES {
|
||||
data_source.offer(mime_type.to_string());
|
||||
}
|
||||
data_source.offer(state.clipboard.self_mime());
|
||||
data_source.offer(TEXT_MIME_TYPE.to_string());
|
||||
primary_selection.set_selection(Some(&data_source), serial);
|
||||
}
|
||||
}
|
||||
|
@ -796,8 +798,10 @@ impl LinuxClient for WaylandClient {
|
|||
state.clipboard.set(item);
|
||||
let serial = state.serial_tracker.get(SerialKind::KeyPress);
|
||||
let data_source = data_device_manager.create_data_source(&state.globals.qh, ());
|
||||
for mime_type in TEXT_MIME_TYPES {
|
||||
data_source.offer(mime_type.to_string());
|
||||
}
|
||||
data_source.offer(state.clipboard.self_mime());
|
||||
data_source.offer(TEXT_MIME_TYPE.to_string());
|
||||
data_device.set_selection(Some(&data_source), serial);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,9 @@ use crate::{
|
|||
platform::linux::platform::read_fd,
|
||||
};
|
||||
|
||||
pub(crate) const TEXT_MIME_TYPE: &str = "text/plain;charset=utf-8";
|
||||
/// Text mime types that we'll offer to other programs.
|
||||
pub(crate) const TEXT_MIME_TYPES: [&str; 3] =
|
||||
["text/plain;charset=utf-8", "UTF8_STRING", "text/plain"];
|
||||
pub(crate) const FILE_LIST_MIME_TYPE: &str = "text/uri-list";
|
||||
|
||||
/// Text mime types that we'll accept from other programs.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue