Establish content with a standard window
Display the page in a standard window before adopting a frameless design. Set title, initial and minimum sizes, preserving access to key actions. Keep an obvious close control.
A custom title bar needs real behavior
frameless changes the frame; minimize, maximize, restore and close still need Window API handlers. Mark the title drag region with app-region and exclude controls. Update the maximize icon and accessible name when state changes.
auto* minimize = doc->getElementById("window-minimize");
auto* maximize = doc->getElementById("window-maximize");
auto* close = doc->getElementById("window-close");
if (!minimize || !maximize || !close) return 6;
auto* nativeWindow = window.get();
const auto updateWindowControls = [nativeWindow, maximize, english]() {
const bool maximized = nativeWindow->isMaximized();
maximize->setAttribute("data-maximized", maximized ? "true" : "false");
const std::string label = maximized ? (english ? "Restore" : "还原")
: (english ? "Maximize" : "最大化");
maximize->setAttribute("aria-label", label);
maximize->setAttribute("title", label);
};
minimize->addEventListener("click", [nativeWindow](kui::Event&) { nativeWindow->minimize(); });
maximize->addEventListener("click", [nativeWindow, updateWindowControls](kui::Event&) {
if (nativeWindow->isMaximized()) nativeWindow->restore();
else nativeWindow->maximize();
updateWindowControls();Handle unfinished work on close
The application defines save policy. Account for unsaved text, network tasks and Lua timers before closing, and prevent late results from accessing a destroyed window. Clean callbacks, script and model state in ownership order.
Window acceptance
Exercise the controls rather than judging icons alone.
- Minimize and restore from the taskbar.
- Maximize and restore, checking layout, icon and label changes.
- Drag the title bar; controls must not initiate dragging.
- At minimum size, check editing and saving; closing should exit normally.
Something unclear?
Report an issue on this page →