feat(pointer): virtio tablet as 2nd input dev (driver per-instance VAs, abs/btn decode), input server serves 2 devices on one notif; display software cursor, bar click switches window, presses/releases to front window in its px; k-ui hit-tests (press focuses, release on same presses, field only focuses)

This commit is contained in:
2026-10-28 16:50:20 +01:00
parent 0de13f124d
commit 1401af3d82
22 changed files with 545 additions and 46 deletions

View File

@@ -90,6 +90,20 @@ pub fn dma(pages: PageCount, va: VirtualAddress) -> Result<Dma> {
/// Routes `irq` to a fresh notification bound to the calling thread, so
/// its receive calls also return when the interrupt fires, and arms the
/// line (lines start masked; every acknowledgement re-arms).
/// Routes every one of `irqs` to one notification bound to this thread:
/// several devices, one wait.
pub fn bind_irqs(irqs: &[CapSlot]) -> Result<()> {
let notification = syscall::create_notification()?;
for irq in irqs {
syscall::set_irq_notification(*irq, notification)?;
}
syscall::bind_notification(notification)?;
for irq in irqs {
syscall::ack_interrupt(*irq)?;
}
Ok(())
}
pub fn bind_irq(irq: CapSlot) -> Result<()> {
let notification = syscall::create_notification()?;
syscall::set_irq_notification(irq, notification)?;

View File

@@ -21,6 +21,10 @@ pub enum Key {
pub enum InputEvent {
KeyDown(Key),
KeyUp(Key),
/// A button (0 left, 1 right) pressed or let go at (`x`, `y`): through
/// a window, its pixels.
PointerDown { button: u8, x: u16, y: u16 },
PointerUp { button: u8, x: u16, y: u16 },
}
fn decode_key(kind: usize, extra: usize) -> Option<Key> {
@@ -50,6 +54,14 @@ pub fn decode([tag, kind, extra, _]: [usize; 4]) -> Option<InputEvent> {
0 => None,
1 => decode_key(kind, extra).map(InputEvent::KeyDown),
2 => decode_key(kind, extra).map(InputEvent::KeyUp),
types::input::event::POINTER_DOWN | types::input::event::POINTER_UP => {
let (x, y) = types::input::event::unpack_point(extra);
let button = kind as u8;
Some(match tag {
types::input::event::POINTER_DOWN => InputEvent::PointerDown { button, x, y },
_ => InputEvent::PointerUp { button, x, y },
})
}
_ => None,
}
}