mirror of
https://github.com/subhobhai943/SUB-OS.git
synced 2026-10-25 16:52:29 +00:00
Turns the desktop from a fixed set of hand-drawn panels into a real
environment applications can be written against.
SUB-WT immediate-mode toolkit (gui/gui_widgets.c):
Buttons, labels, checkboxes, radios, sliders, list boxes, text fields, tab
bars, scrollbars, progress bars, sparklines and badges. An app feeds the WM
event into the toolkit and then calls widgets from its paint routine, so
each call both draws the control and reports what the user did with it --
no retained widget tree to keep in sync with window state.
Icons and dialogs:
gui_icons.c holds 14 16x16 palette-indexed glyphs stored as hex text, so the
art stays hand-editable and picks up theme changes for free; they scale by
integer factors and can be drawn as tint stencils. gui_dialog.c adds modal
info/warning/error/confirm dialogs that dim the desktop, take exclusive
input, word-wrap on spaces and report results through a callback.
Applications (gui/gui_apps_ext.c):
Settings (tabbed appearance/input/power), Task Manager (live process table
over task_find_by_pid with memory and heap gauges), Kernel Log viewer (reads
the dmesg ring, strips ANSI, colours by severity, scrolls), KTest Runner
(drives the in-kernel suites and reports 21/21 with timing), Clock & Calendar
(Zeller's congruence month grid) and a Text Editor.
Window manager (gui/gui_wm.c):
Minimize/maximize/restore buttons, a corner resize grip, edge snapping, tile
and cascade layouts, F5-F9 shortcuts, title truncation, and index-based
enumeration so the taskbar no longer assumes window ids stay dense.
Desktop shell (gui/gui_desktop.c):
Launcher icon grid, richer start menu, right-click context menu, taskbar
buttons that minimize and restore, and a live CPU trace in the tray.
Two interaction bugs fixed along the way:
- keyboard_get_key() blocks until a key arrives, so calling it every frame
froze the compositor; it is now gated on keyboard_has_key(), and stale
console input is drained before the first frame.
- When the desktop consumed a click, the WM's press-edge detector kept the
pre-press state and read the still-held button as a fresh press on the
next frame, stealing focus from whatever the click had just opened.
gui_wm_sync_button_state() keeps the two layers in step.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01L5yKJT4Wo2cV3rfPrwY5MP
35 lines
978 B
C
35 lines
978 B
C
#ifndef _GUI_DESKTOP_H
|
|
#define _GUI_DESKTOP_H
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
#define GUI_TASKBAR_HEIGHT 32
|
|
#define GUI_DESKTOP_ICON_W 72
|
|
#define GUI_DESKTOP_ICON_H 64
|
|
|
|
void gui_desktop_init(void);
|
|
|
|
void gui_desktop_render_background(void);
|
|
void gui_desktop_render_icons(void);
|
|
void gui_desktop_render_taskbar(void);
|
|
void gui_desktop_render_start_menu(void);
|
|
void gui_desktop_render_context_menu(void);
|
|
|
|
void gui_desktop_toggle_start_menu(void);
|
|
bool gui_desktop_is_start_menu_open(void);
|
|
void gui_desktop_open_context_menu(int mx, int my);
|
|
void gui_desktop_close_menus(void);
|
|
|
|
// Returns true if the click was consumed by desktop chrome (taskbar, menus,
|
|
// icons) rather than falling through to the window manager.
|
|
bool gui_desktop_handle_click(int mx, int my);
|
|
|
|
// Height of the area windows may occupy (screen minus taskbar).
|
|
int gui_desktop_workarea_height(void);
|
|
|
|
void gui_desktop_request_exit(void);
|
|
int gui_desktop_run(void);
|
|
|
|
#endif // _GUI_DESKTOP_H
|