Skip to content

Window: get/set position and bounds (save & restore window placement) - #31

Open
codymullins wants to merge 1 commit into
mainfrom
feat/window-position
Open

Window: get/set position and bounds (save & restore window placement)#31
codymullins wants to merge 1 commit into
mainfrom
feat/window-position

Conversation

@codymullins

Copy link
Copy Markdown
Contributor

Closes #13.

Browsers persist and restore window size and position across launches. AppWindow could set logical size (Resize) but couldn't read or set position, nor report user-initiated moves.

What changed

  • AppWindow.Position (get/set) — the window's top-left in logical screen points, matching the GLFW backend's coordinate space.
  • AppWindow.BoundsPosition plus the logical size, as one rect.
  • AppWindow.Moved — fires when the window moves.
  • GLFW backendIWindow.Position for get/set and the IWindow.Move event for Moved.
  • AppKit backend (Skyline.Apple) — flips AppKit's bottom-left frame against the window's screen height so the reported origin is top-left like GLFW, and raises Moved from windowDidMove:. Multi-monitor origin is best-effort against the window's current screen.

Tests

  • Skyline.WindowedTests — sets and reads Position on a real GLFW window and checks Bounds reports position plus logical size (covers the GLFW get/set path).

Verification

  • dotnet build Skyline.slnx clean (0 warnings); Skyline.Apple builds clean on the macos workload.
  • Headless tests pass; windowed harness passes (89 checks); format-check.sh clean.
  • Coverage: GlfwWindowBackend 100%; AppWindow rose to 97.1% (new position code covered). Overall 98% matches main on this machine — the remaining uncovered lines are the pre-existing AppWindow/AppHost windowed-thread flakiness under coverlet, not from this change.

Note

Independent of #5/#8, but this is the 3rd open PR touching AppWindow.cs, GlfwWindowBackend.cs, IWindowBackend.cs, and the windowed harness. Whichever PRs merge after the first will need trivial conflict resolution (the edits are in different regions / are appends).

A shell can now save the window placement on close and restore it on the
next launch, and react when the user drags the window.

- AppWindow.Position (get/set) is the top-left in logical screen points,
  matching the GLFW backend. AppWindow.Bounds adds the logical size.
- AppWindow.Moved fires when the window moves.
- GLFW backend uses IWindow.Position and the IWindow.Move event.
- AppKit backend flips AppKit's bottom-left frame against the window's
  screen height, and raises Moved from windowDidMove.

Closes #13
Copilot AI review requested due to automatic review settings June 16, 2026 21:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Window: get/set position and bounds (save & restore window placement)

2 participants