Skip to main content

kftray_commons/models/
window.rs

1use std::sync::Arc;
2use std::sync::atomic::AtomicBool;
3
4use serde::{
5    Deserialize,
6    Serialize,
7};
8use tokio::runtime::Runtime;
9
10pub struct SaveDialogState {
11    pub is_open: AtomicBool,
12}
13
14impl Default for SaveDialogState {
15    fn default() -> Self {
16        SaveDialogState {
17            is_open: AtomicBool::new(false),
18        }
19    }
20}
21
22#[derive(Serialize, Deserialize, Debug)]
23pub struct WindowPosition {
24    pub x: i32,
25    pub y: i32,
26}
27
28pub struct AppState {
29    pub positioning_active: Arc<AtomicBool>,
30    pub pinned: Arc<AtomicBool>,
31    pub runtime: Arc<Runtime>,
32}
33
34#[cfg(test)]
35mod tests {
36    use std::sync::atomic::Ordering;
37
38    use super::*;
39
40    #[test]
41    fn test_save_dialog_state_default() {
42        let state = SaveDialogState::default();
43        assert!(!state.is_open.load(Ordering::Relaxed));
44    }
45}