ferroui_headless_vnc/lib.rs
1//! The VNC server of the headless platform.
2//!
3//! An application runs on the headless platform (`ferroui-headless`),
4//! renders its windows with a rendering backend (Skia by default), and a
5//! VNC (RFB) server shows its main window to any VNC viewer and passes the
6//! keyboard and the mouse of the viewer to it:
7//!
8//! ```no_run
9//! use ferroui_controls::{AppBuilder, Application, ShutdownMode};
10//! use ferroui_headless_vnc::HeadlessVncPlatformExtensions;
11//!
12//! fn main() {
13//! let args: Vec<String> = std::env::args().skip(1).collect();
14//! // The builder of the application, with its rendering backend (for
15//! // example `use_skia` of `ferroui-skia`).
16//! let builder = AppBuilder::configure::<Application>();
17//! let exit_code = builder.start_with_headless_vnc_platform(None, 5901, &args, ShutdownMode::OnMainWindowClose);
18//! std::process::exit(exit_code);
19//! }
20//! ```
21//!
22//! [`HeadlessVncPlatformExtensions`] starts the application with the
23//! headless platform, binds the server (on the loopback address unless a
24//! host is given, with an optional password) and runs the lifetime of the
25//! application. Each client gets a session ([`remote_viewing::vnc::server::VncServerSession`])
26//! whose framebuffer is the last frame of the main window
27//! ([`HeadlessVncFramebufferSource`]).
28//!
29//! The RFB server is [`remote_viewing`], a port of the parts of the .NET
30//! library RemoteViewing that the original builds on (`NOTICE.md` of this
31//! crate; `docs/porting/headless-vnc.md` of the repository says why it was
32//! ported and what differs).
33
34mod ferro_vnc_logger;
35mod headless_vnc_framebuffer_source;
36mod headless_vnc_platform_extensions;
37pub mod remote_viewing;
38
39pub use headless_vnc_framebuffer_source::HeadlessVncFramebufferSource;
40pub use headless_vnc_platform_extensions::HeadlessVncPlatformExtensions;