mirror of
https://github.com/tauri-apps/window-shadows.git
synced 2026-02-04 02:31:23 +01:00
36 lines
884 B
Rust
36 lines
884 B
Rust
// Copyright 2020-2022 Tauri Programme within The Commons Conservancy
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
fn main() {
|
|
use tao::{
|
|
event::{Event, WindowEvent},
|
|
event_loop::{ControlFlow, EventLoop},
|
|
window::WindowBuilder,
|
|
};
|
|
use window_shadows::set_shadow;
|
|
|
|
let event_loop = EventLoop::new();
|
|
|
|
let window = WindowBuilder::new()
|
|
.with_decorations(false)
|
|
.build(&event_loop)
|
|
.unwrap();
|
|
|
|
set_shadow(&window, true).expect("Unsupported platform!");
|
|
|
|
window.set_title("A fantastic window!");
|
|
|
|
event_loop.run(move |event, _, control_flow| {
|
|
*control_flow = ControlFlow::Wait;
|
|
|
|
if let Event::WindowEvent {
|
|
event: WindowEvent::CloseRequested,
|
|
..
|
|
} = event
|
|
{
|
|
*control_flow = ControlFlow::Exit
|
|
}
|
|
});
|
|
}
|