html 2.0 compliance update browser

This commit is contained in:
boreddevnl
2026-03-06 00:27:57 +01:00
parent b708ad7e45
commit 41d1e3960b
13 changed files with 600 additions and 316 deletions

View File

@@ -75,3 +75,11 @@ uint32_t ui_get_font_height_scaled(float scale) {
uint32_t scale_bits = *(uint32_t*)&scale;
return (uint32_t)syscall3(SYS_GUI, GUI_CMD_GET_FONT_HEIGHT_SCALED, (uint64_t)scale_bits, 0);
}
void ui_window_set_title(ui_window_t win, const char *title) {
syscall3(SYS_GUI, GUI_CMD_WINDOW_SET_TITLE, (uint64_t)win, (uint64_t)title);
}
void ui_window_set_resizable(ui_window_t win, bool resizable) {
syscall3(SYS_GUI, GUI_CMD_WINDOW_SET_RESIZABLE, (uint64_t)win, resizable ? 1 : 0);
}

View File

@@ -14,10 +14,12 @@
#define GUI_CMD_DRAW_IMAGE 7
#define GUI_CMD_GET_STRING_WIDTH 8
#define GUI_CMD_GET_FONT_HEIGHT 9
#define GUI_CMD_WINDOW_SET_RESIZABLE 14
#define GUI_CMD_DRAW_STRING_BITMAP 10
#define GUI_CMD_DRAW_STRING_SCALED 11
#define GUI_CMD_GET_STRING_WIDTH_SCALED 12
#define GUI_CMD_GET_FONT_HEIGHT_SCALED 13
#define GUI_CMD_WINDOW_SET_TITLE 15
// Event Types
#define GUI_EVENT_NONE 0
@@ -32,6 +34,7 @@
#define GUI_EVENT_MOUSE_UP 7
#define GUI_EVENT_MOUSE_MOVE 8
#define GUI_EVENT_MOUSE_WHEEL 9
#define GUI_EVENT_RESIZE 11
typedef struct {
int type;
@@ -59,5 +62,7 @@ void ui_draw_string_bitmap(ui_window_t win, int x, int y, const char *str, uint3
void ui_draw_string_scaled(ui_window_t win, int x, int y, const char *str, uint32_t color, float scale);
uint32_t ui_get_string_width_scaled(const char *str, float scale);
uint32_t ui_get_font_height_scaled(float scale);
void ui_window_set_title(ui_window_t win, const char *title);
void ui_window_set_resizable(ui_window_t win, bool resizable);
#endif

View File

@@ -55,25 +55,17 @@ void *malloc(size_t size) {
size = ALIGN8(size);
// Best-fit search
BlockMeta *best = NULL;
// First-fit search (faster than best-fit for large heaps)
BlockMeta *current = heap_head;
while (current) {
if (current->free && current->size >= size) {
if (!best || current->size < best->size) {
best = current;
if (best->size == size) break; // Perfect fit
}
split_block(current, size);
current->free = 0;
return (current + 1);
}
current = current->next;
}
if (best) {
split_block(best, size);
best->free = 0;
return (best + 1);
}
// No suitable block found, request more space
BlockMeta *block = request_space(size);
if (!block) return NULL;