feat: common TLS library, weather app, UI scaling fix in Window Server, and more

This commit is contained in:
2026-02-21 13:05:28 +01:00
parent 9d5e7eac8d
commit e0bfc97f0f
32 changed files with 1440 additions and 1048 deletions
+14
View File
@@ -789,6 +789,16 @@ namespace Zenith {
return count;
}
// ---- Window scale syscalls ----
static int Sys_WinSetScale(int scale) {
return WinServer::SetScale(scale);
}
static int Sys_WinGetScale() {
return WinServer::GetScale();
}
// ---- Window server syscalls ----
static int Sys_WinCreate(const char* title, int w, int h, WinCreateResult* result) {
@@ -1003,6 +1013,10 @@ namespace Zenith {
return (int64_t)Sys_Kill((int)frame->arg1);
case SYS_DEVLIST:
return (int64_t)Sys_DevList((DevInfo*)frame->arg1, (int)frame->arg2);
case SYS_WINSETSCALE:
return (int64_t)Sys_WinSetScale((int)frame->arg1);
case SYS_WINGETSCALE:
return (int64_t)Sys_WinGetScale();
default:
return -1;
}
+4 -1
View File
@@ -75,6 +75,8 @@ namespace Zenith {
static constexpr uint64_t SYS_WINMAP = 59;
static constexpr uint64_t SYS_WINSENDEVENT = 60;
static constexpr uint64_t SYS_WINRESIZE = 64;
static constexpr uint64_t SYS_WINSETSCALE = 65;
static constexpr uint64_t SYS_WINGETSCALE = 66;
// Process management syscalls
static constexpr uint64_t SYS_PROCLIST = 61;
@@ -135,12 +137,13 @@ namespace Zenith {
// Window server shared types
struct WinEvent {
uint8_t type; // 0=key, 1=mouse, 2=resize, 3=close
uint8_t type; // 0=key, 1=mouse, 2=resize, 3=close, 4=scale
uint8_t _pad[3];
union {
KeyEvent key;
struct { int32_t x, y, scroll; uint8_t buttons, prev_buttons; } mouse;
struct { int32_t w, h; } resize;
struct { int32_t scale; } scale;
};
};
+23
View File
@@ -14,6 +14,7 @@
namespace WinServer {
static WindowSlot g_slots[MaxWindows];
static int g_uiScale = 1;
int Create(int ownerPid, uint64_t ownerPml4, const char* title, int w, int h,
uint64_t& heapNext, uint64_t& outVa) {
@@ -201,6 +202,28 @@ namespace WinServer {
return 0;
}
int SetScale(int scale) {
if (scale < 0) scale = 0;
if (scale > 2) scale = 2;
g_uiScale = scale;
// Broadcast scale event to all active windows
Zenith::WinEvent ev;
memset(&ev, 0, sizeof(ev));
ev.type = 4;
ev.scale.scale = scale;
for (int i = 0; i < MaxWindows; i++) {
if (g_slots[i].used) {
SendEvent(i, &ev);
}
}
return 0;
}
int GetScale() {
return g_uiScale;
}
void CleanupProcess(int pid) {
for (int i = 0; i < MaxWindows; i++) {
if (g_slots[i].used && g_slots[i].ownerPid == pid) {
+2
View File
@@ -40,5 +40,7 @@ namespace WinServer {
int Resize(int windowId, int callerPid, uint64_t ownerPml4, int newW, int newH,
uint64_t& heapNext, uint64_t& outVa);
void CleanupProcess(int pid);
int SetScale(int scale);
int GetScale();
}