Add minimize/maximize buttons, double-click maximize behaviour, and proper window state handling for the custom title bar.