refact: texture render as an option (#8168)

* refact: texture render as an option

Signed-off-by: fufesou <linlong1266@gmail.com>

* refact: texture render, translation

Signed-off-by: fufesou <linlong1266@gmail.com>

* refact: texture render as option

Signed-off-by: fufesou <linlong1266@gmail.com>

* Update ui_interface.rs

---------

Signed-off-by: fufesou <linlong1266@gmail.com>
Co-authored-by: RustDesk <71636191+rustdesk@users.noreply.github.com>
This commit is contained in:
fufesou
2024-05-28 16:42:30 +08:00
committed by GitHub
parent 010b17509a
commit 72ec86b58d
66 changed files with 481 additions and 282 deletions

View File

@@ -2,7 +2,7 @@ use crate::{
client::file_trait::FileManager,
common::{is_keyboard_mode_supported, make_fd_to_json},
flutter::{
self, session_add, session_add_existed, session_start_, sessions, try_sync_peer_option,
self, session_add, session_add_existed, session_start_, sessions, try_sync_peer_option, FlutterHandler,
},
input::*,
ui_interface::{self, *},
@@ -711,9 +711,8 @@ pub fn session_change_resolution(session_id: SessionID, display: i32, width: i32
}
}
pub fn session_set_size(_session_id: SessionID, _display: usize, _width: usize, _height: usize) {
#[cfg(feature = "flutter_texture_render")]
super::flutter::session_set_size(_session_id, _display, _width, _height)
pub fn session_set_size(session_id: SessionID, display: usize, width: usize, height: usize) {
super::flutter::session_set_size(session_id, display, width, height)
}
pub fn session_send_selected_session_id(session_id: SessionID, sid: String) {
@@ -774,13 +773,13 @@ pub fn main_show_option(_key: String) -> SyncReturn<bool> {
pub fn main_set_option(key: String, value: String) {
if key.eq("custom-rendezvous-server") {
set_option(key, value);
set_option(key, value.clone());
#[cfg(target_os = "android")]
crate::rendezvous_mediator::RendezvousMediator::restart();
#[cfg(any(target_os = "android", target_os = "ios", feature = "cli"))]
crate::common::test_rendezvous_server();
} else {
set_option(key, value);
set_option(key, value.clone());
}
}
@@ -892,12 +891,25 @@ pub fn main_get_local_option(key: String) -> SyncReturn<String> {
SyncReturn(get_local_option(key))
}
pub fn main_get_use_texture_render() -> SyncReturn<bool> {
SyncReturn(use_texture_render())
}
pub fn main_get_env(key: String) -> SyncReturn<String> {
SyncReturn(std::env::var(key).unwrap_or_default())
}
pub fn main_set_local_option(key: String, value: String) {
set_local_option(key, value)
let is_texture_render_key = key.eq(config::keys::OPTION_TEXTURE_RENDER);
set_local_option(key, value.clone());
if is_texture_render_key {
let session_event = [("v", &value)];
for session in sessions::get_sessions() {
session.push_event("use_texture_render", &session_event, &[]);
session.use_texture_render_changed();
session.ui_handler.update_use_texture_render();
}
}
}
// We do use use `main_get_local_option` and `main_set_local_option`.
@@ -1824,10 +1836,6 @@ pub fn main_hide_docker() -> SyncReturn<bool> {
SyncReturn(true)
}
pub fn main_has_pixelbuffer_texture_render() -> SyncReturn<bool> {
SyncReturn(cfg!(feature = "flutter_texture_render"))
}
pub fn main_has_file_clipboard() -> SyncReturn<bool> {
let ret = cfg!(any(
target_os = "windows",