feat: rename 'ZenithOS' => 'MontaukOS' and fix build system issues

This commit is contained in:
2026-02-28 12:06:18 +01:00
parent 1809ae55e5
commit 83016847b4
136 changed files with 1669 additions and 51769 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
# Makefile for desktop (GUI desktop environment) on ZenithOS
# Makefile for desktop (GUI desktop environment) on MontaukOS
# Copyright (c) 2025 Daniel Hammer
MAKEFLAGS += -rR
+7 -7
View File
@@ -1,6 +1,6 @@
/*
* app_calculator.cpp
* ZenithOS Desktop - Calculator application
* MontaukOS Desktop - Calculator application
* Integer-only 4-function calculator (values scaled by 100 for 2 decimal places)
* Copyright (c) 2026 Daniel Hammer
*/
@@ -61,7 +61,7 @@ static void calc_format_display(CalcState* cs) {
// Trim trailing zeros after decimal point (unless user is entering decimals)
if (!cs->has_decimal) {
int len = zenith::slen(cs->display_str);
int len = montauk::slen(cs->display_str);
while (len > 1 && cs->display_str[len - 1] == '0') {
cs->display_str[--len] = '\0';
}
@@ -237,7 +237,7 @@ static void calculator_on_draw(Window* win, Framebuffer& fb) {
text_w = fonts::system_font->measure_text(cs->display_str, fonts::LARGE_SIZE);
large_h = fonts::system_font->get_line_height(fonts::LARGE_SIZE);
} else {
int text_len = zenith::slen(cs->display_str);
int text_len = montauk::slen(cs->display_str);
text_w = text_len * FONT_WIDTH * 2;
large_h = FONT_HEIGHT * 2;
}
@@ -342,7 +342,7 @@ static void calculator_on_mouse(Window* win, MouseEvent& ev) {
// Keyboard handling
// ============================================================================
static void calculator_on_key(Window* win, const Zenith::KeyEvent& key) {
static void calculator_on_key(Window* win, const Montauk::KeyEvent& key) {
CalcState* cs = (CalcState*)win->app_data;
if (!cs || !key.pressed) return;
@@ -369,7 +369,7 @@ static void calculator_on_key(Window* win, const Zenith::KeyEvent& key) {
static void calculator_on_close(Window* win) {
if (win->app_data) {
zenith::mfree(win->app_data);
montauk::mfree(win->app_data);
win->app_data = nullptr;
}
}
@@ -386,8 +386,8 @@ void open_calculator(DesktopState* ds) {
if (idx < 0) return;
Window* win = &ds->windows[idx];
CalcState* cs = (CalcState*)zenith::malloc(sizeof(CalcState));
zenith::memset(cs, 0, sizeof(CalcState));
CalcState* cs = (CalcState*)montauk::malloc(sizeof(CalcState));
montauk::memset(cs, 0, sizeof(CalcState));
cs->display_val = 0;
cs->accumulator = 0;
cs->pending_op = 0;
+9 -9
View File
@@ -1,6 +1,6 @@
/*
* app_devexplorer.cpp
* ZenithOS Desktop - Device Explorer (lists hardware detected by the kernel)
* MontaukOS Desktop - Device Explorer (lists hardware detected by the kernel)
* Copyright (c) 2026 Daniel Hammer
*/
@@ -43,7 +43,7 @@ static Color category_colors[] = {
struct DevExplorerState {
DesktopState* desktop;
Zenith::DevInfo devs[DE_MAX_DEVS];
Montauk::DevInfo devs[DE_MAX_DEVS];
int dev_count;
bool collapsed[NUM_CATEGORIES]; // per-category collapse state
int selected_row; // index into visible display rows (-1 = none)
@@ -130,11 +130,11 @@ static void devexplorer_on_poll(Window* win) {
DevExplorerState* de = (DevExplorerState*)win->app_data;
if (!de) return;
uint64_t now = zenith::get_milliseconds();
uint64_t now = montauk::get_milliseconds();
if (now - de->last_poll_ms < DE_POLL_MS) return;
de->last_poll_ms = now;
de->dev_count = zenith::devlist(de->devs, DE_MAX_DEVS);
de->dev_count = montauk::devlist(de->devs, DE_MAX_DEVS);
}
static void devexplorer_on_draw(Window* win, Framebuffer& fb) {
@@ -364,7 +364,7 @@ static void devexplorer_on_mouse(Window* win, MouseEvent& ev) {
}
}
static void devexplorer_on_key(Window* win, const Zenith::KeyEvent& key) {
static void devexplorer_on_key(Window* win, const Montauk::KeyEvent& key) {
DevExplorerState* de = (DevExplorerState*)win->app_data;
if (!de || !key.pressed) return;
@@ -437,7 +437,7 @@ static void devexplorer_on_key(Window* win, const Zenith::KeyEvent& key) {
static void devexplorer_on_close(Window* win) {
if (win->app_data) {
zenith::mfree(win->app_data);
montauk::mfree(win->app_data);
win->app_data = nullptr;
}
}
@@ -452,8 +452,8 @@ void open_devexplorer(DesktopState* ds) {
Window* win = &ds->windows[idx];
DevExplorerState* de = (DevExplorerState*)zenith::malloc(sizeof(DevExplorerState));
zenith::memset(de, 0, sizeof(DevExplorerState));
DevExplorerState* de = (DevExplorerState*)montauk::malloc(sizeof(DevExplorerState));
montauk::memset(de, 0, sizeof(DevExplorerState));
de->desktop = ds;
de->selected_row = -1;
de->scroll_y = 0;
@@ -464,7 +464,7 @@ void open_devexplorer(DesktopState* ds) {
de->collapsed[i] = false;
// Initial poll
de->dev_count = zenith::devlist(de->devs, DE_MAX_DEVS);
de->dev_count = montauk::devlist(de->devs, DE_MAX_DEVS);
win->app_data = de;
win->on_draw = devexplorer_on_draw;
+2 -2
View File
@@ -1,6 +1,6 @@
/*
* app_doom.cpp
* ZenithOS Desktop - DOOM launcher (spawns standalone doom.elf)
* MontaukOS Desktop - DOOM launcher (spawns standalone doom.elf)
* Copyright (c) 2026 Daniel Hammer
*/
@@ -8,5 +8,5 @@
void open_doom(DesktopState* ds) {
(void)ds;
zenith::spawn("0:/games/doom.elf");
montauk::spawn("0:/games/doom.elf");
}
+40 -40
View File
@@ -1,6 +1,6 @@
/*
* app_filemanager.cpp
* ZenithOS Desktop - Enhanced File Manager application
* MontaukOS Desktop - Enhanced File Manager application
* Copyright (c) 2026 Daniel Hammer
*/
@@ -44,8 +44,8 @@ static constexpr int FM_GRID_PAD = 4;
// ============================================================================
static bool str_ends_with(const char* s, const char* suffix) {
int slen = zenith::slen(s);
int suflen = zenith::slen(suffix);
int slen = montauk::slen(s);
int suflen = montauk::slen(suffix);
if (suflen > slen) return false;
for (int i = 0; i < suflen; i++) {
char sc = s[slen - suflen + i];
@@ -77,7 +77,7 @@ static int detect_file_type(const char* name, bool is_dir) {
static void filemanager_read_dir(FileManagerState* fm) {
const char* names[64];
fm->entry_count = zenith::readdir(fm->current_path, names, 64);
fm->entry_count = montauk::readdir(fm->current_path, names, 64);
if (fm->entry_count < 0) fm->entry_count = 0;
// readdir returns full paths from the VFS (e.g. "man/fetch.1" instead
@@ -92,8 +92,8 @@ static void filemanager_read_dir(FileManagerState* fm) {
char prefix[256] = {0};
int prefix_len = 0;
if (after_drive[0] != '\0') {
zenith::strcpy(prefix, after_drive);
prefix_len = zenith::slen(prefix);
montauk::strcpy(prefix, after_drive);
prefix_len = montauk::slen(prefix);
if (prefix_len > 0 && prefix[prefix_len - 1] != '/') {
prefix[prefix_len++] = '/';
prefix[prefix_len] = '\0';
@@ -110,8 +110,8 @@ static void filemanager_read_dir(FileManagerState* fm) {
}
if (match) raw += prefix_len;
}
zenith::strncpy(fm->entry_names[i], raw, 63);
int len = zenith::slen(fm->entry_names[i]);
montauk::strncpy(fm->entry_names[i], raw, 63);
int len = montauk::slen(fm->entry_names[i]);
// Detect directory
if (len > 0 && fm->entry_names[i][len - 1] == '/') {
@@ -131,16 +131,16 @@ static void filemanager_read_dir(FileManagerState* fm) {
fm->entry_sizes[i] = 0;
if (!fm->is_dir[i]) {
char fullpath[512];
zenith::strcpy(fullpath, fm->current_path);
int plen = zenith::slen(fullpath);
montauk::strcpy(fullpath, fm->current_path);
int plen = montauk::slen(fullpath);
if (plen > 0 && fullpath[plen - 1] != '/') {
str_append(fullpath, "/", 512);
}
str_append(fullpath, fm->entry_names[i], 512);
int fd = zenith::open(fullpath);
int fd = montauk::open(fullpath);
if (fd >= 0) {
fm->entry_sizes[i] = (int)zenith::getsize(fd);
zenith::close(fd);
fm->entry_sizes[i] = (int)montauk::getsize(fd);
montauk::close(fd);
}
}
}
@@ -151,7 +151,7 @@ static void filemanager_read_dir(FileManagerState* fm) {
int tmp_type = fm->entry_types[i];
int tmp_size = fm->entry_sizes[i];
bool tmp_isdir = fm->is_dir[i];
zenith::strcpy(tmp_name, fm->entry_names[i]);
montauk::strcpy(tmp_name, fm->entry_names[i]);
int j = i - 1;
while (j >= 0) {
@@ -165,13 +165,13 @@ static void filemanager_read_dir(FileManagerState* fm) {
}
if (!swap) break;
zenith::strcpy(fm->entry_names[j + 1], fm->entry_names[j]);
montauk::strcpy(fm->entry_names[j + 1], fm->entry_names[j]);
fm->entry_types[j + 1] = fm->entry_types[j];
fm->entry_sizes[j + 1] = fm->entry_sizes[j];
fm->is_dir[j + 1] = fm->is_dir[j];
j--;
}
zenith::strcpy(fm->entry_names[j + 1], tmp_name);
montauk::strcpy(fm->entry_names[j + 1], tmp_name);
fm->entry_types[j + 1] = tmp_type;
fm->entry_sizes[j + 1] = tmp_size;
fm->is_dir[j + 1] = tmp_isdir;
@@ -190,16 +190,16 @@ static void filemanager_read_dir(FileManagerState* fm) {
static void filemanager_push_history(FileManagerState* fm) {
// Don't push if same as current position
if (fm->history_count > 0 && fm->history_pos >= 0) {
if (zenith::streq(fm->history[fm->history_pos], fm->current_path)) return;
if (montauk::streq(fm->history[fm->history_pos], fm->current_path)) return;
}
fm->history_pos++;
if (fm->history_pos >= 16) fm->history_pos = 15;
zenith::strcpy(fm->history[fm->history_pos], fm->current_path);
montauk::strcpy(fm->history[fm->history_pos], fm->current_path);
fm->history_count = fm->history_pos + 1;
}
static void filemanager_navigate(FileManagerState* fm, const char* name) {
int path_len = zenith::slen(fm->current_path);
int path_len = montauk::slen(fm->current_path);
if (path_len > 0 && fm->current_path[path_len - 1] != '/') {
str_append(fm->current_path, "/", 256);
}
@@ -209,7 +209,7 @@ static void filemanager_navigate(FileManagerState* fm, const char* name) {
}
static void filemanager_go_up(FileManagerState* fm) {
int len = zenith::slen(fm->current_path);
int len = montauk::slen(fm->current_path);
if (len <= 3) return; // "0:/" is root
if (len > 0 && fm->current_path[len - 1] == '/') {
@@ -231,19 +231,19 @@ static void filemanager_go_up(FileManagerState* fm) {
static void filemanager_go_back(FileManagerState* fm) {
if (fm->history_pos <= 0) return;
fm->history_pos--;
zenith::strcpy(fm->current_path, fm->history[fm->history_pos]);
montauk::strcpy(fm->current_path, fm->history[fm->history_pos]);
filemanager_read_dir(fm);
}
static void filemanager_go_forward(FileManagerState* fm) {
if (fm->history_pos >= fm->history_count - 1) return;
fm->history_pos++;
zenith::strcpy(fm->current_path, fm->history[fm->history_pos]);
montauk::strcpy(fm->current_path, fm->history[fm->history_pos]);
filemanager_read_dir(fm);
}
static void filemanager_go_home(FileManagerState* fm) {
zenith::strcpy(fm->current_path, "0:/");
montauk::strcpy(fm->current_path, "0:/");
filemanager_push_history(fm);
filemanager_read_dir(fm);
}
@@ -368,14 +368,14 @@ static void filemanager_on_draw(Window* win, Framebuffer& fb) {
// Filename centered below icon, truncated if needed
char label[16];
int nlen = zenith::slen(fm->entry_names[i]);
int nlen = montauk::slen(fm->entry_names[i]);
if (nlen > 9) {
for (int k = 0; k < 9; k++) label[k] = fm->entry_names[i][k];
label[9] = '.';
label[10] = '.';
label[11] = '\0';
} else {
zenith::strncpy(label, fm->entry_names[i], 15);
montauk::strncpy(label, fm->entry_names[i], 15);
}
int tw = text_width(label);
int tx = cell_x + (FM_GRID_CELL_W - tw) / 2;
@@ -539,7 +539,7 @@ static void filemanager_on_mouse(Window* win, MouseEvent& ev) {
int clicked_idx = row * cols + col;
if (clicked_idx >= 0 && clicked_idx < fm->entry_count && col < cols) {
uint64_t now = zenith::get_milliseconds();
uint64_t now = montauk::get_milliseconds();
if (fm->last_click_item == clicked_idx &&
(now - fm->last_click_time) < 400) {
@@ -547,16 +547,16 @@ static void filemanager_on_mouse(Window* win, MouseEvent& ev) {
filemanager_navigate(fm, fm->entry_names[clicked_idx]);
} else {
char fullpath[512];
zenith::strcpy(fullpath, fm->current_path);
int plen = zenith::slen(fullpath);
montauk::strcpy(fullpath, fm->current_path);
int plen = montauk::slen(fullpath);
if (plen > 0 && fullpath[plen - 1] != '/') {
str_append(fullpath, "/", 512);
}
str_append(fullpath, fm->entry_names[clicked_idx], 512);
if (is_image_file(fm->entry_names[clicked_idx])) {
zenith::spawn("0:/os/imageviewer.elf", fullpath);
montauk::spawn("0:/os/imageviewer.elf", fullpath);
} else if (is_font_file(fm->entry_names[clicked_idx])) {
zenith::spawn("0:/os/fontpreview.elf", fullpath);
montauk::spawn("0:/os/fontpreview.elf", fullpath);
} else if (fm->desktop) {
open_texteditor_with_file(fm->desktop, fullpath);
}
@@ -578,7 +578,7 @@ static void filemanager_on_mouse(Window* win, MouseEvent& ev) {
int clicked_idx = rel_y / FM_ITEM_H;
if (clicked_idx >= 0 && clicked_idx < fm->entry_count) {
uint64_t now = zenith::get_milliseconds();
uint64_t now = montauk::get_milliseconds();
// Double-click detection
if (fm->last_click_item == clicked_idx &&
@@ -588,16 +588,16 @@ static void filemanager_on_mouse(Window* win, MouseEvent& ev) {
} else {
// Open file in appropriate viewer
char fullpath[512];
zenith::strcpy(fullpath, fm->current_path);
int plen = zenith::slen(fullpath);
montauk::strcpy(fullpath, fm->current_path);
int plen = montauk::slen(fullpath);
if (plen > 0 && fullpath[plen - 1] != '/') {
str_append(fullpath, "/", 512);
}
str_append(fullpath, fm->entry_names[clicked_idx], 512);
if (is_image_file(fm->entry_names[clicked_idx])) {
zenith::spawn("0:/os/imageviewer.elf", fullpath);
montauk::spawn("0:/os/imageviewer.elf", fullpath);
} else if (is_font_file(fm->entry_names[clicked_idx])) {
zenith::spawn("0:/os/fontpreview.elf", fullpath);
montauk::spawn("0:/os/fontpreview.elf", fullpath);
} else if (fm->desktop) {
open_texteditor_with_file(fm->desktop, fullpath);
}
@@ -633,7 +633,7 @@ static void filemanager_on_mouse(Window* win, MouseEvent& ev) {
// Keyboard handling
// ============================================================================
static void filemanager_on_key(Window* win, const Zenith::KeyEvent& key) {
static void filemanager_on_key(Window* win, const Montauk::KeyEvent& key) {
FileManagerState* fm = (FileManagerState*)win->app_data;
if (!fm || !key.pressed) return;
@@ -682,7 +682,7 @@ static void filemanager_on_key(Window* win, const Zenith::KeyEvent& key) {
static void filemanager_on_close(Window* win) {
if (win->app_data) {
zenith::mfree(win->app_data);
montauk::mfree(win->app_data);
win->app_data = nullptr;
}
}
@@ -696,9 +696,9 @@ void open_filemanager(DesktopState* ds) {
if (idx < 0) return;
Window* win = &ds->windows[idx];
FileManagerState* fm = (FileManagerState*)zenith::malloc(sizeof(FileManagerState));
zenith::memset(fm, 0, sizeof(FileManagerState));
zenith::strcpy(fm->current_path, "0:/");
FileManagerState* fm = (FileManagerState*)montauk::malloc(sizeof(FileManagerState));
montauk::memset(fm, 0, sizeof(FileManagerState));
montauk::strcpy(fm->current_path, "0:/");
fm->selected = -1;
fm->last_click_item = -1;
fm->history_pos = -1;
+12 -12
View File
@@ -1,6 +1,6 @@
/*
* app_klog.cpp
* ZenithOS Desktop - Kernel Log viewer (tails the kernel ring buffer)
* MontaukOS Desktop - Kernel Log viewer (tails the kernel ring buffer)
* Copyright (c) 2026 Daniel Hammer
*/
@@ -64,7 +64,7 @@ static void klog_on_mouse(Window* win, MouseEvent& ev) {
// Read-only viewer — no mouse interaction needed
}
static void klog_on_key(Window* win, const Zenith::KeyEvent& key) {
static void klog_on_key(Window* win, const Montauk::KeyEvent& key) {
// Read-only viewer — no keyboard input
}
@@ -72,11 +72,11 @@ static void klog_on_poll(Window* win) {
KlogState* klog = (KlogState*)win->app_data;
if (!klog) return;
uint64_t now = zenith::get_milliseconds();
uint64_t now = montauk::get_milliseconds();
if (now - klog->last_poll_ms < KLOG_POLL_MS) return;
klog->last_poll_ms = now;
int n = (int)zenith::read_klog(klog->klog_buf, KLOG_READ_SIZE);
int n = (int)montauk::read_klog(klog->klog_buf, KLOG_READ_SIZE);
if (n <= 0 && klog->last_len <= 0) return;
if (n > klog->last_len) {
@@ -101,10 +101,10 @@ static void klog_on_poll(Window* win) {
static void klog_on_close(Window* win) {
KlogState* klog = (KlogState*)win->app_data;
if (klog) {
if (klog->term.cells) zenith::mfree(klog->term.cells);
if (klog->term.alt_cells) zenith::mfree(klog->term.alt_cells);
if (klog->klog_buf) zenith::mfree(klog->klog_buf);
zenith::mfree(klog);
if (klog->term.cells) montauk::mfree(klog->term.cells);
if (klog->term.alt_cells) montauk::mfree(klog->term.alt_cells);
if (klog->klog_buf) montauk::mfree(klog->klog_buf);
montauk::mfree(klog);
win->app_data = nullptr;
}
}
@@ -122,20 +122,20 @@ void open_klog(DesktopState* ds) {
int cols = cr.w / mono_cell_width();
int rows = cr.h / mono_cell_height();
KlogState* klog = (KlogState*)zenith::malloc(sizeof(KlogState));
zenith::memset(klog, 0, sizeof(KlogState));
KlogState* klog = (KlogState*)montauk::malloc(sizeof(KlogState));
montauk::memset(klog, 0, sizeof(KlogState));
// Initialize the terminal cell grid (reuse terminal infrastructure)
terminal_init_cells(&klog->term, cols, rows);
// Allocate klog read buffer
klog->klog_buf = (char*)zenith::malloc(KLOG_READ_SIZE);
klog->klog_buf = (char*)montauk::malloc(KLOG_READ_SIZE);
klog->last_len = 0;
klog->last_tail_byte = 0;
klog->last_poll_ms = 0;
// Do an initial read to show existing log content
int n = (int)zenith::read_klog(klog->klog_buf, KLOG_READ_SIZE);
int n = (int)montauk::read_klog(klog->klog_buf, KLOG_READ_SIZE);
if (n > 0) {
klog_refeed(klog, n);
klog->last_len = n;
+5 -5
View File
@@ -1,6 +1,6 @@
/*
* app_mandelbrot.cpp
* ZenithOS Desktop - Mandelbrot set visualizer
* MontaukOS Desktop - Mandelbrot set visualizer
* Supports zoom (scroll wheel), pan (drag), and reset (R key)
* Copyright (c) 2026 Daniel Hammer
*/
@@ -242,7 +242,7 @@ static void mb_on_mouse(Window* win, MouseEvent& ev) {
}
}
static void mb_on_key(Window* win, const Zenith::KeyEvent& key) {
static void mb_on_key(Window* win, const Montauk::KeyEvent& key) {
MandelbrotState* mb = (MandelbrotState*)win->app_data;
if (!mb || !key.pressed) return;
@@ -262,7 +262,7 @@ static void mb_on_key(Window* win, const Zenith::KeyEvent& key) {
static void mb_on_close(Window* win) {
if (win->app_data) {
zenith::mfree(win->app_data);
montauk::mfree(win->app_data);
win->app_data = nullptr;
}
}
@@ -278,8 +278,8 @@ void open_mandelbrot(DesktopState* ds) {
Window* win = &ds->windows[idx];
Rect cr = win->content_rect();
MandelbrotState* mb = (MandelbrotState*)zenith::malloc(sizeof(MandelbrotState));
zenith::memset(mb, 0, sizeof(MandelbrotState));
MandelbrotState* mb = (MandelbrotState*)montauk::malloc(sizeof(MandelbrotState));
montauk::memset(mb, 0, sizeof(MandelbrotState));
mb->desktop = ds;
mb->center_x = -fp_from_int(1) / 2; // -0.5
mb->center_y = 0;
+11 -11
View File
@@ -1,6 +1,6 @@
/*
* app_procmgr.cpp
* ZenithOS Desktop - Process Manager
* MontaukOS Desktop - Process Manager
* Copyright (c) 2026 Daniel Hammer
*/
@@ -18,7 +18,7 @@ static constexpr int PM_POLL_MS = 1000;
struct ProcMgrState {
DesktopState* desktop;
Zenith::ProcInfo procs[PM_MAX_PROCS];
Montauk::ProcInfo procs[PM_MAX_PROCS];
int proc_count;
int selected; // selected row index (-1 = none)
uint64_t last_poll_ms;
@@ -32,7 +32,7 @@ static void procmgr_on_poll(Window* win) {
ProcMgrState* pm = (ProcMgrState*)win->app_data;
if (!pm) return;
uint64_t now = zenith::get_milliseconds();
uint64_t now = montauk::get_milliseconds();
if (now - pm->last_poll_ms < PM_POLL_MS) return;
pm->last_poll_ms = now;
@@ -42,7 +42,7 @@ static void procmgr_on_poll(Window* win) {
prev_pid = pm->procs[pm->selected].pid;
}
pm->proc_count = zenith::proclist(pm->procs, PM_MAX_PROCS);
pm->proc_count = montauk::proclist(pm->procs, PM_MAX_PROCS);
// Restore selection by matching PID
pm->selected = -1;
@@ -172,7 +172,7 @@ static void procmgr_on_mouse(Window* win, MouseEvent& ev) {
if (btn_rect.contains(lx, ly)) {
if (pm->selected >= 0 && pm->selected < pm->proc_count
&& pm->procs[pm->selected].pid != 0) {
zenith::kill(pm->procs[pm->selected].pid);
montauk::kill(pm->procs[pm->selected].pid);
pm->last_poll_ms = 0; // force refresh
}
return;
@@ -191,7 +191,7 @@ static void procmgr_on_mouse(Window* win, MouseEvent& ev) {
}
}
static void procmgr_on_key(Window* win, const Zenith::KeyEvent& key) {
static void procmgr_on_key(Window* win, const Montauk::KeyEvent& key) {
ProcMgrState* pm = (ProcMgrState*)win->app_data;
if (!pm || !key.pressed) return;
@@ -203,7 +203,7 @@ static void procmgr_on_key(Window* win, const Zenith::KeyEvent& key) {
} else if (key.scancode == 0x53) { // Delete key
if (pm->selected >= 0 && pm->selected < pm->proc_count
&& pm->procs[pm->selected].pid != 0) {
zenith::kill(pm->procs[pm->selected].pid);
montauk::kill(pm->procs[pm->selected].pid);
pm->last_poll_ms = 0; // force refresh
}
}
@@ -211,7 +211,7 @@ static void procmgr_on_key(Window* win, const Zenith::KeyEvent& key) {
static void procmgr_on_close(Window* win) {
if (win->app_data) {
zenith::mfree(win->app_data);
montauk::mfree(win->app_data);
win->app_data = nullptr;
}
}
@@ -226,14 +226,14 @@ void open_procmgr(DesktopState* ds) {
Window* win = &ds->windows[idx];
ProcMgrState* pm = (ProcMgrState*)zenith::malloc(sizeof(ProcMgrState));
zenith::memset(pm, 0, sizeof(ProcMgrState));
ProcMgrState* pm = (ProcMgrState*)montauk::malloc(sizeof(ProcMgrState));
montauk::memset(pm, 0, sizeof(ProcMgrState));
pm->desktop = ds;
pm->selected = -1;
pm->last_poll_ms = 0;
// Initial poll
pm->proc_count = zenith::proclist(pm->procs, PM_MAX_PROCS);
pm->proc_count = montauk::proclist(pm->procs, PM_MAX_PROCS);
win->app_data = pm;
win->on_draw = procmgr_on_draw;
+17 -17
View File
@@ -1,6 +1,6 @@
/*
* app_settings.cpp
* ZenithOS Desktop - Settings application
* MontaukOS Desktop - Settings application
* Copyright (c) 2026 Daniel Hammer
*/
@@ -14,7 +14,7 @@
struct SettingsState {
DesktopState* desktop;
int active_tab; // 0=Appearance, 1=Display, 2=About
Zenith::SysInfo sys_info;
Montauk::SysInfo sys_info;
uint64_t uptime_ms;
WallpaperFileList wp_files;
bool wp_scanned;
@@ -180,11 +180,11 @@ static void settings_draw_appearance(Canvas& c, SettingsState* st) {
for (int i = 0; i < st->wp_files.count && i < 8; i++) {
// Build full path for comparison
char fullpath[256];
zenith::strcpy(fullpath, "0:/home/");
montauk::strcpy(fullpath, "0:/home/");
str_append(fullpath, st->wp_files.names[i], 256);
bool selected = s.bg_image &&
zenith::streq(s.bg_image_path, fullpath);
montauk::streq(s.bg_image_path, fullpath);
if (selected) {
c.fill_rounded_rect(x, y, c.w - 2 * x, WP_ITEM_H, 3, accent);
@@ -192,15 +192,15 @@ static void settings_draw_appearance(Canvas& c, SettingsState* st) {
// Truncate long filenames
char label[40];
int nlen = zenith::slen(st->wp_files.names[i]);
int nlen = montauk::slen(st->wp_files.names[i]);
if (nlen > 35) {
zenith::strncpy(label, st->wp_files.names[i], 32);
montauk::strncpy(label, st->wp_files.names[i], 32);
label[32] = '.';
label[33] = '.';
label[34] = '.';
label[35] = '\0';
} else {
zenith::strncpy(label, st->wp_files.names[i], 39);
montauk::strncpy(label, st->wp_files.names[i], 39);
}
Color tc = selected ? colors::WHITE : colors::TEXT_COLOR;
@@ -292,7 +292,7 @@ static void settings_draw_display(Canvas& c, SettingsState* st) {
}
static void settings_draw_about(Canvas& c, SettingsState* st) {
st->uptime_ms = zenith::get_milliseconds();
st->uptime_ms = montauk::get_milliseconds();
Color dim = Color::from_rgb(0x88, 0x88, 0x88);
int x = 16;
@@ -463,7 +463,7 @@ static void settings_on_mouse(Window* win, MouseEvent& ev) {
mx >= x && mx < win->content_w - x) {
// Build full path and load wallpaper
char fullpath[256];
zenith::strcpy(fullpath, "0:/home/");
montauk::strcpy(fullpath, "0:/home/");
str_append(fullpath, st->wp_files.names[i], 256);
wallpaper_load(&s, fullpath,
st->desktop->screen_w, st->desktop->screen_h);
@@ -552,21 +552,21 @@ static void settings_on_mouse(Window* win, MouseEvent& ev) {
if (mx >= bx && mx < bx + sbw && cy >= y && cy < y + btn_h) {
s.ui_scale = 0;
apply_ui_scale(0);
zenith::win_setscale(0);
montauk::win_setscale(0);
return;
}
// Default
if (mx >= bx + sbw + 8 && mx < bx + sbw * 2 + 8 && cy >= y && cy < y + btn_h) {
s.ui_scale = 1;
apply_ui_scale(1);
zenith::win_setscale(1);
montauk::win_setscale(1);
return;
}
// Large
if (mx >= bx + (sbw + 8) * 2 && mx < bx + sbw * 3 + 16 && cy >= y && cy < y + btn_h) {
s.ui_scale = 2;
apply_ui_scale(2);
zenith::win_setscale(2);
montauk::win_setscale(2);
return;
}
}
@@ -578,7 +578,7 @@ static void settings_on_mouse(Window* win, MouseEvent& ev) {
static void settings_on_close(Window* win) {
if (win->app_data) {
zenith::mfree(win->app_data);
montauk::mfree(win->app_data);
win->app_data = nullptr;
}
}
@@ -592,12 +592,12 @@ void open_settings(DesktopState* ds) {
if (idx < 0) return;
Window* win = &ds->windows[idx];
SettingsState* st = (SettingsState*)zenith::malloc(sizeof(SettingsState));
zenith::memset(st, 0, sizeof(SettingsState));
SettingsState* st = (SettingsState*)montauk::malloc(sizeof(SettingsState));
montauk::memset(st, 0, sizeof(SettingsState));
st->desktop = ds;
st->active_tab = 0;
zenith::get_info(&st->sys_info);
st->uptime_ms = zenith::get_milliseconds();
montauk::get_info(&st->sys_info);
st->uptime_ms = montauk::get_milliseconds();
st->wp_scanned = false;
st->wp_files.count = 0;
+10 -10
View File
@@ -1,6 +1,6 @@
/*
* app_sysinfo.cpp
* ZenithOS Desktop - System Info application
* MontaukOS Desktop - System Info application
* Copyright (c) 2026 Daniel Hammer
*/
@@ -11,8 +11,8 @@
// ============================================================================
struct SysInfoState {
Zenith::SysInfo sys_info;
Zenith::NetCfg net_cfg;
Montauk::SysInfo sys_info;
Montauk::NetCfg net_cfg;
uint64_t uptime_ms;
};
@@ -20,7 +20,7 @@ static void sysinfo_on_draw(Window* win, Framebuffer& fb) {
SysInfoState* si = (SysInfoState*)win->app_data;
if (!si) return;
si->uptime_ms = zenith::get_milliseconds();
si->uptime_ms = montauk::get_milliseconds();
Canvas c(win);
c.fill(colors::WINDOW_BG);
@@ -107,7 +107,7 @@ static void sysinfo_on_draw(Window* win, Framebuffer& fb) {
static void sysinfo_on_close(Window* win) {
if (win->app_data) {
zenith::mfree(win->app_data);
montauk::mfree(win->app_data);
win->app_data = nullptr;
}
}
@@ -121,11 +121,11 @@ void open_sysinfo(DesktopState* ds) {
if (idx < 0) return;
Window* win = &ds->windows[idx];
SysInfoState* si = (SysInfoState*)zenith::malloc(sizeof(SysInfoState));
zenith::memset(si, 0, sizeof(SysInfoState));
zenith::get_info(&si->sys_info);
zenith::get_netcfg(&si->net_cfg);
si->uptime_ms = zenith::get_milliseconds();
SysInfoState* si = (SysInfoState*)montauk::malloc(sizeof(SysInfoState));
montauk::memset(si, 0, sizeof(SysInfoState));
montauk::get_info(&si->sys_info);
montauk::get_netcfg(&si->net_cfg);
si->uptime_ms = montauk::get_milliseconds();
win->app_data = si;
win->on_draw = sysinfo_on_draw;
+6 -6
View File
@@ -1,6 +1,6 @@
/*
* app_terminal.cpp
* ZenithOS Desktop - Terminal application
* MontaukOS Desktop - Terminal application
* Copyright (c) 2026 Daniel Hammer
*/
@@ -30,7 +30,7 @@ static void terminal_on_mouse(Window* win, MouseEvent& ev) {
// Terminal doesn't need mouse handling for now
}
static void terminal_on_key(Window* win, const Zenith::KeyEvent& key) {
static void terminal_on_key(Window* win, const Montauk::KeyEvent& key) {
TerminalState* ts = (TerminalState*)win->app_data;
if (!ts) return;
terminal_handle_key(ts, key);
@@ -39,8 +39,8 @@ static void terminal_on_key(Window* win, const Zenith::KeyEvent& key) {
static void terminal_on_close(Window* win) {
TerminalState* ts = (TerminalState*)win->app_data;
if (ts) {
if (ts->cells) zenith::mfree(ts->cells);
zenith::mfree(ts);
if (ts->cells) montauk::mfree(ts->cells);
montauk::mfree(ts);
win->app_data = nullptr;
}
}
@@ -63,8 +63,8 @@ void open_terminal(DesktopState* ds) {
int cols = cr.w / mono_cell_width();
int rows = cr.h / mono_cell_height();
TerminalState* ts = (TerminalState*)zenith::malloc(sizeof(TerminalState));
zenith::memset(ts, 0, sizeof(TerminalState));
TerminalState* ts = (TerminalState*)montauk::malloc(sizeof(TerminalState));
montauk::memset(ts, 0, sizeof(TerminalState));
terminal_init(ts, cols, rows);
win->app_data = ts;
+30 -30
View File
@@ -1,6 +1,6 @@
/*
* app_texteditor.cpp
* ZenithOS Desktop - Text Editor application
* MontaukOS Desktop - Text Editor application
* Single-buffer text editor with line numbers, cursor, scrolling, file I/O
* Copyright (c) 2026 Daniel Hammer
*/
@@ -48,7 +48,7 @@ struct TextEditorState {
static void te_recompute_lines(TextEditorState* te) {
if (!te->line_offsets) {
te->line_offsets = (int*)zenith::malloc(TE_MAX_LINES * sizeof(int));
te->line_offsets = (int*)montauk::malloc(TE_MAX_LINES * sizeof(int));
}
te->line_count = 0;
@@ -94,7 +94,7 @@ static void te_ensure_capacity(TextEditorState* te, int needed) {
int new_cap = te->buf_cap * 2;
if (new_cap > TE_MAX_CAP) new_cap = TE_MAX_CAP;
if (new_cap < te->buf_len + needed) new_cap = te->buf_len + needed;
te->buffer = (char*)zenith::realloc(te->buffer, new_cap);
te->buffer = (char*)montauk::realloc(te->buffer, new_cap);
te->buf_cap = new_cap;
}
@@ -236,21 +236,21 @@ static void te_ensure_cursor_visible(TextEditorState* te, int visible_lines, int
// ============================================================================
static void te_load_file(TextEditorState* te, const char* path) {
int fd = zenith::open(path);
int fd = montauk::open(path);
if (fd < 0) return;
uint64_t size = zenith::getsize(fd);
uint64_t size = montauk::getsize(fd);
if (size > TE_MAX_CAP) size = TE_MAX_CAP;
if ((int)size >= te->buf_cap) {
int new_cap = (int)size + 1024;
if (new_cap > TE_MAX_CAP) new_cap = TE_MAX_CAP;
te->buffer = (char*)zenith::realloc(te->buffer, new_cap);
te->buffer = (char*)montauk::realloc(te->buffer, new_cap);
te->buf_cap = new_cap;
}
zenith::read(fd, (uint8_t*)te->buffer, 0, size);
zenith::close(fd);
montauk::read(fd, (uint8_t*)te->buffer, 0, size);
montauk::close(fd);
te->buf_len = (int)size;
te->cursor_pos = 0;
@@ -258,7 +258,7 @@ static void te_load_file(TextEditorState* te, const char* path) {
te->scroll_x = 0;
te->modified = false;
zenith::strncpy(te->filepath, path, 255);
montauk::strncpy(te->filepath, path, 255);
// Extract filename from path
int last_slash = -1;
@@ -266,9 +266,9 @@ static void te_load_file(TextEditorState* te, const char* path) {
if (path[i] == '/') last_slash = i;
}
if (last_slash >= 0) {
zenith::strncpy(te->filename, path + last_slash + 1, 63);
montauk::strncpy(te->filename, path + last_slash + 1, 63);
} else {
zenith::strncpy(te->filename, path, 63);
montauk::strncpy(te->filename, path, 63);
}
te_recompute_lines(te);
@@ -278,11 +278,11 @@ static void te_load_file(TextEditorState* te, const char* path) {
static void te_save_file(TextEditorState* te) {
if (te->filepath[0] == '\0') return;
int fd = zenith::fcreate(te->filepath);
int fd = montauk::fcreate(te->filepath);
if (fd < 0) return;
zenith::fwrite(fd, (const uint8_t*)te->buffer, 0, te->buf_len);
zenith::close(fd);
montauk::fwrite(fd, (const uint8_t*)te->buffer, 0, te->buf_len);
montauk::close(fd);
te->modified = false;
}
@@ -502,8 +502,8 @@ static void texteditor_on_mouse(Window* win, MouseEvent& ev) {
te->show_pathbar = !te->show_pathbar;
if (te->show_pathbar) {
// Pre-fill with current filepath
zenith::strncpy(te->pathbar_text, te->filepath, 255);
te->pathbar_len = zenith::slen(te->pathbar_text);
montauk::strncpy(te->pathbar_text, te->filepath, 255);
te->pathbar_len = montauk::slen(te->pathbar_text);
te->pathbar_cursor = te->pathbar_len;
}
return;
@@ -529,7 +529,7 @@ static void texteditor_on_mouse(Window* win, MouseEvent& ev) {
// Update window title
char title[64];
snprintf(title, 64, "%s - Editor", te->filename);
zenith::strncpy(win->title, title, 63);
montauk::strncpy(win->title, title, 63);
te->show_pathbar = false;
}
}
@@ -566,7 +566,7 @@ static void texteditor_on_mouse(Window* win, MouseEvent& ev) {
// Keyboard handling
// ============================================================================
static void texteditor_on_key(Window* win, const Zenith::KeyEvent& key) {
static void texteditor_on_key(Window* win, const Montauk::KeyEvent& key) {
TextEditorState* te = (TextEditorState*)win->app_data;
if (!te || !key.pressed) return;
@@ -577,7 +577,7 @@ static void texteditor_on_key(Window* win, const Zenith::KeyEvent& key) {
te_load_file(te, te->pathbar_text);
char title[64];
snprintf(title, 64, "%s - Editor", te->filename);
zenith::strncpy(win->title, title, 63);
montauk::strncpy(win->title, title, 63);
te->show_pathbar = false;
}
return;
@@ -628,8 +628,8 @@ static void texteditor_on_key(Window* win, const Zenith::KeyEvent& key) {
if (key.ctrl && (key.ascii == 'o' || key.ascii == 'O')) {
te->show_pathbar = !te->show_pathbar;
if (te->show_pathbar) {
zenith::strncpy(te->pathbar_text, te->filepath, 255);
te->pathbar_len = zenith::slen(te->pathbar_text);
montauk::strncpy(te->pathbar_text, te->filepath, 255);
te->pathbar_len = montauk::slen(te->pathbar_text);
te->pathbar_cursor = te->pathbar_len;
}
return;
@@ -678,9 +678,9 @@ static void texteditor_on_key(Window* win, const Zenith::KeyEvent& key) {
static void texteditor_on_close(Window* win) {
TextEditorState* te = (TextEditorState*)win->app_data;
if (te) {
if (te->buffer) zenith::mfree(te->buffer);
if (te->line_offsets) zenith::mfree(te->line_offsets);
zenith::mfree(te);
if (te->buffer) montauk::mfree(te->buffer);
if (te->line_offsets) montauk::mfree(te->line_offsets);
montauk::mfree(te);
win->app_data = nullptr;
}
}
@@ -694,10 +694,10 @@ void open_texteditor(DesktopState* ds) {
if (idx < 0) return;
Window* win = &ds->windows[idx];
TextEditorState* te = (TextEditorState*)zenith::malloc(sizeof(TextEditorState));
zenith::memset(te, 0, sizeof(TextEditorState));
TextEditorState* te = (TextEditorState*)montauk::malloc(sizeof(TextEditorState));
montauk::memset(te, 0, sizeof(TextEditorState));
te->buffer = (char*)zenith::malloc(TE_INIT_CAP);
te->buffer = (char*)montauk::malloc(TE_INIT_CAP);
te->buf_cap = TE_INIT_CAP;
te->buf_len = 0;
te->modified = false;
@@ -731,10 +731,10 @@ void open_texteditor_with_file(DesktopState* ds, const char* path) {
if (idx < 0) return;
Window* win = &ds->windows[idx];
TextEditorState* te = (TextEditorState*)zenith::malloc(sizeof(TextEditorState));
zenith::memset(te, 0, sizeof(TextEditorState));
TextEditorState* te = (TextEditorState*)montauk::malloc(sizeof(TextEditorState));
montauk::memset(te, 0, sizeof(TextEditorState));
te->buffer = (char*)zenith::malloc(TE_INIT_CAP);
te->buffer = (char*)montauk::malloc(TE_INIT_CAP);
te->buf_cap = TE_INIT_CAP;
te->buf_len = 0;
te->modified = false;
+2 -2
View File
@@ -1,6 +1,6 @@
/*
* app_weather.cpp
* ZenithOS Desktop - Weather app launcher
* MontaukOS Desktop - Weather app launcher
* Spawns weather.elf as a standalone Window Server process
* Copyright (c) 2026 Daniel Hammer
*/
@@ -9,5 +9,5 @@
void open_weather(DesktopState* ds) {
(void)ds;
zenith::spawn("0:/os/weather.elf");
montauk::spawn("0:/os/weather.elf");
}
+2 -2
View File
@@ -1,6 +1,6 @@
/*
* app_wiki.cpp
* ZenithOS Desktop - Wikipedia launcher
* MontaukOS Desktop - Wikipedia launcher
* Spawns wikipedia.elf as a standalone Window Server process
* Copyright (c) 2026 Daniel Hammer
*/
@@ -9,5 +9,5 @@
void open_wiki(DesktopState* ds) {
(void)ds;
zenith::spawn("0:/os/wikipedia.elf");
montauk::spawn("0:/os/wikipedia.elf");
}
+4 -4
View File
@@ -6,9 +6,9 @@
#pragma once
#include <zenith/syscall.h>
#include <zenith/string.h>
#include <zenith/heap.h>
#include <montauk/syscall.h>
#include <montauk/string.h>
#include <montauk/heap.h>
#include <gui/gui.hpp>
#include <gui/framebuffer.hpp>
#include <gui/font.hpp>
@@ -95,7 +95,7 @@ inline int snprintf(char* buf, int size, const char* fmt, ...) {
// ============================================================================
inline void str_append(char* dst, const char* src, int max) {
int len = zenith::slen(dst);
int len = montauk::slen(dst);
int i = 0;
while (src[i] && len < max - 1) {
dst[len++] = src[i++];
+81 -81
View File
@@ -1,6 +1,6 @@
/*
* main.cpp
* ZenithOS Desktop Environment - window manager, compositor, and run loop
* MontaukOS Desktop Environment - window manager, compositor, and run loop
* Copyright (c) 2026 Daniel Hammer
*/
@@ -32,8 +32,8 @@ void gui::desktop_init(DesktopState* ds) {
ds->prev_buttons = 0;
ds->app_menu_open = false;
zenith::memset(&ds->mouse, 0, sizeof(Zenith::MouseState));
zenith::set_mouse_bounds(ds->screen_w - 1, ds->screen_h - 1);
montauk::memset(&ds->mouse, 0, sizeof(Montauk::MouseState));
montauk::set_mouse_bounds(ds->screen_w - 1, ds->screen_h - 1);
// Load SVG icons — scalable (colorful) for app menu, symbolic for toolbar/panel
Color defColor = colors::ICON_COLOR;
@@ -87,17 +87,17 @@ void gui::desktop_init(DesktopState* ds) {
ds->settings.ui_scale = 1;
// Try to load default wallpaper
wallpaper_load(&ds->settings, "0:/home/troy-olson-MhYIwOiyZpM-unsplash.jpg",
wallpaper_load(&ds->settings, "0:/home/gustav-gullstrand-d6kSvT2xZQo-unsplash.jpg",
ds->screen_w, ds->screen_h);
zenith::win_setscale(1);
montauk::win_setscale(1);
ds->ctx_menu_open = false;
ds->ctx_menu_x = 0;
ds->ctx_menu_y = 0;
ds->net_popup_open = false;
zenith::get_netcfg(&ds->cached_net_cfg);
ds->net_cfg_last_poll = zenith::get_milliseconds();
montauk::get_netcfg(&ds->cached_net_cfg);
ds->net_cfg_last_poll = montauk::get_milliseconds();
ds->net_icon_rect = {0, 0, 0, 0};
}
@@ -107,9 +107,9 @@ int gui::desktop_create_window(DesktopState* ds, const char* title, int x, int y
int idx = ds->window_count;
Window* win = &ds->windows[idx];
zenith::memset(win, 0, sizeof(Window));
montauk::memset(win, 0, sizeof(Window));
zenith::strncpy(win->title, title, MAX_TITLE_LEN);
montauk::strncpy(win->title, title, MAX_TITLE_LEN);
win->frame = {x, y, w, h};
win->state = WIN_NORMAL;
win->z_order = idx;
@@ -124,8 +124,8 @@ int gui::desktop_create_window(DesktopState* ds, const char* title, int x, int y
win->content_w = cr.w;
win->content_h = cr.h;
int buf_size = cr.w * cr.h * 4;
win->content = (uint32_t*)zenith::alloc(buf_size);
zenith::memset(win->content, 0xFF, buf_size);
win->content = (uint32_t*)montauk::alloc(buf_size);
montauk::memset(win->content, 0xFF, buf_size);
win->on_draw = nullptr;
win->on_mouse = nullptr;
@@ -153,17 +153,17 @@ void gui::desktop_close_window(DesktopState* ds, int idx) {
// For external windows, send a close event instead of freeing the buffer
if (win->external) {
Zenith::WinEvent ev;
zenith::memset(&ev, 0, sizeof(ev));
Montauk::WinEvent ev;
montauk::memset(&ev, 0, sizeof(ev));
ev.type = 3; // close
zenith::win_sendevent(win->ext_win_id, &ev);
montauk::win_sendevent(win->ext_win_id, &ev);
}
if (win->on_close) win->on_close(win);
// Free content buffer (skip for external windows — shared memory)
if (win->content && !win->external) {
zenith::free(win->content);
montauk::free(win->content);
win->content = nullptr;
}
@@ -359,7 +359,7 @@ void gui::desktop_draw_panel(DesktopState* ds) {
// Truncate title if too long
char short_title[20];
zenith::strncpy(short_title, win->title, 18);
montauk::strncpy(short_title, win->title, 18);
int tx = indicator_x + pad;
int ty = 4 + (24 - system_font_height()) / 2;
@@ -369,8 +369,8 @@ void gui::desktop_draw_panel(DesktopState* ds) {
}
// Date + Clock (right side)
Zenith::DateTime dt;
zenith::gettime(&dt);
Montauk::DateTime dt;
montauk::gettime(&dt);
char clock_str[12];
if (ds->settings.clock_24h) {
@@ -395,9 +395,9 @@ void gui::desktop_draw_panel(DesktopState* ds) {
draw_text(fb, date_x, clock_y, date_str, colors::PANEL_TEXT);
// Network icon (to the left of the date)
uint64_t now = zenith::get_milliseconds();
uint64_t now = montauk::get_milliseconds();
if (now - ds->net_cfg_last_poll > 5000) {
zenith::get_netcfg(&ds->cached_net_cfg);
montauk::get_netcfg(&ds->cached_net_cfg);
ds->net_cfg_last_poll = now;
}
@@ -574,7 +574,7 @@ static void desktop_draw_net_popup(DesktopState* ds) {
int line_h = system_font_height() + 6;
char line[64];
Zenith::NetCfg& nc = ds->cached_net_cfg;
Montauk::NetCfg& nc = ds->cached_net_cfg;
if (nc.ipAddress != 0) {
char ipbuf[20];
@@ -670,7 +670,7 @@ static void reboot_dialog_on_mouse(Window* win, MouseEvent& ev) {
rs->hover_cancel = cb.contains(lx, ly);
if (ev.left_pressed()) {
if (rs->hover_reboot) zenith::reset();
if (rs->hover_reboot) montauk::reset();
if (rs->hover_cancel) {
for (int i = 0; i < rs->ds->window_count; i++) {
if (rs->ds->windows[i].app_data == rs) {
@@ -682,12 +682,12 @@ static void reboot_dialog_on_mouse(Window* win, MouseEvent& ev) {
}
}
static void reboot_dialog_on_key(Window* win, const Zenith::KeyEvent& key) {
static void reboot_dialog_on_key(Window* win, const Montauk::KeyEvent& key) {
RebootDialogState* rs = (RebootDialogState*)win->app_data;
if (!rs || !key.pressed) return;
if (key.ascii == '\n' || key.ascii == '\r') {
zenith::reset();
montauk::reset();
}
if (key.scancode == 0x01) { // Escape
for (int i = 0; i < rs->ds->window_count; i++) {
@@ -701,7 +701,7 @@ static void reboot_dialog_on_key(Window* win, const Zenith::KeyEvent& key) {
static void reboot_dialog_on_close(Window* win) {
if (win->app_data) {
zenith::mfree(win->app_data);
montauk::mfree(win->app_data);
win->app_data = nullptr;
}
}
@@ -713,8 +713,8 @@ void open_reboot_dialog(DesktopState* ds) {
if (idx < 0) return;
Window* win = &ds->windows[idx];
RebootDialogState* rs = (RebootDialogState*)zenith::malloc(sizeof(RebootDialogState));
zenith::memset(rs, 0, sizeof(RebootDialogState));
RebootDialogState* rs = (RebootDialogState*)montauk::malloc(sizeof(RebootDialogState));
montauk::memset(rs, 0, sizeof(RebootDialogState));
rs->ds = ds;
win->app_data = rs;
@@ -782,7 +782,7 @@ static void shutdown_dialog_on_mouse(Window* win, MouseEvent& ev) {
ss->hover_cancel = cb.contains(lx, ly);
if (ev.left_pressed()) {
if (ss->hover_shutdown) zenith::shutdown();
if (ss->hover_shutdown) montauk::shutdown();
if (ss->hover_cancel) {
for (int i = 0; i < ss->ds->window_count; i++) {
if (ss->ds->windows[i].app_data == ss) {
@@ -794,12 +794,12 @@ static void shutdown_dialog_on_mouse(Window* win, MouseEvent& ev) {
}
}
static void shutdown_dialog_on_key(Window* win, const Zenith::KeyEvent& key) {
static void shutdown_dialog_on_key(Window* win, const Montauk::KeyEvent& key) {
ShutdownDialogState* ss = (ShutdownDialogState*)win->app_data;
if (!ss || !key.pressed) return;
if (key.ascii == '\n' || key.ascii == '\r') {
zenith::shutdown();
montauk::shutdown();
}
if (key.scancode == 0x01) { // Escape
for (int i = 0; i < ss->ds->window_count; i++) {
@@ -813,7 +813,7 @@ static void shutdown_dialog_on_key(Window* win, const Zenith::KeyEvent& key) {
static void shutdown_dialog_on_close(Window* win) {
if (win->app_data) {
zenith::mfree(win->app_data);
montauk::mfree(win->app_data);
win->app_data = nullptr;
}
}
@@ -825,8 +825,8 @@ void open_shutdown_dialog(DesktopState* ds) {
if (idx < 0) return;
Window* win = &ds->windows[idx];
ShutdownDialogState* ss = (ShutdownDialogState*)zenith::malloc(sizeof(ShutdownDialogState));
zenith::memset(ss, 0, sizeof(ShutdownDialogState));
ShutdownDialogState* ss = (ShutdownDialogState*)montauk::malloc(sizeof(ShutdownDialogState));
montauk::memset(ss, 0, sizeof(ShutdownDialogState));
ss->ds = ds;
win->app_data = ss;
@@ -1100,20 +1100,20 @@ void gui::desktop_handle_mouse(DesktopState* ds) {
if (!win->external) {
Rect cr = win->content_rect();
if (cr.w != win->content_w || cr.h != win->content_h) {
if (win->content) zenith::free(win->content);
if (win->content) montauk::free(win->content);
win->content_w = cr.w;
win->content_h = cr.h;
win->content = (uint32_t*)zenith::alloc(cr.w * cr.h * 4);
zenith::memset(win->content, 0xFF, cr.w * cr.h * 4);
win->content = (uint32_t*)montauk::alloc(cr.w * cr.h * 4);
montauk::memset(win->content, 0xFF, cr.w * cr.h * 4);
}
} else {
Rect cr = win->content_rect();
Zenith::WinEvent rev;
zenith::memset(&rev, 0, sizeof(rev));
Montauk::WinEvent rev;
montauk::memset(&rev, 0, sizeof(rev));
rev.type = 2;
rev.resize.w = cr.w;
rev.resize.h = cr.h;
zenith::win_sendevent(win->ext_win_id, &rev);
montauk::win_sendevent(win->ext_win_id, &rev);
}
} else if (mx >= ds->screen_w - 1) {
win->saved_frame = win->frame;
@@ -1122,20 +1122,20 @@ void gui::desktop_handle_mouse(DesktopState* ds) {
if (!win->external) {
Rect cr = win->content_rect();
if (cr.w != win->content_w || cr.h != win->content_h) {
if (win->content) zenith::free(win->content);
if (win->content) montauk::free(win->content);
win->content_w = cr.w;
win->content_h = cr.h;
win->content = (uint32_t*)zenith::alloc(cr.w * cr.h * 4);
zenith::memset(win->content, 0xFF, cr.w * cr.h * 4);
win->content = (uint32_t*)montauk::alloc(cr.w * cr.h * 4);
montauk::memset(win->content, 0xFF, cr.w * cr.h * 4);
}
} else {
Rect cr = win->content_rect();
Zenith::WinEvent rev;
zenith::memset(&rev, 0, sizeof(rev));
Montauk::WinEvent rev;
montauk::memset(&rev, 0, sizeof(rev));
rev.type = 2;
rev.resize.w = cr.w;
rev.resize.h = cr.h;
zenith::win_sendevent(win->ext_win_id, &rev);
montauk::win_sendevent(win->ext_win_id, &rev);
}
}
}
@@ -1188,21 +1188,21 @@ void gui::desktop_handle_mouse(DesktopState* ds) {
if (!win->external) {
Rect cr = win->content_rect();
if (cr.w != win->content_w || cr.h != win->content_h) {
if (win->content) zenith::free(win->content);
if (win->content) montauk::free(win->content);
win->content_w = cr.w;
win->content_h = cr.h;
win->content = (uint32_t*)zenith::alloc(cr.w * cr.h * 4);
zenith::memset(win->content, 0xFF, cr.w * cr.h * 4);
win->content = (uint32_t*)montauk::alloc(cr.w * cr.h * 4);
montauk::memset(win->content, 0xFF, cr.w * cr.h * 4);
}
win->dirty = true;
} else {
Rect cr = win->content_rect();
Zenith::WinEvent rev;
zenith::memset(&rev, 0, sizeof(rev));
Montauk::WinEvent rev;
montauk::memset(&rev, 0, sizeof(rev));
rev.type = 2;
rev.resize.w = cr.w;
rev.resize.h = cr.h;
zenith::win_sendevent(win->ext_win_id, &rev);
montauk::win_sendevent(win->ext_win_id, &rev);
}
}
return;
@@ -1355,20 +1355,20 @@ void gui::desktop_handle_mouse(DesktopState* ds) {
if (!win->external) {
Rect cr = win->content_rect();
if (cr.w != win->content_w || cr.h != win->content_h) {
if (win->content) zenith::free(win->content);
if (win->content) montauk::free(win->content);
win->content_w = cr.w;
win->content_h = cr.h;
win->content = (uint32_t*)zenith::alloc(cr.w * cr.h * 4);
zenith::memset(win->content, 0xFF, cr.w * cr.h * 4);
win->content = (uint32_t*)montauk::alloc(cr.w * cr.h * 4);
montauk::memset(win->content, 0xFF, cr.w * cr.h * 4);
}
} else {
Rect cr = win->content_rect();
Zenith::WinEvent rev;
zenith::memset(&rev, 0, sizeof(rev));
Montauk::WinEvent rev;
montauk::memset(&rev, 0, sizeof(rev));
rev.type = 2;
rev.resize.w = cr.w;
rev.resize.h = cr.h;
zenith::win_sendevent(win->ext_win_id, &rev);
montauk::win_sendevent(win->ext_win_id, &rev);
}
desktop_raise_window(ds, i);
return;
@@ -1416,15 +1416,15 @@ void gui::desktop_handle_mouse(DesktopState* ds) {
Window* raised = &ds->windows[new_idx];
if (raised->external) {
// Forward mouse event to external window
Zenith::WinEvent wev;
zenith::memset(&wev, 0, sizeof(wev));
Montauk::WinEvent wev;
montauk::memset(&wev, 0, sizeof(wev));
wev.type = 1; // mouse
wev.mouse.x = mx - cr.x;
wev.mouse.y = my - cr.y;
wev.mouse.scroll = ev.scroll;
wev.mouse.buttons = buttons;
wev.mouse.prev_buttons = prev;
zenith::win_sendevent(raised->ext_win_id, &wev);
montauk::win_sendevent(raised->ext_win_id, &wev);
} else if (raised->on_mouse) {
ev.x = mx;
ev.y = my;
@@ -1450,15 +1450,15 @@ void gui::desktop_handle_mouse(DesktopState* ds) {
Rect cr = win->content_rect();
if (cr.contains(mx, my)) {
if (win->external) {
Zenith::WinEvent wev;
zenith::memset(&wev, 0, sizeof(wev));
Montauk::WinEvent wev;
montauk::memset(&wev, 0, sizeof(wev));
wev.type = 1; // mouse
wev.mouse.x = mx - cr.x;
wev.mouse.y = my - cr.y;
wev.mouse.scroll = ev.scroll;
wev.mouse.buttons = buttons;
wev.mouse.prev_buttons = prev;
zenith::win_sendevent(win->ext_win_id, &wev);
montauk::win_sendevent(win->ext_win_id, &wev);
} else if (win->on_mouse) {
win->on_mouse(win, ev);
}
@@ -1486,7 +1486,7 @@ void gui::desktop_handle_mouse(DesktopState* ds) {
}
}
void gui::desktop_handle_keyboard(DesktopState* ds, const Zenith::KeyEvent& key) {
void gui::desktop_handle_keyboard(DesktopState* ds, const Montauk::KeyEvent& key) {
// Global shortcuts (only on key press)
if (key.pressed && key.ctrl && key.alt) {
if (key.ascii == 't' || key.ascii == 'T') {
@@ -1524,11 +1524,11 @@ void gui::desktop_handle_keyboard(DesktopState* ds, const Zenith::KeyEvent& key)
Window* win = &ds->windows[ds->focused_window];
if (win->external) {
// Forward key event to external window via syscall
Zenith::WinEvent ev;
zenith::memset(&ev, 0, sizeof(ev));
Montauk::WinEvent ev;
montauk::memset(&ev, 0, sizeof(ev));
ev.type = 0; // key
ev.key = key;
zenith::win_sendevent(win->ext_win_id, &ev);
montauk::win_sendevent(win->ext_win_id, &ev);
} else if (win->on_key) {
win->on_key(win, key);
}
@@ -1540,8 +1540,8 @@ void gui::desktop_handle_keyboard(DesktopState* ds, const Zenith::KeyEvent& key)
// ============================================================================
void desktop_poll_external_windows(DesktopState* ds) {
Zenith::WinInfo extWins[8];
int extCount = zenith::win_enumerate(extWins, 8);
Montauk::WinInfo extWins[8];
int extCount = montauk::win_enumerate(extWins, 8);
// Check for new external windows and map them
for (int e = 0; e < extCount; e++) {
@@ -1559,7 +1559,7 @@ void desktop_poll_external_windows(DesktopState* ds) {
// Re-map if external app resized its buffer
if (extWins[e].width != ds->windows[i].content_w ||
extWins[e].height != ds->windows[i].content_h) {
uint64_t va = zenith::win_map(extId);
uint64_t va = montauk::win_map(extId);
if (va != 0) {
ds->windows[i].content = (uint32_t*)va;
ds->windows[i].content_w = extWins[e].width;
@@ -1573,14 +1573,14 @@ void desktop_poll_external_windows(DesktopState* ds) {
if (!found && ds->window_count < MAX_WINDOWS) {
// Map the pixel buffer into our address space
uint64_t va = zenith::win_map(extId);
uint64_t va = montauk::win_map(extId);
if (va == 0) continue;
int idx = ds->window_count;
Window* win = &ds->windows[idx];
zenith::memset(win, 0, sizeof(Window));
montauk::memset(win, 0, sizeof(Window));
zenith::strncpy(win->title, extWins[e].title, MAX_TITLE_LEN);
montauk::strncpy(win->title, extWins[e].title, MAX_TITLE_LEN);
int w = extWins[e].width;
int h = extWins[e].height;
// Position the window centered-ish
@@ -1643,12 +1643,12 @@ void gui::desktop_run(DesktopState* ds) {
for (;;) {
// Poll mouse state
ds->prev_buttons = ds->mouse.buttons;
zenith::mouse_state(&ds->mouse);
montauk::mouse_state(&ds->mouse);
// Poll keyboard events
while (zenith::is_key_available()) {
Zenith::KeyEvent key;
zenith::getkey(&key);
while (montauk::is_key_available()) {
Montauk::KeyEvent key;
montauk::getkey(&key);
desktop_handle_keyboard(ds, key);
}
@@ -1672,7 +1672,7 @@ void gui::desktop_run(DesktopState* ds) {
ds->fb.flip();
// Target ~60fps
zenith::sleep_ms(16);
montauk::sleep_ms(16);
}
}
@@ -1683,8 +1683,8 @@ void gui::desktop_run(DesktopState* ds) {
static DesktopState* g_desktop;
extern "C" void _start() {
DesktopState* ds = (DesktopState*)zenith::malloc(sizeof(DesktopState));
zenith::memset(ds, 0, sizeof(DesktopState));
DesktopState* ds = (DesktopState*)montauk::malloc(sizeof(DesktopState));
montauk::memset(ds, 0, sizeof(DesktopState));
// Placement-new the Framebuffer since it has a constructor
new (&ds->fb) Framebuffer();
@@ -1694,5 +1694,5 @@ extern "C" void _start() {
desktop_init(ds);
desktop_run(ds);
zenith::exit(0);
montauk::exit(0);
}
+8 -8
View File
@@ -1,13 +1,13 @@
/*
* stb_truetype_impl.cpp
* Single compilation unit for stb_truetype in ZenithOS freestanding environment
* Single compilation unit for stb_truetype in MontaukOS freestanding environment
* Copyright (c) 2026 Daniel Hammer
*/
#include <cstdint>
#include <cstddef>
#include <zenith/heap.h>
#include <zenith/string.h>
#include <montauk/heap.h>
#include <montauk/string.h>
#include <gui/stb_math.h>
// Override all stb_truetype dependencies before including the implementation
@@ -21,13 +21,13 @@
#define STBTT_acos(x) stb_acos(x)
#define STBTT_fabs(x) stb_fabs(x)
#define STBTT_malloc(x,u) ((void)(u), zenith::malloc(x))
#define STBTT_free(x,u) ((void)(u), zenith::mfree(x))
#define STBTT_malloc(x,u) ((void)(u), montauk::malloc(x))
#define STBTT_free(x,u) ((void)(u), montauk::mfree(x))
#define STBTT_memcpy(d,s,n) zenith::memcpy(d,s,n)
#define STBTT_memset(d,v,n) zenith::memset(d,v,n)
#define STBTT_memcpy(d,s,n) montauk::memcpy(d,s,n)
#define STBTT_memset(d,v,n) montauk::memset(d,v,n)
#define STBTT_strlen(x) zenith::slen(x)
#define STBTT_strlen(x) montauk::slen(x)
#define STBTT_assert(x) ((void)(x))
+22 -22
View File
@@ -1,14 +1,14 @@
/*
* wallpaper.hpp
* ZenithOS Desktop - JPEG wallpaper loading, scaling, and directory scanning
* MontaukOS Desktop - JPEG wallpaper loading, scaling, and directory scanning
* Copyright (c) 2026 Daniel Hammer
*/
#pragma once
#include <zenith/syscall.h>
#include <zenith/string.h>
#include <zenith/heap.h>
#include <montauk/syscall.h>
#include <montauk/string.h>
#include <montauk/heap.h>
#include <gui/gui.hpp>
#include <gui/desktop.hpp>
@@ -35,41 +35,41 @@ inline bool wallpaper_load(DesktopSettings* s, const char* path,
int screen_w, int screen_h) {
// Free existing wallpaper
if (s->bg_wallpaper) {
zenith::mfree(s->bg_wallpaper);
montauk::mfree(s->bg_wallpaper);
s->bg_wallpaper = nullptr;
s->bg_wallpaper_w = 0;
s->bg_wallpaper_h = 0;
}
// Read file
int fd = zenith::open(path);
int fd = montauk::open(path);
if (fd < 0) return false;
uint64_t size = zenith::getsize(fd);
uint64_t size = montauk::getsize(fd);
if (size == 0 || size > 16 * 1024 * 1024) {
zenith::close(fd);
montauk::close(fd);
return false;
}
uint8_t* filedata = (uint8_t*)zenith::malloc(size);
if (!filedata) { zenith::close(fd); return false; }
uint8_t* filedata = (uint8_t*)montauk::malloc(size);
if (!filedata) { montauk::close(fd); return false; }
int bytes_read = zenith::read(fd, filedata, 0, size);
zenith::close(fd);
if (bytes_read <= 0) { zenith::mfree(filedata); return false; }
int bytes_read = montauk::read(fd, filedata, 0, size);
montauk::close(fd);
if (bytes_read <= 0) { montauk::mfree(filedata); return false; }
// Decode JPEG
int img_w, img_h, channels;
unsigned char* rgb = stbi_load_from_memory(filedata, bytes_read,
&img_w, &img_h, &channels, 3);
zenith::mfree(filedata);
montauk::mfree(filedata);
if (!rgb) return false;
// Scale to cover screen (crop to fill, maintain aspect ratio)
int dst_w = screen_w;
int dst_h = screen_h;
uint32_t* scaled = (uint32_t*)zenith::malloc((uint64_t)dst_w * dst_h * 4);
uint32_t* scaled = (uint32_t*)montauk::malloc((uint64_t)dst_w * dst_h * 4);
if (!scaled) { stbi_image_free(rgb); return false; }
// Compute source crop region for "cover" scaling
@@ -110,7 +110,7 @@ inline bool wallpaper_load(DesktopSettings* s, const char* path,
s->bg_wallpaper = scaled;
s->bg_wallpaper_w = dst_w;
s->bg_wallpaper_h = dst_h;
zenith::strncpy(s->bg_image_path, path, 127);
montauk::strncpy(s->bg_image_path, path, 127);
s->bg_image = true;
s->bg_gradient = false;
@@ -119,7 +119,7 @@ inline bool wallpaper_load(DesktopSettings* s, const char* path,
inline void wallpaper_free(DesktopSettings* s) {
if (s->bg_wallpaper) {
zenith::mfree(s->bg_wallpaper);
montauk::mfree(s->bg_wallpaper);
s->bg_wallpaper = nullptr;
s->bg_wallpaper_w = 0;
s->bg_wallpaper_h = 0;
@@ -143,7 +143,7 @@ inline void wallpaper_scan_dir(const char* dir_path, WallpaperFileList* list) {
list->count = 0;
const char* raw_names[64];
int total = zenith::readdir(dir_path, raw_names, 64);
int total = montauk::readdir(dir_path, raw_names, 64);
if (total <= 0) return;
// Compute prefix to strip (readdir returns full paths from VFS root)
@@ -157,8 +157,8 @@ inline void wallpaper_scan_dir(const char* dir_path, WallpaperFileList* list) {
char prefix[256] = {0};
int prefix_len = 0;
if (after_drive[0] != '\0') {
zenith::strcpy(prefix, after_drive);
prefix_len = zenith::slen(prefix);
montauk::strcpy(prefix, after_drive);
prefix_len = montauk::slen(prefix);
if (prefix_len > 0 && prefix[prefix_len - 1] != '/') {
prefix[prefix_len++] = '/';
prefix[prefix_len] = '\0';
@@ -181,7 +181,7 @@ inline void wallpaper_scan_dir(const char* dir_path, WallpaperFileList* list) {
if (match) name += prefix_len;
}
int nlen = zenith::slen(name);
int nlen = montauk::slen(name);
// Skip directories
if (nlen > 0 && name[nlen - 1] == '/') continue;
@@ -206,7 +206,7 @@ inline void wallpaper_scan_dir(const char* dir_path, WallpaperFileList* list) {
}
if (is_jpeg) {
zenith::strncpy(list->names[list->count], name, 63);
montauk::strncpy(list->names[list->count], name, 63);
list->count++;
}
}