Skip to main content

wasma_legacy_platform/
lib.rs

1#![allow(dead_code)]
2#![allow(unused_imports)]
3#![allow(unused)]
4
5extern crate libc;
6
7pub use insysdirection_platformer::direction_xf86_sysbase::XF86SysBase;
8pub use insysdirection_platformer::direction_voardless_xf86::VoardlessXF86;
9pub use insysdirection_platformer::direction_baseioplatformer::BaseIOPlatformer;
10pub use insysdirection_platformer::direction_sys::SysDirectAccess;
11pub use insysdirection_platformer::direction_sysletboolctl::SysletBoolCtl;
12pub use insysdirection_platformer::direction_sysappindicator::SysAppIndicator;
13
14pub use wasma_sys::parser;
15pub use wasma_sys::window_handling;
16pub use wasma_sys::uclient;
17pub use wasma_sys::window_client;
18pub use wasma_client::window_multitary;
19pub use wasma_client::window_singularity;
20pub use wasma_client::window_resourcer_engineering;
21pub use wasma_client::protocols;
22
23pub use wasma_sys::wasma_client_unix_posix_raw_app;
24pub use wasma_sys::wasma_client_unix_posix_raw_window;
25pub use wasma_sys::wasma_client_unix_posix_raw_applettel;
26
27pub use wasma_sys::wasma_protocol_universal_client_unix_posix_window;
28pub use wasma_sys::wasma_protocol_unix_posix_conversion;
29pub use wasma_sys::wasma_protocol_unix_posix_opt;
30pub use wasma_sys::wasma_protocol_unix_posix_window;
31pub use wasma_sys::wasma_protocol_unix_posix_windowesc;
32pub use wasma_sys::wasma_protocol_unixverse_windowesc;
33
34pub use wasma_sys::parser::WasmaConfig;
35
36pub use wasma_sys::wasma_client_unix_posix_raw_app::{
37    UClientEngine,
38    RawAppSource,
39    RawAppClient,
40    RawAppClientBuilder,
41    posix,
42};
43
44// Legacy Xf86 applet features (wasma-sys-xf86-applet)
45#[path = "wasma-sys-xf86-applet/wasma_xf86_sysapplet.rs"]
46pub mod wasma_xf86_sysapplet;
47
48#[path = "wasma-sys-xf86-applet/wasma_xf86_applet_ui_fscat.rs"]
49pub mod wasma_xf86_applet_ui_fscat;
50
51pub use wasma_client_unix_posix_raw_window::{
52    RawWindowClient,
53    RawWindowRecord,
54    RawWindowCommand,
55    RawWindowStatus,
56    RawWindowFd,
57    geometry_codec,
58    state_codec,
59};
60
61pub use wasma_client_unix_posix_raw_applettel::{
62    ApplettelClient,
63    ApplettelClientBuilder,
64    AppletDescriptor,
65    AppletKind,
66    SystemAppletRole,
67    EmbeddedAppletRole,
68    FieldKey,
69    FieldValue,
70    FieldTypeHint,
71    LettingEvent,
72    LettingHandler,
73    LettingMsgType,
74    LettingStatus,
75};
76
77pub use wasma_protocol_universal_client_unix_posix_window::{
78    UniversalClient,
79    UniversalClientBuilder,
80    UniversalEndpoint,
81    UniversalWindowRecord,
82    ArchKind,
83    CURRENT_ARCH,
84};
85
86pub use wasma_protocol_unix_posix_conversion::{
87    CoordSpace,
88    CoordValue,
89    SizeValue,
90    RectValue,
91    DpiProfile,
92    DpiPreset,
93    ConversionEngine,
94    ConversionEngineMode,
95    ConversionPipeline,
96    ConversionManager,
97    DirectConverter,
98};
99
100pub use wasma_protocol_unix_posix_opt::{
101    PosixOpt,
102    PosixOptBuilder,
103    RuntimeOptStore,
104    DrawOpt,
105    PixelOpt,
106    XlinxOpt,
107    BackendOpt,
108    ToolkitTheme,
109    GtkThemeOpt,
110    IcedThemeOpt,
111    IcedThemeVariant,
112    QtThemeOpt,
113    PixelColorFormat,
114    XlinxCacheMode,
115    RasterMode,
116    XlinxArch,
117    DisplayBackend,
118    WaylandSurfaceOpt,
119};
120
121pub use wasma_protocol_unix_posix_window::{
122    PosixWindowLauncher,
123    PosixWindowLauncherBuilder,
124    PosixWindow,
125    WindowSpec,
126    WindowSpecBuilder,
127    WindowMode,
128    DecorationStyle,
129    SpecSource,
130};
131
132pub use wasma_protocol_unix_posix_windowesc::{
133    PosixWindowEsc,
134    ShiftMaskEngine,
135    ShiftMaskKey,
136    ShiftMaskAlgo,
137    ShiftMaskError,
138    WindowIdEscaper,
139    StreamEscaper,
140    PlatformWidth,
141    PLATFORM_WIDTH,
142};
143
144pub use wasma_protocol_unixverse_windowesc::{
145    UniverseWindowEsc,
146    UniverseEngine,
147    UniverseKey,
148    UniverseAlgo,
149    UniverseWindowIdEscaper,
150    UniverseStreamEscaper,
151    AvaxEngine,
152    UniverseWidth,
153    UNIVERSE_WIDTH,
154};
155
156#[cfg(feature = "wgpu")]
157pub mod wgclient;
158
159#[cfg(feature = "wgpu")]
160pub use wgclient::WGClient;
161
162pub mod prelude {
163    pub use wasma_sys::parser::WasmaConfig;
164    pub use wasma_sys::wasma_client_unix_posix_raw_app::UClientEngine;
165    pub use wasma_sys::wasma_client_unix_posix_raw_app::RawAppClient;
166    pub use wasma_sys::wasma_client_unix_posix_raw_window::RawWindowClient;
167    pub use wasma_sys::wasma_client_unix_posix_raw_applettel::{
168        ApplettelClient, AppletKind, SystemAppletRole, EmbeddedAppletRole,
169        FieldKey, FieldValue, LettingEvent,
170    };
171    pub use wasma_sys::wasma_protocol_universal_client_unix_posix_window::{
172        UniversalClient, CURRENT_ARCH, ArchKind,
173    };
174    pub use wasma_sys::wasma_protocol_unix_posix_conversion::{
175        CoordSpace, CoordValue, DpiProfile, ConversionManager, ConversionEngineMode,
176    };
177    pub use wasma_sys::wasma_protocol_unix_posix_opt::{
178        PosixOpt, PosixOptBuilder, RuntimeOptStore,
179        DisplayBackend, ToolkitTheme, RasterMode,
180    };
181    pub use wasma_sys::wasma_protocol_unix_posix_window::{
182        PosixWindowLauncher, WindowSpec, WindowSpecBuilder, WindowMode,
183    };
184    pub use wasma_sys::wasma_protocol_unix_posix_windowesc::{
185        PosixWindowEsc, ShiftMaskAlgo, ShiftMaskKey, PLATFORM_WIDTH,
186    };
187    pub use wasma_sys::wasma_protocol_unixverse_windowesc::{
188        UniverseWindowEsc, UniverseAlgo, UniverseKey, UNIVERSE_WIDTH,
189    };
190    pub use wasma_sys::window_handling::{WindowGeometry, WindowState, WindowType};
191    pub use insysdirection_platformer::direction_xf86_sysbase::XF86SysBase;
192    pub use insysdirection_platformer::direction_voardless_xf86::VoardlessXF86;
193    pub use insysdirection_platformer::direction_baseioplatformer::BaseIOPlatformer;
194    pub use insysdirection_platformer::direction_sys::SysDirectAccess;
195    pub use insysdirection_platformer::direction_sysletboolctl::SysletBoolCtl;
196    pub use insysdirection_platformer::direction_sysappindicator::SysAppIndicator;
197}
198
199pub const WASMA_VERSION: &str = env!("CARGO_PKG_VERSION");
200pub const WASMA_CLIENT_LAYER: &str = "wasma_client";
201pub const WASMA_PROTOCOL_LAYER: &str = "wasma_protocol";
202pub const WASMA_UNIXVERSE_SCOPE: &str = "unixverse";
203
204pub fn print_wasma_info() {
205    println!("╔══════════════════════════════════════════════════════════════╗");
206    println!("║            WASMA — Windows Assignment System                 ║");
207    println!("║              Monitoring Architecture                         ║");
208    println!("╚══════════════════════════════════════════════════════════════╝");
209    println!();
210    println!("  Version:       {}", WASMA_VERSION);
211    println!("  Client layer:  {}", WASMA_CLIENT_LAYER);
212    println!("  Protocol layer: {}", WASMA_PROTOCOL_LAYER);
213    println!();
214    println!("  ── Architecture ──────────────────────────────────────────");
215    println!("  Detected arch:    {}", CURRENT_ARCH.name());
216    println!("  Pointer width:    {}-bit", CURRENT_ARCH.pointer_width());
217    println!("  SIMD support:     {}", CURRENT_ARCH.supports_simd());
218    println!("  AVX support:      {}", CURRENT_ARCH.supports_avx());
219    println!("  Partial mode:     {}", CURRENT_ARCH.is_partial());
220    println!();
221    println!("  ── ShiftMask ─────────────────────────────────────────────");
222    println!("  POSIX platform:   {}", PLATFORM_WIDTH.name());
223    println!("  Universe width:   {}", UNIVERSE_WIDTH.name());
224    println!();
225    println!("  ── Modules ───────────────────────────────────────────────");
226    println!("  [client]  raw_app             — UClient default, POSIX fd read()");
227    println!("  [client]  raw_window          — Raw window management, POSIX fd");
228    println!("  [client]  raw_applettel       — Reactive applet letting protocol");
229    println!("  [proto]   universal_client    — Platform-agnostic, all arch");
230    println!("  [proto]   conversion          — Coord space conversion, DPI");
231    println!("  [proto]   opt                 — DrawOpt, PixelOpt, XlinxOpt, BackendOpt");
232    println!("  [proto]   window              — Normal window launch, singularity/multitary");
233    println!("  [proto]   posix_windowesc     — ShiftMask POSIX (64-bit full, 32-bit semi)");
234    println!("  [proto]   unixverse_windowesc — ShiftMask AVAX (all platforms, full)");
235    println!("  [dir]     xf86_sysbase        — XF86SysBase");
236    println!("  [dir]     voardless_xf86      — VoardlessXF86");
237    println!("  [dir]     baseioplatformer    — BaseIOPlatformer");
238    println!("  [dir]     sys                 — SysDirectAccess");
239    println!("  [dir]     sysletboolctl       — SysletBoolCtl");
240    println!("  [dir]     sysappindicator     — SysAppIndicator");
241    println!();
242    println!("  ── Scope ─────────────────────────────────────────────────");
243    println!("  unix_posix:  UNIX/POSIX-compatible devices");
244    println!("  unixverse:   ALL platforms including non-POSIX ({})", WASMA_UNIXVERSE_SCOPE);
245    println!("╚══════════════════════════════════════════════════════════════╝");
246}
247
248#[cfg(test)]
249mod tests {
250    use super::*;
251    use super::prelude::*;
252
253    #[test]
254    fn test_lib_version_constants() {
255        assert!(!WASMA_CLIENT_LAYER.is_empty());
256        assert!(!WASMA_PROTOCOL_LAYER.is_empty());
257        assert_eq!(WASMA_UNIXVERSE_SCOPE, "unixverse");
258    }
259
260    #[test]
261    fn test_print_wasma_info() {
262        print_wasma_info();
263    }
264
265    #[test]
266    fn test_prelude_arch_accessible() {
267        let arch = CURRENT_ARCH;
268        assert!(arch.name().len() > 0);
269        let uw = UNIVERSE_WIDTH;
270        assert!(uw.bits() == 32 || uw.bits() == 64);
271        let pw = PLATFORM_WIDTH;
272        assert!(pw.name().len() > 0);
273    }
274
275    #[test]
276    fn test_prelude_window_mode() {
277        let m1 = WindowMode::Singularity;
278        let m2 = WindowMode::Multitary;
279        assert_ne!(m1, m2);
280    }
281
282    #[test]
283    fn test_prelude_coord_space() {
284        let v = CoordValue::logical(100.0, 200.0);
285        assert_eq!(v.space, CoordSpace::LogicalPx);
286    }
287
288    #[test]
289    fn test_prelude_shiftmask_algo() {
290        assert!(ShiftMaskAlgo::Xor.is_available());
291        assert!(UniverseAlgo::Avax.is_available());
292    }
293
294    #[test]
295    fn test_prelude_applet_kind() {
296        let sys = AppletKind::System(SystemAppletRole::TrayIcon);
297        let emb = AppletKind::Embedded(EmbeddedAppletRole::SidePanel);
298        assert!(sys.is_system());
299        assert!(emb.is_embedded());
300    }
301
302    #[test]
303    fn test_prelude_posix_opt() {
304        let opt = PosixOpt::default();
305        assert!(opt.validate().is_ok());
306    }
307
308    #[test]
309    fn test_prelude_dpi_profile() {
310        let profile = DpiProfile::from_preset(DpiPreset::HiDpi2x, 1920, 1080);
311        assert!((profile.scale_factor - 2.0).abs() < f64::EPSILON);
312    }
313}