Add F11 fullscreen toggle #1067

Open
github-bot wants to merge 2 commits from github-bot/gh-1067 into main AGit
Owner

@⁠erax4193 on GitHub · 2026-11-28 12:38 UTC · original
erax4193:f11-fullscreen-toggle → main · +66 −5 · 2 files · 2 commits · open

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

**@⁠erax4193** on GitHub · 2026-11-28 12:38 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1067) `erax4193:f11-fullscreen-toggle` → `main` · +66 −5 · 2 files · 2 commits · open ## 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)
F11 now toggles between borderless fullscreen and windowed at runtime,
without needing a restart or the F1 menu. The window rect and style
are saved before going fullscreen so they can be fully restored.

Starting with VICTORY_FULLSCREEN=1 also works: the windowed state is
captured at startup by fullscreen(), so F11 restores to it correctly.

The F1 menu FULLSCREEN label now shows (F11) as a hint.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 14:32:27 +00:00
Author
Owner

@⁠ANDREANIADS on GitHub · 2026-11-28 20:12 UTC · original

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.

**@⁠ANDREANIADS** on GitHub · 2026-11-28 20:12 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1067#issuecomment-7245112891) 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.
lParam bit 30 is set by Windows on WM_KEYDOWN/WM_SYSKEYDOWN auto-repeat
messages.  Without this guard, holding F11 fires the toggle once per
repeat message, bouncing between fullscreen and windowed many times per
second.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Author
Owner

@⁠erax4193 on GitHub · 2026-11-29 09:49 UTC · original

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.

**@⁠erax4193** on GitHub · 2026-11-29 09:49 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1067#issuecomment-7254016369) 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 has changes conflicting with the target branch.
  • crates/victory-gpu/src/host/menu.rs
  • crates/victory-hle/src/modules/lifecycle.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1067/head:github-bot/gh-1067'
git switch 'github-bot/gh-1067'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1067'
git switch 'github-bot/gh-1067'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1067'
git switch 'github-bot/gh-1067'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1067'
git switch 'main'
git merge --squash 'github-bot/gh-1067'
git switch 'main'
git merge --ff-only 'github-bot/gh-1067'
git switch 'main'
git merge 'github-bot/gh-1067'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

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