mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
show wallpaper only when support, show test on checked
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
@@ -1625,6 +1625,10 @@ pub fn main_test_wallpaper(_second: u64) {
|
||||
});
|
||||
}
|
||||
|
||||
pub fn main_support_remove_wallpaper() -> bool {
|
||||
support_remove_wallpaper()
|
||||
}
|
||||
|
||||
/// Send a url scheme throught the ipc.
|
||||
///
|
||||
/// * macOS only
|
||||
|
||||
@@ -1341,6 +1341,14 @@ impl WallPaperRemover {
|
||||
old_path_dark,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn support() -> bool {
|
||||
let desktop = std::env::var("XDG_CURRENT_DESKTOP").unwrap_or_default();
|
||||
if wallpaper::gnome::is_compliant(&desktop) || desktop.as_str() == "XFCE" {
|
||||
return wallpaper::get().is_ok();
|
||||
}
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for WallPaperRemover {
|
||||
|
||||
@@ -2392,6 +2392,10 @@ impl WallPaperRemover {
|
||||
Ok(Self { old_path })
|
||||
}
|
||||
|
||||
pub fn support() -> bool {
|
||||
wallpaper::get().is_ok() || !Self::get_recent_wallpaper().unwrap_or_default().is_empty()
|
||||
}
|
||||
|
||||
fn get_recent_wallpaper() -> ResultType<String> {
|
||||
// SystemParametersInfoW may return %appdata%\Microsoft\Windows\Themes\TranscodedWallpaper, not real path and may not real cache
|
||||
// https://www.makeuseof.com/find-desktop-wallpapers-file-location-windows-11/
|
||||
|
||||
@@ -598,6 +598,10 @@ impl UI {
|
||||
fn get_login_device_info(&self) -> String {
|
||||
get_login_device_info_json()
|
||||
}
|
||||
|
||||
fn support_remove_wallpaper(&self) -> bool {
|
||||
support_remove_wallpaper()
|
||||
}
|
||||
}
|
||||
|
||||
impl sciter::EventHandler for UI {
|
||||
@@ -683,6 +687,7 @@ impl sciter::EventHandler for UI {
|
||||
fn default_video_save_directory();
|
||||
fn handle_relay_id(String);
|
||||
fn get_login_device_info();
|
||||
fn support_remove_wallpaper();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -210,6 +210,7 @@ class Enhancements: Reactor.Component {
|
||||
|
||||
function render() {
|
||||
var has_hwcodec = handler.has_hwcodec();
|
||||
var support_remove_wallpaper = handler.support_remove_wallpaper();
|
||||
var me = this;
|
||||
self.timer(1ms, function() { me.toggleMenuState() });
|
||||
return <li>{translate('Enhancements')}
|
||||
@@ -217,7 +218,7 @@ class Enhancements: Reactor.Component {
|
||||
{has_hwcodec ? <li #enable-hwcodec><span>{svg_checkmark}</span>{translate("Hardware Codec")} (beta)</li> : ""}
|
||||
<li #enable-abr><span>{svg_checkmark}</span>{translate("Adaptive bitrate")} (beta)</li>
|
||||
<li #screen-recording>{translate("Recording")}</li>
|
||||
{is_osx ? "" : <li #allow-remove-wallpaper><span>{svg_checkmark}</span>{translate("Remove wallpaper during incoming sessions")}</li>}
|
||||
{support_remove_wallpaper ? <li #allow-remove-wallpaper><span>{svg_checkmark}</span>{translate("Remove wallpaper during incoming sessions")}</li> : ""}
|
||||
</menu>
|
||||
</li>;
|
||||
}
|
||||
|
||||
@@ -594,7 +594,13 @@ pub fn current_is_wayland() -> bool {
|
||||
|
||||
#[inline]
|
||||
pub fn get_new_version() -> String {
|
||||
(*SOFTWARE_UPDATE_URL.lock().unwrap().rsplit('/').next().unwrap_or("")).to_string()
|
||||
(*SOFTWARE_UPDATE_URL
|
||||
.lock()
|
||||
.unwrap()
|
||||
.rsplit('/')
|
||||
.next()
|
||||
.unwrap_or(""))
|
||||
.to_string()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@@ -1248,3 +1254,10 @@ pub fn handle_relay_id(id: String) -> String {
|
||||
id
|
||||
}
|
||||
}
|
||||
|
||||
pub fn support_remove_wallpaper() -> bool {
|
||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
||||
return crate::platform::WallPaperRemover::support();
|
||||
#[cfg(not(any(target_os = "windows", target_os = "linux")))]
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user