#[cfg(all(
not(alloc_frugal),
any(feature = "desktop", feature = "tablet", feature = "mobile")
))]
use std::thread::sleep;
#[cfg(all(
not(alloc_frugal),
any(feature = "desktop", feature = "tablet", feature = "mobile")
))]
use std::time::Duration;
#[cfg(all(
not(alloc_frugal),
any(feature = "desktop", feature = "tablet", feature = "mobile")
))]
use rust_widgets::app::App;
#[cfg(all(
not(alloc_frugal),
any(feature = "desktop", feature = "tablet", feature = "mobile")
))]
use rust_widgets::platform::get_platform;
#[cfg(all(
not(alloc_frugal),
any(feature = "desktop", feature = "tablet", feature = "mobile")
))]
use rust_widgets::WindowStateFlag;
#[cfg(all(not(alloc_frugal), any(feature = "desktop", feature = "tablet", feature = "mobile")))]
fn main() {
App::new().init();
let platform = get_platform();
println!("backend = {}", platform.backend_name());
let window = platform.create_window("Async probe", 60, 60, 480, 320);
if window == 0 {
eprintln!("no window");
return;
}
for flag in [WindowStateFlag::Fullscreen, WindowStateFlag::Minimized] {
println!("--- {flag:?} ---");
println!("before = {:?}", platform.is_window_in_state(window, flag));
let wrote = platform.set_window_state(window, flag, true);
println!("write(true) = {wrote}");
for delay_ms in [0u64, 50, 200, 600, 1500] {
sleep(Duration::from_millis(delay_ms));
println!("after +{delay_ms:>4}ms = {:?}", platform.is_window_in_state(window, flag));
}
let wrote = platform.set_window_state(window, flag, false);
println!("write(false) = {wrote}");
for delay_ms in [0u64, 50, 200, 600, 1500] {
sleep(Duration::from_millis(delay_ms));
println!("back +{delay_ms:>4}ms = {:?}", platform.is_window_in_state(window, flag));
}
}
}
#[cfg(not(all(
not(alloc_frugal),
any(feature = "desktop", feature = "tablet", feature = "mobile")
)))]
fn main() {
println!(
"macos_window_state_async_probe: not applicable in this build — it needs a \
device profile with the platform singleton; skipped."
);
}