diff --git a/boredos.iso b/boredos.iso index 06a0dd9..638d63b 100644 Binary files a/boredos.iso and b/boredos.iso differ diff --git a/build/about.o b/build/about.o index 46a35ec..cbcb148 100644 Binary files a/build/about.o and b/build/about.o differ diff --git a/build/boredos.elf b/build/boredos.elf index dc258c2..96036e9 100755 Binary files a/build/boredos.elf and b/build/boredos.elf differ diff --git a/build/calculator.o b/build/calculator.o index 6675df3..bcefb88 100644 Binary files a/build/calculator.o and b/build/calculator.o differ diff --git a/build/cli_apps/boredver.o b/build/cli_apps/boredver.o index 46f463e..79428bf 100644 Binary files a/build/cli_apps/boredver.o and b/build/cli_apps/boredver.o differ diff --git a/build/cli_apps/cli_utils.o b/build/cli_apps/cli_utils.o index 34ec4d3..5fd28b1 100644 Binary files a/build/cli_apps/cli_utils.o and b/build/cli_apps/cli_utils.o differ diff --git a/build/cli_apps/txtedit.o b/build/cli_apps/txtedit.o index ce8d1c7..3a3e2a1 100644 Binary files a/build/cli_apps/txtedit.o and b/build/cli_apps/txtedit.o differ diff --git a/build/cmd.o b/build/cmd.o index 8b8c5b5..d00bc9d 100644 Binary files a/build/cmd.o and b/build/cmd.o differ diff --git a/build/control_panel.o b/build/control_panel.o index 829ca4e..e04e2fe 100644 Binary files a/build/control_panel.o and b/build/control_panel.o differ diff --git a/build/editor.o b/build/editor.o index b961cee..0bbb324 100644 Binary files a/build/editor.o and b/build/editor.o differ diff --git a/build/explorer.o b/build/explorer.o index 60cbd2e..14eea81 100644 Binary files a/build/explorer.o and b/build/explorer.o differ diff --git a/build/fat32.o b/build/fat32.o index 1b8a519..bbf1650 100644 Binary files a/build/fat32.o and b/build/fat32.o differ diff --git a/build/icmp.o b/build/icmp.o index f7c6afa..9093efb 100644 Binary files a/build/icmp.o and b/build/icmp.o differ diff --git a/build/main.o b/build/main.o index ee4e503..194d412 100644 Binary files a/build/main.o and b/build/main.o differ diff --git a/build/markdown.o b/build/markdown.o index 69d74d5..52b7bb0 100644 Binary files a/build/markdown.o and b/build/markdown.o differ diff --git a/build/minesweeper.o b/build/minesweeper.o index d2bc75d..05688a0 100644 Binary files a/build/minesweeper.o and b/build/minesweeper.o differ diff --git a/build/notepad.o b/build/notepad.o index bef6e2d..015de53 100644 Binary files a/build/notepad.o and b/build/notepad.o differ diff --git a/build/paint.o b/build/paint.o index 5c787ad..8ef4c51 100644 Binary files a/build/paint.o and b/build/paint.o differ diff --git a/build/ps2.o b/build/ps2.o index e2446ce..e939b11 100644 Binary files a/build/ps2.o and b/build/ps2.o differ diff --git a/build/vm.o b/build/vm.o index 22626af..33ab63a 100644 Binary files a/build/vm.o and b/build/vm.o differ diff --git a/build/wm.o b/build/wm.o index c911a25..1b3d3d0 100644 Binary files a/build/wm.o and b/build/wm.o differ diff --git a/iso_root/boredos.elf b/iso_root/boredos.elf index dc258c2..96036e9 100755 Binary files a/iso_root/boredos.elf and b/iso_root/boredos.elf differ diff --git a/src/kernel/about.c b/src/kernel/about.c index ee725d3..fae37c0 100644 --- a/src/kernel/about.c +++ b/src/kernel/about.c @@ -14,8 +14,8 @@ static void about_paint(Window *win) { // Version info draw_string(offset_x, offset_y + 105, "BoredOS 'Panda'", COLOR_WHITE); - draw_string(offset_x, offset_y + 120, "BoredOS Version 1.51", COLOR_WHITE); - draw_string(offset_x, offset_y + 135, "Kernel Version 2.5.0", COLOR_WHITE); + draw_string(offset_x, offset_y + 120, "BoredOS Version 1.60", COLOR_WHITE); + draw_string(offset_x, offset_y + 135, "Kernel Version 2.5.1", COLOR_WHITE); // Copyright draw_string(offset_x, offset_y + 150, "(C) 2026 boreddevnl.", COLOR_WHITE); diff --git a/src/kernel/cli_apps/boredver.c b/src/kernel/cli_apps/boredver.c index 5c9a795..d1b5265 100644 --- a/src/kernel/cli_apps/boredver.c +++ b/src/kernel/cli_apps/boredver.c @@ -2,6 +2,6 @@ void cli_cmd_boredver(char *args) { (void)args; - cli_write("BrewOS v1.50 Beta\n"); - cli_write("BrewOS Kernel V2.4.0 Beta\n"); + cli_write("BoredOS v1.60\n"); + cli_write("BoredOS Kernel V2.5.1\n"); } diff --git a/src/kernel/cmd.c b/src/kernel/cmd.c index a77c032..dd0cdb2 100644 --- a/src/kernel/cmd.c +++ b/src/kernel/cmd.c @@ -802,20 +802,35 @@ static void cmd_exec_single(char *cmd) { if (cmd[0] == '.' && cmd[1] == '/') { char *filename = cmd + 2; - // Build full path with drive context + // Build full path with drive context and current directory char full_exec_path[512]; - if (cmd_state && cmd_state->current_drive != 'A') { - full_exec_path[0] = cmd_state->current_drive; - full_exec_path[1] = ':'; - int i = 2; - const char *p = filename; - while (*p && i < 509) { - full_exec_path[i++] = *p++; + int i = 0; + + // Add drive letter + if (cmd_state) { + full_exec_path[i++] = cmd_state->current_drive; + full_exec_path[i++] = ':'; + + // Add current directory + const char *dir = cmd_state->current_dir; + while (*dir && i < 509) { + full_exec_path[i++] = *dir++; + } + + // Add separator if current dir doesn't end with / + if (i > 2 && full_exec_path[i-1] != '/') { + full_exec_path[i++] = '/'; } - full_exec_path[i] = 0; - filename = full_exec_path; } + // Add the relative path argument + const char *p = filename; + while (*p && i < 509) { + full_exec_path[i++] = *p++; + } + full_exec_path[i] = 0; + filename = full_exec_path; + FAT32_FileHandle *fh = fat32_open(filename, "r"); if (fh) { @@ -930,8 +945,8 @@ static void cmd_exec_single(char *cmd) { if (args[1] == ':') { // Already has drive letter cmd_strcpy(full_path_arg, args); - } else { - // Add drive letter + } else if (args[0] == '/') { + // Absolute path, just prepend drive full_path_arg[0] = cmd_state->current_drive; full_path_arg[1] = ':'; int i = 2; @@ -940,6 +955,29 @@ static void cmd_exec_single(char *cmd) { full_path_arg[i++] = args[j++]; } full_path_arg[i] = 0; + } else { + // Relative path - need to build from current directory + int i = 0; + full_path_arg[i++] = cmd_state->current_drive; + full_path_arg[i++] = ':'; + + // Add current directory + const char *dir = cmd_state->current_dir; + while (*dir && i < 509) { + full_path_arg[i++] = *dir++; + } + + // Add separator if current dir doesn't end with / + if (i > 2 && full_path_arg[i-1] != '/') { + full_path_arg[i++] = '/'; + } + + // Add the relative path argument + int j = 0; + while (args[j] && i < 509) { + full_path_arg[i++] = args[j++]; + } + full_path_arg[i] = 0; } args = full_path_arg; } else if (is_cd_command) { @@ -1439,20 +1477,9 @@ static void create_test_files(void) { if (!fat32_exists("Desktop")) fat32_mkdir("Desktop"); if (!fat32_exists("RecycleBin")) fat32_mkdir("RecycleBin"); - // Create Desktop Shortcuts - FAT32_FileHandle *fh; - fh = fat32_open("Desktop/Explorer.shortcut", "w"); if(fh) fat32_close(fh); - fh = fat32_open("Desktop/Notepad.shortcut", "w"); if(fh) fat32_close(fh); - fh = fat32_open("Desktop/Calculator.shortcut", "w"); if(fh) fat32_close(fh); - fh = fat32_open("Desktop/Minesweeper.shortcut", "w"); if(fh) fat32_close(fh); - fh = fat32_open("Desktop/Control Panel.shortcut", "w"); if(fh) fat32_close(fh); - fh = fat32_open("Desktop/Terminal.shortcut", "w"); if(fh) fat32_close(fh); - fh = fat32_open("Desktop/About.shortcut", "w"); if(fh) fat32_close(fh); - fh = fat32_open("Desktop/Recycle Bin.shortcut", "w"); if(fh) fat32_close(fh); - fh = fat32_open("Desktop/Paint.shortcut", "w"); if(fh) fat32_close(fh); - + // Always try to write README to ensure content exists - fh = fat32_open("README.md", "w"); + FAT32_FileHandle *fh = fat32_open("README.md", "w"); if (fh) { const char *content = "# Bored OS 1.50\n\n" diff --git a/src/kernel/control_panel.c b/src/kernel/control_panel.c index 3a060a6..2b336ed 100644 --- a/src/kernel/control_panel.c +++ b/src/kernel/control_panel.c @@ -152,11 +152,8 @@ static void control_panel_paint_main(Window *win) { int offset_x = win->x + 8; int offset_y = win->y + 30; - // Background - draw_rect(win->x, win->y + 30, win->w, win->h - 30, COLOR_DARK_BG); - // Draw settings items with rounded boxes - int item_y = 30 + 15; + int item_y = 15; int item_h = 60; int item_spacing = 10; @@ -168,7 +165,7 @@ static void control_panel_paint_main(Window *win) { draw_rect(offset_x + 24, offset_y + item_y + 22, 3, 6, 0xFF654321); // Tree trunk draw_rect(offset_x + 21, offset_y + item_y + 18, 9, 8, 0xFF228B22); // Tree leaves draw_string(offset_x + 60, offset_y + item_y + 15, "Wallpaper", COLOR_DARK_TEXT); - draw_string(offset_x + 60, offset_y + item_y + 35, "Choose background design", COLOR_DKGRAY); + draw_string(offset_x + 60, offset_y + item_y + 35, "Choose wallpaper", COLOR_DKGRAY); // Network Settings item_y += item_h + item_spacing; @@ -187,150 +184,135 @@ static void control_panel_paint_main(Window *win) { draw_rect(offset_x + 12, offset_y + item_y + 10, 36, 8, 0xFFE0C060); draw_rect(offset_x + 12, offset_y + item_y + 18, 36, 22, 0xFFD4A574); draw_string(offset_x + 60, offset_y + item_y + 15, "Desktop", COLOR_DARK_TEXT); - draw_string(offset_x + 60, offset_y + item_y + 35, "Desktop appearance&icons", COLOR_DKGRAY); + draw_string(offset_x + 60, offset_y + item_y + 35, "Desktop alignment", COLOR_DKGRAY); } // Mouse Settings item_y += item_h + item_spacing; - if (offset_y + item_y + item_h < win->y + win->h) { - draw_rounded_rect_filled(offset_x, offset_y + item_y, win->w - 16, item_h, 8, COLOR_DARK_PANEL); - // Mouse icon - draw_rect(offset_x + 18, offset_y + item_y + 8, 20, 28, 0xFFD3D3D3); - draw_rect(offset_x + 20, offset_y + item_y + 10, 16, 10, 0xFFB0B0B0); - draw_string(offset_x + 60, offset_y + item_y + 15, "Mouse", COLOR_DARK_TEXT); - draw_string(offset_x + 60, offset_y + item_y + 35, "Pointer and trackpad", COLOR_DKGRAY); - } + draw_rounded_rect_filled(offset_x, offset_y + item_y, win->w - 16, item_h, 8, COLOR_DARK_PANEL); + // Mouse icon + draw_rect(offset_x + 18, offset_y + item_y + 8, 20, 28, 0xFFD3D3D3); + draw_rect(offset_x + 20, offset_y + item_y + 10, 16, 10, 0xFFB0B0B0); + draw_string(offset_x + 60, offset_y + item_y + 15, "Mouse", COLOR_DARK_TEXT); + draw_string(offset_x + 60, offset_y + item_y + 35, "Pointer settings", COLOR_DKGRAY); } static void control_panel_paint_wallpaper(Window *win) { int offset_x = win->x + 8; int offset_y = win->y + 30; - // Back button - draw_string(offset_x, offset_y, "< Back", 0xFF000080); + // Back button (rounded) - padded lower to avoid title bar + draw_rounded_rect_filled(offset_x, offset_y + 5, 80, 25, 6, COLOR_DARK_PANEL); + draw_string(offset_x + 10, offset_y + 13, "< Back", COLOR_DARK_TEXT); - draw_string(offset_x, offset_y + 25, "Presets:", 0xFF000000); + draw_string(offset_x, offset_y + 40, "Presets:", COLOR_DARK_TEXT); - // Color buttons - int button_y = offset_y + 45; + // Color buttons (rounded) - 30% wider + int button_y = offset_y + 65; int button_x = offset_x; // Coffee button - draw_button(button_x, button_y, 60, 20, "Coffee", false); - draw_rect(button_x + 65, button_y + 5, 20, 10, COLOR_COFFEE); + draw_rounded_rect_filled(button_x, button_y, 91, 25, 6, COLOR_DARK_PANEL); + draw_rect(button_x + 8, button_y + 6, 18, 13, COLOR_COFFEE); + draw_string(button_x + 35, button_y + 8, "Coffee", COLOR_DARK_TEXT); // Teal button - draw_button(button_x + 100, button_y, 60, 20, "Teal", false); - draw_rect(button_x + 165, button_y + 5, 20, 10, COLOR_TEAL); + draw_rounded_rect_filled(button_x + 100, button_y, 91, 25, 6, COLOR_DARK_PANEL); + draw_rect(button_x + 108, button_y + 6, 18, 13, COLOR_TEAL); + draw_string(button_x + 135, button_y + 8, "Teal", COLOR_DARK_TEXT); // Green button - draw_button(button_x + 200, button_y, 60, 20, "Green", false); - draw_rect(button_x + 265, button_y + 5, 20, 10, COLOR_GREEN); + draw_rounded_rect_filled(button_x + 200, button_y, 91, 25, 6, COLOR_DARK_PANEL); + draw_rect(button_x + 208, button_y + 6, 18, 13, COLOR_GREEN); + draw_string(button_x + 235, button_y + 8, "Green", COLOR_DARK_TEXT); // Blue button - button_y += 30; - draw_button(button_x, button_y, 60, 20, "Blue", false); - draw_rect(button_x + 65, button_y + 5, 20, 10, COLOR_BLUE_BG); + button_y += 35; + draw_rounded_rect_filled(button_x, button_y, 91, 25, 6, COLOR_DARK_PANEL); + draw_rect(button_x + 8, button_y + 6, 18, 13, COLOR_BLUE_BG); + draw_string(button_x + 35, button_y + 8, "Blue", COLOR_DARK_TEXT); // Purple button - draw_button(button_x + 100, button_y, 60, 20, "Purple", false); - draw_rect(button_x + 165, button_y + 5, 20, 10, COLOR_PURPLE); + draw_rounded_rect_filled(button_x + 100, button_y, 91, 25, 6, COLOR_DARK_PANEL); + draw_rect(button_x + 108, button_y + 6, 18, 13, COLOR_PURPLE); + draw_string(button_x + 132, button_y + 8, "Purple", COLOR_DARK_TEXT); // Grey button - draw_button(button_x + 200, button_y, 60, 20, "Grey", false); - draw_rect(button_x + 265, button_y + 5, 20, 10, COLOR_GREY); + draw_rounded_rect_filled(button_x + 200, button_y, 91, 25, 6, COLOR_DARK_PANEL); + draw_rect(button_x + 208, button_y + 6, 18, 13, COLOR_GREY); + draw_string(button_x + 235, button_y + 8, "Grey", COLOR_DARK_TEXT); // Pattern section button_y += 40; - draw_string(offset_x, button_y, "Patterns:", 0xFF000000); + draw_string(offset_x, button_y, "Patterns:", COLOR_DARK_TEXT); button_y += 20; - // Lumberjack pattern button - draw_button(button_x, button_y, 100, 20, "Lumberjack", false); + // Lumberjack pattern button - 20% wider + draw_rounded_rect_filled(button_x, button_y, 132, 25, 6, COLOR_DARK_PANEL); // Draw small pattern preview (3x3 repeating) - for (int py = 0; py < 12; py++) { - for (int px = 0; px < 18; px++) { + for (int py = 0; py < 10; py++) { + for (int px = 0; px < 12; px++) { int cell_x = px % 3; int cell_y = py % 3; - uint32_t color; - - if (cell_x == 1 && cell_y == 1) { - color = 0xFF000000; // Black center - } else if (cell_x == 1 || cell_y == 1) { - color = 0xFF404040; // Dark grey cross - } else { - color = 0xFFDC143C; // Red corners - } - - draw_rect(button_x + 110 + px, button_y + 4 + py, 1, 1, color); + uint32_t color = (cell_x == 1 && cell_y == 1) ? 0xFF000000 : + (cell_x == 1 || cell_y == 1) ? 0xFF404040 : 0xFFDC143C; + draw_rect(button_x + 8 + px, button_y + 7 + py, 1, 1, color); } } + draw_string(button_x + 28, button_y + 8, "Lumberjack", COLOR_DARK_TEXT); - // Blue Diamond pattern button - draw_button(button_x + 145, button_y, 115, 20, "Blue Diamond", false); + // Blue Diamond pattern button - 20% wider + draw_rounded_rect_filled(button_x + 145, button_y, 132, 25, 6, COLOR_DARK_PANEL); // Draw small diamond preview - for (int py = 0; py < 10; py++) { - for (int px = 0; px < 20; px++) { - int cx = px - 10; - int cy = py - 5; + for (int py = 0; py < 8; py++) { + for (int px = 0; px < 10; px++) { + int cx = px - 5; + int cy = py - 4; int abs_cx = cx < 0 ? -cx : cx; int abs_cy = cy < 0 ? -cy : cy; - uint32_t color = (abs_cx + abs_cy <= 5) ? 0xFF0000CD : 0xFFADD8E6; - draw_rect(button_x + 270 + px, button_y + 5 + py, 1, 1, color); + uint32_t color = (abs_cx + abs_cy <= 3) ? 0xFF0000CD : 0xFFADD8E6; + draw_rect(button_x + 153 + px, button_y + 8 + py, 1, 1, color); } } + draw_string(button_x + 165, button_y + 8, "Blue Diamond", COLOR_DARK_TEXT); // Custom color section button_y += 40; - draw_string(offset_x, button_y, "Or something custom", 0xFF000000); + draw_string(offset_x, button_y, "Custom color:", COLOR_DARK_TEXT); button_y += 20; - // R input box - draw_string(button_x, button_y, "R:", 0xFF000000); - draw_rect(button_x + 25, button_y, 50, 15, 0xFFFFFFFF); - draw_rect(button_x + 25, button_y, 50, 1, COLOR_BLACK); - draw_rect(button_x + 25, button_y, 1, 15, COLOR_BLACK); - draw_rect(button_x + 74, button_y, 1, 15, COLOR_BLACK); - draw_rect(button_x + 25, button_y + 14, 50, 1, COLOR_BLACK); - draw_string(button_x + 30, button_y + 3, rgb_r, (focused_field == 0) ? 0xFFFF0000 : COLOR_BLACK); + // R input box (dark mode) + draw_string(button_x, button_y + 4, "R:", COLOR_DARK_TEXT); + draw_rounded_rect_filled(button_x + 25, button_y, 50, 18, 4, COLOR_DARK_PANEL); + draw_string(button_x + 30, button_y + 4, rgb_r, (focused_field == 0) ? 0xFFFF6B6B : COLOR_DARK_TEXT); if (focused_field == 0) { - // Draw cursor int cursor_x = button_x + 30 + input_cursor * 8; - draw_rect(cursor_x, button_y + 3, 1, 9, 0xFFFF0000); + draw_rect(cursor_x, button_y + 4, 1, 9, 0xFFFF6B6B); } - // G input box - draw_string(button_x + 90, button_y, "G:", 0xFF000000); - draw_rect(button_x + 115, button_y, 50, 15, 0xFFFFFFFF); - draw_rect(button_x + 115, button_y, 50, 1, COLOR_BLACK); - draw_rect(button_x + 115, button_y, 1, 15, COLOR_BLACK); - draw_rect(button_x + 164, button_y, 1, 15, COLOR_BLACK); - draw_rect(button_x + 115, button_y + 14, 50, 1, COLOR_BLACK); - draw_string(button_x + 120, button_y + 3, rgb_g, (focused_field == 1) ? 0xFF00AA00 : COLOR_BLACK); + // G input box (dark mode) + draw_string(button_x + 90, button_y + 4, "G:", COLOR_DARK_TEXT); + draw_rounded_rect_filled(button_x + 115, button_y, 50, 18, 4, COLOR_DARK_PANEL); + draw_string(button_x + 120, button_y + 4, rgb_g, (focused_field == 1) ? 0xFF90EE90 : COLOR_DARK_TEXT); if (focused_field == 1) { - // Draw cursor int cursor_x = button_x + 120 + input_cursor * 8; - draw_rect(cursor_x, button_y + 3, 1, 9, 0xFF00AA00); + draw_rect(cursor_x, button_y + 4, 1, 9, 0xFF90EE90); } - // B input box - draw_string(button_x + 180, button_y, "B:", 0xFF000000); - draw_rect(button_x + 205, button_y, 50, 15, 0xFFFFFFFF); - draw_rect(button_x + 205, button_y, 50, 1, COLOR_BLACK); - draw_rect(button_x + 205, button_y, 1, 15, COLOR_BLACK); - draw_rect(button_x + 254, button_y, 1, 15, COLOR_BLACK); - draw_rect(button_x + 205, button_y + 14, 50, 1, COLOR_BLACK); - draw_string(button_x + 210, button_y + 3, rgb_b, (focused_field == 2) ? 0xFF0000FF : COLOR_BLACK); + // B input box (dark mode) + draw_string(button_x + 180, button_y + 4, "B:", COLOR_DARK_TEXT); + draw_rounded_rect_filled(button_x + 205, button_y, 50, 18, 4, COLOR_DARK_PANEL); + draw_string(button_x + 210, button_y + 4, rgb_b, (focused_field == 2) ? 0xFF87CEEB : COLOR_DARK_TEXT); if (focused_field == 2) { - // Draw cursor int cursor_x = button_x + 210 + input_cursor * 8; - draw_rect(cursor_x, button_y + 3, 1, 9, 0xFF0000FF); + draw_rect(cursor_x, button_y + 4, 1, 9, 0xFF87CEEB); } - // Apply button - draw_button(button_x, button_y + 25, 70, 20, "Apply", false); + // Apply button (rounded) + draw_rounded_rect_filled(button_x, button_y + 25, 70, 25, 6, COLOR_DARK_PANEL); + draw_string(button_x + 18, button_y + 33, "Apply", COLOR_DARK_TEXT); } static void draw_input_box(int x, int y, int width, const char *text, bool focused, int cursor_pos) { @@ -356,132 +338,172 @@ static void control_panel_paint_network(Window *win) { int offset_x = win->x + 8; int offset_y = win->y + 30; - // Back button - draw_string(offset_x, offset_y, "< Back", 0xFF000080); + // Back button (rounded) - padded lower to avoid title bar + draw_rounded_rect_filled(offset_x, offset_y + 5, 80, 25, 6, COLOR_DARK_PANEL); + draw_string(offset_x + 10, offset_y + 13, "< Back", COLOR_DARK_TEXT); // Network Init Button - draw_string(offset_x, offset_y + 25, "Network:", 0xFF000000); - draw_button(offset_x, offset_y + 45, 100, 22, "Init Network", false); + draw_string(offset_x, offset_y + 40, "Network:", COLOR_DARK_TEXT); + draw_rounded_rect_filled(offset_x, offset_y + 55, 140, 25, 6, COLOR_DARK_PANEL); + draw_string(offset_x + 30, offset_y + 63, "Init Network", COLOR_DARK_TEXT); // Status message if (net_status[0] != '\0') { - draw_string(offset_x + 110, offset_y + 50, net_status, 0xFF008000); + draw_string(offset_x + 150, offset_y + 63, net_status, 0xFF90EE90); } // Set IP Section - int section_y = offset_y + 80; - draw_string(offset_x, section_y, "Set Static IP:", 0xFF000000); + int section_y = offset_y + 85; + draw_string(offset_x, section_y, "Set Static IP:", COLOR_DARK_TEXT); section_y += 20; - // IP input boxes (4 octets) - draw_input_box(offset_x, section_y, 40, ip_1, focused_field == 0, input_cursor); - draw_string(offset_x + 42, section_y + 4, ".", COLOR_BLACK); - draw_input_box(offset_x + 50, section_y, 40, ip_2, focused_field == 1, input_cursor); - draw_string(offset_x + 92, section_y + 4, ".", COLOR_BLACK); - draw_input_box(offset_x + 100, section_y, 40, ip_3, focused_field == 2, input_cursor); - draw_string(offset_x + 142, section_y + 4, ".", COLOR_BLACK); - draw_input_box(offset_x + 150, section_y, 40, ip_4, focused_field == 3, input_cursor); + // IP input boxes (4 octets, dark mode rounded) - with cursor indicators + uint32_t ip1_color = (focused_field == 0) ? 0xFF4A90E2 : COLOR_DARK_TEXT; + draw_rounded_rect_filled(offset_x, section_y, 35, 20, 4, COLOR_DARK_PANEL); + draw_string(offset_x + 5, section_y + 4, ip_1, ip1_color); + if (focused_field == 0) draw_rect(offset_x + 5 + input_cursor * 8, section_y + 4, 1, 9, 0xFF4A90E2); + draw_string(offset_x + 40, section_y + 4, ".", COLOR_DARK_TEXT); - // Apply IP button - draw_button(offset_x + 200, section_y, 70, 18, "Apply", false); + uint32_t ip2_color = (focused_field == 1) ? 0xFF4A90E2 : COLOR_DARK_TEXT; + draw_rounded_rect_filled(offset_x + 50, section_y, 35, 20, 4, COLOR_DARK_PANEL); + draw_string(offset_x + 55, section_y + 4, ip_2, ip2_color); + if (focused_field == 1) draw_rect(offset_x + 55 + input_cursor * 8, section_y + 4, 1, 9, 0xFF4A90E2); + draw_string(offset_x + 90, section_y + 4, ".", COLOR_DARK_TEXT); + + uint32_t ip3_color = (focused_field == 2) ? 0xFF4A90E2 : COLOR_DARK_TEXT; + draw_rounded_rect_filled(offset_x + 100, section_y, 35, 20, 4, COLOR_DARK_PANEL); + draw_string(offset_x + 105, section_y + 4, ip_3, ip3_color); + if (focused_field == 2) draw_rect(offset_x + 105 + input_cursor * 8, section_y + 4, 1, 9, 0xFF4A90E2); + draw_string(offset_x + 140, section_y + 4, ".", COLOR_DARK_TEXT); + + uint32_t ip4_color = (focused_field == 3) ? 0xFF4A90E2 : COLOR_DARK_TEXT; + draw_rounded_rect_filled(offset_x + 150, section_y, 35, 20, 4, COLOR_DARK_PANEL); + draw_string(offset_x + 155, section_y + 4, ip_4, ip4_color); + if (focused_field == 3) draw_rect(offset_x + 155 + input_cursor * 8, section_y + 4, 1, 9, 0xFF4A90E2); + + // Apply IP button (rounded) + draw_rounded_rect_filled(offset_x + 200, section_y, 70, 20, 6, COLOR_DARK_PANEL); + draw_string(offset_x + 218, section_y + 4, "Apply", COLOR_DARK_TEXT); // Send UDP Section - section_y += 35; - draw_string(offset_x, section_y, "Send UDP Message:", 0xFF000000); + section_y += 30; + draw_string(offset_x, section_y, "Send UDP Message:", COLOR_DARK_TEXT); section_y += 20; - draw_string(offset_x, section_y + 4, "IP:", COLOR_BLACK); - draw_input_box(offset_x + 25, section_y, 40, dest_ip_1, focused_field == 4, input_cursor); - draw_string(offset_x + 67, section_y + 4, ".", COLOR_BLACK); - draw_input_box(offset_x + 75, section_y, 40, dest_ip_2, focused_field == 5, input_cursor); - draw_string(offset_x + 117, section_y + 4, ".", COLOR_BLACK); - draw_input_box(offset_x + 125, section_y, 40, dest_ip_3, focused_field == 6, input_cursor); - draw_string(offset_x + 167, section_y + 4, ".", COLOR_BLACK); - draw_input_box(offset_x + 175, section_y, 40, dest_ip_4, focused_field == 7, input_cursor); + draw_string(offset_x, section_y + 4, "IP:", COLOR_DARK_TEXT); + uint32_t dip1_color = (focused_field == 4) ? 0xFF4A90E2 : COLOR_DARK_TEXT; + draw_rounded_rect_filled(offset_x + 25, section_y, 35, 20, 4, COLOR_DARK_PANEL); + draw_string(offset_x + 30, section_y + 4, dest_ip_1, dip1_color); + if (focused_field == 4) draw_rect(offset_x + 30 + input_cursor * 8, section_y + 4, 1, 9, 0xFF4A90E2); + draw_string(offset_x + 65, section_y + 4, ".", COLOR_DARK_TEXT); + + uint32_t dip2_color = (focused_field == 5) ? 0xFF4A90E2 : COLOR_DARK_TEXT; + draw_rounded_rect_filled(offset_x + 70, section_y, 35, 20, 4, COLOR_DARK_PANEL); + draw_string(offset_x + 75, section_y + 4, dest_ip_2, dip2_color); + if (focused_field == 5) draw_rect(offset_x + 75 + input_cursor * 8, section_y + 4, 1, 9, 0xFF4A90E2); + draw_string(offset_x + 110, section_y + 4, ".", COLOR_DARK_TEXT); + + uint32_t dip3_color = (focused_field == 6) ? 0xFF4A90E2 : COLOR_DARK_TEXT; + draw_rounded_rect_filled(offset_x + 115, section_y, 35, 20, 4, COLOR_DARK_PANEL); + draw_string(offset_x + 120, section_y + 4, dest_ip_3, dip3_color); + if (focused_field == 6) draw_rect(offset_x + 120 + input_cursor * 8, section_y + 4, 1, 9, 0xFF4A90E2); + draw_string(offset_x + 155, section_y + 4, ".", COLOR_DARK_TEXT); + + uint32_t dip4_color = (focused_field == 7) ? 0xFF4A90E2 : COLOR_DARK_TEXT; + draw_rounded_rect_filled(offset_x + 160, section_y, 35, 20, 4, COLOR_DARK_PANEL); + draw_string(offset_x + 165, section_y + 4, dest_ip_4, dip4_color); + if (focused_field == 7) draw_rect(offset_x + 165 + input_cursor * 8, section_y + 4, 1, 9, 0xFF4A90E2); section_y += 25; - draw_string(offset_x, section_y + 4, "Port:", COLOR_BLACK); - draw_input_box(offset_x + 40, section_y, 60, udp_port, focused_field == 8, input_cursor); + draw_string(offset_x, section_y + 4, "Port:", COLOR_DARK_TEXT); + uint32_t port_color = (focused_field == 8) ? 0xFF4A90E2 : COLOR_DARK_TEXT; + draw_rounded_rect_filled(offset_x + 40, section_y, 60, 20, 4, COLOR_DARK_PANEL); + draw_string(offset_x + 45, section_y + 4, udp_port, port_color); + if (focused_field == 8) draw_rect(offset_x + 45 + input_cursor * 8, section_y + 4, 1, 9, 0xFF4A90E2); section_y += 25; - draw_string(offset_x, section_y + 4, "Msg:", COLOR_BLACK); - draw_input_box(offset_x + 40, section_y, 260, udp_message, focused_field == 9, input_cursor); + draw_string(offset_x, section_y + 4, "Msg:", COLOR_DARK_TEXT); + uint32_t msg_color = (focused_field == 9) ? 0xFF4A90E2 : COLOR_DARK_TEXT; + draw_rounded_rect_filled(offset_x + 40, section_y, 180, 20, 4, COLOR_DARK_PANEL); + draw_string(offset_x + 45, section_y + 4, udp_message, msg_color); + if (focused_field == 9) draw_rect(offset_x + 45 + input_cursor * 8, section_y + 4, 1, 9, 0xFF4A90E2); - // Send button + // Send button (rounded) section_y += 25; - draw_button(offset_x, section_y, 80, 22, "Send", false); + draw_rounded_rect_filled(offset_x, section_y, 80, 25, 6, COLOR_DARK_PANEL); + draw_string(offset_x + 22, section_y + 7, "Send", COLOR_DARK_TEXT); } + static void control_panel_paint_desktop(Window *win) { int offset_x = win->x + 8; int offset_y = win->y + 30; - // Back button - draw_string(offset_x, offset_y, "< Back", 0xFF000080); - draw_string(offset_x, offset_y + 25, "Desktop Settings:", 0xFF000000); + // Back button (rounded) - padded lower to avoid title bar + draw_rounded_rect_filled(offset_x, offset_y + 5, 80, 25, 6, COLOR_DARK_PANEL); + draw_string(offset_x + 10, offset_y + 13, "< Back", COLOR_DARK_TEXT); + draw_string(offset_x, offset_y + 40, "Desktop Settings:", COLOR_DARK_TEXT); - int section_y = offset_y + 50; + int section_y = offset_y + 65; - // Snap to Grid - draw_rect(offset_x, section_y, 15, 15, 0xFFFFFFFF); - draw_rect(offset_x, section_y, 15, 1, COLOR_BLACK); - draw_rect(offset_x, section_y, 1, 15, COLOR_BLACK); - draw_rect(offset_x + 14, section_y, 1, 15, COLOR_BLACK); - draw_rect(offset_x, section_y + 14, 15, 1, COLOR_BLACK); - if (desktop_snap_to_grid) draw_string(offset_x + 3, section_y + 3, "X", COLOR_BLACK); - draw_string(offset_x + 25, section_y + 3, "Snap to Grid", COLOR_BLACK); + // Snap to Grid checkbox (rounded) + draw_rounded_rect_filled(offset_x, section_y, 16, 16, 3, COLOR_DARK_PANEL); + if (desktop_snap_to_grid) draw_string(offset_x + 3, section_y + 1, "✓", 0xFF90EE90); + draw_string(offset_x + 25, section_y + 3, "Snap to Grid", COLOR_DARK_TEXT); - // Auto Align + // Auto Align checkbox (rounded) section_y += 25; - draw_rect(offset_x, section_y, 15, 15, 0xFFFFFFFF); - draw_rect(offset_x, section_y, 15, 1, COLOR_BLACK); - draw_rect(offset_x, section_y, 1, 15, COLOR_BLACK); - draw_rect(offset_x + 14, section_y, 1, 15, COLOR_BLACK); - draw_rect(offset_x, section_y + 14, 15, 1, COLOR_BLACK); - if (desktop_auto_align) draw_string(offset_x + 3, section_y + 3, "X", COLOR_BLACK); - draw_string(offset_x + 25, section_y + 3, "Auto Align Icons", COLOR_BLACK); + draw_rounded_rect_filled(offset_x, section_y, 16, 16, 3, COLOR_DARK_PANEL); + if (desktop_auto_align) draw_string(offset_x + 3, section_y + 1, "✓", 0xFF90EE90); + draw_string(offset_x + 25, section_y + 3, "Auto Align Icons", COLOR_DARK_TEXT); // Max Rows - section_y += 25; - draw_string(offset_x, section_y + 3, "Apps per column:", COLOR_BLACK); - draw_button(offset_x + 130, section_y, 20, 20, "-", false); + section_y += 30; + draw_string(offset_x, section_y + 3, "Apps per column:", COLOR_DARK_TEXT); + draw_rounded_rect_filled(offset_x + 130, section_y, 20, 20, 4, COLOR_DARK_PANEL); + draw_string(offset_x + 135, section_y + 4, "-", COLOR_DARK_TEXT); char num[4]; num[0] = '0' + (desktop_max_rows_per_col / 10); num[1] = '0' + (desktop_max_rows_per_col % 10); num[2] = 0; if (num[0] == '0') { num[0] = num[1]; num[1] = 0; } - draw_string(offset_x + 160, section_y + 5, num, COLOR_BLACK); - draw_button(offset_x + 180, section_y, 20, 20, "+", false); + draw_string(offset_x + 160, section_y + 5, num, COLOR_DARK_TEXT); + draw_rounded_rect_filled(offset_x + 180, section_y, 20, 20, 4, COLOR_DARK_PANEL); + draw_string(offset_x + 186, section_y + 4, "+", COLOR_DARK_TEXT); // Max Cols - section_y += 25; - draw_string(offset_x, section_y + 3, "Columns:", COLOR_BLACK); - draw_button(offset_x + 130, section_y, 20, 20, "-", false); + section_y += 30; + draw_string(offset_x, section_y + 3, "Columns:", COLOR_DARK_TEXT); + draw_rounded_rect_filled(offset_x + 130, section_y, 20, 20, 4, COLOR_DARK_PANEL); + draw_string(offset_x + 135, section_y + 4, "-", COLOR_DARK_TEXT); char num_c[4]; num_c[0] = '0' + (desktop_max_cols / 10); num_c[1] = '0' + (desktop_max_cols % 10); num_c[2] = 0; if (num_c[0] == '0') { num_c[0] = num_c[1]; num_c[1] = 0; } - draw_string(offset_x + 160, section_y + 5, num_c, COLOR_BLACK); - draw_button(offset_x + 180, section_y, 20, 20, "+", false); + draw_string(offset_x + 160, section_y + 5, num_c, COLOR_DARK_TEXT); + draw_rounded_rect_filled(offset_x + 180, section_y, 20, 20, 4, COLOR_DARK_PANEL); + draw_string(offset_x + 186, section_y + 4, "+", COLOR_DARK_TEXT); } + static void control_panel_paint_mouse(Window *win) { int offset_x = win->x + 8; int offset_y = win->y + 30; - // Back button - draw_string(offset_x, offset_y, "< Back", 0xFF000080); - draw_string(offset_x, offset_y + 25, "Mouse Settings:", 0xFF000000); + // Back button (rounded) - padded lower to avoid title bar + draw_rounded_rect_filled(offset_x, offset_y + 5, 80, 25, 6, COLOR_DARK_PANEL); + draw_string(offset_x + 10, offset_y + 13, "< Back", COLOR_DARK_TEXT); + draw_string(offset_x, offset_y + 40, "Mouse Settings:", COLOR_DARK_TEXT); - int section_y = offset_y + 60; - draw_string(offset_x, section_y, "Speed:", COLOR_BLACK); + int section_y = offset_y + 65; + draw_string(offset_x, section_y, "Speed:", COLOR_DARK_TEXT); - // Slider track - draw_rect(offset_x + 60, section_y + 8, 200, 2, COLOR_DKGRAY); + // Slider track (rounded background) + draw_rounded_rect_filled(offset_x + 60, section_y + 8, 200, 8, 4, COLOR_DARK_PANEL); - // Slider knob (range 1-50, default 10) + // Slider knob (range 1-50, default 10) - rounded with blue color int knob_x = offset_x + 60 + (mouse_speed - 1) * 190 / 49; - draw_button(knob_x, section_y, 10, 18, "", false); + draw_rounded_rect_filled(knob_x, section_y + 2, 10, 14, 3, 0xFF4A90E2); - draw_string(offset_x + 270, section_y + 4, "x", COLOR_BLACK); + draw_string(offset_x + 270, section_y + 4, "x", COLOR_DARK_TEXT); char speed_str[4]; cli_itoa(mouse_speed, speed_str); - draw_string(offset_x + 280, section_y + 4, speed_str, COLOR_BLACK); + draw_string(offset_x + 280, section_y + 4, speed_str, COLOR_DARK_TEXT); } static void control_panel_paint(Window *win) { @@ -534,57 +556,64 @@ static void control_panel_handle_click(Window *win, int x, int y) { // Check mouse button item_y += item_h + item_spacing; - if (x >= offset_x && x < win->w - 8 && + if (offset_y + item_y + item_h < win->y + win->h && + x >= offset_x && x < win->w - 8 && y >= item_y && y < item_y + item_h) { current_view = VIEW_MOUSE; } } else if (current_view == VIEW_WALLPAPER) { int offset_x = 8; int offset_y = 30; - int button_y = offset_y + 45; + int button_y = offset_y + 65; int button_x = offset_x; // Back button - if (x >= offset_x && x < offset_x + 40 && - y >= offset_y && y < offset_y + 15) { + if (x >= offset_x && x < offset_x + 80 && + y >= offset_y + 5 && y < offset_y + 30) { current_view = VIEW_MAIN; return; } - // Check Coffee button - if (x >= button_x && x < button_x + 60 && y >= button_y && y < button_y + 20) { + // Check Coffee button (91px wide) + if (x >= button_x && x < button_x + 91 && y >= button_y && y < button_y + 25) { graphics_set_bg_color(COLOR_COFFEE); + wm_refresh(); return; } // Check Teal button - if (x >= button_x + 100 && x < button_x + 160 && y >= button_y && y < button_y + 20) { + if (x >= button_x + 100 && x < button_x + 191 && y >= button_y && y < button_y + 25) { graphics_set_bg_color(COLOR_TEAL); + wm_refresh(); return; } // Check Green button - if (x >= button_x + 200 && x < button_x + 260 && y >= button_y && y < button_y + 20) { + if (x >= button_x + 200 && x < button_x + 291 && y >= button_y && y < button_y + 25) { graphics_set_bg_color(COLOR_GREEN); + wm_refresh(); return; } // Check Blue button - button_y += 30; - if (x >= button_x && x < button_x + 60 && y >= button_y && y < button_y + 20) { + button_y += 35; + if (x >= button_x && x < button_x + 91 && y >= button_y && y < button_y + 25) { graphics_set_bg_color(COLOR_BLUE_BG); + wm_refresh(); return; } // Check Purple button - if (x >= button_x + 100 && x < button_x + 160 && y >= button_y && y < button_y + 20) { + if (x >= button_x + 100 && x < button_x + 191 && y >= button_y && y < button_y + 25) { graphics_set_bg_color(COLOR_PURPLE); + wm_refresh(); return; } // Check Grey button - if (x >= button_x + 200 && x < button_x + 260 && y >= button_y && y < button_y + 20) { + if (x >= button_x + 200 && x < button_x + 291 && y >= button_y && y < button_y + 25) { graphics_set_bg_color(COLOR_GREY); + wm_refresh(); return; } @@ -592,15 +621,17 @@ static void control_panel_handle_click(Window *win, int x, int y) { button_y += 40; button_y += 20; - // Check Lumberjack pattern button - if (x >= button_x && x < button_x + 100 && y >= button_y && y < button_y + 20) { + // Check Lumberjack pattern button (132px wide) + if (x >= button_x && x < button_x + 132 && y >= button_y && y < button_y + 25) { graphics_set_bg_pattern(pattern_lumberjack); + wm_refresh(); return; } - // Check Blue Diamond pattern button - if (x >= button_x + 145 && x < button_x + 260 && y >= button_y && y < button_y + 20) { + // Check Blue Diamond pattern button (132px wide) + if (x >= button_x + 145 && x < button_x + 277 && y >= button_y && y < button_y + 25) { graphics_set_bg_pattern(pattern_blue_diamond); + wm_refresh(); return; } @@ -609,7 +640,7 @@ static void control_panel_handle_click(Window *win, int x, int y) { button_y += 20; // Check R input box click - if (x >= button_x + 25 && x < button_x + 75 && y >= button_y && y < button_y + 15) { + if (x >= button_x + 25 && x < button_x + 75 && y >= button_y && y < button_y + 18) { if (focused_field != 0) { rgb_r[0] = '\0'; // Clear when first focused } @@ -619,7 +650,7 @@ static void control_panel_handle_click(Window *win, int x, int y) { } // Check G input box click - if (x >= button_x + 115 && x < button_x + 165 && y >= button_y && y < button_y + 15) { + if (x >= button_x + 115 && x < button_x + 165 && y >= button_y && y < button_y + 18) { if (focused_field != 1) { rgb_g[0] = '\0'; // Clear when first focused } @@ -629,7 +660,7 @@ static void control_panel_handle_click(Window *win, int x, int y) { } // Check B input box click - if (x >= button_x + 205 && x < button_x + 255 && y >= button_y && y < button_y + 15) { + if (x >= button_x + 205 && x < button_x + 255 && y >= button_y && y < button_y + 18) { if (focused_field != 2) { rgb_b[0] = '\0'; // Clear when first focused } @@ -639,8 +670,9 @@ static void control_panel_handle_click(Window *win, int x, int y) { } // Check Apply button - if (x >= button_x && x < button_x + 70 && y >= button_y + 25 && y < button_y + 45) { + if (x >= button_x && x < button_x + 70 && y >= button_y + 25 && y < button_y + 50) { graphics_set_bg_color(parse_rgb_separate(rgb_r, rgb_g, rgb_b)); + wm_refresh(); return; } } else if (current_view == VIEW_NETWORK) { @@ -648,14 +680,14 @@ static void control_panel_handle_click(Window *win, int x, int y) { int offset_y = 30; // Back button - if (x >= offset_x && x < offset_x + 40 && y >= offset_y && y < offset_y + 15) { + if (x >= offset_x && x < offset_x + 80 && y >= offset_y + 5 && y < offset_y + 30) { current_view = VIEW_MAIN; focused_field = -1; return; } - // Init Network button - if (x >= offset_x && x < offset_x + 100 && y >= offset_y + 45 && y < offset_y + 67) { + // Init Network button (140px wide now) + if (x >= offset_x && x < offset_x + 140 && y >= offset_y + 55 && y < offset_y + 80) { int result = network_init(); if (result == 0) { net_status[0] = 'I'; net_status[1] = 'n'; net_status[2] = 'i'; @@ -669,35 +701,35 @@ static void control_panel_handle_click(Window *win, int x, int y) { return; } - int section_y = offset_y + 80 + 20; + int section_y = offset_y + 85 + 20; // IP octet 1 - if (x >= offset_x && x < offset_x + 40 && y >= section_y && y < section_y + 18) { + if (x >= offset_x && x < offset_x + 35 && y >= section_y && y < section_y + 20) { focused_field = 0; input_cursor = 0; return; } // IP octet 2 - if (x >= offset_x + 50 && x < offset_x + 90 && y >= section_y && y < section_y + 18) { + if (x >= offset_x + 50 && x < offset_x + 85 && y >= section_y && y < section_y + 20) { focused_field = 1; input_cursor = 0; return; } // IP octet 3 - if (x >= offset_x + 100 && x < offset_x + 140 && y >= section_y && y < section_y + 18) { + if (x >= offset_x + 100 && x < offset_x + 135 && y >= section_y && y < section_y + 20) { focused_field = 2; input_cursor = 0; return; } // IP octet 4 - if (x >= offset_x + 150 && x < offset_x + 190 && y >= section_y && y < section_y + 18) { + if (x >= offset_x + 150 && x < offset_x + 185 && y >= section_y && y < section_y + 20) { focused_field = 3; input_cursor = 0; return; } // Apply IP button - if (x >= offset_x + 200 && x < offset_x + 270 && y >= section_y && y < section_y + 18) { + if (x >= offset_x + 200 && x < offset_x + 270 && y >= section_y && y < section_y + 20) { ipv4_address_t ip; ip.bytes[0] = 0; ip.bytes[1] = 0; ip.bytes[2] = 0; ip.bytes[3] = 0; @@ -730,25 +762,25 @@ static void control_panel_handle_click(Window *win, int x, int y) { return; } - section_y += 35 + 20; + section_y += 30; // Dest IP octets - if (x >= offset_x + 25 && x < offset_x + 65 && y >= section_y && y < section_y + 18) { + if (x >= offset_x + 25 && x < offset_x + 60 && y >= section_y && y < section_y + 20) { focused_field = 4; input_cursor = 0; return; } - if (x >= offset_x + 75 && x < offset_x + 115 && y >= section_y && y < section_y + 18) { + if (x >= offset_x + 70 && x < offset_x + 105 && y >= section_y && y < section_y + 20) { focused_field = 5; input_cursor = 0; return; } - if (x >= offset_x + 125 && x < offset_x + 165 && y >= section_y && y < section_y + 18) { + if (x >= offset_x + 115 && x < offset_x + 150 && y >= section_y && y < section_y + 20) { focused_field = 6; input_cursor = 0; return; } - if (x >= offset_x + 175 && x < offset_x + 215 && y >= section_y && y < section_y + 18) { + if (x >= offset_x + 160 && x < offset_x + 195 && y >= section_y && y < section_y + 20) { focused_field = 7; input_cursor = 0; return; @@ -757,7 +789,7 @@ static void control_panel_handle_click(Window *win, int x, int y) { section_y += 25; // Port field - if (x >= offset_x + 40 && x < offset_x + 100 && y >= section_y && y < section_y + 18) { + if (x >= offset_x + 40 && x < offset_x + 100 && y >= section_y && y < section_y + 20) { focused_field = 8; input_cursor = 0; return; @@ -766,7 +798,7 @@ static void control_panel_handle_click(Window *win, int x, int y) { section_y += 25; // Message field - if (x >= offset_x + 40 && x < offset_x + 300 && y >= section_y && y < section_y + 18) { + if (x >= offset_x + 40 && x < offset_x + 220 && y >= section_y && y < section_y + 20) { focused_field = 9; input_cursor = 0; return; @@ -775,7 +807,7 @@ static void control_panel_handle_click(Window *win, int x, int y) { section_y += 25; // Send button - if (x >= offset_x && x < offset_x + 80 && y >= section_y && y < section_y + 22) { + if (x >= offset_x && x < offset_x + 80 && y >= section_y && y < section_y + 25) { ipv4_address_t dest_ip; dest_ip.bytes[0] = 0; dest_ip.bytes[1] = 0; dest_ip.bytes[2] = 0; dest_ip.bytes[3] = 0; @@ -830,14 +862,14 @@ static void control_panel_handle_click(Window *win, int x, int y) { int offset_y = 30; // Back button - if (x >= offset_x && x < offset_x + 40 && y >= offset_y && y < offset_y + 15) { + if (x >= offset_x && x < offset_x + 80 && y >= offset_y + 5 && y < offset_y + 30) { current_view = VIEW_MAIN; return; } - int section_y = offset_y + 50; - // Snap toggle - if (x >= offset_x && x < offset_x + 150 && y >= section_y && y < section_y + 20) { + int section_y = offset_y + 65; + // Snap toggle - click on checkbox only + if (x >= offset_x && x < offset_x + 16 && y >= section_y && y < section_y + 16) { desktop_snap_to_grid = !desktop_snap_to_grid; // If Snap is turned OFF, Auto Align must be OFF if (!desktop_snap_to_grid) { @@ -847,9 +879,9 @@ static void control_panel_handle_click(Window *win, int x, int y) { return; } - // Auto Align toggle + // Auto Align toggle - click on checkbox only section_y += 25; - if (x >= offset_x && x < offset_x + 150 && y >= section_y && y < section_y + 20) { + if (x >= offset_x && x < offset_x + 16 && y >= section_y && y < section_y + 16) { desktop_auto_align = !desktop_auto_align; // If Auto Align is turned ON, Snap must be ON if (desktop_auto_align) { @@ -897,12 +929,12 @@ static void control_panel_handle_click(Window *win, int x, int y) { int offset_y = 30; // Back button - if (x >= offset_x && x < offset_x + 40 && y >= offset_y && y < offset_y + 15) { + if (x >= offset_x && x < offset_x + 80 && y >= offset_y + 5 && y < offset_y + 30) { current_view = VIEW_MAIN; return; } - int section_y = offset_y + 60; + int section_y = offset_y + 65; // Slider interaction if (x >= offset_x + 60 && x <= offset_x + 260 && y >= section_y && y <= section_y + 20) { int new_speed = 1 + (x - (offset_x + 60)) * 49 / 200; @@ -1009,7 +1041,7 @@ void control_panel_init(void) { win_control_panel.x = 200; win_control_panel.y = 150; win_control_panel.w = 350; - win_control_panel.h = 300; + win_control_panel.h = 320; win_control_panel.visible = false; win_control_panel.focused = false; win_control_panel.z_index = 0; diff --git a/src/kernel/fat32.c b/src/kernel/fat32.c index a70bd01..ff8d208 100644 --- a/src/kernel/fat32.c +++ b/src/kernel/fat32.c @@ -147,18 +147,11 @@ void fat32_normalize_path(const char *path, char *normalized) { // Initialize with current directory or root // If drive changed, we assume root of that drive if (p[0] == '/') { - temp[0] = '/'; - temp[1] = 0; + fs_strcpy(temp, "/"); temp_len = 1; } else { - if (drive != current_drive) { - temp[0] = '/'; - temp[1] = 0; - temp_len = 1; - } else { - fs_strcpy(temp, current_dir); - temp_len = fs_strlen(temp); - } + fs_strcpy(temp, current_dir); + temp_len = fs_strlen(temp); } int i = 0; diff --git a/src/kernel/notepad.c b/src/kernel/notepad.c index ac18d4d..a71dc9f 100644 --- a/src/kernel/notepad.c +++ b/src/kernel/notepad.c @@ -25,7 +25,7 @@ static void notepad_ensure_cursor_visible(Window *win) { static void notepad_paint(Window *win) { // Dark mode background for text - draw_rect(win->x + 4, win->y + 30, win->w - 8, win->h - 34, COLOR_DARK_BG); + draw_rect(win->x + 4, win->y + 30, win->w - 8, win->h - 34, COLOR_NOTEPAD_BG); int visual_line = 0; int current_x = win->x + 8; @@ -69,7 +69,7 @@ static void notepad_paint(Window *win) { } char ch[2] = {win->buffer[i], 0}; - draw_string(current_x, current_y, ch, COLOR_DARK_TEXT); + draw_string(current_x, current_y, ch, COLOR_BLACK); current_x += 8; } } @@ -98,7 +98,7 @@ static void notepad_paint(Window *win) { if (visual_line >= notepad_scroll_line && visual_line < notepad_scroll_line + (win->h - 40) / 10) { - draw_rect(cx, cy, 2, 8, COLOR_DARK_TEXT); + draw_rect(cx, cy, 2, 8, COLOR_BLACK); } } } diff --git a/src/kernel/wm.c b/src/kernel/wm.c index e66082d..94d2b88 100644 --- a/src/kernel/wm.c +++ b/src/kernel/wm.c @@ -124,7 +124,7 @@ static int str_eq(const char *s1, const char *s2) { static void refresh_desktop_icons(void) { // Update limit in FS - fat32_set_desktop_limit(desktop_max_cols * (desktop_max_rows_per_col > 1 ? desktop_max_rows_per_col - 1 : 0)); + fat32_set_desktop_limit(desktop_max_cols * desktop_max_rows_per_col); FAT32_FileInfo *files = (FAT32_FileInfo*)kmalloc(MAX_DESKTOP_ICONS * sizeof(FAT32_FileInfo)); if (!files) return; @@ -184,8 +184,8 @@ static void refresh_desktop_icons(void) { // 3. Layout Icons if (desktop_auto_align) { - int start_x = 20; // Starting X position for icons - int start_y = 20 + DESKTOP_TOP_DEADSPACE_HEIGHT; // Starting Y position for icons, offset by dead space + int start_x = 20; + int start_y = 50; int grid_x = 0; int grid_y = 0; @@ -200,8 +200,8 @@ static void refresh_desktop_icons(void) { // Place Recycle Bin at bottom-right of grid if (recycle_idx != -1) { - desktop_icons[recycle_idx].x = start_x + (desktop_max_cols - 1) * 80; // Align to the last column - desktop_icons[recycle_idx].y = start_y + (desktop_max_rows_per_col - 2) * 80; // Align to the second to last row (since one is dead space) + desktop_icons[recycle_idx].x = start_x + (desktop_max_cols - 1) * 80; + desktop_icons[recycle_idx].y = start_y + (desktop_max_rows_per_col - 1) * 80; } for (int i = 0; i < desktop_icon_count; i++) { @@ -210,7 +210,7 @@ static void refresh_desktop_icons(void) { desktop_icons[i].x = start_x + (grid_x * 80); desktop_icons[i].y = start_y + (grid_y * 80); - grid_y++; // Increment grid_y for the next icon + grid_y++; if (grid_y >= desktop_max_rows_per_col) { grid_y = 0; grid_x++; @@ -224,7 +224,7 @@ static void refresh_desktop_icons(void) { if (desktop_icons[i].x != -1) { int col = (desktop_icons[i].x - 20) / 80; int row = (desktop_icons[i].y - 20) / 80; - if (col >= 0 && col < 16 && row >= 0 && row < 16) occupied[col][row] = true; // Mark occupied cells + if (col >= 0 && col < 16 && row >= 0 && row < 16) occupied[col][row] = true; } } @@ -233,13 +233,13 @@ static void refresh_desktop_icons(void) { int found_col = -1, found_row = -1; for (int c = 0; c < 16; c++) { for (int r = 0; r < desktop_max_rows_per_col; r++) { - if (!occupied[c][r] && r > 0) { // Ensure not in the dead space row + if (!occupied[c][r]) { found_col = c; found_row = r; goto found; } } } - found: + found: if (found_col != -1) { desktop_icons[i].x = 20 + found_col * 80; desktop_icons[i].y = 20 + found_row * 80; @@ -564,16 +564,12 @@ void draw_paint_icon(int x, int y, const char *label) { } // New macOS-style drawing functions +static void draw_filled_circle(int cx, int cy, int r, uint32_t color); // Draw traffic light (close button - red) void draw_traffic_light(int x, int y) { - // Red close button - draw_rounded_rect_filled(x, y, 12, 12, 3, COLOR_TRAFFIC_RED); - // X mark - draw_rect(x + 4, y + 4, 1, 4, COLOR_WHITE); // Vertical - draw_rect(x + 5, y + 5, 1, 1, COLOR_WHITE); - draw_rect(x + 5, y + 6, 1, 1, COLOR_WHITE); - draw_rect(x + 6, y + 5, 1, 2, COLOR_WHITE); + draw_filled_circle(x + 6, y + 6, 6, COLOR_TRAFFIC_RED); + draw_filled_circle(x + 6, y + 6, 2, COLOR_WHITE); } // Draw a squircle-style app icon @@ -600,6 +596,181 @@ void draw_settings_icon(int x, int y, const char *label) { draw_rect(cx - 2, cy - 2, 4, 4, COLOR_WHITE); // Center } +static int isqrt_local(int n) { + if (n <= 0) return 0; + int x = n; + int y = (x + 1) / 2; + while (y < x) { + x = y; + y = (x + n / x) / 2; + } + return x; +} + +static void draw_filled_circle(int cx, int cy, int r, uint32_t color) { + for (int dy = -r; dy <= r; dy++) { + int dx = isqrt_local(r * r - dy * dy); + draw_rect(cx - dx, cy + dy, dx * 2 + 1, 1, color); + } +} + +static void draw_dock_files(int x, int y) { + draw_rounded_rect_filled(x, y, 48, 48, 10, 0xFF1D5FAA); + draw_rounded_rect_filled(x + 1, y + 1, 46, 28, 9, 0xFF4A90E2); + draw_rounded_rect_filled(x + 1, y + 24, 46, 23, 9, 0xFF2E72C9); + draw_rounded_rect_filled(x + 7, y + 13, 15, 7, 3, 0xFF62A8F5); + draw_rounded_rect_filled(x + 8, y + 12, 13, 5, 3, 0xFF7DB8F8); + draw_rounded_rect_filled(x + 5, y + 17, 38, 23, 5, 0xFFCDE4FA); + draw_rounded_rect_filled(x + 7, y + 19, 34, 19, 4, 0xFFEAF5FF); + draw_rect(x + 12, y + 23, 24, 2, 0xFF88B8D8); + draw_rect(x + 12, y + 27, 17, 2, 0xFF88B8D8); + draw_rect(x + 12, y + 31, 21, 2, 0xFF88B8D8); +} + +static void draw_dock_settings(int x, int y) { + draw_rounded_rect_filled(x, y, 48, 48, 10, 0xFF3A3A3A); + draw_rounded_rect_filled(x + 1, y + 1, 46, 28, 9, 0xFF6E6E6E); + draw_rounded_rect_filled(x + 1, y + 24, 46, 23, 9, 0xFF4A4A4A); + int cx = x + 24, cy = y + 25; + draw_rounded_rect_filled(cx - 4, cy - 18, 8, 7, 2, 0xFFCCCCCC); + draw_rounded_rect_filled(cx - 4, cy + 11, 8, 7, 2, 0xFFCCCCCC); + draw_rounded_rect_filled(cx - 18, cy - 4, 7, 8, 2, 0xFFCCCCCC); + draw_rounded_rect_filled(cx + 11, cy - 4, 7, 8, 2, 0xFFCCCCCC); + draw_rounded_rect_filled(cx - 14, cy - 14, 6, 6, 2, 0xFFCCCCCC); + draw_rounded_rect_filled(cx + 8, cy - 14, 6, 6, 2, 0xFFCCCCCC); + draw_rounded_rect_filled(cx - 14, cy + 8, 6, 6, 2, 0xFFCCCCCC); + draw_rounded_rect_filled(cx + 8, cy + 8, 6, 6, 2, 0xFFCCCCCC); + draw_filled_circle(cx, cy, 13, 0xFFCCCCCC); + draw_filled_circle(cx, cy, 6, 0xFF4A4A4A); + draw_filled_circle(cx, cy, 4, 0xFF3A3A3A); +} + +static void draw_dock_notepad(int x, int y) { + draw_rounded_rect_filled(x, y, 48, 48, 10, 0xFFCC9A00); + draw_rounded_rect_filled(x + 1, y + 1, 46, 28, 9, 0xFFFFD700); + draw_rounded_rect_filled(x + 1, y + 24, 46, 23, 9, 0xFFE8BC00); + draw_rounded_rect_filled(x + 7, y + 9, 34, 32, 3, 0xFFFFFDE7); + draw_rounded_rect_filled(x + 7, y + 9, 34, 8, 3, 0xFFFFCA28); + draw_rect(x + 7, y + 13, 34, 4, 0xFFFFCA28); + draw_rect(x + 11, y + 21, 18, 2, 0xFFBBAA70); + draw_rect(x + 11, y + 25, 26, 1, 0xFFCCBB88); + draw_rect(x + 11, y + 28, 22, 1, 0xFFCCBB88); + draw_rect(x + 11, y + 31, 24, 1, 0xFFCCBB88); + draw_rect(x + 11, y + 34, 18, 1, 0xFFCCBB88); + draw_rect(x + 32, y + 11, 3, 13, 0xFFF5DEB3); + draw_rect(x + 32, y + 9, 3, 4, 0xFFFF9800); + draw_rect(x + 33, y + 24, 1, 2, 0xFF555555); +} + +static void draw_dock_calculator(int x, int y) { + draw_rounded_rect_filled(x, y, 48, 48, 10, 0xFF111111); + draw_rounded_rect_filled(x + 1, y + 1, 46, 28, 9, 0xFF222222); + draw_rounded_rect_filled(x + 1, y + 24, 46, 23, 9, 0xFF151515); + draw_rounded_rect_filled(x + 6, y + 6, 36, 11, 3, 0xFF1A3A2A); + draw_rect(x + 25, y + 9, 14, 5, 0xFF33FF88); + // 3x3 button grid + uint32_t btn_clr[3][3] = { + {0xFF555555, 0xFF555555, 0xFF555555}, + {0xFF444444, 0xFF444444, 0xFF444444}, + {0xFF444444, 0xFF444444, 0xFFFF9500}, + }; + for (int row = 0; row < 3; row++) { + for (int col = 0; col < 3; col++) { + draw_rounded_rect_filled(x + 10 + col * 9, y + 22 + row * 6, 7, 5, 2, btn_clr[row][col]); + } + } +} + +static void draw_dock_terminal(int x, int y) { + draw_rounded_rect_filled(x, y, 48, 48, 10, 0xFF0A0A0A); + draw_rounded_rect_filled(x + 1, y + 1, 46, 28, 9, 0xFF161616); + draw_rounded_rect_filled(x + 1, y + 24, 46, 23, 9, 0xFF0D0D0D); + int px = x + 12; + int py = y + 24; + for (int i = 0; i < 6; i++) { + draw_rect(px + i, py - 4 + i, 2, 1, 0xFF33DD33); + } + for (int i = 0; i < 6; i++) { + draw_rect(px + i, py + 4 - i, 2, 1, 0xFF33DD33); + } + draw_rect(px + 10, py + 7, 8, 1, 0xFF33DD33); +} + +static void draw_dock_minesweeper(int x, int y) { + draw_rounded_rect_filled(x, y, 48, 48, 10, 0xFF1B5E20); + draw_rounded_rect_filled(x + 1, y + 1, 46, 28, 9, 0xFF4CAF50); + draw_rounded_rect_filled(x + 1, y + 24, 46, 23, 9, 0xFF388E3C); + for (int row = 0; row < 5; row++) { + for (int col = 0; col < 5; col++) { + int bx = x + 6 + col * 8, by = y + 7 + row * 8; + if ((row == 2 && col == 2)) { + draw_rounded_rect_filled(bx, by, 6, 6, 1, 0xFFC8E6C9); + } else if ((row + col) % 2 == 0) { + draw_rounded_rect_filled(bx, by, 6, 6, 1, 0xFF81C784); + draw_rect(bx, by, 6, 1, 0xFFA5D6A7); + draw_rect(bx, by, 1, 6, 0xFFA5D6A7); + draw_rect(bx + 5, by + 1, 1, 5, 0xFF2E7D32); + draw_rect(bx + 1, by + 5, 5, 1, 0xFF2E7D32); + } else { + draw_rounded_rect_filled(bx, by, 6, 6, 1, 0xFF66BB6A); + draw_rect(bx, by, 6, 1, 0xFF81C784); + draw_rect(bx, by, 1, 6, 0xFF81C784); + } + } + } + int mx = x + 6 + 2 * 8 + 3, my = y + 7 + 2 * 8 + 3; + draw_filled_circle(mx, my, 4, 0xFF111111); + draw_rect(mx - 5, my - 1, 11, 2, 0xFF111111); + draw_rect(mx - 1, my - 5, 2, 11, 0xFF111111); + draw_rect(mx - 3, my - 3, 2, 2, 0xFF111111); + draw_rect(mx + 1, my - 3, 2, 2, 0xFF111111); + draw_rect(mx - 3, my + 1, 2, 2, 0xFF111111); + draw_rect(mx + 1, my + 1, 2, 2, 0xFF111111); + draw_rect(mx - 1, my - 2, 2, 2, 0xFFFFFFFF); + draw_rect(x + 7, y + 40, 1, 6, 0xFF333333); + draw_rect(x + 8, y + 40, 4, 3, 0xFFFF3333); +} + +static void draw_dock_paint(int x, int y) { + draw_rounded_rect_filled(x, y, 48, 48, 10, 0xFFBBBBBB); + draw_rounded_rect_filled(x + 1, y + 1, 46, 28, 9, 0xFFFFFFFF); + draw_rounded_rect_filled(x + 1, y + 24, 46, 23, 9, 0xFFEEEEEE); + draw_rounded_rect_filled(x + 6, y + 9, 36, 30, 10, 0xFFEEDDB0); + draw_rounded_rect_filled(x + 8, y + 11, 32, 26, 8, 0xFFF5E8C0); + draw_filled_circle(x + 35, y + 32, 5, 0xFFEEDDB0); + draw_filled_circle(x + 35, y + 32, 3, 0xFFFFFFFF); + draw_filled_circle(x + 15, y + 18, 5, 0xFFFF3333); + draw_filled_circle(x + 23, y + 14, 5, 0xFF3399FF); + draw_filled_circle(x + 31, y + 18, 5, 0xFFFFCC00); + draw_filled_circle(x + 28, y + 27, 5, 0xFF33CC33); + draw_filled_circle(x + 16, y + 27, 5, 0xFFFF6600); + draw_rect(x + 30, y + 30, 3, 14, 0xFF8B6914); + draw_rounded_rect_filled(x + 29, y + 27, 5, 5, 2, 0xFFBBBBBB); + draw_rounded_rect_filled(x + 30, y + 22, 3, 7, 1, 0xFF1A1A1A); +} + +static void draw_dock_editor(int x, int y) { + draw_rounded_rect_filled(x, y, 48, 48, 10, 0xFF0A1628); + draw_rounded_rect_filled(x + 1, y + 1, 46, 28, 9, 0xFF1565C0); + draw_rounded_rect_filled(x + 1, y + 24, 46, 23, 9, 0xFF0D47A1); + draw_rect(x + 5, y + 8, 9, 32, 0xFF1A237E); + draw_filled_circle(x + 10, y + 14, 2, 0xFF7986CB); + draw_filled_circle(x + 10, y + 22, 2, 0xFF7986CB); + draw_filled_circle(x + 10, y + 30, 2, 0xFF7986CB); + draw_rect(x + 15, y + 8, 28, 32, 0xFF1B2B3C); + draw_rect(x + 15, y + 8, 14, 5, 0xFF1B2B3C); + draw_rect(x + 15, y + 8, 14, 1, 0xFF569CD6); + draw_rect(x + 18, y + 13, 9, 2, 0xFF569CD6); + draw_rect(x + 29, y + 13, 8, 2, 0xFF4EC9B0); + draw_rect(x + 18, y + 18, 5, 2, 0xFFCE9178); + draw_rect(x + 25, y + 18, 7, 2, 0xFFCE9178); + draw_rect(x + 21, y + 23, 7, 2, 0xFF9CDCFE); + draw_rect(x + 30, y + 23, 5, 2, 0xFFD4D4D4); + draw_rect(x + 18, y + 28, 16, 2, 0xFF6A9955); + draw_rect(x + 18, y + 33, 10, 2, 0xFFD4D4D4); + draw_rect(x + 30, y + 33, 6, 2, 0xFF569CD6); +} + void draw_window(Window *win) { if (!win->visible) return; @@ -607,18 +778,20 @@ void draw_window(Window *win) { // Border/Shadow effect draw_rounded_rect_filled(win->x - 1, win->y - 1, win->w + 2, win->h + 2, 8, 0xFF000000); - // Main window body + // Main window body (fully rounded) draw_rounded_rect_filled(win->x, win->y, win->w, win->h, 8, COLOR_DARK_PANEL); - // Title Bar - draw_rounded_rect_filled(win->x, win->y, win->w, 22, 8, COLOR_DARK_TITLEBAR); - draw_string(win->x + 28, win->y + 7, win->title, COLOR_DARK_TEXT); + // Title Bar (rounded at top only - overdraw bottom to hide rounding) + draw_rounded_rect_filled(win->x, win->y, win->w, 20, 8, COLOR_DARK_TITLEBAR); + draw_rect(win->x, win->y + 12, win->w, 8, COLOR_DARK_TITLEBAR); // Cover bottom rounded corners + draw_string(win->x + 28, win->y + 5, win->title, COLOR_DARK_TEXT); // Traffic Light (close button - red) - draw_traffic_light(win->x + 8, win->y + 5); + draw_traffic_light(win->x + 8, win->y + 2); - // Client Area with dark background (no rounding) - draw_rect(win->x, win->y + 22, win->w, win->h - 22, COLOR_DARK_BG); + // Client Area with dark background, rounded only at bottom + draw_rounded_rect_filled(win->x, win->y + 20, win->w, win->h - 20, 8, COLOR_DARK_BG); + draw_rect(win->x, win->y + 20, win->w, 8, COLOR_DARK_BG); if (win->paint) { win->paint(win); @@ -720,8 +893,8 @@ void wm_paint(void) { graphics_clear_clipping(); } - // 1. Desktop Background (dark mode) - draw_rect(0, 0, sw, sh, COLOR_DARK_BG); + // 1. Desktop Background (respects wallpaper color/pattern) + draw_desktop_background(); // Draw Desktop Icons for (int i = 0; i < desktop_icon_count; i++) { @@ -747,10 +920,10 @@ void wm_paint(void) { else if (str_starts_with(icon->name, "Calculator")) draw_calculator_icon(icon->x, icon->y, label); else if (str_starts_with(icon->name, "Terminal")) draw_terminal_icon(icon->x, icon->y, label); else if (str_starts_with(icon->name, "Minesweeper")) draw_minesweeper_icon(icon->x, icon->y, label); - else if (str_starts_with(icon->name, "Settings")) draw_settings_icon(icon->x, icon->y, label); + else if (str_starts_with(icon->name, "Settings")) draw_control_panel_icon(icon->x, icon->y, label); else if (str_starts_with(icon->name, "About")) draw_about_icon(icon->x, icon->y, label); else if (str_starts_with(icon->name, "Recycle Bin")) draw_recycle_bin_icon(icon->x, icon->y, label); - else if (str_starts_with(icon->name, "Files")) draw_files_icon(icon->x, icon->y, label); + else if (str_starts_with(icon->name, "Files")) draw_folder_icon(icon->x, icon->y, label); else if (str_starts_with(icon->name, "Paint")) draw_paint_icon(icon->x, icon->y, label); else draw_icon(icon->x, icon->y, label); } else { @@ -796,8 +969,8 @@ void wm_paint(void) { draw_window(win); } - // 4. Top Menu Bar (macOS style) - draw_rect(0, 0, sw, 40, COLOR_TOPBAR_BG); + // 4. Top Menu Bar + draw_rect(0, 0, sw, 30, COLOR_TOPBAR_BG); // Logo dropdown (top-left) draw_boredos_logo(8, 8, 1); @@ -807,7 +980,7 @@ void wm_paint(void) { // Top menu dropdown (if logo clicked) if (start_menu_open) { - int menu_h = 100; + int menu_h = 85; draw_rounded_rect_filled(8, 40, 160, menu_h, 8, COLOR_DARK_PANEL); draw_string(20, 48, "About BoredOS", COLOR_DARK_TEXT); draw_string(20, 68, "Settings", COLOR_DARK_TEXT); @@ -820,7 +993,7 @@ void wm_paint(void) { int dock_y = sh - dock_h - 6; // Float above bottom int dock_item_size = 48; int dock_spacing = 10; - int total_dock_width = 8 * (dock_item_size + dock_spacing); + int total_dock_width = 7 * (dock_item_size + dock_spacing); int dock_bg_x = (sw - total_dock_width) / 2 - 12; // Rounded background extends beyond icons int dock_bg_w = total_dock_width + 24; draw_rounded_rect_filled(dock_bg_x, dock_y, dock_bg_w, dock_h, 18, COLOR_DOCK_BG); @@ -829,36 +1002,20 @@ void wm_paint(void) { int dock_x = (sw - total_dock_width) / 2; int dock_item_y = dock_y + 6; - // Files app - draw_rounded_rect_filled(dock_x, dock_item_y, dock_item_size, dock_item_size, 10, 0xFF4A90E2); + draw_dock_files(dock_x, dock_item_y); dock_x += dock_item_size + dock_spacing; - - // Settings app - draw_rounded_rect_filled(dock_x, dock_item_y, dock_item_size, dock_item_size, 10, 0xFF888888); + draw_dock_settings(dock_x, dock_item_y); dock_x += dock_item_size + dock_spacing; - - // Notepad - draw_rounded_rect_filled(dock_x, dock_item_y, dock_item_size, dock_item_size, 10, 0xFFFFD700); + draw_dock_notepad(dock_x, dock_item_y); dock_x += dock_item_size + dock_spacing; - - // Calculator - draw_rounded_rect_filled(dock_x, dock_item_y, dock_item_size, dock_item_size, 10, 0xFFFF6B6B); + draw_dock_calculator(dock_x, dock_item_y); dock_x += dock_item_size + dock_spacing; - - // Terminal - draw_rounded_rect_filled(dock_x, dock_item_y, dock_item_size, dock_item_size, 10, 0xFF000000); + draw_dock_terminal(dock_x, dock_item_y); dock_x += dock_item_size + dock_spacing; - - // Minesweeper - draw_rounded_rect_filled(dock_x, dock_item_y, dock_item_size, dock_item_size, 10, 0xFF808080); + draw_dock_minesweeper(dock_x, dock_item_y); dock_x += dock_item_size + dock_spacing; - - // Paint - draw_rounded_rect_filled(dock_x, dock_item_y, dock_item_size, dock_item_size, 10, 0xFF4CAF50); - dock_x += dock_item_size + dock_spacing; - - // Editor - draw_rounded_rect_filled(dock_x, dock_item_y, dock_item_size, dock_item_size, 10, 0xFF2196F3); + draw_dock_paint(dock_x, dock_item_y); + // Editor removed from dock // Desktop Context Menu (with rounded corners) if (desktop_menu_visible) { @@ -1091,7 +1248,7 @@ void wm_handle_click(int x, int y) { } } else if (desktop_dialog_state == 1 || desktop_dialog_state == 2) { // Create File/Folder if (desktop_icon_count >= desktop_max_cols * desktop_max_rows_per_col) { - wm_show_message("Error", "Desktop is full!"); // This message is now based on the adjusted limit + wm_show_message("Error", "Desktop is full!"); } else if (desktop_dialog_input[0] != 0) { char path[128] = "/Desktop/"; int p=9; int n=0; while(desktop_dialog_input[n]) path[p++] = desktop_dialog_input[n++]; path[p]=0; @@ -1170,7 +1327,7 @@ void wm_handle_click(int x, int y) { wm_bring_to_front(topmost); // Check traffic light close button (now at top-left) - if (rect_contains(topmost->x + 8, topmost->y + 9, 12, 12, x, y)) { + if (rect_contains(topmost->x + 8, topmost->y + 2, 12, 12, x, y)) { topmost->visible = false; // Reset window state on close if (topmost == &win_explorer) { @@ -1308,7 +1465,7 @@ void wm_handle_right_click(int x, int y) { int dock_y = sh - dock_h - 6; // Float above bottom int dock_item_size = 48; int dock_spacing = 10; - int total_dock_width = 8 * (dock_item_size + dock_spacing); + int total_dock_width = 7 * (dock_item_size + dock_spacing); int dock_bg_x = (sw - total_dock_width) / 2 - 12; int dock_bg_w = total_dock_width + 24; @@ -1326,7 +1483,6 @@ void wm_handle_right_click(int x, int y) { else if (item == 4) start_menu_pending_app = "Terminal"; else if (item == 5) start_menu_pending_app = "Minesweeper"; else if (item == 6) start_menu_pending_app = "Paint"; - else if (item == 7) start_menu_pending_app = "Editor"; } } else { wm_handle_click(mx, my); @@ -1416,8 +1572,7 @@ void wm_handle_right_click(int x, int y) { if (start_menu_pending_app) { // Launch App if (str_starts_with(start_menu_pending_app, "Files")) { - explorer_reset(); - wm_bring_to_front(&win_explorer); + explorer_open_directory("/"); } else if (str_starts_with(start_menu_pending_app, "Notepad")) { notepad_reset(); wm_bring_to_front(&win_notepad); @@ -1465,9 +1620,8 @@ void wm_handle_right_click(int x, int y) { wm_bring_to_front(&win_cmd); handled = true; } else if (str_ends_with(icon->name, "About.shortcut")) { wm_bring_to_front(&win_about); handled = true; - } else if (str_ends_with(icon->name, "Explorer.shortcut")) { // Files - explorer_reset(); - wm_bring_to_front(&win_explorer); + } else if (str_ends_with(icon->name, "Files.shortcut")) { + explorer_open_directory("/"); handled = true; } else if (str_ends_with(icon->name, "Recycle Bin.shortcut")) { explorer_open_directory("/RecycleBin"); handled = true; } else if (str_ends_with(icon->name, "Paint.shortcut")) { @@ -1593,7 +1747,7 @@ void wm_handle_right_click(int x, int y) { if (!dropped_on_target && !from_desktop) { // Dragged from Explorer to Desktop // Check limit first - if (desktop_icon_count >= desktop_max_cols * (desktop_max_rows_per_col > 1 ? desktop_max_rows_per_col - 1 : 0)) { + if (desktop_icon_count >= desktop_max_cols * desktop_max_rows_per_col) { wm_show_message("Error", "Desktop is full!"); } else { explorer_import_file_to(&win_explorer, drag_file_path, "/Desktop"); @@ -1937,9 +2091,8 @@ void wm_timer_tick(void) { if (current_sec != last_second) { last_second = current_sec; int sw = get_screen_width(); - int sh = get_screen_height(); - // Mark clock area + a bit of buffer - wm_mark_dirty(sw - 90, sh - 30, 90, 20); + // Mark clock area in the top menu bar (around draw_clock at sw - 80, y=12) + wm_mark_dirty(sw - 110, 6, 110, 24); } // If force_redraw is set, do a full redraw diff --git a/src/kernel/wm.h b/src/kernel/wm.h index 2a6d629..bf67052 100644 --- a/src/kernel/wm.h +++ b/src/kernel/wm.h @@ -23,7 +23,8 @@ #define COLOR_APPLE_INDIGO 0xFF4B0082 #define COLOR_APPLE_VIOLET 0xFF9400D3 -// --- Dark Mode Colors (macOS Style) --- +// --- Dark Mode Colors --- +#define COLOR_NOTEPAD_BG 0xFFF5F5DC #define COLOR_DARK_BG 0xFF1E1E1E // Main dark background #define COLOR_DARK_PANEL 0xFF2D2D2D // Slightly lighter panel background #define COLOR_DARK_TITLEBAR 0xFF282828 // Darker for title bar