implements PLN-0052
This commit is contained in:
parent
28cb21118b
commit
ab825d3274
@ -339,8 +339,8 @@ mod tests {
|
||||
firmware.tick(&signals, &mut hardware);
|
||||
|
||||
assert!(matches!(firmware.state, FirmwareState::SystemRunning(_)));
|
||||
assert!(firmware.hub.window_manager.focused.is_some());
|
||||
assert_eq!(firmware.hub.window_manager.windows.len(), 1);
|
||||
assert!(firmware.os.window_manager.focused.is_some());
|
||||
assert_eq!(firmware.os.window_manager.windows.len(), 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@ -43,12 +43,12 @@ impl LoadCartridgeStep {
|
||||
}
|
||||
|
||||
if self.cartridge.app_mode == AppMode::Shell {
|
||||
let id = ctx.hub.window_manager.add_window(
|
||||
let id = ctx.os.window_manager.add_window(
|
||||
self.cartridge.title.clone(),
|
||||
Rect { x: 40, y: 20, w: 240, h: 140 },
|
||||
Color::WHITE,
|
||||
);
|
||||
ctx.hub.window_manager.set_focus(id);
|
||||
ctx.os.window_manager.set_focus(id);
|
||||
|
||||
let task_id =
|
||||
ctx.os.create_vm_shell_task(self.cartridge.app_id, self.cartridge.title.clone());
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
use crate::VirtualMachineRuntime;
|
||||
use crate::process::ProcessManager;
|
||||
use crate::services::window_manager::WindowManager;
|
||||
use crate::task::TaskId;
|
||||
use crate::task::TaskManager;
|
||||
use prometeu_hal::telemetry::CertificationConfig;
|
||||
@ -8,6 +9,7 @@ pub struct SystemOS {
|
||||
pub vm_runtime: VirtualMachineRuntime,
|
||||
pub process_manager: ProcessManager,
|
||||
pub task_manager: TaskManager,
|
||||
pub window_manager: WindowManager,
|
||||
}
|
||||
|
||||
impl SystemOS {
|
||||
@ -16,6 +18,7 @@ impl SystemOS {
|
||||
vm_runtime: VirtualMachineRuntime::new(cap_config),
|
||||
process_manager: ProcessManager::new(),
|
||||
task_manager: TaskManager::new(),
|
||||
window_manager: WindowManager::new(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
#[allow(clippy::module_inception)]
|
||||
mod prometeu_hub;
|
||||
mod window_manager;
|
||||
|
||||
pub use prometeu_hub::PrometeuHub;
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
use crate::programs::prometeu_hub::window_manager::WindowManager;
|
||||
use crate::{CrashReport, SystemOS};
|
||||
use prometeu_hal::color::Color;
|
||||
use prometeu_hal::log::{LogLevel, LogSource};
|
||||
@ -7,9 +6,7 @@ use prometeu_hal::{HardwareBridge, InputSignals};
|
||||
use prometeu_vm::VirtualMachine;
|
||||
|
||||
/// PrometeuHub: Launcher and system UI environment.
|
||||
pub struct PrometeuHub {
|
||||
pub window_manager: WindowManager,
|
||||
}
|
||||
pub struct PrometeuHub;
|
||||
|
||||
pub struct SystemProfileUpdate {
|
||||
pub crash: Option<CrashReport>,
|
||||
@ -24,7 +21,7 @@ impl Default for PrometeuHub {
|
||||
|
||||
impl PrometeuHub {
|
||||
pub fn new() -> Self {
|
||||
Self { window_manager: WindowManager::new() }
|
||||
Self
|
||||
}
|
||||
|
||||
pub fn init(&mut self) {
|
||||
@ -64,14 +61,14 @@ impl PrometeuHub {
|
||||
}
|
||||
|
||||
if let Some((title, rect, color)) = next_window {
|
||||
self.window_manager.remove_all_windows();
|
||||
let id = self.window_manager.add_window(title, rect, color);
|
||||
self.window_manager.set_focus(id);
|
||||
os.window_manager.remove_all_windows();
|
||||
let id = os.window_manager.add_window(title, rect, color);
|
||||
os.window_manager.set_focus(id);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn render(&mut self, _os: &mut SystemOS, hw: &mut dyn HardwareBridge) {
|
||||
for window in &self.window_manager.windows {
|
||||
pub fn render(&mut self, os: &mut SystemOS, hw: &mut dyn HardwareBridge) {
|
||||
for window in &os.window_manager.windows {
|
||||
hw.gfx_mut().fill_rect(
|
||||
window.viewport.x,
|
||||
window.viewport.y,
|
||||
@ -93,9 +90,9 @@ impl PrometeuHub {
|
||||
|
||||
self.gui_update(os, hw);
|
||||
|
||||
if let Some(focused_id) = self.window_manager.focused {
|
||||
if let Some(focused_id) = os.window_manager.focused {
|
||||
if hw.pad().start().down {
|
||||
self.window_manager.remove_window(focused_id);
|
||||
os.window_manager.remove_window(focused_id);
|
||||
} else {
|
||||
crash = os.vm_runtime.tick(vm, signals, hw);
|
||||
}
|
||||
@ -104,6 +101,6 @@ impl PrometeuHub {
|
||||
self.render(os, hw);
|
||||
hw.gfx_mut().present();
|
||||
|
||||
SystemProfileUpdate { crash, focused_window_active: self.window_manager.focused.is_some() }
|
||||
SystemProfileUpdate { crash, focused_window_active: os.window_manager.focused.is_some() }
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,3 +3,4 @@ pub mod memcard;
|
||||
pub mod process;
|
||||
pub mod task;
|
||||
pub mod vm_runtime;
|
||||
pub mod window_manager;
|
||||
|
||||
@ -31,4 +31,4 @@
|
||||
{"type":"discussion","id":"DSC-0030","status":"done","ticket":"internal-viewport-270p","title":"Agenda - Internal Viewport 270p (480x270)","created_at":"2026-04-27","updated_at":"2026-04-28","tags":["gfx","runtime","viewport","resolution","frame-composer","host"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0039","file":"discussion/lessons/DSC-0030-internal-viewport-270p/LSN-0039-resolution-baseline-changes-are-runtime-wide-contracts.md","status":"done","created_at":"2026-04-28","updated_at":"2026-04-28"}]}
|
||||
{"type":"discussion","id":"DSC-0031","status":"done","ticket":"runtime-mode-separation-game-system","title":"Agenda - Runtime Mode Separation: Game and System","created_at":"2026-05-11","updated_at":"2026-05-14","tags":["runtime","firmware","hub","system-apps","game-mode","scheduler"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0040","file":"discussion/lessons/DSC-0031-runtime-mode-separation-game-system/LSN-0040-system-pipeline-separation.md","status":"done","created_at":"2026-05-14","updated_at":"2026-05-14"}]}
|
||||
{"type":"discussion","id":"DSC-0032","status":"open","ticket":"system-os-lifecycle-process-task-contract","title":"Agenda - SystemOS Lifecycle, Process and Task Contract","created_at":"2026-05-14","updated_at":"2026-05-14","tags":["runtime","os","lifecycle","process","task","shell","firmware"],"agendas":[{"id":"AGD-0032","file":"AGD-0032-system-os-lifecycle-process-task-contract.md","status":"open","created_at":"2026-05-14","updated_at":"2026-05-14"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0033","status":"in_progress","ticket":"system-os-service-ownership-and-module-layout","title":"Agenda - SystemOS Service Ownership and Module Layout","created_at":"2026-05-14","updated_at":"2026-05-14","tags":["runtime","os","services","module-layout","vm","window-manager","logging"],"agendas":[{"id":"AGD-0033","file":"AGD-0033-system-os-service-ownership-and-module-layout.md","status":"accepted","created_at":"2026-05-14","updated_at":"2026-05-14"}],"decisions":[{"id":"DEC-0024","file":"DEC-0024-systemos-service-ownership-and-module-layout.md","status":"accepted","created_at":"2026-05-14","updated_at":"2026-05-14","ref_agenda":"AGD-0033"}],"plans":[{"id":"PLN-0051","file":"PLN-0051-move-vm-runtime-into-services.md","status":"done","created_at":"2026-05-14","updated_at":"2026-05-14","ref_decisions":["DEC-0024"]},{"id":"PLN-0052","file":"PLN-0052-promote-window-manager-to-systemos-service.md","status":"open","created_at":"2026-05-14","updated_at":"2026-05-14","ref_decisions":["DEC-0024"]},{"id":"PLN-0053","file":"PLN-0053-move-logging-ownership-to-systemos.md","status":"open","created_at":"2026-05-14","updated_at":"2026-05-14","ref_decisions":["DEC-0024"]},{"id":"PLN-0054","file":"PLN-0054-move-fs-and-memcard-ownership-to-systemos.md","status":"open","created_at":"2026-05-14","updated_at":"2026-05-14","ref_decisions":["DEC-0024"]}],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0033","status":"in_progress","ticket":"system-os-service-ownership-and-module-layout","title":"Agenda - SystemOS Service Ownership and Module Layout","created_at":"2026-05-14","updated_at":"2026-05-14","tags":["runtime","os","services","module-layout","vm","window-manager","logging"],"agendas":[{"id":"AGD-0033","file":"AGD-0033-system-os-service-ownership-and-module-layout.md","status":"accepted","created_at":"2026-05-14","updated_at":"2026-05-14"}],"decisions":[{"id":"DEC-0024","file":"DEC-0024-systemos-service-ownership-and-module-layout.md","status":"accepted","created_at":"2026-05-14","updated_at":"2026-05-14","ref_agenda":"AGD-0033"}],"plans":[{"id":"PLN-0051","file":"PLN-0051-move-vm-runtime-into-services.md","status":"done","created_at":"2026-05-14","updated_at":"2026-05-14","ref_decisions":["DEC-0024"]},{"id":"PLN-0052","file":"PLN-0052-promote-window-manager-to-systemos-service.md","status":"done","created_at":"2026-05-14","updated_at":"2026-05-14","ref_decisions":["DEC-0024"]},{"id":"PLN-0053","file":"PLN-0053-move-logging-ownership-to-systemos.md","status":"open","created_at":"2026-05-14","updated_at":"2026-05-14","ref_decisions":["DEC-0024"]},{"id":"PLN-0054","file":"PLN-0054-move-fs-and-memcard-ownership-to-systemos.md","status":"open","created_at":"2026-05-14","updated_at":"2026-05-14","ref_decisions":["DEC-0024"]}],"lessons":[]}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
id: PLN-0052
|
||||
ticket: system-os-service-ownership-and-module-layout
|
||||
title: Promote Window Manager To SystemOS Service
|
||||
status: open
|
||||
status: done
|
||||
created: 2026-05-14
|
||||
ref_decisions: [DEC-0024]
|
||||
tags: [runtime, os, services, module-layout, vm, window-manager, logging]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user