srdusr
aboutsummaryrefslogtreecommitdiffstats
path: root/crates/wayland/src/winit/run.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/wayland/src/winit/run.rs')
-rw-r--r--crates/wayland/src/winit/run.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/crates/wayland/src/winit/run.rs b/crates/wayland/src/winit/run.rs
new file mode 100644
index 0000000..ed7c4c3
--- /dev/null
+++ b/crates/wayland/src/winit/run.rs
@@ -0,0 +1,26 @@
+use super::*;
+use super::events::handle_winit_event;
+
+impl WaylandPlatform {
+
+ pub(super) fn accept_clients(&mut self) -> PlatformResult<()> {
+ if let Some(stream) = self.listener.accept().map_err(err)? {
+ let client = self.display.handle().insert_client(stream, std::sync::Arc::new(ClientState::default())).map_err(err)?;
+ self.clients.push(client);
+ }
+ Ok(())
+ }
+
+ pub(super) fn pump_winit(&mut self) -> PlatformResult<bool> {
+ let mut closed = false;
+ let state = &mut self.state;
+ let output = &self.output;
+ let pump = self.winit_events.dispatch_new_events(|event| {
+ handle_winit_event(state, output, event, &mut closed);
+ });
+ if matches!(pump, PumpStatus::Exit(_)) {
+ closed = true;
+ }
+ Ok(closed)
+ }
+}