Skip to content

Commit

Permalink
Revert "fix xdg portal verison check for persist_mode (#6742)"
Browse files Browse the repository at this point in the history
This reverts commit 57acadd.
  • Loading branch information
rustdesk committed Dec 27, 2023
1 parent bdf6f5c commit be9cc47
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions libs/scrap/src/wayland/pipewire.rs
Expand Up @@ -563,16 +563,7 @@ fn on_create_session_response(
move |r: OrgFreedesktopPortalRequestResponse, c, _| {
let portal = get_portal(c);
let mut args: PropMap = HashMap::new();
if let Ok(version) = remote_desktop_portal::version(&portal) {
if version >= 2 {
let restore_token = config::LocalConfig::get_option(RESTORE_TOKEN_CONF_KEY);
if !restore_token.is_empty() {
args.insert(RESTORE_TOKEN.to_string(), Variant(Box::new(restore_token)));
}
// persist_mode may be configured by the user.
args.insert("persist_mode".to_string(), Variant(Box::new(2u32)));
}
}

args.insert(
"handle_token".to_string(),
Variant(Box::new("u2".to_string())),
Expand Down Expand Up @@ -629,6 +620,16 @@ fn on_select_devices_response(
move |_: OrgFreedesktopPortalRequestResponse, c, _| {
let portal = get_portal(c);
let mut args: PropMap = HashMap::new();
if let Ok(version) = remote_desktop_portal::version(&portal) {
if version >= 4 {
let restore_token = config::LocalConfig::get_option(RESTORE_TOKEN_CONF_KEY);
if !restore_token.is_empty() {
args.insert(RESTORE_TOKEN.to_string(), Variant(Box::new(restore_token)));
}
// persist_mode may be configured by the user.
args.insert("persist_mode".to_string(), Variant(Box::new(2u32)));
}
}
args.insert(
"handle_token".to_string(),
Variant(Box::new("u3".to_string())),
Expand Down Expand Up @@ -696,7 +697,7 @@ fn on_start_response(
move |r: OrgFreedesktopPortalRequestResponse, c, _| {
let portal = get_portal(c);
if let Ok(version) = remote_desktop_portal::version(&portal) {
if version >= 2 {
if version >= 4 {
if let Some(restore_token) = r.results.get(RESTORE_TOKEN) {
if let Some(restore_token) = restore_token.as_str() {
config::LocalConfig::set_option(
Expand Down

0 comments on commit be9cc47

Please sign in to comment.