VICTORY_MONITOR: the window, or full screen, on a chosen monitor #125

Closed
github-bot wants to merge 2 commits from github-bot/gh-125 into main AGit
Owner

@⁠Geckomacabre on GitHub · 2026-11-27 03:09 UTC · original
Geckomacabre:pr/monitor → main · +166 −7 · 2 files · 2 commits · closed without merging

VICTORY_MONITOR picks the monitor by device name (DISPLAY3, \.\DISPLAY3) or by its 1-based place in Windows' list.

  • The fitted window is centred on that monitor's work area.
  • With VICTORY_FULLSCREEN=1 the full-screen popup covers that monitor instead of the primary one. The per-window restore state (#104) and F11 / Alt+Enter are unchanged.
  • Unset, or a name that matches nothing (logged once with the names found): as before.
  • Log: title window put on the monitor VICTORY_MONITOR names / title window made full screen ... left= top=. Test: pick_monitor.

Tested: used every session on a two-monitor PC (RTX 4090) on a sibling tree; resolved here onto the per-window restore state from #104.

Checks: cargo check -p victory --features diagnostics --tests passes on this branch. Unit tests (victory-hle lifecycle) are pending; results will follow as a comment.

🤖 Generated with Claude Code

**@⁠Geckomacabre** on GitHub · 2026-11-27 03:09 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/125) `Geckomacabre:pr/monitor` → `main` · +166 −7 · 2 files · 2 commits · closed without merging `VICTORY_MONITOR` picks the monitor by device name (`DISPLAY3`, `\.\DISPLAY3`) or by its 1-based place in Windows' list. - The fitted window is centred on that monitor's work area. - With `VICTORY_FULLSCREEN=1` the full-screen popup covers that monitor instead of the primary one. The per-window restore state (#104) and F11 / Alt+Enter are unchanged. - Unset, or a name that matches nothing (logged once with the names found): as before. - Log: `title window put on the monitor VICTORY_MONITOR names` / `title window made full screen ... left= top=`. Test: `pick_monitor`. **Tested:** used every session on a two-monitor PC (RTX 4090) on a sibling tree; resolved here onto the per-window restore state from #104. **Checks:** `cargo check -p victory --features diagnostics --tests` passes on this branch. Unit tests (`victory-hle` lifecycle) are pending; results will follow as a comment. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
VICTORY_MONITOR names a monitor by its device name (DISPLAY3 or \.\DISPLAY3) or by its
1-based place in the order Windows lists them. The fitted window is centred on that
monitor's work area; with VICTORY_FULLSCREEN=1 the full-screen popup covers that
monitor instead of the primary one (the per-window restore state and F11/Alt+Enter are
unchanged). Unset, or a name that matches nothing (logged once with the names found):
as before. For machines whose primary display is not the one played on.
Log: 'title window put on the monitor VICTORY_MONITOR names' / 'title window made full
screen ... left= top='. Test: pick_monitor.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 03:09:38 +00:00
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-27 03:13 UTC · original

Thanks for bringing the monitor selector over. I checked the startup path against #104. F11 and Alt+Enter still use the monitor under the current window, so moving the window before toggling works the same way.

I’d fix two cases before merging.

  • The monitor branch in fit only checks for a null parent. An unowned WS_EX_TOOLWINDOW can be moved to the selected display, and a zero-sized helper can become as large as the work area. The full-screen path already excludes tool windows and child windows. Please share that eligibility check and look up the selected monitor once in place, so both startup rectangles use the same display.
  • fit_with_limit passes through CW_USEDEFAULT. The fallback then uses the whole work area and bypasses VICTORY_WINDOW_MAX. This also changes the rectangle restored on the first exit from full screen. Please resolve a default windowed size on the selected monitor before applying the cap. A test with a negative monitor origin, CW_USEDEFAULT, and a 1280x720 cap would cover windowed startup and the first restore.

All 15 lifecycle tests passed locally on 3207b8a. Please add a short example to docs/this-fork.md (-More @{VICTORY_MONITOR='DISPLAY3'}) and mention that numbers use enumeration order. The separate DXGI fallback window still uses its own placement.

**@⁠TaynanGT** on GitHub · 2026-11-27 03:13 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/125#issuecomment-7208813932) Thanks for bringing the monitor selector over. I checked the startup path against #104. F11 and Alt+Enter still use the monitor under the current window, so moving the window before toggling works the same way. I’d fix two cases before merging. - The monitor branch in `fit` only checks for a null parent. An unowned `WS_EX_TOOLWINDOW` can be moved to the selected display, and a zero-sized helper can become as large as the work area. The full-screen path already excludes tool windows and child windows. Please share that eligibility check and look up the selected monitor once in `place`, so both startup rectangles use the same display. - `fit_with_limit` passes through `CW_USEDEFAULT`. The fallback then uses the whole work area and bypasses `VICTORY_WINDOW_MAX`. This also changes the rectangle restored on the first exit from full screen. Please resolve a default windowed size on the selected monitor before applying the cap. A test with a negative monitor origin, `CW_USEDEFAULT`, and a `1280x720` cap would cover windowed startup and the first restore. All 15 lifecycle tests passed locally on `3207b8a`. Please add a short example to `docs/this-fork.md` (`-More @{VICTORY_MONITOR='DISPLAY3'}`) and mention that numbers use enumeration order. The separate DXGI fallback window still uses its own placement.
Author
Owner

@⁠Geckomacabre on GitHub · 2026-11-27 03:34 UTC · original

Test results for this branch (Windows 11, RTX 4090, toolchain 1.98.1, --test-threads=1):

  • cargo check -p victory --features diagnostics --tests: clean.
  • cargo test -p victory-hle -- --test-threads=1 lifecycle: 15 passed, 0 failed, including the new a_monitor_is_picked_by_name_or_place and the existing full_screen_switches_both_ways_on_the_window_s_monitor and a_full_screen_window_is_a_frameless_popup_over_the_screen.

🤖 Generated with Claude Code

**@⁠Geckomacabre** on GitHub · 2026-11-27 03:34 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/125#issuecomment-7209094877) Test results for this branch (Windows 11, RTX 4090, toolchain 1.98.1, `--test-threads=1`): - `cargo check -p victory --features diagnostics --tests`: clean. - `cargo test -p victory-hle -- --test-threads=1 lifecycle`: 15 passed, 0 failed, including the new `a_monitor_is_picked_by_name_or_place` and the existing `full_screen_switches_both_ways_on_the_window_s_monitor` and `a_full_screen_window_is_a_frameless_popup_over_the_screen`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-27 04:01 UTC · original

Thanks for running the lifecycle checks, @⁠Geckomacabre. I approved CI for 3207b8a, and the full Windows workflow passed. The remaining review cases are the exclusion of tool windows and the CW_USEDEFAULT path with VICTORY_WINDOW_MAX. A secondary monitor with a negative origin would cover the startup and full-screen restore cases in one test. CI run

**@⁠TaynanGT** on GitHub · 2026-11-27 04:01 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/125#issuecomment-7209457618) Thanks for running the lifecycle checks, @⁠Geckomacabre. I approved CI for `3207b8a`, and the full Windows workflow passed. The remaining review cases are the exclusion of tool windows and the `CW_USEDEFAULT` path with `VICTORY_WINDOW_MAX`. A secondary monitor with a negative origin would cover the startup and full-screen restore cases in one test. [CI run](https://github.com/TaynanGT/Vice-Tay/actions/runs/45932477460)
- placeable(): the full-screen path's eligibility (no owner/parent, not a child, not a
  tool window) now also decides whether fit() moves a window to the chosen monitor.
