⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

ScreenLocker

Struct ScreenLocker 

Source
pub struct ScreenLocker { /* private fields */ }
Expand description

Fullscreen lock screen with password authentication.

Implementations§

Source§

impl ScreenLocker

Source

pub fn new(screen_width: usize, screen_height: usize) -> Self

Create a new screen locker in the Unlocked state.

Source

pub fn lock(&mut self)

Lock the screen. Clears any in-progress password entry.

Source

pub fn unlock(&mut self)

Unlock the screen and reset failure counters.

Source

pub fn is_locked(&self) -> bool

Returns true if the screen is in any locked/authenticating state.

Source

pub fn state(&self) -> LockState

Returns the current lock state.

Source

pub fn handle_key(&mut self, key: u8, current_tick: u64) -> LockAction

Process a key press while the lock screen is active.

key is an ASCII byte (printable characters, Enter=0x0D, Backspace=0x08, Escape=0x1B). Returns a LockAction indicating what happened.

Source

pub fn attempt_auth(&mut self, current_tick: u64) -> bool

Attempt to authenticate with the current password buffer contents.

On success: resets failure count, transitions to AuthSuccess. On failure: increments failed_attempts; if >= max_attempts, sets a lockout timer.

Returns true on successful authentication.

Source

pub fn check_idle_timeout(&mut self, current_tick: u64) -> bool

Check whether the idle timeout has elapsed since the last activity.

Returns true if the screen should be locked due to inactivity. Only meaningful when the screen is currently unlocked.

Source

pub fn record_activity(&mut self, current_tick: u64)

Record user activity (resets the idle timer).

Source

pub fn tick(&mut self, current_tick: u64)

Advance internal animation timers. Call once per frame or per tick.

Toggles cursor blink state every CURSOR_BLINK_TICKS ticks. Also auto-transitions from AuthSuccess to Unlocked after a brief delay.

Source

pub fn set_idle_timeout(&mut self, ticks: u64)

Set the idle timeout in ticks. Pass 0 to disable auto-lock.

Source

pub fn set_max_attempts(&mut self, n: u32)

Set the maximum number of failed attempts before lockout.

Source

pub fn set_lock_message(&mut self, msg: &'static str)

Set the display message shown on the lock screen.

Source

pub fn set_user_name(&mut self, name: &'static str)

Set the username displayed on the lock screen.

Source

pub fn set_screen_size(&mut self, width: usize, height: usize)

Update screen dimensions (e.g., on resolution change).

Source

pub fn render_to_buffer( &self, buffer: &mut [u32], buf_width: usize, buf_height: usize, current_tick: u64, )

Render the lock screen into a u32 pixel buffer.

buffer is buf_width * buf_height elements in 0xAARRGGBB layout. The caller is responsible for blitting this buffer to the framebuffer (with any necessary RGB/BGR conversion).

Auto Trait Implementations§

§

impl Freeze for ScreenLocker

§

impl RefUnwindSafe for ScreenLocker

§

impl Send for ScreenLocker

§

impl Sync for ScreenLocker

§

impl Unpin for ScreenLocker

§

impl UnwindSafe for ScreenLocker

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.