Add F11 fullscreen toggle #1067

Open
erax4193 wants to merge 2 commits from upstream-pr/1067 into main
erax4193 commented 2026-11-28 12:38:16 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by erax4193 on 2026-11-28T12:38:16Z.


Summary

  • F11 now toggles between borderless fullscreen and windowed at runtime, no restart needed
  • Window rect and style are saved before going fullscreen so they restore exactly
  • If started with VICTORY_FULLSCREEN=1, pressing F11 restores to the original windowed position
  • F1 menu FULLSCREEN label now shows (F11) as a shortcut hint

How it works

The title's window procedure (window_proc in lifecycle.rs) intercepts WM_KEYDOWN/WM_SYSKEYDOWN for VK_F11 on the top-level window and calls toggle_on_f11().

A static BEFORE_F11: Mutex<Option<[i32; 6]>> stores [left, top, right, bottom, GWL_STYLE, GWL_EXSTYLE] before going fullscreen. fullscreen() (the startup path via VICTORY_FULLSCREEN=1) also writes this state so the toggle always has something to restore to.

Closes #1063

Test plan

  • Start windowed → press F11 → window goes borderless fullscreen → press F11 again → window restores to original position and style
  • Start with VICTORY_FULLSCREEN=1 → press F11 → window goes windowed → press F11 → back to fullscreen
  • Existing every_line_fits_and_every_character_has_a_picture test still passes (label is 27 chars, all characters have bitmaps)
  • Existing CreateWindowExW fullscreen test still passes

🤖 Generated with Claude Code

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5540195769 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1067). Originally posted by [erax4193](https://github.com/erax4193) on 2026-11-28T12:38:16Z. --- ## Summary - **F11** now toggles between borderless fullscreen and windowed at runtime, no restart needed - Window rect and style are saved before going fullscreen so they restore exactly - If started with `VICTORY_FULLSCREEN=1`, pressing F11 restores to the original windowed position - F1 menu **FULLSCREEN** label now shows `(F11)` as a shortcut hint ## How it works The title's window procedure (`window_proc` in `lifecycle.rs`) intercepts `WM_KEYDOWN`/`WM_SYSKEYDOWN` for `VK_F11` on the top-level window and calls `toggle_on_f11()`. A static `BEFORE_F11: Mutex<Option<[i32; 6]>>` stores `[left, top, right, bottom, GWL_STYLE, GWL_EXSTYLE]` before going fullscreen. `fullscreen()` (the startup path via `VICTORY_FULLSCREEN=1`) also writes this state so the toggle always has something to restore to. Closes #1063 ## Test plan - [ ] Start windowed → press F11 → window goes borderless fullscreen → press F11 again → window restores to original position and style - [ ] Start with `VICTORY_FULLSCREEN=1` → press F11 → window goes windowed → press F11 → back to fullscreen - [ ] Existing `every_line_fits_and_every_character_has_a_picture` test still passes (label is 27 chars, all characters have bitmaps) - [ ] Existing `CreateWindowExW` fullscreen test still passes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
ANDREANIADS commented 2026-11-28 20:12:17 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by ANDREANIADS on 2026-11-28T20:12:17Z.


On fe2ac5b, holding F11 can call the fullscreen toggle more than once per physical press. I exercised the PR’s dispatch block with synthetic WM_KEYDOWN and WM_SYSKEYDOWN: press, autorepeat (lParam bit 30 set), release, press again produced three toggle callbacks for each message type. Guarding only toggle_on_f11(hwnd) with if lparam & (1 << 30) == 0 reduced that to two. The repeat was still consumed, while key-up and an unrelated key were forwarded. This was a Linux CPU test of the handler with a callback stand-in. Native window transitions still need a Windows check.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7245112891 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1067#issuecomment-7245112891). Originally posted by [ANDREANIADS](https://github.com/ANDREANIADS) on 2026-11-28T20:12:17Z. --- On `fe2ac5b`, holding F11 can call the fullscreen toggle more than once per physical press. I exercised the PR’s dispatch block with synthetic `WM_KEYDOWN` and `WM_SYSKEYDOWN`: press, autorepeat (lParam bit 30 set), release, press again produced three toggle callbacks for each message type. Guarding only `toggle_on_f11(hwnd)` with `if lparam & (1 << 30) == 0` reduced that to two. The repeat was still consumed, while key-up and an unrelated key were forwarded. This was a Linux CPU test of the handler with a callback stand-in. Native window transitions still need a Windows check.
erax4193 commented 2026-11-29 09:49:04 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by erax4193 on 2026-11-29T09:49:04Z.


Thanks for catching that — added lparam & (1 << 30) == 0 guard in 38751f5 so auto-repeat keydowns are skipped. Both WM_KEYDOWN and WM_SYSKEYDOWN now fire the toggle only on the initial press.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7254016369 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1067#issuecomment-7254016369). Originally posted by [erax4193](https://github.com/erax4193) on 2026-11-29T09:49:04Z. --- Thanks for catching that — added `lparam & (1 << 30) == 0` guard in 38751f5 so auto-repeat keydowns are skipped. Both `WM_KEYDOWN` and `WM_SYSKEYDOWN` now fire the toggle only on the initial press.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1067:upstream-pr/1067'
git switch 'upstream-pr/1067'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1067'
git switch 'upstream-pr/1067'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1067'
git switch 'upstream-pr/1067'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1067'
git switch 'main'
git merge --squash 'upstream-pr/1067'
git switch 'main'
git merge --ff-only 'upstream-pr/1067'
git switch 'main'
git merge 'upstream-pr/1067'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
trustno1-coder/VIctory-NVIDIA!1067
No description provided.