cleanup: namespace Montauk (capital M) => montauk::abi
This commit is contained in:
@@ -452,7 +452,7 @@ static bool apply_move(MoveDir dir) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool handle_key(const Montauk::KeyEvent& key) {
|
||||
static bool handle_key(const montauk::abi::KeyEvent& key) {
|
||||
if (!key.pressed) return false;
|
||||
|
||||
if (key.scancode == 0x01)
|
||||
@@ -478,7 +478,7 @@ static bool handle_key(const Montauk::KeyEvent& key) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool handle_mouse(const Montauk::WinEvent& ev) {
|
||||
static bool handle_mouse(const montauk::abi::WinEvent& ev) {
|
||||
int old_x = g_mouse_x;
|
||||
int old_y = g_mouse_y;
|
||||
g_mouse_x = ev.mouse.x;
|
||||
@@ -511,7 +511,7 @@ extern "C" void _start() {
|
||||
render();
|
||||
|
||||
while (true) {
|
||||
Montauk::WinEvent ev;
|
||||
montauk::abi::WinEvent ev;
|
||||
int r = g_win.poll(&ev);
|
||||
|
||||
if (r < 0) break;
|
||||
|
||||
@@ -53,7 +53,7 @@ static WsWindow g_win;
|
||||
static int g_master_vol = 80;
|
||||
static bool g_master_muted = false;
|
||||
|
||||
static Montauk::AudioStreamInfo g_streams[8];
|
||||
static montauk::abi::AudioStreamInfo g_streams[8];
|
||||
static int g_stream_count = 0;
|
||||
|
||||
// Drag target: -2 = none, -1 = master, 0..N-1 = stream slot in g_streams.
|
||||
@@ -385,7 +385,7 @@ static bool handle_mouse(int mx, int my, uint8_t buttons, uint8_t prev) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool handle_key(const Montauk::KeyEvent& key) {
|
||||
static bool handle_key(const montauk::abi::KeyEvent& key) {
|
||||
if (!key.pressed) return false;
|
||||
if (key.scancode == 0x01) {
|
||||
g_win.closed = true;
|
||||
@@ -428,7 +428,7 @@ extern "C" void _start() {
|
||||
render();
|
||||
|
||||
while (g_win.id >= 0 && !g_win.closed) {
|
||||
Montauk::WinEvent ev;
|
||||
montauk::abi::WinEvent ev;
|
||||
int r = g_win.poll(&ev);
|
||||
|
||||
bool redraw = false;
|
||||
|
||||
@@ -76,16 +76,16 @@ static int g_mouse_y = -1;
|
||||
static int g_hover_row = -1;
|
||||
|
||||
// Adapter info
|
||||
static Montauk::BtAdapterInfo g_adapter;
|
||||
static montauk::abi::BtAdapterInfo g_adapter;
|
||||
static bool g_adapter_ok = false;
|
||||
|
||||
// Connected/paired devices
|
||||
static Montauk::BtDevInfo g_devices[MAX_CONNECTED];
|
||||
static montauk::abi::BtDevInfo g_devices[MAX_CONNECTED];
|
||||
static char g_device_names[MAX_CONNECTED][64];
|
||||
static int g_device_count = 0;
|
||||
|
||||
// Scan results
|
||||
static Montauk::BtScanResult g_scan[MAX_SCAN];
|
||||
static montauk::abi::BtScanResult g_scan[MAX_SCAN];
|
||||
static int g_scan_count = 0;
|
||||
static bool g_scanning = false;
|
||||
|
||||
@@ -268,7 +268,7 @@ static void refresh_devices() {
|
||||
|
||||
// Append bonded (paired) devices that aren't currently connected, so the
|
||||
// Devices tab remembers them across sessions/reboots.
|
||||
Montauk::BtBondInfo bonds[8];
|
||||
montauk::abi::BtBondInfo bonds[8];
|
||||
int nb = montauk::bt_bonds(bonds, 8);
|
||||
for (int i = 0; i < nb && g_device_count < MAX_CONNECTED; i++) {
|
||||
bool already = false;
|
||||
@@ -277,7 +277,7 @@ static void refresh_devices() {
|
||||
}
|
||||
if (already) continue;
|
||||
|
||||
Montauk::BtDevInfo d = {};
|
||||
montauk::abi::BtDevInfo d = {};
|
||||
montauk::memcpy(d.bdAddr, bonds[i].bdAddr, 6);
|
||||
d.connected = 0; // paired but not connected
|
||||
d.encrypted = 0;
|
||||
@@ -642,7 +642,7 @@ static bool handle_adapter_mouse(int mx, int my, uint8_t buttons,
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool handle_adapter_key(const Montauk::KeyEvent& key) {
|
||||
static bool handle_adapter_key(const montauk::abi::KeyEvent& key) {
|
||||
if (key.ascii == '\n' || key.ascii == '\r') { apply_mac(); return true; }
|
||||
if (key.ascii == '\t') { g_mac_focus = !g_mac_focus; return true; }
|
||||
|
||||
@@ -883,7 +883,7 @@ extern "C" void _start() {
|
||||
uint64_t last_refresh = montauk::get_milliseconds();
|
||||
|
||||
while (true) {
|
||||
Montauk::WinEvent ev;
|
||||
montauk::abi::WinEvent ev;
|
||||
int r = win.poll(&ev);
|
||||
|
||||
if (r < 0) break;
|
||||
|
||||
@@ -530,7 +530,7 @@ static void render(Canvas& c) {
|
||||
}
|
||||
}
|
||||
|
||||
static bool handle_mouse(const Montauk::WinEvent& ev, int win_w, int win_h) {
|
||||
static bool handle_mouse(const montauk::abi::WinEvent& ev, int win_w, int win_h) {
|
||||
CalcLayout layout;
|
||||
calc_build_layout(win_w, win_h, &layout);
|
||||
|
||||
@@ -558,7 +558,7 @@ static bool handle_mouse(const Montauk::WinEvent& ev, int win_w, int win_h) {
|
||||
return redraw;
|
||||
}
|
||||
|
||||
static bool handle_key(const Montauk::KeyEvent& key) {
|
||||
static bool handle_key(const montauk::abi::KeyEvent& key) {
|
||||
if (!key.pressed) return false;
|
||||
|
||||
if (key.ascii >= '0' && key.ascii <= '9') {
|
||||
@@ -602,7 +602,7 @@ extern "C" void _start() {
|
||||
win.present();
|
||||
|
||||
while (win.id >= 0 && !win.closed) {
|
||||
Montauk::WinEvent ev;
|
||||
montauk::abi::WinEvent ev;
|
||||
int r = win.poll(&ev);
|
||||
|
||||
if (r < 0) break;
|
||||
|
||||
@@ -21,7 +21,7 @@ static constexpr int COL1_W = 200;
|
||||
static constexpr int SECTION_GAP = 10;
|
||||
|
||||
WsWindow g_win;
|
||||
Montauk::CrashReportInfo g_report = {};
|
||||
montauk::abi::CrashReportInfo g_report = {};
|
||||
int g_scroll = 0;
|
||||
|
||||
// Colors - light theme matching DiskDetail
|
||||
@@ -213,7 +213,7 @@ extern "C" void _start() {
|
||||
render();
|
||||
|
||||
while (true) {
|
||||
Montauk::WinEvent ev;
|
||||
montauk::abi::WinEvent ev;
|
||||
int r = g_win.poll(&ev);
|
||||
if (r < 0) break;
|
||||
if (r == 0) {
|
||||
|
||||
@@ -37,7 +37,7 @@ static const char* month_name(int m) {
|
||||
}
|
||||
|
||||
extern "C" void _start() {
|
||||
Montauk::DateTime dt;
|
||||
montauk::abi::DateTime dt;
|
||||
montauk::gettime(&dt);
|
||||
|
||||
print_int(dt.Day);
|
||||
|
||||
@@ -233,7 +233,7 @@ void open_sleep_dialog(DesktopState* ds);
|
||||
// Hand a graceful power-off request to login.elf and exit the desktop so the
|
||||
// user returns to the login screen, where the shutdown stages run (Bluetooth
|
||||
// teardown, filesystem flush) before the final ACPI power-off / reset. Pass
|
||||
// Montauk::POWER_REQ_SHUTDOWN or Montauk::POWER_REQ_REBOOT.
|
||||
// montauk::abi::POWER_REQ_SHUTDOWN or montauk::abi::POWER_REQ_REBOOT.
|
||||
[[noreturn]] inline void desktop_request_power(int action) {
|
||||
montauk::power_request(action);
|
||||
montauk::exit(0);
|
||||
|
||||
@@ -319,7 +319,7 @@ void filemanager_on_mouse(Window* win, MouseEvent& ev) {
|
||||
}
|
||||
}
|
||||
|
||||
void filemanager_on_key(Window* win, const Montauk::KeyEvent& key) {
|
||||
void filemanager_on_key(Window* win, const montauk::abi::KeyEvent& key) {
|
||||
FileManagerState* fm = (FileManagerState*)win->app_data;
|
||||
if (!fm || !key.pressed) return;
|
||||
|
||||
|
||||
@@ -297,7 +297,7 @@ int filemanager_collect_selection(const FileManagerState* fm, int* out, int max
|
||||
void filemanager_draw_header(Canvas& c, FileManagerState* fm, Color toolbar_color, Color btn_bg);
|
||||
void filemanager_on_draw(Window* win, Framebuffer& fb);
|
||||
void filemanager_on_mouse(Window* win, MouseEvent& ev);
|
||||
void filemanager_on_key(Window* win, const Montauk::KeyEvent& key);
|
||||
void filemanager_on_key(Window* win, const montauk::abi::KeyEvent& key);
|
||||
void filemanager_on_close(Window* win);
|
||||
|
||||
} // namespace filemanager
|
||||
|
||||
@@ -238,7 +238,7 @@ static void fileop_dialog_on_mouse(Window* win, MouseEvent& ev) {
|
||||
}
|
||||
}
|
||||
|
||||
static void fileop_dialog_on_key(Window* win, const Montauk::KeyEvent& key) {
|
||||
static void fileop_dialog_on_key(Window* win, const montauk::abi::KeyEvent& key) {
|
||||
FileOpJob* job = (FileOpJob*)win->app_data;
|
||||
if (!job || !key.pressed) return;
|
||||
if (key.scancode == 0x01) job->cancel = 1; // Escape requests cancel
|
||||
|
||||
@@ -392,7 +392,7 @@ static void props_on_mouse(Window* win, MouseEvent& ev) {
|
||||
props_close_self(st->desktop, st);
|
||||
}
|
||||
|
||||
static void props_on_key(Window* win, const Montauk::KeyEvent& key) {
|
||||
static void props_on_key(Window* win, const montauk::abi::KeyEvent& key) {
|
||||
FilePropertiesDialogState* st = (FilePropertiesDialogState*)win->app_data;
|
||||
if (!st || !key.pressed) return;
|
||||
if (key.scancode == 0x01 || key.ascii == '\n' || key.ascii == '\r')
|
||||
@@ -576,7 +576,7 @@ static void delete_confirm_on_mouse(Window* win, MouseEvent& ev) {
|
||||
}
|
||||
}
|
||||
|
||||
static void delete_confirm_on_key(Window* win, const Montauk::KeyEvent& key) {
|
||||
static void delete_confirm_on_key(Window* win, const montauk::abi::KeyEvent& key) {
|
||||
FileDeleteConfirmDialogState* st = (FileDeleteConfirmDialogState*)win->app_data;
|
||||
if (!st || !key.pressed) return;
|
||||
|
||||
@@ -820,7 +820,7 @@ static void multi_props_on_mouse(Window* win, MouseEvent& ev) {
|
||||
props_close_self(st->desktop, st);
|
||||
}
|
||||
|
||||
static void multi_props_on_key(Window* win, const Montauk::KeyEvent& key) {
|
||||
static void multi_props_on_key(Window* win, const montauk::abi::KeyEvent& key) {
|
||||
MultiPropertiesDialogState* st = (MultiPropertiesDialogState*)win->app_data;
|
||||
if (!st || !key.pressed) return;
|
||||
if (key.scancode == 0x01 || key.ascii == '\n' || key.ascii == '\r')
|
||||
|
||||
@@ -60,7 +60,7 @@ static void settings_on_mouse(Window* win, MouseEvent& ev) {
|
||||
}
|
||||
}
|
||||
|
||||
static void settings_on_key(Window* win, const Montauk::KeyEvent& key) {
|
||||
static void settings_on_key(Window* win, const montauk::abi::KeyEvent& key) {
|
||||
// Settings main window no longer needs keyboard handling.
|
||||
(void)win;
|
||||
(void)key;
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace settings_app {
|
||||
struct SettingsState {
|
||||
DesktopState* desktop;
|
||||
int active_tab; // 0=Appearance, 1=Display, 2=About
|
||||
Montauk::SysInfo sys_info;
|
||||
montauk::abi::SysInfo sys_info;
|
||||
uint64_t uptime_ms;
|
||||
WallpaperFileList wp_files;
|
||||
bool wp_scanned;
|
||||
|
||||
@@ -32,7 +32,7 @@ static void usermanager_on_mouse(Window* win, MouseEvent& ev) {
|
||||
}
|
||||
}
|
||||
|
||||
static void usermanager_on_key(Window* win, const Montauk::KeyEvent& key) {
|
||||
static void usermanager_on_key(Window* win, const montauk::abi::KeyEvent& key) {
|
||||
(void)win;
|
||||
(void)key;
|
||||
}
|
||||
|
||||
@@ -257,7 +257,7 @@ static void adduser_on_mouse(Window* win, MouseEvent& ev) {
|
||||
}
|
||||
}
|
||||
|
||||
static void adduser_on_key(Window* win, const Montauk::KeyEvent& key) {
|
||||
static void adduser_on_key(Window* win, const montauk::abi::KeyEvent& key) {
|
||||
AddUserDialogState* st = (AddUserDialogState*)win->app_data;
|
||||
if (!st || !key.pressed) return;
|
||||
|
||||
@@ -495,7 +495,7 @@ static void chpwd_on_mouse(Window* win, MouseEvent& ev) {
|
||||
}
|
||||
}
|
||||
|
||||
static void chpwd_on_key(Window* win, const Montauk::KeyEvent& key) {
|
||||
static void chpwd_on_key(Window* win, const montauk::abi::KeyEvent& key) {
|
||||
ChPwdDialogState* st = (ChPwdDialogState*)win->app_data;
|
||||
if (!st || !key.pressed) return;
|
||||
|
||||
@@ -647,7 +647,7 @@ static void deluser_on_mouse(Window* win, MouseEvent& ev) {
|
||||
}
|
||||
}
|
||||
|
||||
static void deluser_on_key(Window* win, const Montauk::KeyEvent& key) {
|
||||
static void deluser_on_key(Window* win, const montauk::abi::KeyEvent& key) {
|
||||
DeleteUserDialogState* st = (DeleteUserDialogState*)win->app_data;
|
||||
if (!st || !key.pressed) return;
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ void desktop_draw_lock_screen(DesktopState* ds) {
|
||||
fb.fill_rect_alpha(0, 0, sw, sh, Color::from_rgba(0, 0, 0, 0x80));
|
||||
|
||||
// Clock display above card
|
||||
Montauk::DateTime dt;
|
||||
montauk::abi::DateTime dt;
|
||||
montauk::gettime(&dt);
|
||||
char time_str[12];
|
||||
snprintf(time_str, sizeof(time_str), "%02d:%02d", (int)dt.Hour, (int)dt.Minute);
|
||||
|
||||
@@ -124,7 +124,7 @@ inline int menu_add_external(const char* label, const char* binary, SvgIcon* ico
|
||||
// ============================================================================
|
||||
|
||||
inline bool desktop_window_fullscreen(const gui::Window* win) {
|
||||
return win && win->external && (win->ext_flags & Montauk::WIN_FLAG_FULLSCREEN);
|
||||
return win && win->external && (win->ext_flags & montauk::abi::WIN_FLAG_FULLSCREEN);
|
||||
}
|
||||
|
||||
inline gui::Rect desktop_content_rect(const gui::Window* win) {
|
||||
@@ -160,7 +160,7 @@ inline const char* month_names[] = {
|
||||
|
||||
// launcher.cpp
|
||||
void desktop_init_launcher(gui::DesktopState* ds);
|
||||
bool desktop_handle_launcher_keyboard(gui::DesktopState* ds, const Montauk::KeyEvent& key);
|
||||
bool desktop_handle_launcher_keyboard(gui::DesktopState* ds, const montauk::abi::KeyEvent& key);
|
||||
void desktop_handle_launcher_mouse(gui::DesktopState* ds);
|
||||
void desktop_draw_launcher(gui::DesktopState* ds);
|
||||
uint64_t desktop_launcher_blink_token(const gui::DesktopState* ds, uint64_t now);
|
||||
|
||||
@@ -69,7 +69,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) desktop_request_power(Montauk::POWER_REQ_REBOOT);
|
||||
if (rs->hover_reboot) desktop_request_power(montauk::abi::POWER_REQ_REBOOT);
|
||||
if (rs->hover_cancel) {
|
||||
for (int i = 0; i < rs->ds->window_count; i++) {
|
||||
if (rs->ds->windows[i].app_data == rs) {
|
||||
@@ -81,12 +81,12 @@ static void reboot_dialog_on_mouse(Window* win, MouseEvent& ev) {
|
||||
}
|
||||
}
|
||||
|
||||
static void reboot_dialog_on_key(Window* win, const Montauk::KeyEvent& key) {
|
||||
static void reboot_dialog_on_key(Window* win, const montauk::abi::KeyEvent& key) {
|
||||
RebootDialogState* rs = (RebootDialogState*)win->app_data;
|
||||
if (!rs || !key.pressed) return;
|
||||
|
||||
if (key.ascii == '\n' || key.ascii == '\r') {
|
||||
desktop_request_power(Montauk::POWER_REQ_REBOOT);
|
||||
desktop_request_power(montauk::abi::POWER_REQ_REBOOT);
|
||||
}
|
||||
if (key.scancode == 0x01) { // Escape
|
||||
for (int i = 0; i < rs->ds->window_count; i++) {
|
||||
@@ -181,7 +181,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) desktop_request_power(Montauk::POWER_REQ_SHUTDOWN);
|
||||
if (ss->hover_shutdown) desktop_request_power(montauk::abi::POWER_REQ_SHUTDOWN);
|
||||
if (ss->hover_cancel) {
|
||||
for (int i = 0; i < ss->ds->window_count; i++) {
|
||||
if (ss->ds->windows[i].app_data == ss) {
|
||||
@@ -193,12 +193,12 @@ static void shutdown_dialog_on_mouse(Window* win, MouseEvent& ev) {
|
||||
}
|
||||
}
|
||||
|
||||
static void shutdown_dialog_on_key(Window* win, const Montauk::KeyEvent& key) {
|
||||
static void shutdown_dialog_on_key(Window* win, const montauk::abi::KeyEvent& key) {
|
||||
ShutdownDialogState* ss = (ShutdownDialogState*)win->app_data;
|
||||
if (!ss || !key.pressed) return;
|
||||
|
||||
if (key.ascii == '\n' || key.ascii == '\r') {
|
||||
desktop_request_power(Montauk::POWER_REQ_SHUTDOWN);
|
||||
desktop_request_power(montauk::abi::POWER_REQ_SHUTDOWN);
|
||||
}
|
||||
if (key.scancode == 0x01) { // Escape
|
||||
for (int i = 0; i < ss->ds->window_count; i++) {
|
||||
@@ -314,7 +314,7 @@ static void sleep_dialog_on_mouse(Window* win, MouseEvent& ev) {
|
||||
}
|
||||
}
|
||||
|
||||
static void sleep_dialog_on_key(Window* win, const Montauk::KeyEvent& key) {
|
||||
static void sleep_dialog_on_key(Window* win, const montauk::abi::KeyEvent& key) {
|
||||
SleepDialogState* ss = (SleepDialogState*)win->app_data;
|
||||
if (!ss || !key.pressed) return;
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ static void handle_lock_mouse(DesktopState* ds) {
|
||||
}
|
||||
}
|
||||
|
||||
static void handle_lock_keyboard(DesktopState* ds, const Montauk::KeyEvent& key) {
|
||||
static void handle_lock_keyboard(DesktopState* ds, const montauk::abi::KeyEvent& key) {
|
||||
if (!key.pressed) return;
|
||||
|
||||
// Enter submits
|
||||
@@ -101,7 +101,7 @@ static void forward_external_mouse(gui::Window* win,
|
||||
uint8_t buttons,
|
||||
uint8_t prev) {
|
||||
gui::Rect cr = desktop_content_rect(win);
|
||||
Montauk::WinEvent wev;
|
||||
montauk::abi::WinEvent wev;
|
||||
montauk::memset(&wev, 0, sizeof(wev));
|
||||
wev.type = 1; // mouse
|
||||
wev.mouse.x = mx - cr.x;
|
||||
@@ -242,7 +242,7 @@ void gui::desktop_handle_mouse(DesktopState* ds) {
|
||||
}
|
||||
} else {
|
||||
Rect cr = desktop_content_rect(win);
|
||||
Montauk::WinEvent rev;
|
||||
montauk::abi::WinEvent rev;
|
||||
montauk::memset(&rev, 0, sizeof(rev));
|
||||
rev.type = 2;
|
||||
rev.resize.w = cr.w;
|
||||
@@ -264,7 +264,7 @@ void gui::desktop_handle_mouse(DesktopState* ds) {
|
||||
}
|
||||
} else {
|
||||
Rect cr = desktop_content_rect(win);
|
||||
Montauk::WinEvent rev;
|
||||
montauk::abi::WinEvent rev;
|
||||
montauk::memset(&rev, 0, sizeof(rev));
|
||||
rev.type = 2;
|
||||
rev.resize.w = cr.w;
|
||||
@@ -331,7 +331,7 @@ void gui::desktop_handle_mouse(DesktopState* ds) {
|
||||
win->dirty = true;
|
||||
} else {
|
||||
Rect cr = desktop_content_rect(win);
|
||||
Montauk::WinEvent rev;
|
||||
montauk::abi::WinEvent rev;
|
||||
montauk::memset(&rev, 0, sizeof(rev));
|
||||
rev.type = 2;
|
||||
rev.resize.w = cr.w;
|
||||
@@ -615,7 +615,7 @@ void gui::desktop_handle_mouse(DesktopState* ds) {
|
||||
}
|
||||
} else {
|
||||
Rect cr = desktop_content_rect(win);
|
||||
Montauk::WinEvent rev;
|
||||
montauk::abi::WinEvent rev;
|
||||
montauk::memset(&rev, 0, sizeof(rev));
|
||||
rev.type = 2;
|
||||
rev.resize.w = cr.w;
|
||||
@@ -661,7 +661,7 @@ void gui::desktop_handle_mouse(DesktopState* ds) {
|
||||
Window* raised = &ds->windows[new_idx];
|
||||
if (raised->external) {
|
||||
// Forward mouse event to external window
|
||||
Montauk::WinEvent wev;
|
||||
montauk::abi::WinEvent wev;
|
||||
montauk::memset(&wev, 0, sizeof(wev));
|
||||
wev.type = 1; // mouse
|
||||
wev.mouse.x = mx - cr.x;
|
||||
@@ -700,7 +700,7 @@ void gui::desktop_handle_mouse(DesktopState* ds) {
|
||||
// Forward if mouse is over content (hover/move) or button is held/released (drag continuity)
|
||||
if (cr.contains(mx, my) || left_held || left_released) {
|
||||
if (win->external) {
|
||||
Montauk::WinEvent wev;
|
||||
montauk::abi::WinEvent wev;
|
||||
montauk::memset(&wev, 0, sizeof(wev));
|
||||
wev.type = 1; // mouse
|
||||
wev.mouse.x = mx - cr.x;
|
||||
@@ -726,7 +726,7 @@ void gui::desktop_handle_mouse(DesktopState* ds) {
|
||||
Rect cr = desktop_content_rect(win);
|
||||
if (cr.contains(mx, my)) {
|
||||
if (win->external) {
|
||||
Montauk::WinEvent wev;
|
||||
montauk::abi::WinEvent wev;
|
||||
montauk::memset(&wev, 0, sizeof(wev));
|
||||
wev.type = 1; // mouse
|
||||
wev.mouse.x = mx - cr.x;
|
||||
@@ -763,7 +763,7 @@ void gui::desktop_handle_mouse(DesktopState* ds) {
|
||||
}
|
||||
}
|
||||
|
||||
void gui::desktop_handle_keyboard(DesktopState* ds, const Montauk::KeyEvent& key) {
|
||||
void gui::desktop_handle_keyboard(DesktopState* ds, const montauk::abi::KeyEvent& key) {
|
||||
if (ds->screen_locked) {
|
||||
handle_lock_keyboard(ds, key);
|
||||
return;
|
||||
@@ -776,7 +776,7 @@ void gui::desktop_handle_keyboard(DesktopState* ds, const Montauk::KeyEvent& key
|
||||
if (!desktop_window_fullscreen(win))
|
||||
break;
|
||||
|
||||
Montauk::WinEvent ev;
|
||||
montauk::abi::WinEvent ev;
|
||||
montauk::memset(&ev, 0, sizeof(ev));
|
||||
ev.type = 0; // key
|
||||
ev.key = key;
|
||||
@@ -828,7 +828,7 @@ void gui::desktop_handle_keyboard(DesktopState* ds, const Montauk::KeyEvent& key
|
||||
Window* win = &ds->windows[ds->focused_window];
|
||||
if (win->external) {
|
||||
// Forward key event to external window via syscall
|
||||
Montauk::WinEvent ev;
|
||||
montauk::abi::WinEvent ev;
|
||||
montauk::memset(&ev, 0, sizeof(ev));
|
||||
ev.type = 0; // key
|
||||
ev.key = key;
|
||||
|
||||
@@ -339,11 +339,11 @@ static void launcher_activate_selected(DesktopState* ds) {
|
||||
break;
|
||||
case LAUNCHER_ITEM_COMMAND_REBOOT:
|
||||
desktop_close_launcher(ds);
|
||||
desktop_request_power(Montauk::POWER_REQ_REBOOT);
|
||||
desktop_request_power(montauk::abi::POWER_REQ_REBOOT);
|
||||
return;
|
||||
case LAUNCHER_ITEM_COMMAND_SHUTDOWN:
|
||||
desktop_close_launcher(ds);
|
||||
desktop_request_power(Montauk::POWER_REQ_SHUTDOWN);
|
||||
desktop_request_power(montauk::abi::POWER_REQ_SHUTDOWN);
|
||||
return;
|
||||
case LAUNCHER_ITEM_SPECIAL_FOLDER:
|
||||
if (item->path[0] != '\0') {
|
||||
@@ -355,7 +355,7 @@ static void launcher_activate_selected(DesktopState* ds) {
|
||||
desktop_close_launcher(ds);
|
||||
}
|
||||
|
||||
static void launcher_update_super_state(DesktopState* ds, const Montauk::KeyEvent& key) {
|
||||
static void launcher_update_super_state(DesktopState* ds, const montauk::abi::KeyEvent& key) {
|
||||
uint8_t sc = key.scancode & 0x7F;
|
||||
if (sc == 0x5B) {
|
||||
ds->super_left_down = key.pressed;
|
||||
@@ -411,7 +411,7 @@ void desktop_close_launcher(DesktopState* ds) {
|
||||
ds->launcher_scroll = 0;
|
||||
}
|
||||
|
||||
bool desktop_handle_launcher_keyboard(DesktopState* ds, const Montauk::KeyEvent& key) {
|
||||
bool desktop_handle_launcher_keyboard(DesktopState* ds, const montauk::abi::KeyEvent& key) {
|
||||
launcher_update_super_state(ds, key);
|
||||
uint8_t sc = key.scancode & 0x7F;
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@ void gui::desktop_init(DesktopState* ds) {
|
||||
ds->app_menu_open = false;
|
||||
desktop_init_launcher(ds);
|
||||
|
||||
montauk::memset(&ds->mouse, 0, sizeof(Montauk::MouseState));
|
||||
montauk::memset(&ds->mouse, 0, sizeof(montauk::abi::MouseState));
|
||||
montauk::set_mouse_bounds(ds->screen_w - 1, ds->screen_h - 1);
|
||||
gui::clipboard_clear();
|
||||
|
||||
@@ -333,7 +333,7 @@ void gui::desktop_init(DesktopState* ds) {
|
||||
// ============================================================================
|
||||
|
||||
static uint64_t desktop_clock_token() {
|
||||
Montauk::DateTime dt;
|
||||
montauk::abi::DateTime dt;
|
||||
montauk::gettime(&dt);
|
||||
return ((uint64_t)dt.Year << 32)
|
||||
| ((uint64_t)dt.Month << 24)
|
||||
@@ -369,7 +369,7 @@ static void desktop_clear_window_dirty(DesktopState* ds) {
|
||||
}
|
||||
}
|
||||
|
||||
static bool desktop_netcfg_equal(const Montauk::NetCfg& a, const Montauk::NetCfg& b) {
|
||||
static bool desktop_netcfg_equal(const montauk::abi::NetCfg& a, const montauk::abi::NetCfg& b) {
|
||||
if (a.ipAddress != b.ipAddress || a.subnetMask != b.subnetMask ||
|
||||
a.gateway != b.gateway || a.dnsServer != b.dnsServer) {
|
||||
return false;
|
||||
@@ -385,7 +385,7 @@ static bool desktop_refresh_panel_state(DesktopState* ds, uint64_t now) {
|
||||
|
||||
bool changed = false;
|
||||
if (now - ds->net_cfg_last_poll > 5000) {
|
||||
Montauk::NetCfg next;
|
||||
montauk::abi::NetCfg next;
|
||||
montauk::get_netcfg(&next);
|
||||
if (!desktop_netcfg_equal(next, ds->cached_net_cfg)) {
|
||||
ds->cached_net_cfg = next;
|
||||
@@ -425,7 +425,7 @@ static bool desktop_refresh_panel_state(DesktopState* ds, uint64_t now) {
|
||||
|
||||
bool desktop_poll_external_windows(DesktopState* ds) {
|
||||
bool changed = false;
|
||||
Montauk::WinInfo extWins[8];
|
||||
montauk::abi::WinInfo extWins[8];
|
||||
int extCount = montauk::win_enumerate(extWins, 8);
|
||||
|
||||
// Check for new external windows and map them
|
||||
@@ -649,7 +649,7 @@ void gui::desktop_run(DesktopState* ds) {
|
||||
|
||||
// Poll keyboard events
|
||||
while (montauk::is_key_available()) {
|
||||
Montauk::KeyEvent key;
|
||||
montauk::abi::KeyEvent key;
|
||||
montauk::getkey(&key);
|
||||
desktop_handle_keyboard(ds, key);
|
||||
keyboardChanged = true;
|
||||
@@ -730,7 +730,7 @@ static DesktopState* g_desktop;
|
||||
static constexpr const char kDesktopBinaryName[] = "desktop.elf";
|
||||
static constexpr int DESKTOP_PROC_SCAN_MAX = 256;
|
||||
|
||||
static bool desktop_proc_alive(const Montauk::ProcInfo& proc) {
|
||||
static bool desktop_proc_alive(const montauk::abi::ProcInfo& proc) {
|
||||
return proc.state == 1 || proc.state == 2 || proc.state == 3;
|
||||
}
|
||||
|
||||
@@ -745,7 +745,7 @@ static bool proc_name_is_desktop(const char* name) {
|
||||
}
|
||||
|
||||
static bool existing_desktop_running() {
|
||||
static Montauk::ProcInfo procs[DESKTOP_PROC_SCAN_MAX];
|
||||
static montauk::abi::ProcInfo procs[DESKTOP_PROC_SCAN_MAX];
|
||||
int count = montauk::proclist(procs, DESKTOP_PROC_SCAN_MAX);
|
||||
if (count <= 0) return false;
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ void gui::desktop_draw_panel(DesktopState* ds) {
|
||||
}
|
||||
|
||||
// Date + Clock (right side)
|
||||
Montauk::DateTime dt;
|
||||
montauk::abi::DateTime dt;
|
||||
montauk::gettime(&dt);
|
||||
|
||||
char clock_str[12];
|
||||
@@ -256,7 +256,7 @@ void desktop_draw_app_menu(DesktopState* ds) {
|
||||
|
||||
void desktop_draw_net_popup(DesktopState* ds) {
|
||||
Framebuffer& fb = ds->fb;
|
||||
Montauk::NetCfg& nc = ds->cached_net_cfg;
|
||||
montauk::abi::NetCfg& nc = ds->cached_net_cfg;
|
||||
bool connected = nc.ipAddress != 0;
|
||||
|
||||
int popup_w = 220;
|
||||
|
||||
@@ -64,7 +64,7 @@ void gui::desktop_close_window(DesktopState* ds, int idx) {
|
||||
if (ds->closing_ext_count < DesktopState::MAX_CLOSING) {
|
||||
ds->closing_ext_ids[ds->closing_ext_count++] = win->ext_win_id;
|
||||
}
|
||||
Montauk::WinEvent ev;
|
||||
montauk::abi::WinEvent ev;
|
||||
montauk::memset(&ev, 0, sizeof(ev));
|
||||
ev.type = 3; // close
|
||||
montauk::win_sendevent(win->ext_win_id, &ev);
|
||||
|
||||
@@ -139,7 +139,7 @@ static constexpr int DD_INIT_H = 420;
|
||||
static constexpr int DD_TAB_BAR_H = 32;
|
||||
|
||||
struct DiskDetailState {
|
||||
Montauk::DiskInfo info;
|
||||
montauk::abi::DiskInfo info;
|
||||
int active_tab;
|
||||
int win_id;
|
||||
int win_w, win_h;
|
||||
@@ -152,7 +152,7 @@ struct DiskDetailState {
|
||||
// ============================================================================
|
||||
|
||||
struct DevExplorerState {
|
||||
Montauk::DevInfo devs[MAX_TOTAL_DEVS];
|
||||
montauk::abi::DevInfo devs[MAX_TOTAL_DEVS];
|
||||
int dev_count;
|
||||
bool collapsed[NUM_CATEGORIES];
|
||||
int selected_row;
|
||||
@@ -193,7 +193,7 @@ void render(uint32_t* pixels);
|
||||
// ============================================================================
|
||||
|
||||
int build_display_rows(DevExplorerState* de, DisplayRow* rows);
|
||||
int append_printer_devices(Montauk::DevInfo* out, int max_count);
|
||||
int append_printer_devices(montauk::abi::DevInfo* out, int max_count);
|
||||
ScrollMetrics compute_scroll_metrics(DevExplorerState* de,
|
||||
const DisplayRow* rows, int row_count);
|
||||
void set_scroll_from_px(DevExplorerState* de, const DisplayRow* rows,
|
||||
|
||||
@@ -274,7 +274,7 @@ void open_disk_detail(int port, const char* model) {
|
||||
montauk::memset(&dd.info, 0, sizeof(dd.info));
|
||||
montauk::diskinfo(&dd.info, port);
|
||||
|
||||
Montauk::WinCreateResult wres;
|
||||
montauk::abi::WinCreateResult wres;
|
||||
if (montauk::win_create(title, dd.win_w, dd.win_h, &wres) < 0 || wres.id < 0)
|
||||
return;
|
||||
|
||||
|
||||
@@ -186,7 +186,7 @@ static bool handle_list_click(int mx, int my) {
|
||||
// Mouse handling (wheel, draggable scrollbar, clicks)
|
||||
// ============================================================================
|
||||
|
||||
static bool handle_main_mouse(const Montauk::WinEvent& ev) {
|
||||
static bool handle_main_mouse(const montauk::abi::WinEvent& ev) {
|
||||
auto& de = g_state;
|
||||
int mx = ev.mouse.x;
|
||||
int my = ev.mouse.y;
|
||||
@@ -272,7 +272,7 @@ static bool handle_main_mouse(const Montauk::WinEvent& ev) {
|
||||
// Key handling
|
||||
// ============================================================================
|
||||
|
||||
static bool handle_key(const Montauk::KeyEvent& key) {
|
||||
static bool handle_key(const montauk::abi::KeyEvent& key) {
|
||||
if (!key.pressed) return false;
|
||||
|
||||
auto& de = g_state;
|
||||
@@ -371,7 +371,7 @@ extern "C" void _start() {
|
||||
win.present();
|
||||
|
||||
while (true) {
|
||||
Montauk::WinEvent ev;
|
||||
montauk::abi::WinEvent ev;
|
||||
bool redraw_main = false;
|
||||
bool redraw_detail = false;
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ static void format_printer_detail(const ProbeState& probe,
|
||||
snprintf(out, (size_t)out_len, "Awaiting spooler probe");
|
||||
}
|
||||
|
||||
int append_printer_devices(Montauk::DevInfo* out, int max_count) {
|
||||
int append_printer_devices(montauk::abi::DevInfo* out, int max_count) {
|
||||
if (out == nullptr || max_count <= 0) return 0;
|
||||
|
||||
char current_uri[MAX_PATH_LEN] = {};
|
||||
@@ -65,7 +65,7 @@ int append_printer_devices(Montauk::DevInfo* out, int max_count) {
|
||||
char uri_err[128] = {};
|
||||
bool normalized_ok = normalize_ipp_uri(effective_uri, &normalized, uri_err, sizeof(uri_err));
|
||||
|
||||
Montauk::DevInfo dev = {};
|
||||
montauk::abi::DevInfo dev = {};
|
||||
dev.category = CAT_PRINTER;
|
||||
|
||||
if (has_probe && probe.caps.printer_name[0]) {
|
||||
|
||||
@@ -335,7 +335,7 @@ extern "C" void _start() {
|
||||
montauk::print("MontaukOS DHCP Client\n");
|
||||
|
||||
// 1. Get MAC address
|
||||
Montauk::NetCfg origCfg;
|
||||
montauk::abi::NetCfg origCfg;
|
||||
montauk::get_netcfg(&origCfg);
|
||||
|
||||
char macStr[32];
|
||||
@@ -344,14 +344,14 @@ extern "C" void _start() {
|
||||
montauk::print(msg);
|
||||
|
||||
// 2. Set IP to 0.0.0.0 to allow broadcast send/receive
|
||||
Montauk::NetCfg zeroCfg;
|
||||
montauk::abi::NetCfg zeroCfg;
|
||||
zeroCfg.ipAddress = 0;
|
||||
zeroCfg.subnetMask = 0;
|
||||
zeroCfg.gateway = 0;
|
||||
montauk::set_netcfg(&zeroCfg);
|
||||
|
||||
// 3. Create UDP socket and bind to port 68
|
||||
int fd = montauk::socket(Montauk::SOCK_UDP);
|
||||
int fd = montauk::socket(montauk::abi::SOCK_UDP);
|
||||
if (fd < 0) {
|
||||
montauk::print("Error: failed to create UDP socket\n");
|
||||
montauk::set_netcfg(&origCfg);
|
||||
@@ -399,7 +399,7 @@ extern "C" void _start() {
|
||||
}
|
||||
uint64_t now = montauk::get_milliseconds();
|
||||
if (now >= startMs + 10000) break;
|
||||
montauk::wait_handle(fd, Montauk::IPC_SIGNAL_READABLE, startMs + 10000 - now);
|
||||
montauk::wait_handle(fd, montauk::abi::IPC_SIGNAL_READABLE, startMs + 10000 - now);
|
||||
}
|
||||
|
||||
if (!gotOffer) {
|
||||
@@ -451,7 +451,7 @@ extern "C" void _start() {
|
||||
}
|
||||
uint64_t now = montauk::get_milliseconds();
|
||||
if (now >= startMs + 10000) break;
|
||||
montauk::wait_handle(fd, Montauk::IPC_SIGNAL_READABLE, startMs + 10000 - now);
|
||||
montauk::wait_handle(fd, montauk::abi::IPC_SIGNAL_READABLE, startMs + 10000 - now);
|
||||
}
|
||||
|
||||
montauk::closesocket(fd);
|
||||
@@ -463,7 +463,7 @@ extern "C" void _start() {
|
||||
}
|
||||
|
||||
// 8. Apply configuration
|
||||
Montauk::NetCfg newCfg;
|
||||
montauk::abi::NetCfg newCfg;
|
||||
newCfg.ipAddress = offer.offeredIp;
|
||||
newCfg.subnetMask = offer.subnetMask;
|
||||
newCfg.gateway = offer.router;
|
||||
|
||||
@@ -1047,7 +1047,7 @@ int file_field_mouse(mtk::TextInputState& input, const Rect& rect, char* buf, in
|
||||
focused, false, filter);
|
||||
}
|
||||
|
||||
void handle_file_mouse(const Montauk::WinEvent& ev) {
|
||||
void handle_file_mouse(const montauk::abi::WinEvent& ev) {
|
||||
FileDialogState* st = &g_file;
|
||||
st->mouse_x = ev.mouse.x;
|
||||
st->mouse_y = ev.mouse.y;
|
||||
@@ -1159,7 +1159,7 @@ void handle_file_mouse(const Montauk::WinEvent& ev) {
|
||||
}
|
||||
}
|
||||
|
||||
void handle_file_key(const Montauk::KeyEvent& key) {
|
||||
void handle_file_key(const montauk::abi::KeyEvent& key) {
|
||||
if (!key.pressed) return;
|
||||
|
||||
FileDialogState* st = &g_file;
|
||||
@@ -1234,11 +1234,11 @@ void draw() {
|
||||
draw_file_dialog();
|
||||
}
|
||||
|
||||
void handle_mouse(const Montauk::WinEvent& ev) {
|
||||
void handle_mouse(const montauk::abi::WinEvent& ev) {
|
||||
handle_file_mouse(ev);
|
||||
}
|
||||
|
||||
void handle_key(const Montauk::KeyEvent& key) {
|
||||
void handle_key(const montauk::abi::KeyEvent& key) {
|
||||
handle_file_key(key);
|
||||
}
|
||||
|
||||
|
||||
@@ -50,8 +50,8 @@ constexpr int BUTTON_W = 88;
|
||||
|
||||
void init(const gui::dialogs::Request& req);
|
||||
void draw();
|
||||
void handle_mouse(const Montauk::WinEvent& ev);
|
||||
void handle_key(const Montauk::KeyEvent& key);
|
||||
void handle_mouse(const montauk::abi::WinEvent& ev);
|
||||
void handle_key(const montauk::abi::KeyEvent& key);
|
||||
void cleanup();
|
||||
|
||||
} // namespace filedialog
|
||||
|
||||
@@ -35,8 +35,8 @@ static constexpr uint8_t WIN_SCALE = 4;
|
||||
struct DialogCallbacks {
|
||||
void (*draw)();
|
||||
void (*on_close)();
|
||||
void (*handle_mouse)(const Montauk::WinEvent& ev);
|
||||
void (*handle_key)(const Montauk::KeyEvent& key);
|
||||
void (*handle_mouse)(const montauk::abi::WinEvent& ev);
|
||||
void (*handle_key)(const montauk::abi::KeyEvent& key);
|
||||
};
|
||||
|
||||
static void run_dialog_loop(const DialogCallbacks& cb) {
|
||||
@@ -44,7 +44,7 @@ static void run_dialog_loop(const DialogCallbacks& cb) {
|
||||
cb.draw();
|
||||
g_app.win.present();
|
||||
|
||||
Montauk::WinEvent ev;
|
||||
montauk::abi::WinEvent ev;
|
||||
int rc = g_app.win.poll(&ev);
|
||||
if (rc < 0) { cb.on_close(); break; }
|
||||
if (rc == 0) { montauk::sleep_ms(16); continue; }
|
||||
@@ -143,8 +143,8 @@ DIALOGS_EXPORT bool dialogs_run_request(const dlg::Request* request, dlg::Result
|
||||
}
|
||||
|
||||
void (*draw_fn)() = g_app.is_print ? printdialog::draw : filedialog::draw;
|
||||
void (*mouse_fn)(const Montauk::WinEvent&) = g_app.is_print ? printdialog::handle_mouse : filedialog::handle_mouse;
|
||||
void (*key_fn)(const Montauk::KeyEvent&) = g_app.is_print ? printdialog::handle_key : filedialog::handle_key;
|
||||
void (*mouse_fn)(const montauk::abi::WinEvent&) = g_app.is_print ? printdialog::handle_mouse : filedialog::handle_mouse;
|
||||
void (*key_fn)(const montauk::abi::KeyEvent&) = g_app.is_print ? printdialog::handle_key : filedialog::handle_key;
|
||||
|
||||
draw_fn();
|
||||
g_app.win.present();
|
||||
|
||||
@@ -367,7 +367,7 @@ void draw_message_box() {
|
||||
}
|
||||
}
|
||||
|
||||
void handle_message_mouse(const Montauk::WinEvent& ev) {
|
||||
void handle_message_mouse(const montauk::abi::WinEvent& ev) {
|
||||
MessageBoxState* st = &g_message;
|
||||
st->mouse_x = ev.mouse.x;
|
||||
st->mouse_y = ev.mouse.y;
|
||||
@@ -384,7 +384,7 @@ void handle_message_mouse(const Montauk::WinEvent& ev) {
|
||||
}
|
||||
}
|
||||
|
||||
void handle_message_key(const Montauk::KeyEvent& key) {
|
||||
void handle_message_key(const montauk::abi::KeyEvent& key) {
|
||||
if (!key.pressed) return;
|
||||
|
||||
MessageBoxState* st = &g_message;
|
||||
@@ -464,11 +464,11 @@ void draw() {
|
||||
draw_message_box();
|
||||
}
|
||||
|
||||
void handle_mouse(const Montauk::WinEvent& ev) {
|
||||
void handle_mouse(const montauk::abi::WinEvent& ev) {
|
||||
handle_message_mouse(ev);
|
||||
}
|
||||
|
||||
void handle_key(const Montauk::KeyEvent& key) {
|
||||
void handle_key(const montauk::abi::KeyEvent& key) {
|
||||
handle_message_key(key);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,8 +38,8 @@ constexpr int MAX_LINE_LEN = 128;
|
||||
void init(const char* message, uint8_t buttons, uint8_t default_choice = 0);
|
||||
void preferred_size(const char* title, int* out_w, int* out_h);
|
||||
void draw();
|
||||
void handle_mouse(const Montauk::WinEvent& ev);
|
||||
void handle_key(const Montauk::KeyEvent& key);
|
||||
void handle_mouse(const montauk::abi::WinEvent& ev);
|
||||
void handle_key(const montauk::abi::KeyEvent& key);
|
||||
void dismiss();
|
||||
uint8_t selected_choice();
|
||||
void cleanup();
|
||||
|
||||
@@ -420,7 +420,7 @@ void print_submit(PrintDialogState* st) {
|
||||
dialog_finish("ok", "", job_id, msg, printer.uri, printer.name, st->copies);
|
||||
}
|
||||
|
||||
void handle_print_mouse(const Montauk::WinEvent& ev) {
|
||||
void handle_print_mouse(const montauk::abi::WinEvent& ev) {
|
||||
PrintDialogState* st = &g_print;
|
||||
st->mouse_x = ev.mouse.x;
|
||||
st->mouse_y = ev.mouse.y;
|
||||
@@ -456,7 +456,7 @@ void handle_print_mouse(const Montauk::WinEvent& ev) {
|
||||
}
|
||||
}
|
||||
|
||||
void handle_print_key(const Montauk::KeyEvent& key) {
|
||||
void handle_print_key(const montauk::abi::KeyEvent& key) {
|
||||
if (!key.pressed) return;
|
||||
if (key.scancode == 0x01) {
|
||||
dialog_cancel();
|
||||
@@ -505,11 +505,11 @@ void draw() {
|
||||
draw_print_dialog();
|
||||
}
|
||||
|
||||
void handle_mouse(const Montauk::WinEvent& ev) {
|
||||
void handle_mouse(const montauk::abi::WinEvent& ev) {
|
||||
handle_print_mouse(ev);
|
||||
}
|
||||
|
||||
void handle_key(const Montauk::KeyEvent& key) {
|
||||
void handle_key(const montauk::abi::KeyEvent& key) {
|
||||
handle_print_key(key);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,8 +34,8 @@ constexpr int BUTTON_W = 88;
|
||||
|
||||
void init(const gui::dialogs::Request& req);
|
||||
void draw();
|
||||
void handle_mouse(const Montauk::WinEvent& ev);
|
||||
void handle_key(const Montauk::KeyEvent& key);
|
||||
void handle_mouse(const montauk::abi::WinEvent& ev);
|
||||
void handle_key(const montauk::abi::KeyEvent& key);
|
||||
void cleanup();
|
||||
|
||||
} // namespace printdialog
|
||||
|
||||
@@ -14,7 +14,7 @@ void disktool_refresh() {
|
||||
auto& dt = g_state;
|
||||
dt.disk_count = 0;
|
||||
for (int port = 0; port < MAX_DISKS; port++) {
|
||||
Montauk::DiskInfo info;
|
||||
montauk::abi::DiskInfo info;
|
||||
montauk::memset(&info, 0, sizeof(info));
|
||||
int r = montauk::diskinfo(&info, port);
|
||||
if (r == 0 && info.type != 0) {
|
||||
@@ -45,7 +45,7 @@ void open_newpart_dialog() {
|
||||
dlg.hover_confirm = false;
|
||||
dlg.hover_cancel = false;
|
||||
|
||||
Montauk::DiskInfo& disk = dt.disks[dt.selected_disk];
|
||||
montauk::abi::DiskInfo& disk = dt.disks[dt.selected_disk];
|
||||
int blockDev = selected_block_dev();
|
||||
char sz[24];
|
||||
format_disk_size(sz, sizeof(sz), disk.sectorCount, disk.sectorSizeLog);
|
||||
@@ -64,7 +64,7 @@ void open_newpart_dialog() {
|
||||
"free region on this disk.");
|
||||
}
|
||||
|
||||
Montauk::WinCreateResult wres;
|
||||
montauk::abi::WinCreateResult wres;
|
||||
const char* title = dlg.will_init_gpt ? "Initialize Disk" : "New Partition";
|
||||
if (montauk::win_create(title, NP_DLG_W, NP_DLG_H, &wres) < 0 || wres.id < 0) {
|
||||
set_status("Failed to open dialog");
|
||||
@@ -100,7 +100,7 @@ void newpart_dialog_confirm() {
|
||||
set_status("Initialized GPT");
|
||||
}
|
||||
|
||||
Montauk::GptAddParams params;
|
||||
montauk::abi::GptAddParams params;
|
||||
montauk::memset(¶ms, 0, sizeof(params));
|
||||
params.blockDev = selected_block_dev();
|
||||
params.startLba = 0;
|
||||
@@ -187,15 +187,15 @@ void open_format_dialog() {
|
||||
dlg.hover_cancel = false;
|
||||
|
||||
// Build partition description
|
||||
Montauk::PartInfo& p = dt.parts[global_idx];
|
||||
Montauk::DiskInfo& disk = dt.disks[dt.selected_disk];
|
||||
montauk::abi::PartInfo& p = dt.parts[global_idx];
|
||||
montauk::abi::DiskInfo& disk = dt.disks[dt.selected_disk];
|
||||
char sz[24];
|
||||
format_disk_size(sz, sizeof(sz), p.sectorCount, disk.sectorSizeLog);
|
||||
const char* pname = p.name[0] ? p.name : "Partition";
|
||||
snprintf(dlg.part_desc, sizeof(dlg.part_desc), "%s (%s)", pname, sz);
|
||||
|
||||
// Create dialog window
|
||||
Montauk::WinCreateResult wres;
|
||||
montauk::abi::WinCreateResult wres;
|
||||
if (montauk::win_create("Format Partition", FMT_DLG_W, FMT_DLG_H, &wres) < 0 || wres.id < 0) {
|
||||
set_status("Failed to open format dialog");
|
||||
return;
|
||||
@@ -219,7 +219,7 @@ void format_dialog_do_format() {
|
||||
auto& dt = g_state;
|
||||
auto& dlg = dt.fmt_dlg;
|
||||
|
||||
Montauk::FsFormatParams params;
|
||||
montauk::abi::FsFormatParams params;
|
||||
montauk::memset(¶ms, 0, sizeof(params));
|
||||
params.partIndex = dlg.global_part_index;
|
||||
params.fsType = g_fsTypes[dlg.selected_fs].id;
|
||||
|
||||
@@ -49,7 +49,7 @@ struct FsTypeEntry {
|
||||
};
|
||||
|
||||
static const FsTypeEntry g_fsTypes[] = {
|
||||
{ "FAT32", Montauk::FS_TYPE_FAT32 },
|
||||
{ "FAT32", montauk::abi::FS_TYPE_FAT32 },
|
||||
};
|
||||
static constexpr int NUM_FS_TYPES = 1;
|
||||
|
||||
@@ -86,9 +86,9 @@ struct NewPartDialog {
|
||||
};
|
||||
|
||||
struct DiskToolState {
|
||||
Montauk::DiskInfo disks[MAX_DISKS];
|
||||
montauk::abi::DiskInfo disks[MAX_DISKS];
|
||||
int disk_count;
|
||||
Montauk::PartInfo parts[MAX_PARTS];
|
||||
montauk::abi::PartInfo parts[MAX_PARTS];
|
||||
int part_count;
|
||||
int selected_disk;
|
||||
int selected_part;
|
||||
|
||||
@@ -146,13 +146,13 @@ static bool handle_content_click(int mx, int my) {
|
||||
int map_x = MAP_PAD;
|
||||
int map_w = g_win_w - MAP_PAD * 2;
|
||||
if (my >= y && my < y + MAP_H) {
|
||||
Montauk::DiskInfo& disk = dt.disks[dt.selected_disk];
|
||||
montauk::abi::DiskInfo& disk = dt.disks[dt.selected_disk];
|
||||
int part_indices[MAX_PARTS];
|
||||
int nparts = get_disk_parts(part_indices, MAX_PARTS);
|
||||
uint64_t total = disk.sectorCount;
|
||||
if (total > 0) {
|
||||
for (int pi = 0; pi < nparts; pi++) {
|
||||
Montauk::PartInfo& p = dt.parts[part_indices[pi]];
|
||||
montauk::abi::PartInfo& p = dt.parts[part_indices[pi]];
|
||||
int px = map_x + (int)((p.startLba * (uint64_t)map_w) / total);
|
||||
int pw = (int)((p.sectorCount * (uint64_t)map_w) / total);
|
||||
if (pw < 2) pw = 2;
|
||||
@@ -278,7 +278,7 @@ static void clamp_scroll() {
|
||||
g_state.scroll_y = gui_clamp(g_state.scroll_y, 0, max_scroll_y());
|
||||
}
|
||||
|
||||
static bool handle_mouse(const Montauk::WinEvent& ev) {
|
||||
static bool handle_mouse(const montauk::abi::WinEvent& ev) {
|
||||
int prev_x = g_state.mouse_x;
|
||||
int prev_y = g_state.mouse_y;
|
||||
int prev_disk_hover = hovered_disk_button(prev_x, prev_y);
|
||||
@@ -320,7 +320,7 @@ static bool handle_mouse(const Montauk::WinEvent& ev) {
|
||||
// Key handling
|
||||
// ============================================================================
|
||||
|
||||
static bool handle_key(const Montauk::KeyEvent& key) {
|
||||
static bool handle_key(const montauk::abi::KeyEvent& key) {
|
||||
if (!key.pressed) return false;
|
||||
|
||||
auto& dt = g_state;
|
||||
@@ -403,7 +403,7 @@ extern "C" void _start() {
|
||||
win.present();
|
||||
|
||||
while (true) {
|
||||
Montauk::WinEvent ev;
|
||||
montauk::abi::WinEvent ev;
|
||||
bool redraw_main = false;
|
||||
bool redraw_dlg = false;
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ static void render_content(Canvas& c, const mtk::Theme& theme) {
|
||||
if (dt.disk_count == 0 || dt.selected_disk < 0 || dt.selected_disk >= dt.disk_count)
|
||||
return;
|
||||
|
||||
Montauk::DiskInfo& disk = dt.disks[dt.selected_disk];
|
||||
montauk::abi::DiskInfo& disk = dt.disks[dt.selected_disk];
|
||||
int y = content_title_y();
|
||||
|
||||
char info_str[64];
|
||||
@@ -138,7 +138,7 @@ static void render_content(Canvas& c, const mtk::Theme& theme) {
|
||||
|
||||
if (total_sectors > 0 && nparts > 0) {
|
||||
for (int pi = 0; pi < nparts; pi++) {
|
||||
Montauk::PartInfo& p = dt.parts[part_indices[pi]];
|
||||
montauk::abi::PartInfo& p = dt.parts[part_indices[pi]];
|
||||
int part_x = map_rect.x + (int)((p.startLba * (uint64_t)map_rect.w) / total_sectors);
|
||||
int part_w = (int)((p.sectorCount * (uint64_t)map_rect.w) / total_sectors);
|
||||
if (part_w < 2) part_w = 2;
|
||||
@@ -214,7 +214,7 @@ static void render_content(Canvas& c, const mtk::Theme& theme) {
|
||||
table_style.row_hover_bg);
|
||||
}
|
||||
|
||||
Montauk::PartInfo& p = dt.parts[part_indices[pi]];
|
||||
montauk::abi::PartInfo& p = dt.parts[part_indices[pi]];
|
||||
|
||||
c.fill_rounded_rect(col_idx, row_y + (ITEM_H - 10) / 2, 10, 10, 5,
|
||||
part_colors[pi % NUM_PART_COLORS]);
|
||||
|
||||
@@ -66,7 +66,7 @@ static inline long _zos_syscall4(long nr, long a1, long a2, long a3, long a4) {
|
||||
#define SYS_WINPRESENT 56
|
||||
#define SYS_WINPOLL 57
|
||||
|
||||
/* Window server structs (must match Montauk::WinCreateResult and Montauk::WinEvent) */
|
||||
/* Window server structs (must match montauk::abi::WinCreateResult and montauk::abi::WinEvent) */
|
||||
struct WinCreateResult {
|
||||
int id; /* -1 on failure */
|
||||
unsigned _pad;
|
||||
|
||||
@@ -396,7 +396,7 @@ static int prompt_input(const char* promptStr, char* out, int outMax) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Montauk::KeyEvent ev;
|
||||
montauk::abi::KeyEvent ev;
|
||||
montauk::getkey(&ev);
|
||||
if (!ev.pressed) continue;
|
||||
|
||||
@@ -732,7 +732,7 @@ static constexpr uint8_t SC_DELETE = 0x53;
|
||||
|
||||
// ---- Input handling ----
|
||||
|
||||
static void handle_key(const Montauk::KeyEvent& ev) {
|
||||
static void handle_key(const montauk::abi::KeyEvent& ev) {
|
||||
if (!ev.pressed) return;
|
||||
|
||||
// Ctrl key combinations
|
||||
@@ -905,7 +905,7 @@ extern "C" void _start() {
|
||||
montauk::yield();
|
||||
}
|
||||
|
||||
Montauk::KeyEvent ev;
|
||||
montauk::abi::KeyEvent ev;
|
||||
montauk::getkey(&ev);
|
||||
handle_key(ev);
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ static void parse_status_text(const char* buf, int len, char* out, int outMax) {
|
||||
|
||||
static bool check_keyboard_abort() {
|
||||
if (montauk::is_key_available()) {
|
||||
Montauk::KeyEvent ev;
|
||||
montauk::abi::KeyEvent ev;
|
||||
montauk::getkey(&ev);
|
||||
if (ev.pressed && ev.ctrl && ev.ascii == 'q') return true;
|
||||
}
|
||||
@@ -189,7 +189,7 @@ static int plain_http_exchange(int fd, const char* request, int reqLen,
|
||||
deadline = montauk::get_milliseconds() + 15000;
|
||||
while (respLen < respMax - 1) {
|
||||
if (montauk::is_key_available()) {
|
||||
Montauk::KeyEvent ev;
|
||||
montauk::abi::KeyEvent ev;
|
||||
montauk::getkey(&ev);
|
||||
if (ev.pressed && ev.ctrl && ev.ascii == 'q') return -2; // aborted
|
||||
}
|
||||
@@ -202,7 +202,7 @@ static int plain_http_exchange(int fd, const char* request, int reqLen,
|
||||
if (now >= deadline) break;
|
||||
uint32_t signals = montauk::wait_handle(
|
||||
fd,
|
||||
Montauk::IPC_SIGNAL_READABLE | Montauk::IPC_SIGNAL_PEER_CLOSED,
|
||||
montauk::abi::IPC_SIGNAL_READABLE | montauk::abi::IPC_SIGNAL_PEER_CLOSED,
|
||||
deadline - now
|
||||
);
|
||||
if (signals == 0 || signals == (uint32_t)-1) break;
|
||||
@@ -404,7 +404,7 @@ extern "C" void _start() {
|
||||
if (verbose) {
|
||||
uint32_t days, secs;
|
||||
tls::get_bearssl_time(&days, &secs);
|
||||
Montauk::DateTime dt;
|
||||
montauk::abi::DateTime dt;
|
||||
montauk::gettime(&dt);
|
||||
char tmsg[128];
|
||||
snprintf(tmsg, sizeof(tmsg), "System time: %u-%02u-%02u %02u:%02u:%02u (days=%u secs=%u)\n",
|
||||
@@ -424,7 +424,7 @@ extern "C" void _start() {
|
||||
}
|
||||
} else {
|
||||
// ---- Plain HTTP ----
|
||||
int fd = montauk::socket(Montauk::SOCK_TCP);
|
||||
int fd = montauk::socket(montauk::abi::SOCK_TCP);
|
||||
if (fd < 0) {
|
||||
montauk::print("Error: failed to create socket\n");
|
||||
montauk::exit(1);
|
||||
|
||||
@@ -369,7 +369,7 @@ extern "C" void _start() {
|
||||
win.present();
|
||||
|
||||
while (true) {
|
||||
Montauk::WinEvent ev;
|
||||
montauk::abi::WinEvent ev;
|
||||
int r = win.poll(&ev);
|
||||
|
||||
if (r < 0) break;
|
||||
|
||||
@@ -223,7 +223,7 @@ static int parse_request_path(const char* req, int reqLen, char* pathOut, int pa
|
||||
|
||||
static void log_request(const char* method, const char* path, int status, int bodyLen) {
|
||||
// Get timestamp
|
||||
Montauk::DateTime dt;
|
||||
montauk::abi::DateTime dt;
|
||||
montauk::gettime(&dt);
|
||||
|
||||
char msg[256];
|
||||
@@ -236,7 +236,7 @@ static void log_request(const char* method, const char* path, int status, int bo
|
||||
// ---- Page generators ----
|
||||
|
||||
static int generate_index_page(char* buf, int bufSize) {
|
||||
Montauk::SysInfo info;
|
||||
montauk::abi::SysInfo info;
|
||||
montauk::get_info(&info);
|
||||
|
||||
uint64_t ms = montauk::get_milliseconds();
|
||||
@@ -388,13 +388,13 @@ static void handle_client(int clientFd) {
|
||||
} else {
|
||||
uint32_t signals = montauk::wait_handle(
|
||||
clientFd,
|
||||
Montauk::IPC_SIGNAL_READABLE | Montauk::IPC_SIGNAL_PEER_CLOSED,
|
||||
montauk::abi::IPC_SIGNAL_READABLE | montauk::abi::IPC_SIGNAL_PEER_CLOSED,
|
||||
20
|
||||
);
|
||||
if (signals == 0) {
|
||||
idleCount++;
|
||||
if (idleCount > 500) break;
|
||||
} else if (signals & Montauk::IPC_SIGNAL_PEER_CLOSED) {
|
||||
} else if (signals & montauk::abi::IPC_SIGNAL_PEER_CLOSED) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -545,7 +545,7 @@ extern "C" void _start() {
|
||||
}
|
||||
|
||||
// Create server socket
|
||||
int listenFd = montauk::socket(Montauk::SOCK_TCP);
|
||||
int listenFd = montauk::socket(montauk::abi::SOCK_TCP);
|
||||
if (listenFd < 0) {
|
||||
montauk::print("Error: failed to create socket\n");
|
||||
montauk::exit(1);
|
||||
@@ -578,7 +578,7 @@ extern "C" void _start() {
|
||||
while (running) {
|
||||
// Check for Ctrl+Q before blocking on accept
|
||||
while (montauk::is_key_available()) {
|
||||
Montauk::KeyEvent ev;
|
||||
montauk::abi::KeyEvent ev;
|
||||
montauk::getkey(&ev);
|
||||
if (ev.pressed && ev.ctrl && ev.ascii == 'q') {
|
||||
running = false;
|
||||
@@ -599,7 +599,7 @@ extern "C" void _start() {
|
||||
|
||||
// After serving, check for Ctrl+Q
|
||||
while (montauk::is_key_available()) {
|
||||
Montauk::KeyEvent ev;
|
||||
montauk::abi::KeyEvent ev;
|
||||
montauk::getkey(&ev);
|
||||
if (ev.pressed && ev.ctrl && ev.ascii == 'q') {
|
||||
running = false;
|
||||
|
||||
@@ -70,7 +70,7 @@ extern "C" void _start() {
|
||||
|
||||
if (len <= 0 || args[0] == '\0') {
|
||||
// Show current network configuration
|
||||
Montauk::NetCfg cfg;
|
||||
montauk::abi::NetCfg cfg;
|
||||
montauk::get_netcfg(&cfg);
|
||||
montauk::print(" IP Address: ");
|
||||
print_ip(cfg.ipAddress);
|
||||
@@ -135,7 +135,7 @@ extern "C" void _start() {
|
||||
montauk::exit(1);
|
||||
}
|
||||
|
||||
Montauk::NetCfg cfg;
|
||||
montauk::abi::NetCfg cfg;
|
||||
cfg.ipAddress = ip;
|
||||
cfg.subnetMask = mask;
|
||||
cfg.gateway = gw;
|
||||
|
||||
@@ -581,7 +581,7 @@ extern "C" void _start() {
|
||||
|
||||
// Event loop
|
||||
while (true) {
|
||||
Montauk::WinEvent ev;
|
||||
montauk::abi::WinEvent ev;
|
||||
int r = win.poll(&ev);
|
||||
|
||||
if (r < 0) break;
|
||||
|
||||
@@ -23,7 +23,7 @@ static void print_int(uint64_t n) {
|
||||
}
|
||||
|
||||
extern "C" void _start() {
|
||||
Montauk::SysInfo info;
|
||||
montauk::abi::SysInfo info;
|
||||
montauk::get_info(&info);
|
||||
montauk::print(info.osName);
|
||||
montauk::print(" v");
|
||||
|
||||
@@ -90,7 +90,7 @@ static int snprintf(char* buf, int size, const char* fmt, ...) {
|
||||
// ---- Logging ----
|
||||
|
||||
static void log_timestamp(char* buf, int size) {
|
||||
Montauk::DateTime dt;
|
||||
montauk::abi::DateTime dt;
|
||||
montauk::gettime(&dt);
|
||||
snprintf(buf, size, "%02d:%02d:%02d", dt.Hour, dt.Minute, dt.Second);
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
// ============================================================================
|
||||
|
||||
// EFI System Partition: C12A7328-F81F-11D2-BA4B-00A0C93EC93B
|
||||
static Montauk::PartGuid esp_type_guid() {
|
||||
Montauk::PartGuid g;
|
||||
static montauk::abi::PartGuid esp_type_guid() {
|
||||
montauk::abi::PartGuid g;
|
||||
g.Data1 = 0xC12A7328;
|
||||
g.Data2 = 0xF81F;
|
||||
g.Data3 = 0x11D2;
|
||||
@@ -24,8 +24,8 @@ static Montauk::PartGuid esp_type_guid() {
|
||||
}
|
||||
|
||||
// Linux Filesystem: 0FC63DAF-8483-4772-8E79-3D69D8477DE4
|
||||
static Montauk::PartGuid linux_fs_type_guid() {
|
||||
Montauk::PartGuid g;
|
||||
static montauk::abi::PartGuid linux_fs_type_guid() {
|
||||
montauk::abi::PartGuid g;
|
||||
g.Data1 = 0x0FC63DAF;
|
||||
g.Data2 = 0x8483;
|
||||
g.Data3 = 0x4772;
|
||||
@@ -52,7 +52,7 @@ void installer_refresh_disks() {
|
||||
auto& st = g_state;
|
||||
st.disk_count = 0;
|
||||
for (int port = 0; port < MAX_DISKS; port++) {
|
||||
Montauk::DiskInfo info;
|
||||
montauk::abi::DiskInfo info;
|
||||
montauk::memset(&info, 0, sizeof(info));
|
||||
int r = montauk::diskinfo(&info, port);
|
||||
if (r == 0 && info.type != 0) {
|
||||
@@ -272,7 +272,7 @@ static bool copy_recursive(const char* src_dir, const char* dst_dir,
|
||||
// GPT + partition helper
|
||||
// ============================================================================
|
||||
|
||||
static void set_gpt_name(Montauk::GptAddParams& params, const char* name) {
|
||||
static void set_gpt_name(montauk::abi::GptAddParams& params, const char* name) {
|
||||
int i = 0;
|
||||
for (; name[i] && i < 71; i++) params.name[i] = name[i];
|
||||
params.name[i] = '\0';
|
||||
@@ -306,7 +306,7 @@ static void install_efi_ext2(int disk) {
|
||||
add_log("Creating EFI partition (128 MB)...");
|
||||
flush_ui();
|
||||
{
|
||||
Montauk::GptAddParams params;
|
||||
montauk::abi::GptAddParams params;
|
||||
montauk::memset(¶ms, 0, sizeof(params));
|
||||
params.blockDev = disk;
|
||||
params.startLba = FIRST_USABLE_LBA;
|
||||
@@ -327,7 +327,7 @@ static void install_efi_ext2(int disk) {
|
||||
add_log("Creating ext2 partition...");
|
||||
flush_ui();
|
||||
{
|
||||
Montauk::GptAddParams params;
|
||||
montauk::abi::GptAddParams params;
|
||||
montauk::memset(¶ms, 0, sizeof(params));
|
||||
params.blockDev = disk;
|
||||
params.startLba = 0; // auto-fill largest free region
|
||||
@@ -345,7 +345,7 @@ static void install_efi_ext2(int disk) {
|
||||
flush_ui();
|
||||
|
||||
// Step 4: Find partition indices
|
||||
Montauk::PartInfo parts[MAX_PARTS];
|
||||
montauk::abi::PartInfo parts[MAX_PARTS];
|
||||
int part_count = montauk::partlist(parts, MAX_PARTS);
|
||||
int efi_idx = -1, linux_idx = -1;
|
||||
for (int p = 0; p < part_count; p++) {
|
||||
@@ -365,10 +365,10 @@ static void install_efi_ext2(int disk) {
|
||||
add_log("Formatting EFI partition (FAT32)...");
|
||||
flush_ui();
|
||||
{
|
||||
Montauk::FsFormatParams fmt;
|
||||
montauk::abi::FsFormatParams fmt;
|
||||
montauk::memset(&fmt, 0, sizeof(fmt));
|
||||
fmt.partIndex = efi_idx;
|
||||
fmt.fsType = Montauk::FS_TYPE_FAT32;
|
||||
fmt.fsType = montauk::abi::FS_TYPE_FAT32;
|
||||
r = montauk::fs_format(&fmt);
|
||||
if (r < 0) {
|
||||
add_log("ERROR: FAT32 format failed");
|
||||
@@ -382,10 +382,10 @@ static void install_efi_ext2(int disk) {
|
||||
add_log("Formatting root partition (ext2)...");
|
||||
flush_ui();
|
||||
{
|
||||
Montauk::FsFormatParams fmt;
|
||||
montauk::abi::FsFormatParams fmt;
|
||||
montauk::memset(&fmt, 0, sizeof(fmt));
|
||||
fmt.partIndex = linux_idx;
|
||||
fmt.fsType = Montauk::FS_TYPE_EXT2;
|
||||
fmt.fsType = montauk::abi::FS_TYPE_EXT2;
|
||||
r = montauk::fs_format(&fmt);
|
||||
if (r < 0) {
|
||||
add_log("ERROR: ext2 format failed");
|
||||
@@ -515,7 +515,7 @@ static void install_single_fat32(int disk) {
|
||||
// Step 2: Create EFI System Partition (entire disk)
|
||||
add_log("Creating EFI System Partition...");
|
||||
flush_ui();
|
||||
Montauk::GptAddParams params;
|
||||
montauk::abi::GptAddParams params;
|
||||
montauk::memset(¶ms, 0, sizeof(params));
|
||||
params.blockDev = disk;
|
||||
params.startLba = 0;
|
||||
@@ -535,7 +535,7 @@ static void install_single_fat32(int disk) {
|
||||
add_log("Formatting as FAT32...");
|
||||
flush_ui();
|
||||
|
||||
Montauk::PartInfo parts[MAX_PARTS];
|
||||
montauk::abi::PartInfo parts[MAX_PARTS];
|
||||
int part_count = montauk::partlist(parts, MAX_PARTS);
|
||||
int esp_index = -1;
|
||||
for (int p = 0; p < part_count; p++) {
|
||||
@@ -550,10 +550,10 @@ static void install_single_fat32(int disk) {
|
||||
flush_ui(); st.step = STEP_ERROR; return;
|
||||
}
|
||||
|
||||
Montauk::FsFormatParams fmt;
|
||||
montauk::abi::FsFormatParams fmt;
|
||||
montauk::memset(&fmt, 0, sizeof(fmt));
|
||||
fmt.partIndex = esp_index;
|
||||
fmt.fsType = Montauk::FS_TYPE_FAT32;
|
||||
fmt.fsType = montauk::abi::FS_TYPE_FAT32;
|
||||
|
||||
r = montauk::fs_format(&fmt);
|
||||
if (r < 0) {
|
||||
|
||||
@@ -106,13 +106,13 @@ struct InstallerState {
|
||||
int mode; // InstallerMode
|
||||
|
||||
// Install flow
|
||||
Montauk::DiskInfo disks[MAX_DISKS];
|
||||
montauk::abi::DiskInfo disks[MAX_DISKS];
|
||||
int disk_count;
|
||||
int selected_disk;
|
||||
int partition_scheme;
|
||||
|
||||
// Update flow
|
||||
Montauk::PartInfo parts[MAX_PARTS];
|
||||
montauk::abi::PartInfo parts[MAX_PARTS];
|
||||
int part_count;
|
||||
int selected_part;
|
||||
|
||||
|
||||
@@ -289,7 +289,7 @@ extern "C" void _start() {
|
||||
bool install_triggered = false;
|
||||
|
||||
while (true) {
|
||||
Montauk::WinEvent ev;
|
||||
montauk::abi::WinEvent ev;
|
||||
bool redraw = false;
|
||||
|
||||
int r = g_window.poll(&ev);
|
||||
|
||||
@@ -917,7 +917,7 @@ extern "C" void _start() {
|
||||
ui_render();
|
||||
|
||||
// Create socket and connect
|
||||
irc.fd = montauk::socket(Montauk::SOCK_TCP);
|
||||
irc.fd = montauk::socket(montauk::abi::SOCK_TCP);
|
||||
if (irc.fd < 0) {
|
||||
msg_add("\033[31m*** Failed to create socket\033[0m");
|
||||
ui_render();
|
||||
@@ -955,7 +955,7 @@ extern "C" void _start() {
|
||||
|
||||
// Poll keyboard
|
||||
if (montauk::is_key_available()) {
|
||||
Montauk::KeyEvent ev;
|
||||
montauk::abi::KeyEvent ev;
|
||||
montauk::getkey(&ev);
|
||||
|
||||
if (!ev.pressed) {
|
||||
@@ -1029,7 +1029,7 @@ extern "C" void _start() {
|
||||
} else {
|
||||
if (!dirty) {
|
||||
montauk::wait_handle(irc.fd,
|
||||
Montauk::IPC_SIGNAL_READABLE | Montauk::IPC_SIGNAL_PEER_CLOSED,
|
||||
montauk::abi::IPC_SIGNAL_READABLE | montauk::abi::IPC_SIGNAL_PEER_CLOSED,
|
||||
10);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ static bool klog_render() {
|
||||
return true;
|
||||
}
|
||||
|
||||
static void klog_handle_mouse(const Montauk::WinEvent& ev) {
|
||||
static void klog_handle_mouse(const montauk::abi::WinEvent& ev) {
|
||||
if (ev.mouse.scroll == 0) return;
|
||||
|
||||
g_klog.term.view_offset += (ev.mouse.scroll < 0) ? 3 : -3;
|
||||
@@ -193,7 +193,7 @@ extern "C" void _start() {
|
||||
while (true) {
|
||||
bool redraw = klog_poll();
|
||||
|
||||
Montauk::WinEvent ev;
|
||||
montauk::abi::WinEvent ev;
|
||||
bool quit = false;
|
||||
int r = 0;
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ struct LoginState {
|
||||
char error_msg[128];
|
||||
bool show_error;
|
||||
|
||||
Montauk::MouseState mouse;
|
||||
montauk::abi::MouseState mouse;
|
||||
uint8_t prev_buttons;
|
||||
gui::mtk::TextInputState username_input;
|
||||
gui::mtk::TextInputState display_name_input;
|
||||
@@ -144,12 +144,12 @@ void draw_login_screen(LoginState* ls);
|
||||
int max_fields(LoginState* ls);
|
||||
bool try_first_boot_submit(LoginState* ls);
|
||||
bool try_login(LoginState* ls);
|
||||
void handle_key(LoginState* ls, const Montauk::KeyEvent& key);
|
||||
void handle_key(LoginState* ls, const montauk::abi::KeyEvent& key);
|
||||
void handle_mouse(LoginState* ls);
|
||||
|
||||
// Graceful shutdown view (login_shutdown.cpp). draw_shutdown_screen paints the
|
||||
// status card; perform_graceful_shutdown runs the staged power-off (Bluetooth
|
||||
// teardown, filesystem flush) and finally issues the ACPI power-off / reset, so
|
||||
// it never returns. `action` is Montauk::POWER_REQ_SHUTDOWN or POWER_REQ_REBOOT.
|
||||
// it never returns. `action` is montauk::abi::POWER_REQ_SHUTDOWN or POWER_REQ_REBOOT.
|
||||
void draw_shutdown_screen(LoginState* ls, const char* heading, const char* status);
|
||||
[[noreturn]] void perform_graceful_shutdown(LoginState* ls, int action);
|
||||
|
||||
@@ -50,8 +50,8 @@ void launch_desktop_session(LoginState* ls) {
|
||||
// exiting (see desktop_request_power). Pick it up now that waitpid has
|
||||
// returned and run the shutdown stages; perform_graceful_shutdown never
|
||||
// returns. A normal logout leaves no request, so we fall through.
|
||||
int req = montauk::power_request(Montauk::POWER_REQ_QUERY);
|
||||
if (req == Montauk::POWER_REQ_SHUTDOWN || req == Montauk::POWER_REQ_REBOOT) {
|
||||
int req = montauk::power_request(montauk::abi::POWER_REQ_QUERY);
|
||||
if (req == montauk::abi::POWER_REQ_SHUTDOWN || req == montauk::abi::POWER_REQ_REBOOT) {
|
||||
perform_graceful_shutdown(ls, req);
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ bool try_login(LoginState* ls) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void handle_key(LoginState* ls, const Montauk::KeyEvent& key) {
|
||||
void handle_key(LoginState* ls, const montauk::abi::KeyEvent& key) {
|
||||
if (!key.pressed) return;
|
||||
|
||||
// Tab / Shift+Tab cycles fields.
|
||||
@@ -220,10 +220,10 @@ void handle_mouse(LoginState* ls) {
|
||||
}
|
||||
return;
|
||||
} else if (lo.shutdown_button.contains(mx, my)) {
|
||||
perform_graceful_shutdown(ls, Montauk::POWER_REQ_SHUTDOWN);
|
||||
perform_graceful_shutdown(ls, montauk::abi::POWER_REQ_SHUTDOWN);
|
||||
return;
|
||||
} else if (lo.reboot_button.contains(mx, my)) {
|
||||
perform_graceful_shutdown(ls, Montauk::POWER_REQ_REBOOT);
|
||||
perform_graceful_shutdown(ls, montauk::abi::POWER_REQ_REBOOT);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,11 +148,11 @@ bool run_stage(void (*fn)(), uint64_t timeout_ms) {
|
||||
// that return immediately when no adapter exists (e.g. under QEMU), so this
|
||||
// gate is effectively free.
|
||||
bool bluetooth_has_active_connection() {
|
||||
Montauk::BtAdapterInfo adapter;
|
||||
montauk::abi::BtAdapterInfo adapter;
|
||||
if (montauk::bt_info(&adapter) != 0 || !adapter.initialized) {
|
||||
return false; // no adapter
|
||||
}
|
||||
Montauk::BtDevInfo devs[8];
|
||||
montauk::abi::BtDevInfo devs[8];
|
||||
int n = montauk::bt_list(devs, 8);
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (devs[i].connected) return true;
|
||||
@@ -162,7 +162,7 @@ bool bluetooth_has_active_connection() {
|
||||
|
||||
// Stage bodies -- no captured state, so they double as bare thread entries.
|
||||
void stage_disconnect_bluetooth() {
|
||||
Montauk::BtDevInfo devs[8];
|
||||
montauk::abi::BtDevInfo devs[8];
|
||||
int n = montauk::bt_list(devs, 8);
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (devs[i].connected) {
|
||||
@@ -178,7 +178,7 @@ void stage_flush_filesystems() {
|
||||
} // namespace
|
||||
|
||||
void perform_graceful_shutdown(LoginState* ls, int action) {
|
||||
const bool rebooting = (action == Montauk::POWER_REQ_REBOOT);
|
||||
const bool rebooting = (action == montauk::abi::POWER_REQ_REBOOT);
|
||||
const char* heading = rebooting ? "Restarting" : "Shutting Down";
|
||||
|
||||
// ==== Stage 1: disconnect connected Bluetooth devices ====
|
||||
|
||||
@@ -94,7 +94,7 @@ extern "C" void _start() {
|
||||
fast_mouse_path = mouse_changed || ls->mouse.buttons != 0;
|
||||
|
||||
while (montauk::is_key_available()) {
|
||||
Montauk::KeyEvent key;
|
||||
montauk::abi::KeyEvent key;
|
||||
montauk::getkey(&key);
|
||||
handle_key(ls, key);
|
||||
key_changed = true;
|
||||
|
||||
@@ -287,7 +287,7 @@ extern "C" void _start() {
|
||||
montauk::yield();
|
||||
}
|
||||
|
||||
Montauk::KeyEvent ev;
|
||||
montauk::abi::KeyEvent ev;
|
||||
montauk::getkey(&ev);
|
||||
if (!ev.pressed) continue;
|
||||
|
||||
|
||||
@@ -253,7 +253,7 @@ static bool handle_mouse(MandelbrotState* mb, const MouseEvent& ev, int win_w, i
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool handle_key(MandelbrotState* mb, const Montauk::KeyEvent& key, int win_w) {
|
||||
static bool handle_key(MandelbrotState* mb, const montauk::abi::KeyEvent& key, int win_w) {
|
||||
if (!key.pressed) return false;
|
||||
|
||||
if (key.ascii == 'r' || key.ascii == 'R') {
|
||||
@@ -303,7 +303,7 @@ extern "C" void _start() {
|
||||
win.present();
|
||||
|
||||
while (true) {
|
||||
Montauk::WinEvent ev;
|
||||
montauk::abi::WinEvent ev;
|
||||
int r = win.poll(&ev);
|
||||
|
||||
if (r < 0) break;
|
||||
|
||||
@@ -82,7 +82,7 @@ static const int art_vw[] = {
|
||||
extern "C" void _start() {
|
||||
// ==== Gather system information ====
|
||||
|
||||
Montauk::SysInfo sysinfo;
|
||||
montauk::abi::SysInfo sysinfo;
|
||||
montauk::get_info(&sysinfo);
|
||||
|
||||
const char* username = "user";
|
||||
@@ -97,16 +97,16 @@ extern "C" void _start() {
|
||||
uint64_t mins = (total_secs % 3600) / 60;
|
||||
uint64_t secs = total_secs % 60;
|
||||
|
||||
Montauk::MemStats mem;
|
||||
montauk::abi::MemStats mem;
|
||||
montauk::memstats(&mem);
|
||||
|
||||
Montauk::FbInfo fb;
|
||||
montauk::abi::FbInfo fb;
|
||||
montauk::fb_info(&fb);
|
||||
|
||||
int tcols = 0, trows = 0;
|
||||
montauk::termsize(&tcols, &trows);
|
||||
|
||||
Montauk::DevInfo devs[32];
|
||||
montauk::abi::DevInfo devs[32];
|
||||
int ndev = montauk::devlist(devs, 32);
|
||||
const char* cpu_name = "Unknown";
|
||||
const char* gpu_name = "Unknown";
|
||||
@@ -122,14 +122,14 @@ extern "C" void _start() {
|
||||
}
|
||||
}
|
||||
|
||||
static Montauk::ProcInfo procs[PROC_SCAN_MAX];
|
||||
static montauk::abi::ProcInfo procs[PROC_SCAN_MAX];
|
||||
int nproc = montauk::proclist(procs, PROC_SCAN_MAX);
|
||||
int active = 0;
|
||||
for (int i = 0; i < nproc; i++) {
|
||||
if (process_state_alive(procs[i].state)) active++;
|
||||
}
|
||||
|
||||
Montauk::NetCfg net;
|
||||
montauk::abi::NetCfg net;
|
||||
montauk::get_netcfg(&net);
|
||||
|
||||
// ==== Build info lines ====
|
||||
|
||||
@@ -1402,7 +1402,7 @@ static bool handle_click(int mx, int my) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool handle_key(const Montauk::KeyEvent& key, bool& quit) {
|
||||
static bool handle_key(const montauk::abi::KeyEvent& key, bool& quit) {
|
||||
if (!key.pressed) return false;
|
||||
|
||||
if (key.scancode == 0x01) { // Escape
|
||||
@@ -1620,7 +1620,7 @@ extern "C" void _start() {
|
||||
}
|
||||
|
||||
// Create window
|
||||
Montauk::WinCreateResult wres;
|
||||
montauk::abi::WinCreateResult wres;
|
||||
if (montauk::win_create("Music", g.win_w, g.win_h, &wres) < 0 || wres.id < 0)
|
||||
montauk::exit(1);
|
||||
|
||||
@@ -1638,7 +1638,7 @@ extern "C" void _start() {
|
||||
uint64_t last_render = montauk::get_milliseconds();
|
||||
|
||||
while (true) {
|
||||
Montauk::WinEvent ev;
|
||||
montauk::abi::WinEvent ev;
|
||||
bool redraw = false;
|
||||
bool quit = false;
|
||||
int r;
|
||||
|
||||
@@ -51,8 +51,8 @@ static Tab g_tab = TAB_STATUS;
|
||||
static int g_mouse_x = -1;
|
||||
static int g_mouse_y = -1;
|
||||
static int g_focus_field = -1;
|
||||
static Montauk::NetCfg g_cfg = {};
|
||||
static Montauk::NetStatus g_net = {};
|
||||
static montauk::abi::NetCfg g_cfg = {};
|
||||
static montauk::abi::NetStatus g_net = {};
|
||||
static Field g_fields[FIELD_COUNT] = {
|
||||
{"IP Address", {}, {}},
|
||||
{"Subnet Mask", {}, {}},
|
||||
@@ -475,7 +475,7 @@ static void launch_dhcp() {
|
||||
}
|
||||
|
||||
static void clear_config() {
|
||||
Montauk::NetCfg cfg = g_cfg;
|
||||
montauk::abi::NetCfg cfg = g_cfg;
|
||||
cfg.ipAddress = 0;
|
||||
cfg.subnetMask = 0;
|
||||
cfg.gateway = 0;
|
||||
@@ -500,7 +500,7 @@ static bool apply_config() {
|
||||
}
|
||||
}
|
||||
|
||||
Montauk::NetCfg cfg = g_cfg;
|
||||
montauk::abi::NetCfg cfg = g_cfg;
|
||||
cfg.ipAddress = values[0];
|
||||
cfg.subnetMask = values[1];
|
||||
cfg.gateway = values[2];
|
||||
@@ -623,7 +623,7 @@ static bool handle_mouse(int mx, int my, uint8_t buttons, uint8_t prev_buttons)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool handle_key(const Montauk::KeyEvent& key) {
|
||||
static bool handle_key(const montauk::abi::KeyEvent& key) {
|
||||
if (!key.pressed) return false;
|
||||
|
||||
if (key.scancode == 0x01) {
|
||||
@@ -694,7 +694,7 @@ extern "C" void _start() {
|
||||
render();
|
||||
|
||||
while (g_win.id >= 0 && !g_win.closed) {
|
||||
Montauk::WinEvent ev;
|
||||
montauk::abi::WinEvent ev;
|
||||
int r = g_win.poll(&ev);
|
||||
bool redraw = false;
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ extern "C" void _start() {
|
||||
}
|
||||
|
||||
// Show DNS server
|
||||
Montauk::NetCfg cfg;
|
||||
montauk::abi::NetCfg cfg;
|
||||
montauk::get_netcfg(&cfg);
|
||||
|
||||
montauk::print("Server: ");
|
||||
|
||||
@@ -275,7 +275,7 @@ extern "C" void _start() {
|
||||
win.present();
|
||||
|
||||
while (true) {
|
||||
Montauk::WinEvent ev;
|
||||
montauk::abi::WinEvent ev;
|
||||
int r = win.poll(&ev);
|
||||
|
||||
if (r < 0) break;
|
||||
|
||||
@@ -193,7 +193,7 @@ extern "C" void _start() {
|
||||
win.present();
|
||||
|
||||
while (true) {
|
||||
Montauk::WinEvent ev;
|
||||
montauk::abi::WinEvent ev;
|
||||
int r = win.poll(&ev);
|
||||
|
||||
if (r < 0) break;
|
||||
|
||||
@@ -524,7 +524,7 @@ static void open_config_popup() {
|
||||
g_app.config_mouse_y = -1;
|
||||
|
||||
if (!g_config.open) {
|
||||
Montauk::WinCreateResult wres;
|
||||
montauk::abi::WinCreateResult wres;
|
||||
if (montauk::win_create("Configure Printer", CONFIG_W, CONFIG_H, &wres) < 0 || wres.id < 0) {
|
||||
set_status("Failed to open printer dialog");
|
||||
return;
|
||||
@@ -671,7 +671,7 @@ static bool handle_config_mouse(int mx, int my, uint8_t buttons, uint8_t prev_bu
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool handle_config_key(const Montauk::KeyEvent& key) {
|
||||
static bool handle_config_key(const montauk::abi::KeyEvent& key) {
|
||||
if (!key.pressed) return false;
|
||||
|
||||
if (key.scancode == 0x01) {
|
||||
@@ -1101,7 +1101,7 @@ static bool hover_changed(const Rect& rect, bool enabled,
|
||||
return rect.contains(prev_x, prev_y) != rect.contains(next_x, next_y);
|
||||
}
|
||||
|
||||
static bool handle_mouse(const Montauk::WinEvent& ev) {
|
||||
static bool handle_mouse(const montauk::abi::WinEvent& ev) {
|
||||
if (g_app.config_open)
|
||||
return false;
|
||||
|
||||
@@ -1145,7 +1145,7 @@ static void cycle_tab(int delta) {
|
||||
g_app.active_tab = next;
|
||||
}
|
||||
|
||||
static void handle_key(const Montauk::KeyEvent& key) {
|
||||
static void handle_key(const montauk::abi::KeyEvent& key) {
|
||||
if (!key.pressed) return;
|
||||
|
||||
if (g_app.config_open) {
|
||||
@@ -1211,7 +1211,7 @@ extern "C" void _start() {
|
||||
render();
|
||||
|
||||
while (g_win.id >= 0 && !g_win.closed) {
|
||||
Montauk::WinEvent ev;
|
||||
montauk::abi::WinEvent ev;
|
||||
bool redraw_config = false;
|
||||
bool redraw_main = false;
|
||||
|
||||
|
||||
@@ -54,10 +54,10 @@ struct ProcCpuSnapshot {
|
||||
};
|
||||
|
||||
struct ProcMgrState {
|
||||
Montauk::ProcInfo procs[PM_MAX_PROCS];
|
||||
Montauk::WinInfo windows[PM_MAX_WINDOWS];
|
||||
Montauk::MemStats mem;
|
||||
Montauk::SysInfo sys_info;
|
||||
montauk::abi::ProcInfo procs[PM_MAX_PROCS];
|
||||
montauk::abi::WinInfo windows[PM_MAX_WINDOWS];
|
||||
montauk::abi::MemStats mem;
|
||||
montauk::abi::SysInfo sys_info;
|
||||
int proc_count;
|
||||
int win_count;
|
||||
int selected;
|
||||
@@ -130,7 +130,7 @@ static int parse_positive_int_after_comma(const char* text) {
|
||||
}
|
||||
|
||||
static int detect_cpu_count() {
|
||||
Montauk::DevInfo devs[16];
|
||||
montauk::abi::DevInfo devs[16];
|
||||
int count = montauk::devlist(devs, 16);
|
||||
if (count < 0) count = 0;
|
||||
|
||||
@@ -779,7 +779,7 @@ static bool handle_window_click(int mx, int my) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool handle_mouse(const Montauk::WinEvent& ev) {
|
||||
static bool handle_mouse(const montauk::abi::WinEvent& ev) {
|
||||
bool refresh_hover_before = mouse_in_rect(refresh_button_rect());
|
||||
bool kill_hover_before = mouse_in_rect(kill_button_rect());
|
||||
|
||||
@@ -824,7 +824,7 @@ static bool handle_mouse(const Montauk::WinEvent& ev) {
|
||||
return redraw;
|
||||
}
|
||||
|
||||
static bool handle_key(const Montauk::KeyEvent& key) {
|
||||
static bool handle_key(const montauk::abi::KeyEvent& key) {
|
||||
if (!key.pressed)
|
||||
return false;
|
||||
|
||||
@@ -906,7 +906,7 @@ extern "C" void _start() {
|
||||
while (!g_win.closed) {
|
||||
bool redraw = refresh_state(false);
|
||||
|
||||
Montauk::WinEvent ev;
|
||||
montauk::abi::WinEvent ev;
|
||||
int r = g_win.poll(&ev);
|
||||
if (r < 0) break;
|
||||
|
||||
|
||||
@@ -1053,7 +1053,7 @@ extern "C" void _start() {
|
||||
g_input.begin_frame();
|
||||
|
||||
// Process all pending events
|
||||
Montauk::WinEvent ev;
|
||||
montauk::abi::WinEvent ev;
|
||||
while (g_engine.poll(&ev)) {
|
||||
g_input.handle_event(ev);
|
||||
|
||||
|
||||
@@ -226,7 +226,7 @@ static bool run_picker(CaptureMode* out_mode) {
|
||||
|
||||
bool accepted = false;
|
||||
while (true) {
|
||||
Montauk::WinEvent ev;
|
||||
montauk::abi::WinEvent ev;
|
||||
int r = win.poll(&ev);
|
||||
|
||||
if (r < 0) break;
|
||||
@@ -300,7 +300,7 @@ static bool capture_screen(ScreenBuffer* out, char* err, int err_len) {
|
||||
out->height = 0;
|
||||
out->pitch = 0;
|
||||
|
||||
Montauk::FbInfo fb;
|
||||
montauk::abi::FbInfo fb;
|
||||
montauk::fb_info(&fb);
|
||||
|
||||
int width = (int)fb.width;
|
||||
@@ -559,7 +559,7 @@ enum AreaEventResult : uint8_t {
|
||||
static AreaEventResult handle_area_selector_event(WsWindow& win,
|
||||
const ScreenBuffer& screen,
|
||||
AreaSelectorState& st,
|
||||
const Montauk::WinEvent& ev,
|
||||
const montauk::abi::WinEvent& ev,
|
||||
bool* redraw) {
|
||||
if (!redraw) return AREA_EVENT_CONTINUE;
|
||||
|
||||
@@ -660,7 +660,7 @@ static bool run_area_selector(const ScreenBuffer& screen, Rect* out_area) {
|
||||
return false;
|
||||
}
|
||||
if (st.fullscreen)
|
||||
win.set_flags(Montauk::WIN_FLAG_FULLSCREEN);
|
||||
win.set_flags(montauk::abi::WIN_FLAG_FULLSCREEN);
|
||||
|
||||
mtk::StandaloneHost host(&win);
|
||||
Canvas canvas = host.canvas();
|
||||
@@ -669,7 +669,7 @@ static bool run_area_selector(const ScreenBuffer& screen, Rect* out_area) {
|
||||
|
||||
bool accepted = false;
|
||||
while (true) {
|
||||
Montauk::WinEvent ev;
|
||||
montauk::abi::WinEvent ev;
|
||||
int r = win.poll(&ev);
|
||||
|
||||
if (r < 0) break;
|
||||
@@ -803,7 +803,7 @@ static void build_default_save_dir(char* out, int out_len) {
|
||||
}
|
||||
|
||||
static void build_suggested_name(char* out, int out_len) {
|
||||
Montauk::DateTime dt;
|
||||
montauk::abi::DateTime dt;
|
||||
montauk::gettime(&dt);
|
||||
snprintf(out, out_len,
|
||||
"screenshot_%04d%02d%02d_%02d%02d%02d.jpg",
|
||||
|
||||
@@ -352,12 +352,12 @@ static constexpr uint8_t SC_DOWN = 0x50;
|
||||
static constexpr uint8_t SC_LEFT = 0x4B;
|
||||
static constexpr uint8_t SC_RIGHT = 0x4D;
|
||||
|
||||
static bool empty_key_event(const Montauk::KeyEvent& ev) {
|
||||
static bool empty_key_event(const montauk::abi::KeyEvent& ev) {
|
||||
return ev.scancode == 0 && ev.ascii == 0 && !ev.pressed &&
|
||||
!ev.shift && !ev.ctrl && !ev.alt;
|
||||
}
|
||||
|
||||
static void wait_key_event(Montauk::KeyEvent* out) {
|
||||
static void wait_key_event(montauk::abi::KeyEvent* out) {
|
||||
if (!out) return;
|
||||
|
||||
for (;;) {
|
||||
@@ -399,7 +399,7 @@ extern "C" void _start() {
|
||||
prompt();
|
||||
|
||||
while (true) {
|
||||
Montauk::KeyEvent ev;
|
||||
montauk::abi::KeyEvent ev;
|
||||
wait_key_event(&ev);
|
||||
|
||||
if (!ev.pressed) continue;
|
||||
|
||||
@@ -370,7 +370,7 @@ extern "C" void _start() {
|
||||
win.present();
|
||||
|
||||
while (true) {
|
||||
Montauk::WinEvent ev;
|
||||
montauk::abi::WinEvent ev;
|
||||
int r = win.poll(&ev);
|
||||
|
||||
if (r < 0) break;
|
||||
|
||||
@@ -120,7 +120,7 @@ extern "C" void _start() {
|
||||
}
|
||||
|
||||
// Create socket
|
||||
int fd = montauk::socket(Montauk::SOCK_TCP);
|
||||
int fd = montauk::socket(montauk::abi::SOCK_TCP);
|
||||
if (fd < 0) {
|
||||
montauk::print("Error: failed to create socket\n");
|
||||
montauk::exit(1);
|
||||
@@ -159,7 +159,7 @@ extern "C" void _start() {
|
||||
|
||||
// Poll keyboard
|
||||
if (montauk::is_key_available()) {
|
||||
Montauk::KeyEvent ev;
|
||||
montauk::abi::KeyEvent ev;
|
||||
montauk::getkey(&ev);
|
||||
|
||||
if (!ev.pressed) continue;
|
||||
@@ -187,7 +187,7 @@ extern "C" void _start() {
|
||||
montauk::putchar(ev.ascii);
|
||||
}
|
||||
} else {
|
||||
montauk::wait_handle(fd, Montauk::IPC_SIGNAL_READABLE | Montauk::IPC_SIGNAL_PEER_CLOSED, 10);
|
||||
montauk::wait_handle(fd, montauk::abi::IPC_SIGNAL_READABLE | montauk::abi::IPC_SIGNAL_PEER_CLOSED, 10);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,11 +45,11 @@ static bool g_should_exit = false;
|
||||
static bool g_force_redraw = true;
|
||||
static int g_last_win_w = 0;
|
||||
static int g_last_win_h = 0;
|
||||
static Montauk::ProcInfo g_kill_procs[256];
|
||||
static montauk::abi::ProcInfo g_kill_procs[256];
|
||||
static int g_kill_pids[256];
|
||||
static int g_kill_pid_count = 0;
|
||||
|
||||
static bool left_pressed(const Montauk::WinEvent& ev) {
|
||||
static bool left_pressed(const montauk::abi::WinEvent& ev) {
|
||||
return (ev.mouse.buttons & 1) && !(ev.mouse.prev_buttons & 1);
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ static bool term_render() {
|
||||
return true;
|
||||
}
|
||||
|
||||
static void term_handle_mouse(const Montauk::WinEvent& ev) {
|
||||
static void term_handle_mouse(const montauk::abi::WinEvent& ev) {
|
||||
if (g_tabs.tab_count <= 0) return;
|
||||
|
||||
TerminalState* ts = g_tabs.tabs[g_tabs.active_tab];
|
||||
@@ -319,7 +319,7 @@ static void term_handle_mouse(const Montauk::WinEvent& ev) {
|
||||
}
|
||||
}
|
||||
|
||||
static void term_handle_key(const Montauk::KeyEvent& key) {
|
||||
static void term_handle_key(const montauk::abi::KeyEvent& key) {
|
||||
if (g_tabs.tab_count <= 0) return;
|
||||
|
||||
if (key.ctrl && key.pressed && key.scancode == 0x14) {
|
||||
@@ -423,7 +423,7 @@ extern "C" void _start() {
|
||||
|
||||
while (!g_should_exit) {
|
||||
bool redraw = false;
|
||||
Montauk::WinEvent ev;
|
||||
montauk::abi::WinEvent ev;
|
||||
bool quit = false;
|
||||
int r = 0;
|
||||
|
||||
|
||||
@@ -1033,7 +1033,7 @@ static void open_pathbar_save() {
|
||||
// Keyboard handler
|
||||
// ============================================================================
|
||||
|
||||
static bool handle_key(Montauk::KeyEvent& key, int win_id) {
|
||||
static bool handle_key(montauk::abi::KeyEvent& key, int win_id) {
|
||||
if (!key.pressed) return false;
|
||||
|
||||
if (g_ctx_menu.open) {
|
||||
@@ -1227,7 +1227,7 @@ static bool handle_key(Montauk::KeyEvent& key, int win_id) {
|
||||
// Mouse handler
|
||||
// ============================================================================
|
||||
|
||||
static bool handle_mouse(Montauk::WinEvent& ev, int win_id) {
|
||||
static bool handle_mouse(montauk::abi::WinEvent& ev, int win_id) {
|
||||
int mx = ev.mouse.x;
|
||||
int my = ev.mouse.y;
|
||||
uint8_t btns = ev.mouse.buttons;
|
||||
@@ -1458,7 +1458,7 @@ extern "C" void _start() {
|
||||
}
|
||||
|
||||
// Create window
|
||||
Montauk::WinCreateResult wres;
|
||||
montauk::abi::WinCreateResult wres;
|
||||
if (montauk::win_create(title, INIT_W, INIT_H, &wres) < 0 || wres.id < 0)
|
||||
montauk::exit(1);
|
||||
|
||||
@@ -1469,7 +1469,7 @@ extern "C" void _start() {
|
||||
montauk::win_present(win_id);
|
||||
|
||||
while (true) {
|
||||
Montauk::WinEvent ev;
|
||||
montauk::abi::WinEvent ev;
|
||||
int r = montauk::win_poll(win_id, &ev);
|
||||
|
||||
if (r < 0) break;
|
||||
|
||||
@@ -692,7 +692,7 @@ static void render() {
|
||||
host.present();
|
||||
}
|
||||
|
||||
static bool handle_mouse(const Montauk::WinEvent& ev) {
|
||||
static bool handle_mouse(const montauk::abi::WinEvent& ev) {
|
||||
int prev_x = g_mouse_x;
|
||||
int prev_y = g_mouse_y;
|
||||
g_mouse_x = ev.mouse.x;
|
||||
@@ -803,7 +803,7 @@ static bool handle_mouse(const Montauk::WinEvent& ev) {
|
||||
return redraw;
|
||||
}
|
||||
|
||||
static bool handle_key(const Montauk::KeyEvent& key) {
|
||||
static bool handle_key(const montauk::abi::KeyEvent& key) {
|
||||
if (!key.pressed || g_country_count <= 0) return false;
|
||||
|
||||
if (key.ascii == '\n' || key.ascii == '\r') {
|
||||
@@ -858,7 +858,7 @@ extern "C" void _start() {
|
||||
render();
|
||||
|
||||
while (g_win.id >= 0 && !g_win.closed) {
|
||||
Montauk::WinEvent ev;
|
||||
montauk::abi::WinEvent ev;
|
||||
int r = g_win.poll(&ev);
|
||||
bool redraw = false;
|
||||
|
||||
|
||||
@@ -1205,7 +1205,7 @@ static bool handle_click(int mx, int my) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool handle_key(const Montauk::KeyEvent& key, bool& quit) {
|
||||
static bool handle_key(const montauk::abi::KeyEvent& key, bool& quit) {
|
||||
if (!key.pressed) return false;
|
||||
|
||||
if (key.scancode == 0x01) {
|
||||
@@ -1357,7 +1357,7 @@ extern "C" void _start() {
|
||||
uint64_t last_draw = montauk::get_milliseconds();
|
||||
|
||||
while (true) {
|
||||
Montauk::WinEvent ev;
|
||||
montauk::abi::WinEvent ev;
|
||||
int r = win.poll(&ev);
|
||||
|
||||
if (r < 0) break;
|
||||
|
||||
@@ -432,7 +432,7 @@ extern "C" void _start() {
|
||||
|
||||
// Event loop
|
||||
while (true) {
|
||||
Montauk::WinEvent ev;
|
||||
montauk::abi::WinEvent ev;
|
||||
int r = win.poll(&ev);
|
||||
|
||||
if (r < 0) break;
|
||||
|
||||
@@ -73,7 +73,7 @@ static void sb_cursor_to(int row, int col) {
|
||||
|
||||
static bool check_keyboard_abort() {
|
||||
if (montauk::is_key_available()) {
|
||||
Montauk::KeyEvent ev;
|
||||
montauk::abi::KeyEvent ev;
|
||||
montauk::getkey(&ev);
|
||||
if (ev.pressed && ev.ctrl && ev.ascii == 'q') return true;
|
||||
}
|
||||
@@ -468,7 +468,7 @@ static void run_pager(WikiLine* lines, int totalLines, const char* title,
|
||||
while (running) {
|
||||
while (!montauk::is_key_available()) montauk::yield();
|
||||
|
||||
Montauk::KeyEvent ev;
|
||||
montauk::abi::KeyEvent ev;
|
||||
montauk::getkey(&ev);
|
||||
if (!ev.pressed) continue;
|
||||
|
||||
@@ -631,7 +631,7 @@ static int run_search(char titles[][256], int count, const char* query,
|
||||
while (true) {
|
||||
while (!montauk::is_key_available()) montauk::yield();
|
||||
|
||||
Montauk::KeyEvent ev;
|
||||
montauk::abi::KeyEvent ev;
|
||||
montauk::getkey(&ev);
|
||||
if (!ev.pressed) continue;
|
||||
|
||||
@@ -838,7 +838,7 @@ extern "C" void _start() {
|
||||
sb_puts("\033[2K\033[1;31mFetch failed. Press any key.\033[0m");
|
||||
sb_flush();
|
||||
while (!montauk::is_key_available()) montauk::yield();
|
||||
Montauk::KeyEvent ev; montauk::getkey(&ev);
|
||||
montauk::abi::KeyEvent ev; montauk::getkey(&ev);
|
||||
continue;
|
||||
}
|
||||
respBuf[respLen] = '\0';
|
||||
@@ -856,7 +856,7 @@ extern "C" void _start() {
|
||||
sb_puts("\033[2K\033[1;31mArticle not found. Press any key.\033[0m");
|
||||
sb_flush();
|
||||
while (!montauk::is_key_available()) montauk::yield();
|
||||
Montauk::KeyEvent ev; montauk::getkey(&ev);
|
||||
montauk::abi::KeyEvent ev; montauk::getkey(&ev);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ static bool init_buffers_and_fonts() {
|
||||
return true;
|
||||
}
|
||||
|
||||
static void handle_key_event(const Montauk::WinEvent& ev, bool& search_pending) {
|
||||
static void handle_key_event(const montauk::abi::WinEvent& ev, bool& search_pending) {
|
||||
uint8_t ascii = ev.key.ascii;
|
||||
uint8_t scan = ev.key.scancode;
|
||||
|
||||
@@ -65,7 +65,7 @@ static void handle_key_event(const Montauk::WinEvent& ev, bool& search_pending)
|
||||
else if (scan == 0x4F) { g_scroll_y = max_sc; }
|
||||
}
|
||||
|
||||
static void handle_mouse_event(const Montauk::WinEvent& ev, bool& search_pending) {
|
||||
static void handle_mouse_event(const montauk::abi::WinEvent& ev, bool& search_pending) {
|
||||
int mx = ev.mouse.x, my = ev.mouse.y;
|
||||
g_mouse_x = mx;
|
||||
g_mouse_y = my;
|
||||
@@ -169,7 +169,7 @@ extern "C" void _start() {
|
||||
continue;
|
||||
}
|
||||
|
||||
Montauk::WinEvent ev;
|
||||
montauk::abi::WinEvent ev;
|
||||
int r = win.poll(&ev);
|
||||
|
||||
if (r < 0) break;
|
||||
|
||||
@@ -41,7 +41,7 @@ bool ensure_wiki_tls_ready(char* err, int err_len) {
|
||||
}
|
||||
|
||||
bool welcome_feed_path(char* path, int path_len) {
|
||||
Montauk::DateTime dt {};
|
||||
montauk::abi::DateTime dt {};
|
||||
montauk::gettime(&dt);
|
||||
|
||||
if (dt.Year < 2001 || dt.Month < 1 || dt.Month > 12 ||
|
||||
|
||||
@@ -282,7 +282,7 @@ static int wp_hit_test_text(WordProcessorState* wp, int local_x, int local_y, in
|
||||
return best_abs;
|
||||
}
|
||||
|
||||
void wp_handle_mouse(const Montauk::WinEvent& ev) {
|
||||
void wp_handle_mouse(const montauk::abi::WinEvent& ev) {
|
||||
WordProcessorState* wp = &g_wp;
|
||||
int local_x = ev.mouse.x;
|
||||
int local_y = ev.mouse.y;
|
||||
@@ -592,7 +592,7 @@ void wp_handle_mouse(const Montauk::WinEvent& ev) {
|
||||
}
|
||||
}
|
||||
|
||||
void wp_handle_key(const Montauk::KeyEvent& key) {
|
||||
void wp_handle_key(const montauk::abi::KeyEvent& key) {
|
||||
WordProcessorState* wp = &g_wp;
|
||||
if (!key.pressed) return;
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ extern "C" void _start() {
|
||||
g_win.present();
|
||||
|
||||
while (true) {
|
||||
Montauk::WinEvent ev;
|
||||
montauk::abi::WinEvent ev;
|
||||
int r = g_win.poll(&ev);
|
||||
|
||||
if (r < 0) break;
|
||||
|
||||
@@ -497,5 +497,5 @@ void wp_build_context_items(WordProcessorState* wp,
|
||||
mtk::ContextMenuItem items[WP_CTX_COUNT]);
|
||||
|
||||
void wp_render();
|
||||
void wp_handle_mouse(const Montauk::WinEvent& ev);
|
||||
void wp_handle_key(const Montauk::KeyEvent& key);
|
||||
void wp_handle_mouse(const montauk::abi::WinEvent& ev);
|
||||
void wp_handle_key(const montauk::abi::KeyEvent& key);
|
||||
|
||||
Reference in New Issue
Block a user