[pr-fix][startup] Alt+Enter back to a window keeps the window visible #141

Closed
Jesper-A wants to merge 1 commit from Jesper-A/Darner:up-altenter-visible into main
Collaborator

Refs #136

Contributor role (optional)

  • Fluxer ID:

What it changes

Pressing Alt+Enter in the borderless full screen that Darner applies at the start (DARNER_FULLSCREEN) could hide the window: it went white and then vanished from the taskbar and Alt+Tab, while the game kept running (details in #136).

Cause, as read from the code and from the window style seen in #136 (not confirmed by a live test after the fix): borderless can be applied right when the window is created, before the title shows it. The style saved then has no WS_VISIBLE. The way back to a window put that saved style back as it was, which hid the window.

The fix is in crates/darner-hle/src/modules/lifecycle.rs (+19/-1):

  • New pure function restored_style(saved, current): (saved & !WS_VISIBLE) | (current & WS_VISIBLE). It restores the saved style but keeps the window's current visibility.
  • The restore branch of toggle_fullscreen reads the current style and passes it to restored_style.
  • New test restored_style_keeps_the_current_visibility.

There is no new switch: it only repairs a broken toggle, so the behaviour it changes is the bug itself.

How it was tested

  • Tested revision: 2cb9f85f0 (branch up-altenter-visible, on main 57dea7f23).
  • Commands and results (all with --locked -j 4, on 2cb9f85f0):
    • cargo test -p darner-hle --lib modules::lifecycle: 22 passed
    • cargo clippy --workspace --all-targets -- -D warnings: clean
    • cargo xtask policy: ok
  • Gameplay, when relevant: not run in game. The live Alt+Enter behaviour after the fix is untested. The unit test covers only the style arithmetic, not the window.
  • Before and after, when relevant: not measured. Before: the window style read in #136 was 0x04CF0000 without WS_VISIBLE; that is the only "before" evidence.
  • Shader wave sizes tested, when relevant: not applicable.
  • Coverage gaps: not run: cargo clippy --workspace --all-targets --all-features --locked -- -D warnings, cargo test --workspace --locked, and any game run. There is no CI upstream, so none of this was checked by CI. Hardware for the original report: RTX 2070 SUPER 8 GB (Turing), driver 621.40, ReBAR off, Ryzen 7 5800X, 32 GB, Windows 11 Pro Insider 26320, Series S, DLSS Performance. Other Windows builds and GPUs are untested.

Spec dependence:

  • Likely general (helps any card): plain user32 window-style code, with no GPU involved.
  • May depend on our specs: nothing known.
  • Untested elsewhere: other GPUs, other Windows builds, other monitors and multi-monitor set-ups.

Checklist

  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md.
  • I recorded this PR's dependencies below.
    • Depends on: none

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: none found for the same problem. #75 also changes crates/darner-hle/src/modules/lifecycle.rs (+21/-0, an ultrawide option). Its lines are in fullscreen() and the tests, not in toggle_fullscreen; a trial merge with it conflicts in that file; this is a WIP draft posted as it is, and whichever lands second needs a small rebase.

This change was made with AI assistance (Claude Code).

Refs #136 ## Contributor role (optional) - Fluxer ID: ## What it changes Pressing Alt+Enter in the borderless full screen that Darner applies at the start (`DARNER_FULLSCREEN`) could hide the window: it went white and then vanished from the taskbar and Alt+Tab, while the game kept running (details in #136). Cause, as read from the code and from the window style seen in #136 (not confirmed by a live test after the fix): borderless can be applied right when the window is created, before the title shows it. The style saved then has no `WS_VISIBLE`. The way back to a window put that saved style back as it was, which hid the window. The fix is in `crates/darner-hle/src/modules/lifecycle.rs` (+19/-1): - New pure function `restored_style(saved, current)`: `(saved & !WS_VISIBLE) | (current & WS_VISIBLE)`. It restores the saved style but keeps the window's current visibility. - The restore branch of `toggle_fullscreen` reads the current style and passes it to `restored_style`. - New test `restored_style_keeps_the_current_visibility`. There is no new switch: it only repairs a broken toggle, so the behaviour it changes is the bug itself. ## How it was tested - Tested revision: `2cb9f85f0` (branch `up-altenter-visible`, on `main` 57dea7f23). - Commands and results (all with `--locked -j 4`, on 2cb9f85f0): - `cargo test -p darner-hle --lib modules::lifecycle`: 22 passed - `cargo clippy --workspace --all-targets -- -D warnings`: clean - `cargo xtask policy`: ok - Gameplay, when relevant: not run in game. The live Alt+Enter behaviour after the fix is untested. The unit test covers only the style arithmetic, not the window. - Before and after, when relevant: not measured. Before: the window style read in #136 was `0x04CF0000` without `WS_VISIBLE`; that is the only "before" evidence. - Shader wave sizes tested, when relevant: not applicable. - Coverage gaps: not run: `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`, `cargo test --workspace --locked`, and any game run. There is no CI upstream, so none of this was checked by CI. Hardware for the original report: RTX 2070 SUPER 8 GB (Turing), driver 621.40, ReBAR off, Ryzen 7 5800X, 32 GB, Windows 11 Pro Insider 26320, Series S, DLSS Performance. Other Windows builds and GPUs are untested. Spec dependence: - Likely general (helps any card): plain user32 window-style code, with no GPU involved. - May depend on our specs: nothing known. - Untested elsewhere: other GPUs, other Windows builds, other monitors and multi-monitor set-ups. ## Checklist - [x] This PR contains one change based on `main`. - [x] The diff follows `docs/asset-policy.md`. - [x] I recorded this PR's dependencies below. - Depends on: none ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: none found for the same problem. #75 also changes `crates/darner-hle/src/modules/lifecycle.rs` (+21/-0, an ultrawide option). Its lines are in `fullscreen()` and the tests, not in `toggle_fullscreen`; a trial merge with it conflicts in that file; this is a WIP draft posted as it is, and whichever lands second needs a small rebase. This change was made with AI assistance (Claude Code).
With borderless applied at start, the style saved for the way back came from a window the title had not shown yet, so it lacked WS_VISIBLE. Restoring it hid the window (gone from the taskbar and Alt+Tab, white screen area, game still running). The restore now keeps the window's current WS_VISIBLE bit.

Fixes #136

This change was made with AI assistance (Claude Code).
Jesper-A changed title from [pr-fix][startup] WIP: Alt+Enter back to a window keeps the window visible to WIP: [pr-fix][startup] Alt+Enter back to a window keeps the window visible 2026-12-03 23:04:57 +00:00
Jesper-A changed title from WIP: [pr-fix][startup] Alt+Enter back to a window keeps the window visible to [pr-fix][startup] Alt+Enter back to a window keeps the window visible 2026-12-04 00:20:15 +00:00
First-time contributor

Tested on an RTX 4080 / Ryzen 9 7900 / Windows 11 Home 26200 (details in #136, where the release exe hides the window on the 1st Alt+Enter and keeps it hidden on the 2nd).

Build: 2cb9f85, a release build of this branch (cargo build --release -p darner, names itself v2026.12.03.01-23). Settings: Series X, 4K output, DLSS Performance, frame generation 2x, ray tracing off, borderless at start. Steps: at the account picker, Alt+Enter twice, reading the window with GetWindowLongW(GWL_STYLE) and IsWindowVisible after each (rectangles in 150 % scaled coordinates):

style visible rectangle
before 0x94000000 true 0,0,2560,1440
1st Alt+Enter 0x14CF0000 true 43,0,2466,1392
2nd Alt+Enter 0x94000000 true 0,0,2560,1440

The window keeps WS_VISIBLE going to windowed and coming back, so both the hiding and the stuck second Alt+Enter are fixed here. I checked the window state only: my screen capture tool couldn't show this build's window, so I haven't looked at the picture itself. Not tested: starting with borderless off, and the DARNER_FULLSCREEN_BARS backdrop.

Tested on an RTX 4080 / Ryzen 9 7900 / Windows 11 Home 26200 (details in #136, where the release exe hides the window on the 1st Alt+Enter and keeps it hidden on the 2nd). **Build:** `2cb9f85`, a release build of this branch (`cargo build --release -p darner`, names itself `v2026.12.03.01-23`). **Settings:** Series X, 4K output, DLSS Performance, frame generation 2x, ray tracing off, borderless at start. **Steps:** at the account picker, Alt+Enter twice, reading the window with `GetWindowLongW(GWL_STYLE)` and `IsWindowVisible` after each (rectangles in 150 % scaled coordinates): | | style | visible | rectangle | |---|---|---|---| | before | `0x94000000` | true | 0,0,2560,1440 | | 1st Alt+Enter | `0x14CF0000` | true | 43,0,2466,1392 | | 2nd Alt+Enter | `0x94000000` | true | 0,0,2560,1440 | The window keeps `WS_VISIBLE` going to windowed and coming back, so both the hiding and the stuck second Alt+Enter are fixed here. I checked the window state only: my screen capture tool couldn't show this build's window, so I haven't looked at the picture itself. Not tested: starting with borderless off, and the `DARNER_FULLSCREEN_BARS` backdrop.
Author
Collaborator

Closing: replaced by a917f992f on main ("lifecycle: Alt+Enter out of borderless keeps the window shown (#136)"), which fixes the same call site the same way (the restored style keeps the window's current WS_VISIBLE) and has its own test. This branch now conflicts with it in lifecycle.rs. Thanks to Trillazill for testing this branch on #136 (the window kept WS_VISIBLE through both Alt+Enter presses); the same logic is now on main.

Drafted with AI assistance (Claude Code).

Closing: replaced by a917f992f on main ("lifecycle: Alt+Enter out of borderless keeps the window shown (#136)"), which fixes the same call site the same way (the restored style keeps the window's current WS_VISIBLE) and has its own test. This branch now conflicts with it in lifecycle.rs. Thanks to Trillazill for testing this branch on #136 (the window kept WS_VISIBLE through both Alt+Enter presses); the same logic is now on main. Drafted with AI assistance (Claude Code).
Jesper-A closed this pull request 2026-12-04 02:17:54 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
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
TrustNo1/Darner!141
No description provided.