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
41 lines
1.0 KiB
C
41 lines
1.0 KiB
C
#ifndef _GUI_ICONS_H
|
|
#define _GUI_ICONS_H
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
// 16x16 palette-indexed icon set. Each glyph stores one nibble per pixel
|
|
// indexing a 16-entry ARGB palette, so the whole set costs 128 bytes an icon
|
|
// and can be recoloured per theme without touching the bitmaps.
|
|
|
|
#define GUI_ICON_SIZE 16
|
|
|
|
typedef enum {
|
|
GUI_ICON_TERMINAL = 0,
|
|
GUI_ICON_MONITOR,
|
|
GUI_ICON_FOLDER,
|
|
GUI_ICON_CALC,
|
|
GUI_ICON_PAINT,
|
|
GUI_ICON_INFO,
|
|
GUI_ICON_SETTINGS,
|
|
GUI_ICON_TASKS,
|
|
GUI_ICON_LOG,
|
|
GUI_ICON_FLASK,
|
|
GUI_ICON_CLOCK,
|
|
GUI_ICON_FILE,
|
|
GUI_ICON_POWER,
|
|
GUI_ICON_WARNING,
|
|
GUI_ICON_COUNT
|
|
} gui_icon_id_t;
|
|
|
|
void gui_icons_init(void);
|
|
|
|
// Draw at native 16x16, or scaled by an integer factor (2 = 32x32).
|
|
void gui_icon_draw(gui_icon_id_t id, int x, int y);
|
|
void gui_icon_draw_scaled(gui_icon_id_t id, int x, int y, int scale);
|
|
void gui_icon_draw_tinted(gui_icon_id_t id, int x, int y, int scale, uint32_t tint);
|
|
|
|
const char* gui_icon_name(gui_icon_id_t id);
|
|
|
|
#endif // _GUI_ICONS_H
|