- place() looks the monitor up once and hands its work area to fit(), so the windowed
  and full-screen rectangles use the same display.
- on_monitor(): a size left to Windows (CW_USEDEFAULT) becomes three quarters of the
  chosen work area first, then the area and VICTORY_WINDOW_MAX apply; a zero-sized
  helper keeps what it asked for. The windowed rectangle is also what the first exit
  from full screen restores.
- Tests: negative monitor origin + CW_USEDEFAULT + 1280x720 cap (and the restore),
  tool/child/owned windows not placed.
- docs/this-fork.md: example, enumeration order, the DXGI fallback window's own placement.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠Geckomacabre on GitHub · 2026-11-27 04:07 UTC · original

Thanks for the review. Pushed eaa7578:

  • Eligibility: a shared placeable() (no owner or parent, not a child, not a tool window) now decides both full screen and moving a window to the chosen monitor, so an unowned WS_EX_TOOLWINDOW stays where Windows puts it.
  • One lookup: place() looks the monitor up once and hands its work area to fit(); the windowed and full-screen rectangles use the same display.
  • CW_USEDEFAULT: on_monitor() first resolves a size left to Windows to three quarters of the chosen work area (as restore_rect does), then fits it to the area and VICTORY_WINDOW_MAX, centred. A zero-sized helper keeps what it asked for. The windowed rectangle is what the first exit from full screen restores.
  • Tests: a_default_sized_window_on_the_chosen_monitor_is_resolved_then_capped (negative monitor origin, CW_USEDEFAULT, 1280x720 cap, plus the first restore through toggled) and tool_child_and_owned_windows_are_not_placed.
  • Docs: docs/this-fork.md has the -More @{VICTORY_MONITOR='DISPLAY3'} example, notes that numbers follow the enumeration order, and that the DXGI fallback window keeps its own placement.

