linux/wayland: Add support for pasting images (#17671)

Release Notes:

- You can now paste images into the Assistant Panel to include them as
context on Linux wayland
This commit is contained in:
maan2003 2024-10-01 04:55:32 +05:30 committed by GitHub
parent eb9fd62a90
commit 837756198f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 106 additions and 65 deletions

View file

@ -603,17 +603,11 @@ pub(super) fn get_xkb_compose_state(cx: &xkb::Context) -> Option<xkb::compose::S
state
}
pub(super) unsafe fn read_fd(mut fd: FileDescriptor) -> Result<String> {
pub(super) unsafe fn read_fd(mut fd: FileDescriptor) -> Result<Vec<u8>> {
let mut file = File::from_raw_fd(fd.as_raw_fd());
let mut buffer = String::new();
file.read_to_string(&mut buffer)?;
// Normalize the text to unix line endings, otherwise
// copying from eg: firefox inserts a lot of blank
// lines, and that is super annoying.
let result = buffer.replace("\r\n", "\n");
Ok(result)
let mut buffer = Vec::new();
file.read_to_end(&mut buffer)?;
Ok(buffer)
}
impl CursorStyle {