diff --git a/flutter/lib/desktop/pages/desktop_home_page.dart b/flutter/lib/desktop/pages/desktop_home_page.dart index 0917f9534..cd955efb0 100644 --- a/flutter/lib/desktop/pages/desktop_home_page.dart +++ b/flutter/lib/desktop/pages/desktop_home_page.dart @@ -549,10 +549,11 @@ class _DesktopHomePageState extends State )); } } - final installed = bind.mainIsInstalled(); - if (installed && mainGetBoolOptionSync(kOptionAllowDrmCapture)) { + final drmSupported = bind.mainIsInstalled() && + bind.mainGetCommonSync(key: 'is-drm-capture-supported') == 'true'; + if (drmSupported && mainGetBoolOptionSync(kOptionAllowDrmCapture)) { // DRM capture reaches the session and the login screen: no warning. - } else if (installed && + } else if (drmSupported && !isOptionFixed(kOptionAllowDrmCapture) && (bind.mainCurrentIsWayland() || bind.mainIsLoginWayland())) { final currentIsWayland = bind.mainCurrentIsWayland(); diff --git a/flutter/lib/desktop/pages/desktop_setting_page.dart b/flutter/lib/desktop/pages/desktop_setting_page.dart index 6d9a1a527..8ca777e48 100644 --- a/flutter/lib/desktop/pages/desktop_setting_page.dart +++ b/flutter/lib/desktop/pages/desktop_setting_page.dart @@ -2890,7 +2890,11 @@ class _WaylandCardState extends State { "true"; final children = [ - if (isLinux && bind.mainIsInstalled() && !bind.isOutgoingOnly()) ...[ + if (isLinux && + bind.mainIsInstalled() && + !bind.isOutgoingOnly() && + bind.mainGetCommonSync(key: 'is-drm-capture-supported') == + 'true') ...[ _OptionCheckBox( context, 'Use DRM screen capture', kOptionAllowDrmCapture), Align( diff --git a/src/core_main.rs b/src/core_main.rs index 0f62d1e59..4e9911224 100644 --- a/src/core_main.rs +++ b/src/core_main.rs @@ -43,10 +43,12 @@ fn finish_macos_update(result: hbb_common::ResultType<()>) -> Option Option { + // Before global_init: on Linux its is_x11() can read Config (allow-drm-capture), and Config + // loads from a path named after the custom client's app name. + crate::load_custom_client(); if !crate::common::global_init() { return None; } - crate::load_custom_client(); #[cfg(windows)] if !crate::platform::windows::bootstrap() { // return None to terminate the process diff --git a/src/flutter_ffi.rs b/src/flutter_ffi.rs index d366d39e1..ed2417e8c 100644 --- a/src/flutter_ffi.rs +++ b/src/flutter_ffi.rs @@ -2780,6 +2780,8 @@ pub fn main_get_common(key: String) -> String { return crate::platform::is_win_10_or_greater().to_string(); #[cfg(not(target_os = "windows"))] return false.to_string(); + } else if key == "is-drm-capture-supported" { + return cfg!(all(target_os = "linux", feature = "drm")).to_string(); } else if key == "transfer-job-id" { return base::fs::get_next_job_id().to_string(); } else if key == "is-remote-modify-enabled-by-control-permissions" {