mirror of
https://github.com/VallierDev/uu-remote-linux.git
synced 2026-11-16 16:50:41 +01:00
Preserve granted clipboard capability across locked-session handshake and test closed state
This commit is contained in:
1 parent
a18a69c19e
commit
66c8bb3249
4 files changed
+116
-1
No files matched your search
@@ -10,6 +10,7 @@ mod native {
|
||||
use std::{ffi::c_void, ptr::NonNull, sync::Mutex};
|
||||
extern "C" {
|
||||
fn uu_portal_open_persist(restore: *const libc::c_char, save: extern "C" fn(*const libc::c_char, *mut c_void), data: *mut c_void, error: *mut i32, width: *mut u32, height: *mut u32) -> *mut c_void;
|
||||
fn uu_portal_clipboard_supported(portal: *mut c_void) -> i32;
|
||||
fn uu_portal_clipboard_ready(portal: *mut c_void) -> i32;
|
||||
fn uu_portal_clipboard_set(portal: *mut c_void, text: *const u8, length: usize) -> i32;
|
||||
fn uu_portal_clipboard_poll(portal: *mut c_void, text: *mut u8, capacity: usize) -> i32;
|
||||
@@ -89,6 +90,9 @@ mod native {
|
||||
if code == 10 || code == 9 { super::blank(frame); Ok(()) } else { super::check(code) }
|
||||
}
|
||||
|
||||
pub fn clipboard_supported(&self) -> bool {
|
||||
self.handle.lock().is_ok_and(|handle| unsafe { uu_portal_clipboard_supported(handle.0.as_ptr()) != 0 })
|
||||
}
|
||||
pub fn clipboard_ready(&self) -> bool {
|
||||
self.handle.lock().is_ok_and(|handle| unsafe { uu_portal_clipboard_ready(handle.0.as_ptr()) != 0 })
|
||||
}
|
||||
@@ -144,6 +148,7 @@ pub use native::Session as PortalSession;
|
||||
pub struct PortalSession { pub width: u32, pub height: u32 }
|
||||
#[cfg(not(all(target_os = "linux", feature = "portal")))]
|
||||
impl PortalSession {
|
||||
pub fn clipboard_supported(&self) -> bool { false }
|
||||
pub fn clipboard_ready(&self) -> bool { false }
|
||||
pub fn clipboard_set(&self, _: &str) -> Result<(), String> { Err(error(2)) }
|
||||
pub fn clipboard_poll(&self) -> Option<String> { None }
|
||||
|
||||
+5
-1
@@ -271,7 +271,11 @@ impl WebRtcSession {
|
||||
let input_clone = input.clone();
|
||||
let control_capture = capture.clone();
|
||||
let control_sequence = Arc::new(std::sync::atomic::AtomicU64::new(1));
|
||||
let text_clipboard_ready = Arc::new(std::sync::atomic::AtomicBool::new(false));
|
||||
// Capability belongs to the granted session, including while GNOME is
|
||||
// locked. Echo can precede TEXT readiness and CONTROL auto-unlock;
|
||||
// advertising false here would disable clipboard for the entire peer.
|
||||
let portal_clipboard_supported = desktop && capture.portal.as_ref().is_some_and(|session| session.clipboard_supported());
|
||||
let text_clipboard_ready = Arc::new(std::sync::atomic::AtomicBool::new(portal_clipboard_supported));
|
||||
// One file-transfer session per peer. The viewer may send FileTransferFtp RPCs on CONTROL,
|
||||
// but it receives file traffic only through streamerDidReceiveFileData, so every reply and
|
||||
// host-initiated request goes out on FILE_DATA_CHANNEL.
|
||||
|
||||
Reference in new issue
Block a user