Fix. Multi sub windows, sync peer options (#7247)

* Fix. Multi window, sync peer options

Signed-off-by: fufesou <shuanglongchen@yeah.net>

* Remove unused `use`

Signed-off-by: fufesou <shuanglongchen@yeah.net>

---------

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2024-02-23 22:49:53 +08:00
committed by GitHub
parent cce1ce0ee0
commit 2459bcd206
7 changed files with 136 additions and 57 deletions

View File

@@ -1,8 +1,9 @@
use crate::{
client::file_trait::FileManager,
common::is_keyboard_mode_supported,
common::make_fd_to_json,
flutter::{self, session_add, session_add_existed, session_start_, sessions},
common::{is_keyboard_mode_supported, make_fd_to_json},
flutter::{
self, session_add, session_add_existed, session_start_, sessions, try_sync_peer_option,
},
input::*,
ui_interface::{self, *},
};
@@ -228,6 +229,7 @@ pub fn session_toggle_option(session_id: SessionID, value: String) {
if let Some(session) = sessions::get_session_by_session_id(&session_id) {
log::warn!("toggle option {}", &value);
session.toggle_option(value.clone());
try_sync_peer_option(&session, &session_id, &value, None);
}
#[cfg(not(any(target_os = "android", target_os = "ios")))]
if sessions::get_session_by_session_id(&session_id).is_some() && value == "disable-clipboard" {
@@ -340,6 +342,7 @@ pub fn session_set_keyboard_mode(session_id: SessionID, value: String) {
if let Some(session) = sessions::get_session_by_session_id(&session_id) {
session.save_keyboard_mode(value.clone());
_mode_updated = true;
try_sync_peer_option(&session, &session_id, "keyboard_mode", None);
}
#[cfg(windows)]
if _mode_updated {
@@ -884,7 +887,12 @@ pub fn main_get_input_source() -> SyncReturn<String> {
pub fn main_set_input_source(session_id: SessionID, value: String) {
#[cfg(not(any(target_os = "android", target_os = "ios")))]
change_input_source(session_id, value);
{
change_input_source(session_id, value);
if let Some(session) = sessions::get_session_by_session_id(&session_id) {
try_sync_peer_option(&session, &session_id, "input_source", None);
}
}
}
pub fn main_get_my_id() -> String {