Move window titlebar logic and ui to new CustomWindowTitleBar
Merged
DA
2mo ago+666+666+012345678901234567890123456789-879-879-012345678901234567890123456789
Summary
- Replaces the duplicated titlebar xaml ui and button logic with a simple configurable drop in user control.
- This means related changes such as the alt-tab bug fix can be applied cleanly to all windows.
- Replicates all existing behavior by allowing button handling overrides or extensions (using e.handled to override), and exposing the LastNonMinimizedWindowState specifically for the SettingWindow to persist its state.
- Uses dependency properties to allow easy toggling of which title bar elements are visible, right in the xaml.
- Uses sensible defaults such as reusing the window title and icon, so that things like that can be defined in one place and not risk discrepancies.
- Improved accessibility by giving automation names to the title bar buttons
Bringing up the Windows
| Window | How to trigger |
|---|---|
| SettingWindow | Right-click tray icon → Settings |
| PluginSettingsWindow | Open any plugin's context menu and select the settings option |
| ReleaseNotesWindow | Settings → About → "Release Notes" button |
| SelectBrowserWindow | Settings → General → "Select Default Browser" button |
| SelectFileManagerWindow | Settings → General → "Select Default File Manager" button |
| WelcomeWindow | Settings → About → Dev Tools → rightmost button → "Wizard" button |
| ReportWindow | Cause a plugin to crash (or add this line somewhere new ReportWindow(new Exception("test")).Show();) |
| MessageBoxEx | Settings → Plugin Store → Click install on plugin (see #4503 for existing issues) |
| ProgressBoxEx | Confirm to install a plugin from the Plugin Store or use plugin manager |
| PluginUpdateWindow | Settings → Plugin Store → Check Plugin Updates Button (with an outdated plugin - I download an old release for this) |
| CustomShortcutSetting | Settings → Hotkeys → Custom Query Shortcuts → add or edit a shortcut |
| CustomQueryHotkeySetting | Settings → Hotkeys → Custom Query Hotkeys → add or edit a custom query hotkey |
| ActionKeywords | Settings → Plugins → click a plugin → click its action keyword to edit it |
You can use the changes in PR #4504 to have clean test windows for Report, Progress & Plugin Update (the branches should merge cleanly)
Summary by cubic
Centralized the window title bar UI and logic into a shared CustomWindowTitleBar across thirteen windows to remove duplication and keep behavior consistent. Fixed icon paths and now default to the host window’s title and icon when not set.
Summary of changes
- Changed: 13 windows now use
CustomWindowTitleBar;SettingWindowpersists last non-minimized state; dialog windows mark close clicks as handled; sharedTitleBarButtonPathStyle; fixed icon URIs (removed leading “/”) and rely on window title/icon by default. - Added:
CustomWindowTitleBarwith settableTitle,IconSource(ImageSource), toggles forShowIcon,ShowTitle,ShowMinimizeButton,ShowMaximizeRestoreButton,ShowCloseButton; built-in minimize/maximize/restore/close with handleable click events;LastNonMinimizedWindowStateand change event; Alt+Tab minimized edge-case restore; hidden buttons collapse; accessibility names on buttons. - Removed: Per-window title bar XAML, button handlers, maximize/restore visibility logic, and window state/activation wiring in updated windows.
- Memory usage: Neutral to slightly lower due to de-duplication and shared styles.
- Security risks: None; UI-only refactor.
- Unit tests: None added.
Release Note
All app windows now share a consistent title bar with standard controls and improved accessibility.