fix(window): keep document status inside the working display

Refs #6

Co-Authored-By: Codex (GPT-6) <noreply@openai.com>
Signed-off-by: James Maes <jmaes@dmdbrands.com>
This commit is contained in:
James MaesandCodex committed 2026-10-10 20:27:28 -05:00
1 parent 0507ca5ac4
commit fa0df784b3
3 files changed
+33 -3

No files matched your search

+8
View File
@@ -44,6 +44,14 @@ the initial Opened status to be accessible. Build and formatting pass locally;
hosted recovery proof is pending. Accessibility head 23928bc still failed the initial status lookup (24/25 UI tests passed); properties alone did not resolve it. The next diagnostic retains the native tree and fixture-window PNG in hosted installed evidence. No deletion assertion is weakened. Scripts 38100976565 reproduced the analyzer
engine crash; no scripts/settings/workflow changed and issue #5 remains open.
Hosted diagnostic CI 38101512710 is terminal failure. Its retained app screenshot
shows the initial window extending off the hosted desktop, clipping the entire status
line. The next change fits initial size/position and minimum dimensions to the current
monitor work area using physical DPI-scaled pixels. Exact initial and deletion status
assertions remain unchanged. Theme commit 0507ca5 is local until this follow-up push;
117 core tests/100% coverage and zero-warning build/format passed. Real browser proof
of display fitting and theme selection remains pending.
## Repository and authorization
Public repository: [MarkdownViewr.Windows](https://github.com/KofTwentyTwo/MarkdownViewr.Windows).
+23 -2
View File
@@ -38,8 +38,7 @@ public sealed partial class MainWindow : Window, IDisposable
_browser = new DocumentBrowser(DocumentView, message => StatusText.Text = message, Core.Themes.ThemeCatalog.Find(_settings.DocumentTheme));
CreateDocumentThemeMenu();
Title = AppIdentity.Info.DisplayName;
this.ResizeForDpi(1100, 760);
this.SetMinimumSize(640, 420);
FitInitialWindow();
this.SetAppIcon(AppIdentity.Info);
_updates = new UpdateCoordinator(
@@ -64,6 +63,28 @@ public sealed partial class MainWindow : Window, IDisposable
/// <summary>Keeps the full initial window and status line inside the current monitor's working area.</summary>
private void FitInitialWindow()
{
global::Windows.Graphics.RectInt32 area = Microsoft.UI.Windowing.DisplayArea.GetFromWindowId(AppWindow.Id, Microsoft.UI.Windowing.DisplayAreaFallback.Primary).WorkArea;
double scale = this.DpiScale();
int width = Math.Min((int)(1100 * scale), area.Width);
int height = Math.Min((int)(760 * scale), area.Height);
if(AppWindow.Presenter is Microsoft.UI.Windowing.OverlappedPresenter presenter)
{
presenter.PreferredMinimumWidth = Math.Min((int)(640 * scale), area.Width);
presenter.PreferredMinimumHeight = Math.Min((int)(420 * scale), area.Height);
}
AppWindow.MoveAndResize(new global::Windows.Graphics.RectInt32
{
X = area.X + (area.Width - width) / 2,
Y = area.Y + (area.Height - height) / 2,
Width = width,
Height = height,
});
}
/// <summary>
/// Waits for the splash to clear (dialogs need the window's XamlRoot), then runs the
/// quiet startup update check, which only speaks up when an update exists.
@@ -102,7 +102,8 @@ public sealed class AppSession : IDisposable
Directory.CreateDirectory(directory);
string name = Guid.NewGuid().ToString("N");
MainWindow.CaptureToFile(Path.Combine(directory, name + ".png"));
string tree = FlaUI.Core.Debug.Details(MainWindow);
string tree = string.Join(Environment.NewLine, MainWindow.FindAllDescendants().Take(200).Select(element =>
$"Id={element.Properties.AutomationId.ValueOrDefault}; Name={element.Properties.Name.ValueOrDefault}; Type={element.Properties.ControlType.ValueOrDefault}; Bounds={element.BoundingRectangle}; Offscreen={element.IsOffscreen}"));
File.WriteAllText(Path.Combine(directory, name + ".log"), tree);
return tree;
}