Status: cargo check and the lifecycle tests of this revision are not run yet; I'll post the results after the next build window.

🤖 Generated with Claude Code

**@⁠Geckomacabre** on GitHub · 2026-11-27 04:07 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/125#issuecomment-7209534015) Thanks for the review. Pushed eaa7578: - **Eligibility:** a shared `placeable()` (no owner or parent, not a child, not a tool window) now decides both full screen and moving a window to the chosen monitor, so an unowned `WS_EX_TOOLWINDOW` stays where Windows puts it. - **One lookup:** `place()` looks the monitor up once and hands its work area to `fit()`; the windowed and full-screen rectangles use the same display. - **`CW_USEDEFAULT`:** `on_monitor()` first resolves a size left to Windows to three quarters of the chosen work area (as `restore_rect` does), then fits it to the area and `VICTORY_WINDOW_MAX`, centred. A zero-sized helper keeps what it asked for. The windowed rectangle is what the first exit from full screen restores. - **Tests:** `a_default_sized_window_on_the_chosen_monitor_is_resolved_then_capped` (negative monitor origin, `CW_USEDEFAULT`, 1280x720 cap, plus the first restore through `toggled`) and `tool_child_and_owned_windows_are_not_placed`. - **Docs:** `docs/this-fork.md` has the `-More @{VICTORY_MONITOR='DISPLAY3'}` example, notes that numbers follow the enumeration order, and that the DXGI fallback window keeps its own placement. Status: `cargo check` and the lifecycle tests of this revision are not run yet; I'll post the results after the next build window. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

@⁠Geckomacabre on GitHub · 2026-11-27 04:13 UTC · original

Results for eaa7578 (Windows 11, RTX 4090, toolchain 1.98.1, --test-threads=1):

  • cargo check -p victory --features diagnostics --tests: clean, no warnings.
  • cargo test -p victory-hle -- --test-threads=1 lifecycle: 17 passed, 0 failed, including the new a_default_sized_window_on_the_chosen_monitor_is_resolved_then_capped and tool_child_and_owned_windows_are_not_placed.

🤖 Generated with Claude Code

**@⁠Geckomacabre** on GitHub · 2026-11-27 04:13 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/125#issuecomment-7209627644) Results for eaa7578 (Windows 11, RTX 4090, toolchain 1.98.1, `--test-threads=1`): - `cargo check -p victory --features diagnostics --tests`: clean, no warnings. - `cargo test -p victory-hle -- --test-threads=1 lifecycle`: 17 passed, 0 failed, including the new `a_default_sized_window_on_the_chosen_monitor_is_resolved_then_capped` and `tool_child_and_owned_windows_are_not_placed`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-bot closed this pull request 2026-11-27 04:26:48 +00:00
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-27 04:21 UTC · original

Thanks for updating the monitor selector and rerunning the lifecycle tests, @⁠Geckomacabre. Your change is on main through #148 with your authorship. The 17 lifecycle tests and Windows CI passed. The final revision keeps auxiliary windows in their original geometry and checks the capped default rectangle and fullscreen restore on a monitor with a negative origin.

**@⁠TaynanGT** on GitHub · 2026-11-27 04:21 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/125#issuecomment-7209736307) Thanks for updating the monitor selector and rerunning the lifecycle tests, @⁠Geckomacabre. Your change is on `main` through [#148](https://git.gtahub.st/github/TaynanGT--Vice-Tay/pulls/148) with your authorship. The 17 lifecycle tests and Windows CI passed. The final revision keeps auxiliary windows in their original geometry and checks the capped default rectangle and fullscreen restore on a monitor with a negative origin.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.