mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
feat: insert core entry before launching flutter
This commit is contained in:
13
src/core_main.rs
Normal file
13
src/core_main.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
/// Main entry of the RustDesk Core.
|
||||
/// Return true if the app should continue running with UI(possibly Flutter), false if the app should exit.
|
||||
pub fn core_main() -> bool {
|
||||
let args = std::env::args().collect::<Vec<_>>();
|
||||
// TODO: implement core_main()
|
||||
if args.len() > 1 {
|
||||
if args[1] == "--cm" {
|
||||
// For test purpose only, this should stop any new window from popping up when a new connection is established.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
@@ -52,6 +52,13 @@ fn initialize(app_dir: &str) {
|
||||
}
|
||||
}
|
||||
|
||||
/// FFI for rustdesk core's main entry.
|
||||
/// Return true if the app should continue running with UI(possibly Flutter), false if the app should exit.
|
||||
#[no_mangle]
|
||||
pub extern "C" fn rustdesk_core_main() -> bool {
|
||||
crate::core_main::core_main()
|
||||
}
|
||||
|
||||
pub fn start_event_stream(s: StreamSink<String>) -> ResultType<()> {
|
||||
let _ = flutter::EVENT_STREAM.write().unwrap().insert(s);
|
||||
Ok(())
|
||||
|
||||
@@ -28,6 +28,11 @@ pub mod flutter;
|
||||
#[cfg(any(target_os = "android", target_os = "ios", feature = "flutter"))]
|
||||
pub mod flutter_ffi;
|
||||
use common::*;
|
||||
#[cfg(all(
|
||||
not(any(target_os = "android", target_os = "ios")),
|
||||
feature = "flutter"
|
||||
))]
|
||||
pub mod core_main;
|
||||
#[cfg(feature = "cli")]
|
||||
pub mod cli;
|
||||
#[cfg(all(windows, feature = "hbbs"))]
|
||||
|
||||
Reference in New Issue
Block a user