mirror of
https://github.com/subhobhai943/SUB-OS.git
synced 2026-10-25 16:52:29 +00:00
feat(gui): Upgrade to high-res 800x600, sharp 8x16 font, IRQ12 PS/2 mouse driver, and polished window manager
- Upgrade resolution to 800x600 @ 32bpp TrueColor with Bochs/QEMU VBE LFB - Implement full 8042 Aux PS/2 mouse controller driver on IRQ 12 (vector 44) with packet decode and bounds clamping - Add high-definition 8x16 font rasterizer with text drop shadows for sharp typography - Upgrade to smooth 16x24 anti-aliased cursor with dark slate outline and drop shadow - Increase titlebars to 24px and taskbar to 32px with modern desktop styling - Re-architect applications (SysMon, Terminal, Explorer, Calc, Paint, About) for spacious high-res display
This commit is contained in:
1 parent
56d8b3af1a
commit
4568a9ab4e
10 files changed
+475
-241
No files matched your search
+65
-58
@@ -1,4 +1,4 @@
|
||||
// Desktop Environment & Compositor for SUB-OS
|
||||
// High-Resolution Modern Desktop Environment & Compositor for SUB-OS (800x600)
|
||||
#include <gui/gui_desktop.h>
|
||||
#include <gui/gui_gfx.h>
|
||||
#include <gui/gui_cursor.h>
|
||||
@@ -21,8 +21,8 @@ static bool g_prev_left = false;
|
||||
void gui_desktop_init(void) {
|
||||
const fb_info_t* fb = fb_get_info();
|
||||
uint32_t* fb_addr = fb ? fb->address : NULL;
|
||||
int w = fb ? fb->width : 320;
|
||||
int h = fb ? fb->height : 200;
|
||||
int w = (fb && fb->width > 0) ? fb->width : 800;
|
||||
int h = (fb && fb->height > 0) ? fb->height : 600;
|
||||
|
||||
gui_gfx_init(fb_addr, w, h);
|
||||
gui_cursor_init();
|
||||
@@ -35,20 +35,21 @@ void gui_desktop_render_background(void) {
|
||||
int sw = gui_gfx_get_width();
|
||||
int sh = gui_gfx_get_height();
|
||||
|
||||
// Dark Cyberpunk / Navy Vertical Gradient Wallpaper
|
||||
// Dark Cyberpunk / Nord Deep Gradient Wallpaper
|
||||
gui_gfx_draw_gradient_v(0, 0, sw, sh - GUI_TASKBAR_HEIGHT, 0xFF0B132B, 0xFF1C2541);
|
||||
|
||||
// Subtle Grid Pattern
|
||||
for (int y = 0; y < sh - GUI_TASKBAR_HEIGHT; y += 20) {
|
||||
// Subtle Architectural Grid Overlay
|
||||
for (int y = 0; y < sh - GUI_TASKBAR_HEIGHT; y += 40) {
|
||||
gui_gfx_draw_line(0, y, sw - 1, y, 0xFF141F36);
|
||||
}
|
||||
for (int x = 0; x < sw; x += 20) {
|
||||
for (int x = 0; x < sw; x += 40) {
|
||||
gui_gfx_draw_line(x, 0, x, sh - GUI_TASKBAR_HEIGHT - 1, 0xFF141F36);
|
||||
}
|
||||
|
||||
// Centered Desktop Brand Text Watermark
|
||||
gui_gfx_draw_string_shadow(sw / 2 - 40, sh / 2 - 20, "SUB-OS DESKTOP", 0xFF3A506B, 0xFF050811);
|
||||
gui_gfx_draw_string(sw / 2 - 28, sh / 2 - 8, "v0.2.0-LTS", 0xFF2A3C54);
|
||||
// Centered Elegant Desktop Branding
|
||||
gui_gfx_draw_string_16_shadow(sw / 2 - 80, sh / 2 - 40, "SUB-OS DESKTOP", 0xFF38BDF8, 0xFF0284C7);
|
||||
gui_gfx_draw_string_16(sw / 2 - 95, sh / 2 - 18, "Modular Monolithic Kernel", 0xFF94A3B8);
|
||||
gui_gfx_draw_string(sw / 2 - 60, sh / 2 + 6, "v0.2.0-LTS (x86_64)", 0xFF64748B);
|
||||
}
|
||||
|
||||
void gui_desktop_render_taskbar(void) {
|
||||
@@ -56,73 +57,80 @@ void gui_desktop_render_taskbar(void) {
|
||||
int sh = gui_gfx_get_height();
|
||||
int ty = sh - GUI_TASKBAR_HEIGHT;
|
||||
|
||||
// Taskbar Bar Surface
|
||||
// Taskbar Surface
|
||||
gui_gfx_fill_rect(0, ty, sw, GUI_TASKBAR_HEIGHT, GUI_THEME_TASKBAR_BG);
|
||||
gui_gfx_draw_line(0, ty, sw - 1, ty, GUI_THEME_BORDER);
|
||||
|
||||
// Start Button
|
||||
uint32_t start_bg = g_start_menu_open ? GUI_THEME_PRIMARY_DARK : GUI_THEME_PRIMARY;
|
||||
gui_gfx_fill_rect(2, ty + 2, 54, 16, start_bg);
|
||||
gui_gfx_draw_rect(2, ty + 2, 54, 16, GUI_THEME_PRIMARY_DARK);
|
||||
gui_gfx_draw_string(6, ty + 6, "# SUB-OS", GUI_COLOR_WHITE);
|
||||
gui_gfx_fill_rect(6, ty + 4, 86, 24, start_bg);
|
||||
gui_gfx_draw_rect(6, ty + 4, 86, 24, GUI_THEME_PRIMARY_DARK);
|
||||
gui_gfx_draw_string_16_shadow(14, ty + 8, "# SUB-OS", GUI_COLOR_WHITE, GUI_COLOR_BLACK);
|
||||
|
||||
// Window Tabs in Taskbar
|
||||
int tab_x = 60;
|
||||
int tab_x = 100;
|
||||
int win_count = gui_wm_get_window_count();
|
||||
for (int i = 0; i < win_count && tab_x < sw - 80; i++) {
|
||||
for (int i = 0; i < win_count && tab_x < sw - 160; i++) {
|
||||
gui_window_t* win = gui_wm_get_window(i + 1);
|
||||
if (!win || !win->visible) continue;
|
||||
|
||||
uint32_t tab_bg = win->active ? GUI_THEME_BG_ELEVATED : GUI_THEME_BG_SURFACE;
|
||||
gui_gfx_fill_rect(tab_x, ty + 2, 50, 16, tab_bg);
|
||||
gui_gfx_draw_rect(tab_x, ty + 2, 50, 16, win->active ? GUI_THEME_PRIMARY : GUI_THEME_BORDER);
|
||||
gui_gfx_fill_rect(tab_x, ty + 4, 100, 24, tab_bg);
|
||||
gui_gfx_draw_rect(tab_x, ty + 4, 100, 24, win->active ? GUI_THEME_PRIMARY : GUI_THEME_BORDER);
|
||||
|
||||
char short_title[6];
|
||||
strncpy(short_title, win->title, 5);
|
||||
short_title[5] = '\0';
|
||||
gui_gfx_draw_string(tab_x + 4, ty + 6, short_title, win->active ? GUI_THEME_TEXT_MAIN : GUI_THEME_TEXT_MUTED);
|
||||
char short_title[12];
|
||||
strncpy(short_title, win->title, 11);
|
||||
short_title[11] = '\0';
|
||||
gui_gfx_draw_string_16(tab_x + 8, ty + 8, short_title, win->active ? GUI_THEME_TEXT_MAIN : GUI_THEME_TEXT_MUTED);
|
||||
|
||||
tab_x += 54;
|
||||
tab_x += 106;
|
||||
}
|
||||
|
||||
// System Tray (Clock & Telemetry)
|
||||
rtc_time_t time;
|
||||
rtc_get_time(&time);
|
||||
char time_str[10];
|
||||
char time_str[16];
|
||||
snprintf(time_str, sizeof(time_str), "%02u:%02u:%02u", time.hour, time.minute, time.second);
|
||||
gui_gfx_draw_string_bg(sw - 50, ty + 6, time_str, GUI_THEME_PRIMARY, GUI_THEME_TASKBAR_BG);
|
||||
gui_gfx_draw_string_16_shadow(sw - 85, ty + 8, time_str, GUI_THEME_PRIMARY, GUI_COLOR_BLACK);
|
||||
|
||||
gui_gfx_fill_rect(sw - 68, ty + 5, 12, 10, GUI_THEME_SUCCESS);
|
||||
gui_gfx_draw_string(sw - 66, ty + 6, "24M", GUI_COLOR_WHITE);
|
||||
// RAM Badge
|
||||
gui_gfx_fill_rect(sw - 140, ty + 6, 45, 20, GUI_THEME_SUCCESS);
|
||||
gui_gfx_draw_rect(sw - 140, ty + 6, 45, 20, 0xFF059669);
|
||||
gui_gfx_draw_string_16(sw - 134, ty + 8, "24 MB", GUI_COLOR_WHITE);
|
||||
}
|
||||
|
||||
void gui_desktop_render_start_menu(void) {
|
||||
if (!g_start_menu_open) return;
|
||||
|
||||
int sh = gui_gfx_get_height();
|
||||
int menu_w = 95;
|
||||
int menu_h = 100;
|
||||
int mx = 2;
|
||||
int my = sh - GUI_TASKBAR_HEIGHT - menu_h - 2;
|
||||
int menu_w = 170;
|
||||
int menu_h = 200;
|
||||
int mx = 6;
|
||||
int my = sh - GUI_TASKBAR_HEIGHT - menu_h - 6;
|
||||
|
||||
gui_gfx_draw_shadow(mx, my, menu_w, menu_h, 3);
|
||||
// Drop Shadow & Body
|
||||
gui_gfx_draw_shadow(mx, my, menu_w, menu_h, 8);
|
||||
gui_gfx_fill_rect(mx, my, menu_w, menu_h, GUI_THEME_BG_SURFACE);
|
||||
gui_gfx_draw_rect(mx, my, menu_w, menu_h, GUI_THEME_PRIMARY);
|
||||
|
||||
// Menu Header
|
||||
gui_gfx_fill_rect(mx + 1, my + 1, menu_w - 2, 26, GUI_THEME_PRIMARY_DARK);
|
||||
gui_gfx_draw_string_16_shadow(mx + 10, my + 6, "SUB-OS Applications", GUI_COLOR_WHITE, GUI_COLOR_BLACK);
|
||||
|
||||
const char* items[] = {
|
||||
">_ Terminal",
|
||||
">_ Terminal Console",
|
||||
"[#] System Monitor",
|
||||
"[F] File Explorer",
|
||||
"[=] Calculator",
|
||||
"[*] Paint Studio",
|
||||
"[i] About SUB-OS",
|
||||
"[X] Exit GUI"
|
||||
"[X] Exit to TTY"
|
||||
};
|
||||
|
||||
for (int i = 0; i < 7; i++) {
|
||||
int iy = my + 4 + i * 13;
|
||||
int iy = my + 34 + i * 23;
|
||||
uint32_t fg = (i == 6) ? GUI_THEME_DANGER : GUI_THEME_TEXT_MAIN;
|
||||
gui_gfx_draw_string(mx + 6, iy, items[i], fg);
|
||||
gui_gfx_draw_string_16(mx + 10, iy, items[i], fg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,28 +148,28 @@ void gui_desktop_handle_taskbar_click(int mx, int my) {
|
||||
int ty = sh - GUI_TASKBAR_HEIGHT;
|
||||
|
||||
// Check Start Button
|
||||
if (mx >= 2 && mx <= 56 && my >= ty + 2 && my <= ty + 18) {
|
||||
if (mx >= 6 && mx <= 92 && my >= ty + 4 && my <= ty + 28) {
|
||||
gui_desktop_toggle_start_menu();
|
||||
return;
|
||||
}
|
||||
|
||||
// Check Start Menu Click if open
|
||||
if (g_start_menu_open) {
|
||||
int menu_w = 95;
|
||||
int menu_h = 100;
|
||||
int smx = 2;
|
||||
int smy = sh - GUI_TASKBAR_HEIGHT - menu_h - 2;
|
||||
int menu_w = 170;
|
||||
int menu_h = 200;
|
||||
int smx = 6;
|
||||
int smy = sh - GUI_TASKBAR_HEIGHT - menu_h - 6;
|
||||
|
||||
if (mx >= smx && mx <= smx + menu_w && my >= smy && my <= smy + menu_h) {
|
||||
int item_idx = (my - (smy + 4)) / 13;
|
||||
int item_idx = (my - (smy + 34)) / 23;
|
||||
g_start_menu_open = false;
|
||||
switch (item_idx) {
|
||||
case 0: gui_app_terminal_launch(20, 20, 160, 100); break;
|
||||
case 1: gui_app_sysmon_launch(140, 20, 150, 115); break;
|
||||
case 2: gui_app_fileman_launch(40, 40, 140, 95); break;
|
||||
case 3: gui_app_calc_launch(60, 30, 110, 85); break;
|
||||
case 4: gui_app_paint_launch(80, 20, 130, 90); break;
|
||||
case 5: gui_app_about_launch(90, 50, 150, 75); break;
|
||||
case 0: gui_app_terminal_launch(30, 30, 440, 270); break;
|
||||
case 1: gui_app_sysmon_launch(420, 30, 330, 230); break;
|
||||
case 2: gui_app_fileman_launch(60, 60, 360, 220); break;
|
||||
case 3: gui_app_calc_launch(120, 80, 220, 220); break;
|
||||
case 4: gui_app_paint_launch(160, 50, 340, 240); break;
|
||||
case 5: gui_app_about_launch(200, 100, 320, 160); break;
|
||||
case 6: g_desktop_running = false; break; // Exit GUI
|
||||
default: break;
|
||||
}
|
||||
@@ -172,33 +180,32 @@ void gui_desktop_handle_taskbar_click(int mx, int my) {
|
||||
}
|
||||
|
||||
// Check Window Tabs
|
||||
int tab_x = 60;
|
||||
int tab_x = 100;
|
||||
int win_count = gui_wm_get_window_count();
|
||||
for (int i = 0; i < win_count && tab_x < sw - 80; i++) {
|
||||
if (mx >= tab_x && mx <= tab_x + 50 && my >= ty + 2 && my <= ty + 18) {
|
||||
for (int i = 0; i < win_count && tab_x < sw - 160; i++) {
|
||||
if (mx >= tab_x && mx <= tab_x + 100 && my >= ty + 4 && my <= ty + 28) {
|
||||
gui_wm_focus_window(i + 1);
|
||||
return;
|
||||
}
|
||||
tab_x += 54;
|
||||
tab_x += 106;
|
||||
}
|
||||
}
|
||||
|
||||
int gui_desktop_run(void) {
|
||||
gui_desktop_init();
|
||||
|
||||
// Open initial standard desktop windows
|
||||
gui_app_sysmon_launch(150, 10, 150, 115);
|
||||
gui_app_terminal_launch(10, 15, 130, 95);
|
||||
// Launch default initial windows in spacious 800x600 layout
|
||||
gui_app_sysmon_launch(430, 20, 340, 240);
|
||||
gui_app_terminal_launch(20, 30, 390, 260);
|
||||
|
||||
g_desktop_running = true;
|
||||
printk(KERN_INFO "GUI: Desktop Environment session started (Press ESC to return to TTY)\n");
|
||||
|
||||
int frame_limit = 0;
|
||||
while (g_desktop_running) {
|
||||
// 1. Process Mouse Input
|
||||
const mouse_state_t* ms = mouse_get_state();
|
||||
int mx = ms ? ms->x : 160;
|
||||
int my = ms ? ms->y : 100;
|
||||
int mx = ms ? ms->x : 400;
|
||||
int my = ms ? ms->y : 300;
|
||||
bool left = ms ? ms->left_btn : false;
|
||||
bool right = ms ? ms->right_btn : false;
|
||||
|
||||
|
||||
Reference in new issue
Block a user