forge
Explore
Log in

Don't you dare go Hollow

niri

Clone
★ 0

0 watching0 forksRustGPL-3.012.1 MiBbbbd35eIvan Molodetskikh1 year ago1693 commits

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