Fix keycode mapping, client disconnect, and server shutdown

- Keycodes: add +8 offset for XKB (evdev scancode + 8 = XKB keycode)
- Client: force exit on Cmd+Q/close (network thread may block)
- Server: force exit on Ctrl+C (network thread may block on accept)

Proper graceful shutdown with tokio CancellationToken deferred.
This commit is contained in:
Till Wegmueller 2026-04-07 19:37:41 +02:00
parent c4e3920c79
commit 974511277b
3 changed files with 8 additions and 4 deletions

View file

@ -125,8 +125,10 @@ impl ApplicationHandler for App {
) {
match event {
WindowEvent::CloseRequested => {
info!("close requested, exiting");
info!("close requested, shutting down");
event_loop.exit();
// Force exit since the network thread may be blocking.
std::process::exit(0);
}
WindowEvent::Resized(physical_size) => {
if let Some(display) = &mut self.display {

View file

@ -181,8 +181,9 @@ pub fn run(
}
info!("headless backend shutting down");
calloop_data.net_handle.shutdown();
Ok(())
// Force exit — the network thread may be blocking on accept().
// Proper graceful shutdown with tokio CancellationToken is a future improvement.
std::process::exit(0);
}
/// Drain all pending network events (input, connection changes).

View file

@ -210,9 +210,10 @@ impl WayRay {
smithay::backend::input::KeyState::Released
}
};
// XKB keycodes = evdev scancode + 8
keyboard.input::<(), _>(
self,
ev.keycode.into(),
(ev.keycode + 8).into(),
state,
serial,
ev.time,