mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-06-22 10:02:20 +00:00
revert: drop Inhibit portal workaround for KDE session termination
Signed-off-by: Steve3184 <77789906+Steve3184@users.noreply.github.com>
This commit is contained in:
parent
194253a5d9
commit
dd4381880e
1 changed files with 0 additions and 49 deletions
|
|
@ -110,17 +110,7 @@ pub struct RdpSessionInfo {
|
|||
pub session: dbus::Path<'static>,
|
||||
pub is_support_restore_token: bool,
|
||||
pub resolution: Arc<Mutex<Option<(usize, usize)>>>,
|
||||
inhibit_request_path: Option<dbus::Path<'static>>,
|
||||
}
|
||||
|
||||
impl Drop for RdpSessionInfo {
|
||||
fn drop(&mut self) {
|
||||
if let Some(ref path) = self.inhibit_request_path {
|
||||
release_inhibit(&self.conn, path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct PwStreamInfo {
|
||||
pub path: u64,
|
||||
|
|
@ -970,41 +960,6 @@ fn on_start_response(
|
|||
}
|
||||
}
|
||||
|
||||
fn request_inhibit(conn: &SyncConnection) -> Option<dbus::Path<'static>> {
|
||||
let proxy = conn.with_proxy(
|
||||
"org.freedesktop.portal.Desktop",
|
||||
"/org/freedesktop/portal/desktop",
|
||||
Duration::from_millis(1000),
|
||||
);
|
||||
let mut args: PropMap = HashMap::new();
|
||||
args.insert("handle_token".to_string(), Variant(Box::new("inhibit1".to_string())),);
|
||||
// flags: 8 = inhibit idle, 4 = inhibit suspend
|
||||
// Based on current testing, Dim Screen will forcibly terminate the session.
|
||||
// Solving this problem requires preventing entry into the idle state.
|
||||
// However, for future considerations, entering the suspended state is also prevented here.
|
||||
match proxy.method_call::<(dbus::Path<'static>,), _, _, _>("org.freedesktop.portal.Inhibit", "Inhibit", ("", 12u32, args)) {
|
||||
Ok((path,)) => {
|
||||
debug!("Inhibit requested, request path: {:?}", path);
|
||||
Some(path)
|
||||
}
|
||||
Err(e) => {
|
||||
warn!("Failed to request inhibit: {}", e);
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn release_inhibit(conn: &SyncConnection, path: &dbus::Path<'static>) {
|
||||
let proxy = conn.with_proxy(
|
||||
"org.freedesktop.portal.Desktop",
|
||||
path,
|
||||
Duration::from_millis(1000),
|
||||
);
|
||||
if let Err(e) = proxy.method_call::<(), _, _, _>("org.freedesktop.portal.Request", "Close", ()) {
|
||||
warn!("Failed to release inhibit: {}", e);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_capturables() -> Result<Vec<PipeWireCapturable>, Box<dyn Error>> {
|
||||
let mut rdp_connection = match RDP_SESSION_INFO.lock() {
|
||||
Ok(conn) => conn,
|
||||
|
|
@ -1014,9 +969,6 @@ pub fn get_capturables() -> Result<Vec<PipeWireCapturable>, Box<dyn Error>> {
|
|||
if rdp_connection.is_none() {
|
||||
let (conn, fd, streams, session, is_support_restore_token) = request_remote_desktop(false)?;
|
||||
let conn = Arc::new(conn);
|
||||
// to-do: Add an option like "Keep awake while RustDesk is running" to avoid
|
||||
// impacting users whose sessions are not automatically terminated upon entering the Dim Screen.
|
||||
let inhibit_path = if !is_server_running() { request_inhibit(&conn) } else { None };
|
||||
|
||||
let rdp_info = RdpSessionInfo {
|
||||
conn,
|
||||
|
|
@ -1025,7 +977,6 @@ pub fn get_capturables() -> Result<Vec<PipeWireCapturable>, Box<dyn Error>> {
|
|||
session,
|
||||
is_support_restore_token,
|
||||
resolution: Arc::new(Mutex::new(None)),
|
||||
inhibit_request_path: inhibit_path,
|
||||
};
|
||||
*rdp_connection = Some(rdp_info);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue