feat(display): input routed via display server to focused app; input Subscribe; uses caps badged + Delegate

This commit is contained in:
2026-10-27 16:38:16 +01:00
parent 64ec5df379
commit 2845d190f0
18 changed files with 286 additions and 26 deletions

View File

@@ -1,7 +1,7 @@
use crate::adapters::mock::MockInputDevice;
use crate::protocol::*;
use crate::server::InputServer;
use server_framework::Server;
use server_framework::{Decode, Encode, Server};
fn test_server() -> InputServer<MockInputDevice> {
InputServer::new(MockInputDevice::new())
@@ -85,3 +85,14 @@ fn a_full_buffer_drops_the_oldest_event() {
InputResponse::Event(InputEvent::KeyDown(Key::Char(8)))
);
}
#[test]
fn a_subscription_is_kept_and_other_requests_still_work() {
let mut server = test_server();
let note = types::bounded::CapSlot::new(7);
let (reply, _) = server.handle_call(0, [types::input::SUBSCRIBE, 0, 0, 0], note);
assert_eq!(reply, [0; 4]);
assert_eq!(server.subscriber(), note);
let (reply, _) = server.handle_call(0, InputRequest::PollEvent.encode(), None);
assert_eq!(InputResponse::decode(reply), Some(InputResponse::NoEvent));
}