menios icon indicating copy to clipboard operation
menios copied to clipboard

Implement window decorations (title bar, borders, buttons)

Open pbalduino opened this issue 3 months ago • 0 comments

Summary

Implement window decorations including title bars, borders, resize handles, and control buttons (minimize, maximize, close).

Goals

  • Title bar with window title
  • Window borders
  • Minimize, maximize, close buttons
  • Resize handles
  • Active/inactive styling

Implementation

Decoration Rendering

```c #define TITLEBAR_HEIGHT 24 #define BORDER_WIDTH 1

void wm_draw_decoration(struct window *w) { cairo_t *cr = cairo_create(screen_surface);

// Draw title bar
cairo_rectangle(cr, w->x, w->y - TITLEBAR_HEIGHT,
               w->width, TITLEBAR_HEIGHT);
if (w->focused) {
    cairo_set_source_rgb(cr, 0.2, 0.4, 0.7);  // Blue
} else {
    cairo_set_source_rgb(cr, 0.3, 0.3, 0.3);  // Gray
}
cairo_fill(cr);

// Draw title text
cairo_set_source_rgb(cr, 1.0, 1.0, 1.0);
cairo_select_font_face(cr, "Sans", ...);
cairo_move_to(cr, w->x + 5, w->y - 6);
cairo_show_text(cr, w->title);

// Draw close button
draw_close_button(cr, w->x + w->width - 20, w->y - 20);

// Draw border
cairo_rectangle(cr, w->x - BORDER_WIDTH,
               w->y - TITLEBAR_HEIGHT - BORDER_WIDTH,
               w->width + 2*BORDER_WIDTH,
               w->height + TITLEBAR_HEIGHT + 2*BORDER_WIDTH);
cairo_set_line_width(cr, BORDER_WIDTH);
cairo_stroke(cr);

cairo_destroy(cr);

} ```

Timeline

Total: 2-3 weeks

Definition of Done

  • [ ] Title bars render
  • [ ] Window titles display
  • [ ] Control buttons work
  • [ ] Resize handles work
  • [ ] Active/inactive styles
  • [ ] Professional appearance

Dependencies

  • #396: Cairo (rendering)
  • #405: Window manager core

See docs/road/road_to_gui.md for complete roadmap.

pbalduino avatar Oct 30 '25 22:10 pbalduino