blob: 40f6c1c718aeb4b4989db8c08e6004746e0992ee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
use std::time::Duration;
use calloop::EventLoop;
use niri_config::Config;
use smithay::reexports::wayland_server::Display;
use crate::niri::State;
pub struct Server {
pub event_loop: EventLoop<'static, State>,
pub state: State,
}
impl Server {
pub fn new(config: Config) -> Self {
let event_loop = EventLoop::try_new().unwrap();
let handle = event_loop.handle();
let display = Display::new().unwrap();
let state = State::new(
config,
handle.clone(),
event_loop.get_signal(),
display,
true,
false,
false,
)
.unwrap();
Self { event_loop, state }
}
pub fn dispatch(&mut self) {
self.event_loop
.dispatch(Duration::ZERO, &mut self.state)
.unwrap();
self.state.refresh_and_flush_clients();
}
}
|