feat: screenshot app improvement, WIndow Server supports full-screen overlay, Disks app UI improvements

This commit is contained in:
2026-05-10 10:45:05 +02:00
parent 60ee905552
commit dcdbcac1e0
29 changed files with 1483 additions and 395 deletions
+93 -82
View File
@@ -240,93 +240,103 @@ void gui::desktop_compose(DesktopState* ds) {
}
}
// Draw panel on top
desktop_draw_panel(ds);
// Draw app menu if open
if (ds->app_menu_open) {
desktop_draw_app_menu(ds);
bool topFullscreen = false;
for (int i = ds->window_count - 1; i >= 0; i--) {
if (ds->windows[i].state == WIN_MINIMIZED || ds->windows[i].state == WIN_CLOSED)
continue;
topFullscreen = desktop_window_fullscreen(&ds->windows[i]);
break;
}
// Draw network popup if open
if (ds->net_popup_open) {
desktop_draw_net_popup(ds);
}
if (!topFullscreen) {
// Draw panel on top
desktop_draw_panel(ds);
// Draw volume popup if open
if (ds->vol_popup_open) {
desktop_draw_vol_popup(ds);
}
// Draw right-click context menu if open
if (ds->ctx_menu_open) {
static constexpr int CTX_MENU_W = 180;
static constexpr int CTX_ITEM_H = 36;
static constexpr int CTX_ITEM_COUNT = 6;
int cmx = ds->ctx_menu_x;
int cmy = ds->ctx_menu_y;
int cmh = CTX_ITEM_H * CTX_ITEM_COUNT + 8;
// Clamp to screen
if (cmx + CTX_MENU_W > sw) cmx = sw - CTX_MENU_W;
if (cmy + cmh > sh) cmy = sh - cmh;
ensure_filemanager_icons_loaded(ds);
draw_shadow(fb, cmx, cmy, CTX_MENU_W, cmh, 4, colors::SHADOW);
fill_rounded_rect(fb, cmx, cmy, CTX_MENU_W, cmh, 8, colors::MENU_BG);
draw_rect(fb, cmx, cmy, CTX_MENU_W, cmh, colors::BORDER);
struct CtxItem { const char* label; SvgIcon* icon; };
CtxItem ctx_items[CTX_ITEM_COUNT] = {
{ "Terminal", &ds->icon_terminal },
{ "Files", &ds->icon_filemanager },
{ "System Configuration", &ds->icon_system_configuration_menu },
{ "Sleep", &ds->icon_sleep },
{ "Reboot", &ds->icon_reboot },
{ "Shutdown", &ds->icon_shutdown },
};
int mmx = ds->mouse.x;
int mmy = ds->mouse.y;
for (int i = 0; i < CTX_ITEM_COUNT; i++) {
int iy = cmy + 4 + i * CTX_ITEM_H;
Rect item_r = {cmx + 4, iy, CTX_MENU_W - 8, CTX_ITEM_H};
if (item_r.contains(mmx, mmy)) {
fill_rounded_rect(fb, item_r.x, item_r.y, item_r.w, item_r.h, 4, colors::MENU_HOVER);
}
int icon_x = item_r.x + 8;
int icon_y = item_r.y + (CTX_ITEM_H - 20) / 2;
if (ctx_items[i].icon && ctx_items[i].icon->pixels) {
fb.blit_alpha(icon_x, icon_y, ctx_items[i].icon->width, ctx_items[i].icon->height, ctx_items[i].icon->pixels);
}
int tx = icon_x + 28;
int ty = item_r.y + (CTX_ITEM_H - system_font_height()) / 2;
draw_text(fb, tx, ty, ctx_items[i].label, colors::TEXT_COLOR);
// Draw app menu if open
if (ds->app_menu_open) {
desktop_draw_app_menu(ds);
}
}
if (ds->launcher_open) {
desktop_draw_launcher(ds);
}
// Draw network popup if open
if (ds->net_popup_open) {
desktop_draw_net_popup(ds);
}
// Draw snap preview overlay while dragging to screen edge
for (int i = 0; i < ds->window_count; i++) {
Window* win = &ds->windows[i];
if (win->dragging) {
int dmx = ds->mouse.x;
if (dmx <= 0) {
fb.fill_rect_alpha(0, PANEL_HEIGHT, sw / 2, sh - PANEL_HEIGHT,
Color::from_rgba(0x33, 0x77, 0xCC, 0x30));
} else if (dmx >= sw - 1) {
fb.fill_rect_alpha(sw / 2, PANEL_HEIGHT, sw / 2, sh - PANEL_HEIGHT,
Color::from_rgba(0x33, 0x77, 0xCC, 0x30));
// Draw volume popup if open
if (ds->vol_popup_open) {
desktop_draw_vol_popup(ds);
}
// Draw right-click context menu if open
if (ds->ctx_menu_open) {
static constexpr int CTX_MENU_W = 180;
static constexpr int CTX_ITEM_H = 36;
static constexpr int CTX_ITEM_COUNT = 6;
int cmx = ds->ctx_menu_x;
int cmy = ds->ctx_menu_y;
int cmh = CTX_ITEM_H * CTX_ITEM_COUNT + 8;
// Clamp to screen
if (cmx + CTX_MENU_W > sw) cmx = sw - CTX_MENU_W;
if (cmy + cmh > sh) cmy = sh - cmh;
ensure_filemanager_icons_loaded(ds);
draw_shadow(fb, cmx, cmy, CTX_MENU_W, cmh, 4, colors::SHADOW);
fill_rounded_rect(fb, cmx, cmy, CTX_MENU_W, cmh, 8, colors::MENU_BG);
draw_rect(fb, cmx, cmy, CTX_MENU_W, cmh, colors::BORDER);
struct CtxItem { const char* label; SvgIcon* icon; };
CtxItem ctx_items[CTX_ITEM_COUNT] = {
{ "Terminal", &ds->icon_terminal },
{ "Files", &ds->icon_filemanager },
{ "System Configuration", &ds->icon_system_configuration_menu },
{ "Sleep", &ds->icon_sleep },
{ "Reboot", &ds->icon_reboot },
{ "Shutdown", &ds->icon_shutdown },
};
int mmx = ds->mouse.x;
int mmy = ds->mouse.y;
for (int i = 0; i < CTX_ITEM_COUNT; i++) {
int iy = cmy + 4 + i * CTX_ITEM_H;
Rect item_r = {cmx + 4, iy, CTX_MENU_W - 8, CTX_ITEM_H};
if (item_r.contains(mmx, mmy)) {
fill_rounded_rect(fb, item_r.x, item_r.y, item_r.w, item_r.h, 4, colors::MENU_HOVER);
}
int icon_x = item_r.x + 8;
int icon_y = item_r.y + (CTX_ITEM_H - 20) / 2;
if (ctx_items[i].icon && ctx_items[i].icon->pixels) {
fb.blit_alpha(icon_x, icon_y, ctx_items[i].icon->width, ctx_items[i].icon->height, ctx_items[i].icon->pixels);
}
int tx = icon_x + 28;
int ty = item_r.y + (CTX_ITEM_H - system_font_height()) / 2;
draw_text(fb, tx, ty, ctx_items[i].label, colors::TEXT_COLOR);
}
}
if (ds->launcher_open) {
desktop_draw_launcher(ds);
}
// Draw snap preview overlay while dragging to screen edge
for (int i = 0; i < ds->window_count; i++) {
Window* win = &ds->windows[i];
if (win->dragging) {
int dmx = ds->mouse.x;
if (dmx <= 0) {
fb.fill_rect_alpha(0, PANEL_HEIGHT, sw / 2, sh - PANEL_HEIGHT,
Color::from_rgba(0x33, 0x77, 0xCC, 0x30));
} else if (dmx >= sw - 1) {
fb.fill_rect_alpha(sw / 2, PANEL_HEIGHT, sw / 2, sh - PANEL_HEIGHT,
Color::from_rgba(0x33, 0x77, 0xCC, 0x30));
}
break;
}
break;
}
}
@@ -339,7 +349,8 @@ void gui::desktop_compose(DesktopState* ds) {
cur_style = cursor_for_edge(win->resize_edge);
break;
}
if (win->state == WIN_MINIMIZED || win->state == WIN_CLOSED || win->state == WIN_MAXIMIZED)
if (win->state == WIN_MINIMIZED || win->state == WIN_CLOSED ||
win->state == WIN_MAXIMIZED || desktop_window_fullscreen(win))
continue;
if (win->frame.contains(ds->mouse.x, ds->mouse.y)) {
ResizeEdge edge = hit_test_resize_edge(win->frame, ds->mouse.x, ds->mouse.y);
@@ -354,7 +365,7 @@ void gui::desktop_compose(DesktopState* ds) {
if (cur_style == CURSOR_ARROW && ds->focused_window >= 0) {
Window* fwin = &ds->windows[ds->focused_window];
if (fwin->external && fwin->ext_cursor > 0) {
Rect cr = fwin->content_rect();
Rect cr = desktop_content_rect(fwin);
if (cr.contains(ds->mouse.x, ds->mouse.y)) {
if (fwin->ext_cursor == 1) cur_style = CURSOR_RESIZE_H;
else if (fwin->ext_cursor == 2) cur_style = CURSOR_RESIZE_V;