merge commit. probably broken tbh

This commit is contained in:
2025-02-24 15:10:58 +00:00
parent 8d57540566
commit 2f08835d69
6 changed files with 63 additions and 0 deletions
+2
View File
@@ -17,6 +17,7 @@ static WAKER: AtomicWaker = AtomicWaker::new();
pub fn add_scancode(scancode: u8) {
if let Some(queue) = KBD_QUEUE.get() {
if queue.push(scancode).is_err() {
if queue.push(scancode).is_err() {
println!("WARNING: scancode queue full; dropping keyboard input");
} else {
@@ -54,6 +55,7 @@ impl Stream for ScancodeStream {
return Poll::Ready(Some(scancode));
}
WAKER.register(cx.waker());
WAKER.register(cx.waker());
queue.pop().map_or(Poll::Pending, |scancode| {
+6
View File
@@ -127,6 +127,12 @@ impl TaskWaker {
}
}
impl Default for Executor {
fn default() -> Self {
Self::new()
}
}
impl Wake for TaskWaker {
fn wake(self: Arc<Self>) {
self.wake_task();
+1
View File
@@ -5,6 +5,7 @@ pub mod ibm_vga_8x16;
pub static FONT_SPLEEN_8X16: Font = Font(include_font!(
"./libk/resources/font/spleen-8x16.psf"
));
pub static FONT_CP850_8X16: Font = Font(include_font!(
"./libk/resources/font/cp850-8x16.psf"
));
+19
View File
@@ -0,0 +1,19 @@
use super::{
render::{ColouredChar, RenderError},
window::Window,
};
use alloc::vec::Vec;
pub struct Frame<'f> {
data: Vec<Vec<ColouredChar>>,
window: &'f Window,
}
impl Frame<'_> {
pub fn render(&self) -> Result<(), RenderError> {
let data: Vec<&[ColouredChar]> = self.data.iter().map(|v| v.as_slice()).collect::<Vec<_>>();
self.window
.render(data.as_slice())
.map_err(|_| RenderError::Generic)
}
}
+23
View File
@@ -0,0 +1,23 @@
use core::fmt::Display;
use crate::drivers::io::framebuffer::colour::Colour;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RenderError {
Generic,
}
impl Display for RenderError {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Generic => write!(f, "Generic render error"),
}
}
}
impl core::error::Error for RenderError {}
pub struct ColouredChar {
ch: u8,
colour: Colour,
}
+12
View File
@@ -1,5 +1,7 @@
use crate::{prelude::*, std::maths::geometry::Vec2};
use super::render::{ColouredChar, RenderError};
pub struct Window {
dimensions: Vec2<usize>,
position: Vec2<usize>,
@@ -19,6 +21,10 @@ impl Window {
}
}
pub fn render(&self, _data: &[&[ColouredChar]]) -> Result<(), RenderError> {
todo!();
}
pub const fn is_bordered(&self) -> bool {
self.bordered
}
@@ -78,3 +84,9 @@ impl Drop for Window {
}
}
}
impl Default for Window {
fn default() -> Self {
Self::new()
}
}