feat: desktop environment improvements

This commit is contained in:
2026-02-20 09:03:30 +01:00
parent 6eebc64863
commit 359ef3ba53
24 changed files with 2479 additions and 644 deletions
+14
View File
@@ -36,6 +36,20 @@ struct DesktopState {
SvgIcon icon_folder;
SvgIcon icon_file;
SvgIcon icon_computer;
SvgIcon icon_network;
SvgIcon icon_calculator;
SvgIcon icon_texteditor;
SvgIcon icon_go_up;
SvgIcon icon_go_back;
SvgIcon icon_go_forward;
SvgIcon icon_save;
SvgIcon icon_home;
SvgIcon icon_exec;
bool net_popup_open;
Zenith::NetCfg cached_net_cfg;
uint64_t net_cfg_last_poll;
Rect net_icon_rect;
int screen_w, screen_h;
};
+2
View File
@@ -58,6 +58,8 @@ namespace colors {
static constexpr Color MENU_HOVER = {0xE8, 0xF0, 0xFE, 0xFF};
static constexpr Color TERM_BG = {0x2D, 0x2D, 0x2D, 0xFF};
static constexpr Color TERM_FG = {0xCC, 0xCC, 0xCC, 0xFF};
static constexpr Color PANEL_INDICATOR_ACTIVE = {0x45, 0x58, 0x6A, 0xFF};
static constexpr Color PANEL_INDICATOR_INACTIVE = {0x35, 0x48, 0x5A, 0xFF};
}
struct Point {
+9 -2
View File
@@ -80,7 +80,8 @@ static inline void terminal_scroll_up(TerminalState* t) {
}
}
static inline void terminal_init(TerminalState* t, int cols, int rows) {
// Initialize only the cell grid (no child process). Used by viewers like klog.
static inline void terminal_init_cells(TerminalState* t, int cols, int rows) {
t->cols = cols;
t->rows = rows;
t->cursor_x = 0;
@@ -91,13 +92,14 @@ static inline void terminal_init(TerminalState* t, int cols, int rows) {
t->total_rows = rows;
t->current_fg = colors::TERM_FG;
t->current_bg = colors::TERM_BG;
t->cursor_visible = true;
t->cursor_visible = false;
t->alt_screen_active = false;
t->reverse_video = false;
t->parse_state = TerminalState::STATE_NORMAL;
t->csi_private = false;
t->csi_param_count = 0;
t->csi_current_param = 0;
t->child_pid = 0;
int total_cells = cols * rows;
t->cells = (TermCell*)zenith::alloc(total_cells * sizeof(TermCell));
@@ -106,6 +108,11 @@ static inline void terminal_init(TerminalState* t, int cols, int rows) {
t->cells[i] = {' ', colors::TERM_FG, colors::TERM_BG};
t->alt_cells[i] = {' ', colors::TERM_FG, colors::TERM_BG};
}
}
static inline void terminal_init(TerminalState* t, int cols, int rows) {
terminal_init_cells(t, cols, rows);
t->cursor_visible = true;
t->child_pid = zenith::spawn_redir("0:/os/shell.elf");
zenith::childio_settermsz(t->child_pid, cols, rows);
+2
View File
@@ -25,6 +25,7 @@ using WindowDrawCallback = void (*)(Window* win, Framebuffer& fb);
using WindowMouseCallback = void (*)(Window* win, MouseEvent& ev);
using WindowKeyCallback = void (*)(Window* win, const Zenith::KeyEvent& key);
using WindowCloseCallback = void (*)(Window* win);
using WindowPollCallback = void (*)(Window* win);
struct Window {
char title[MAX_TITLE_LEN];
@@ -48,6 +49,7 @@ struct Window {
WindowMouseCallback on_mouse;
WindowKeyCallback on_key;
WindowCloseCallback on_close;
WindowPollCallback on_poll;
void* app_data;
Rect titlebar_rect() const {