pub struct GuiApi<P: CheckedPermissions> { /* private fields */ }Expand description
Full GUI API, usable by GUI apps
Implementations§
Source§impl<P: CheckedPermissions> GuiApi<P>
impl<P: CheckedPermissions> GuiApi<P>
Source§impl<P: CheckedPermissions> GuiApi<P>
impl<P: CheckedPermissions> GuiApi<P>
Sourcepub fn register(name: &str, height: usize) -> Result<Self, GuiServerError>where
P: MessageAllowed<RegisterAppMessage>,
pub fn register(name: &str, height: usize) -> Result<Self, GuiServerError>where
P: MessageAllowed<RegisterAppMessage>,
Registers an ordinary app window.
Sourcepub fn register_control_center(height: usize) -> Result<Self, GuiServerError>where
P: MessageAllowed<RegisterControlCenter>,
pub fn register_control_center(height: usize) -> Result<Self, GuiServerError>where
P: MessageAllowed<RegisterControlCenter>,
Registers as the control center, which gui-server tracks as a dedicated overlay window rather than an ordinary app.
Sourcepub fn register_keyboard(height: usize) -> Result<Self, GuiServerError>where
P: MessageAllowed<RegisterKeyboard>,
pub fn register_keyboard(height: usize) -> Result<Self, GuiServerError>where
P: MessageAllowed<RegisterKeyboard>,
Registers as the keyboard, which gui-server tracks as a dedicated overlay window rather than an ordinary app.
Sourcepub fn register_with_role<M>(
name: &str,
height: usize,
) -> Result<Self, GuiServerError>
pub fn register_with_role<M>( name: &str, height: usize, ) -> Result<Self, GuiServerError>
Claims a privileged role, then registers an ordinary app window. The role is granted per message type, so an app can only claim a role its manifest permits.
pub fn sid(&self) -> SID
Sourcepub fn submit_frame(&self, buffer: MemoryRange) -> Result<(), GuiServerError>where
P: MessageAllowed<SubmitFrame>,
pub fn submit_frame(&self, buffer: MemoryRange) -> Result<(), GuiServerError>where
P: MessageAllowed<SubmitFrame>,
Submit a frame for display.
pub fn show_camera(&self, y_pos: u16) -> Result<(), GuiServerError>where
P: MessageAllowed<ShowCamera>,
pub fn hide_camera(&self) -> Result<(), GuiServerError>where
P: MessageAllowed<HideCamera>,
pub fn update_keyboard(&self, msg: UpdateKeyboard) -> Result<(), GuiServerError>where
P: MessageAllowed<UpdateKeyboard>,
pub fn hide_keyboard(&self) -> Result<(), GuiServerError>where
P: MessageAllowed<HideKeyboard>,
pub fn notify_login_success(&self) -> Result<(), GuiServerError>where
P: MessageAllowed<LoginSuccess>,
pub fn wake_event_loop(&self)
pub fn request_redraw(&self) -> Result<(), GuiServerError>where
P: MessageAllowed<RequestRedraw>,
pub fn try_receive_input(&self) -> Option<(InputMessage, MessageEnvelope)>
pub fn receive_input( &self, ) -> Result<(InputMessage, MessageEnvelope), GuiServerError>
pub fn key_pressed(&self, key: Key) -> Result<(), GuiServerError>where
P: MessageAllowed<KeyPressed>,
pub fn key_released(&self, key: Key) -> Result<(), GuiServerError>where
P: MessageAllowed<KeyReleased>,
pub fn animate_next_frame(
&self,
animation_kind: NextFrameAnimationKind,
) -> Result<(), GuiServerError>where
P: MessageAllowed<AnimateNextFrame>,
Methods from Deref<Target = GuiApiLight<P>>§
Sourcepub fn show_modal(
&self,
app_id: AppId,
modal_style: ModalStyle,
args: &[u8],
) -> Result<NavigationResult, GuiServerError>where
P: MessageAllowed<ShowModal>,
pub fn show_modal(
&self,
app_id: AppId,
modal_style: ModalStyle,
args: &[u8],
) -> Result<NavigationResult, GuiServerError>where
P: MessageAllowed<ShowModal>,
Shows a modal of the app, giving it a navigation object
pub fn run_app(&self, app_id: AppId) -> Result<RunAppResponse, GuiServerError>where
P: MessageAllowed<RunApp>,
pub fn check_user_presence(
&self,
options: UserPresenceOptions,
) -> Result<Option<UserPresenceResult>, GuiServerError>where
P: MessageAllowed<NavigateTo>,
pub fn invoke_alert(
&self,
alert: InvokeAlert,
) -> Result<AlertResult, GuiServerError>where
P: MessageAllowed<ShowModal>,
Sourcepub fn switch_to(
&self,
next_pid: PID,
x: usize,
y: usize,
) -> Result<(), GuiServerError>where
P: MessageAllowed<SwitchTo>,
pub fn switch_to(
&self,
next_pid: PID,
x: usize,
y: usize,
) -> Result<(), GuiServerError>where
P: MessageAllowed<SwitchTo>,
Switches the focus to the app window of the given PID and the app zoom-in start position. Used by the app launcher, app switcher, and usb-debug protocol.
Sourcepub fn switch_to_launcher(&self) -> Result<bool, GuiServerError>where
P: MessageAllowed<SwitchToLauncher>,
pub fn switch_to_launcher(&self) -> Result<bool, GuiServerError>where
P: MessageAllowed<SwitchToLauncher>,
Switches the focus to the launcher app window. Used by apps.
pub fn is_locked(&self) -> Result<bool, GuiServerError>where
P: MessageAllowed<IsLocked>,
pub fn shutdown(&self) -> Result<(), GuiServerError>where
P: MessageAllowed<Shutdown>,
pub fn reboot(&self) -> Result<(), GuiServerError>where
P: MessageAllowed<Shutdown>,
Sourcepub fn close_app(&self, pid: PID) -> Result<(), GuiServerError>where
P: MessageAllowed<CloseApp>,
pub fn close_app(&self, pid: PID) -> Result<(), GuiServerError>where
P: MessageAllowed<CloseApp>,
Closes the app window of the given PID. Used by the launcher, switcher, and usb-debug protocol to gracefully close apps.
Sourcepub fn capture_screen(&self) -> Result<DropDeallocate, GuiServerError>where
P: MessageAllowed<CaptureScreen>,
pub fn capture_screen(&self) -> Result<DropDeallocate, GuiServerError>where
P: MessageAllowed<CaptureScreen>,
Captures the current composited screen as raw pixel data.
Returns a DropDeallocate of length FB_SIZE (SCREEN_WIDTH * SCREEN_HEIGHT * 4)
that auto-unmaps on drop. Dereferences to MemoryRange / &[u8].
Sourcepub fn inject_touch(&self, touch: Touch) -> Result<(), GuiServerError>where
P: MessageAllowed<InjectTouch>,
pub fn inject_touch(&self, touch: Touch) -> Result<(), GuiServerError>where
P: MessageAllowed<InjectTouch>,
Injects a touch event as if it came from the hardware touch controller.
Sourcepub fn inject_key(
&self,
is_pressed: bool,
key: Key,
) -> Result<(), GuiServerError>where
P: MessageAllowed<InjectKey>,
pub fn inject_key(
&self,
is_pressed: bool,
key: Key,
) -> Result<(), GuiServerError>where
P: MessageAllowed<InjectKey>,
Injects a key press or release event into the active app.
Injects a power button press or release into gui-server’s power-button state machine.