feat: screenshot app improvement, WIndow Server supports full-screen overlay, Disks app UI improvements
This commit is contained in:
@@ -39,6 +39,8 @@ int gui::desktop_create_window(DesktopState* ds, const char* title, int x, int y
|
||||
win->app_data = nullptr;
|
||||
win->external = false;
|
||||
win->ext_win_id = -1;
|
||||
win->ext_cursor = 0;
|
||||
win->ext_flags = 0;
|
||||
|
||||
// Unfocus previous window
|
||||
if (ds->focused_window >= 0 && ds->focused_window < ds->window_count) {
|
||||
@@ -131,50 +133,53 @@ void gui::desktop_draw_window(DesktopState* ds, int idx) {
|
||||
int y = win->frame.y;
|
||||
int w = win->frame.w;
|
||||
int h = win->frame.h;
|
||||
bool fullscreen = desktop_window_fullscreen(win);
|
||||
|
||||
// Draw shadow
|
||||
if (ds->settings.show_shadows)
|
||||
draw_shadow(fb, x, y, w, h, SHADOW_SIZE, colors::SHADOW);
|
||||
if (!fullscreen) {
|
||||
// Draw shadow
|
||||
if (ds->settings.show_shadows)
|
||||
draw_shadow(fb, x, y, w, h, SHADOW_SIZE, colors::SHADOW);
|
||||
|
||||
// Draw window body
|
||||
fb.fill_rect(x, y, w, h, colors::WINDOW_BG);
|
||||
// Draw window body
|
||||
fb.fill_rect(x, y, w, h, colors::WINDOW_BG);
|
||||
|
||||
// Draw titlebar
|
||||
Color tb_bg = win->focused ? colors::TITLEBAR_BG : Color::from_rgb(0xE8, 0xE8, 0xE8);
|
||||
fb.fill_rect(x, y, w, TITLEBAR_HEIGHT, tb_bg);
|
||||
// Draw titlebar
|
||||
Color tb_bg = win->focused ? colors::TITLEBAR_BG : Color::from_rgb(0xE8, 0xE8, 0xE8);
|
||||
fb.fill_rect(x, y, w, TITLEBAR_HEIGHT, tb_bg);
|
||||
|
||||
// Draw border
|
||||
draw_rect(fb, x, y, w, h, colors::BORDER);
|
||||
// Titlebar bottom separator
|
||||
draw_hline(fb, x, y + TITLEBAR_HEIGHT - 1, w, colors::BORDER);
|
||||
// Draw border
|
||||
draw_rect(fb, x, y, w, h, colors::BORDER);
|
||||
// Titlebar bottom separator
|
||||
draw_hline(fb, x, y + TITLEBAR_HEIGHT - 1, w, colors::BORDER);
|
||||
|
||||
// Draw window buttons (macOS style: close, minimize, maximize)
|
||||
Rect close_r = win->close_btn_rect();
|
||||
Rect min_r = win->min_btn_rect();
|
||||
Rect max_r = win->max_btn_rect();
|
||||
// Draw window buttons (macOS style: close, minimize, maximize)
|
||||
Rect close_r = win->close_btn_rect();
|
||||
Rect min_r = win->min_btn_rect();
|
||||
Rect max_r = win->max_btn_rect();
|
||||
|
||||
fill_circle(fb, close_r.x + BTN_RADIUS, close_r.y + BTN_RADIUS, BTN_RADIUS, colors::CLOSE_BTN);
|
||||
fill_circle(fb, min_r.x + BTN_RADIUS, min_r.y + BTN_RADIUS, BTN_RADIUS, colors::MIN_BTN);
|
||||
fill_circle(fb, max_r.x + BTN_RADIUS, max_r.y + BTN_RADIUS, BTN_RADIUS, colors::MAX_BTN);
|
||||
fill_circle(fb, close_r.x + BTN_RADIUS, close_r.y + BTN_RADIUS, BTN_RADIUS, colors::CLOSE_BTN);
|
||||
fill_circle(fb, min_r.x + BTN_RADIUS, min_r.y + BTN_RADIUS, BTN_RADIUS, colors::MIN_BTN);
|
||||
fill_circle(fb, max_r.x + BTN_RADIUS, max_r.y + BTN_RADIUS, BTN_RADIUS, colors::MAX_BTN);
|
||||
|
||||
// Draw title text centered in titlebar (after buttons)
|
||||
int title_x = x + 12 + 44 + BTN_RADIUS * 2 + 12; // after buttons
|
||||
int title_y = y + (TITLEBAR_HEIGHT - system_font_height()) / 2;
|
||||
int title_w = text_width(win->title);
|
||||
// Center in remaining space
|
||||
int remaining_w = w - (title_x - x) - 12;
|
||||
if (remaining_w > title_w) {
|
||||
title_x += (remaining_w - title_w) / 2;
|
||||
}
|
||||
draw_text(fb, title_x, title_y, win->title, colors::TEXT_COLOR);
|
||||
// Draw title text centered in titlebar (after buttons)
|
||||
int title_x = x + 12 + 44 + BTN_RADIUS * 2 + 12; // after buttons
|
||||
int title_y = y + (TITLEBAR_HEIGHT - system_font_height()) / 2;
|
||||
int title_w = text_width(win->title);
|
||||
// Center in remaining space
|
||||
int remaining_w = w - (title_x - x) - 12;
|
||||
if (remaining_w > title_w) {
|
||||
title_x += (remaining_w - title_w) / 2;
|
||||
}
|
||||
draw_text(fb, title_x, title_y, win->title, colors::TEXT_COLOR);
|
||||
|
||||
// Call app draw callback to render content (skip during resize — buffer is old size)
|
||||
if (win->on_draw && !win->resizing) {
|
||||
win->on_draw(win, fb);
|
||||
// Call app draw callback to render content (skip during resize — buffer is old size)
|
||||
if (win->on_draw && !win->resizing) {
|
||||
win->on_draw(win, fb);
|
||||
}
|
||||
}
|
||||
|
||||
// Blit content buffer to framebuffer (clip to actual buffer size during resize)
|
||||
Rect cr = win->content_rect();
|
||||
Rect cr = desktop_content_rect(win);
|
||||
if (win->content) {
|
||||
if (win->external && (cr.w != win->content_w || cr.h != win->content_h)) {
|
||||
// Nearest-neighbor scale for external windows (fixed-size shared buffer)
|
||||
|
||||
Reference in New Issue
Block a user