microsoft / microsoft/DirectX-Graphics-Samples

[Fullscreen] Fullscreen alt-tab behavior

Open
#814 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug samples
Dominant language
C++
Stars
6.8k
Forks
2.2k
PR merge metrics
No merged PRs in 30d

Description

Hello,
Recently I had to implement a D3D12 rendering backend at work. I used the fullscreen sample to implement fullscreen behavior and I had a few issues. Most notably some users were complaining that Alt-tabbing did not work properly in fullscreen (e.g You cannot switch to a window on the same screen as the fullscreen window)

After a bit of debugging I found the culprit: https://github.com/microsoft/DirectX-Graphics-Samples/blob/master/Samples/Desktop/D3D12Fullscreen/src/Win32Application.cpp#L155

The sample uses HWND_TOPMOST when switching to fullscreen. As stated in the documentation (https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowpos), it breaks standard alt-tab behavior ("The window maintains its topmost position even when it is deactivated. "). I believe it should be HWND_TOP instead?

If the original intent is to have a topmost window, it would be great to have a comment explaining the difference between HWND_TOP and HWND_TOPMOST.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in Samples/Desktop/D3D12Fullscreen/src/Win32Application.cpp around line 155 and inspect the SetWindowPos call that uses HWND_TOPMOST. Compare the documented behavior of HWND_TOPMOST and HWND_TOP, then update the fullscreen window handling or add the requested explanatory comment. Verify that standard Alt-tab behavior is preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics, desktop
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.