Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Use composition to fix window transparency when using D3D #2529

Merged
merged 2 commits into from May 11, 2024

Conversation

fredizzimo
Copy link
Member

What kind of change does this PR introduce?

In order to render transparent window backgrounds on Windows with D3D, the drawing is now done using Window's composition engine, see https://learn.microsoft.com/en-us/archive/msdn-magazine/2014/june/windows-with-c-high-performance-window-layering-using-the-windows-composition-engine. This also fixes, the alt-enter hijacking, since the swapchain is no longer bound to the Window.

Additionally, this PR disables the D3D debug layer by default, since it's not supported on some systems without additional software.

Did this PR introduce a breaking change?

A breaking change includes anything that breaks backwards compatibility either at compile or run time.

  • No

Copy link

github-actions bot commented May 7, 2024

Test Results

  6 files  ±0    6 suites  ±0   14s ⏱️ -4s
110 tests ±0  110 ✅ ±0  0 💤 ±0  0 ❌ ±0 
644 runs  ±0  644 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit d3dddf1. ± Comparison against base commit 5efb713.

@pidgeon777
Copy link

Great! 👏

If I understand correctly, in the latest version it is possible to run Neovide also with --opengl.

I would like to ask which would be the differences on Windows 11 running Neovide either with --opengl or in D3D12 mode (performances, features etc.).

@fredizzimo
Copy link
Member Author

The difference is mainly that D3D is smoother on most systems, it should be on all, but there might still be some bugs in the implementation, so --opengl is still supported. It's also more compatible, especially with older hardware.

@pidgeon777
Copy link

If I understand correctly it is also now possible with D3D12 to set Neovide transparency on Windows? If yes, how could this be achieved? Just for a quick test.

@fredizzimo
Copy link
Member Author

You can either download the artifacts from the CI https://github.com/neovide/neovide/actions/runs/8991931441, or build this branch manually
image

@pidgeon777
Copy link

Thanks for the quick reply, I downloaded the artifact from your link here:

https://github.com/neovide/neovide/actions/runs/8991931441

Strangely the Alt + Enter issue still persists, also setting vim.g.neovide_transparency = 0.0 renders makes the background darker:

image

This is when it is set to 1.0:

image

I'm running:

neovide.exe --frame none --log

@fredizzimo
Copy link
Member Author

That's very strange, it definitely fixed both issues for me, maybe it's somehow running the wrong exe? I think powershell by default don't run exes in the current directory, unless you give the path like .\neovide

@pidgeon777
Copy link

I compiled from sources Neovide and it created 4 binaries (debug, release, deps etc.).

As you suggested, it was running the previous version.

image

Even transparency now works fine. My congratulations for the great job! 👍

@pidgeon777
Copy link

I found a little bug in my basic LazyVim configuration (noice enabled by default), this is the Lazy panel:

image

When I try to enter the diff subwindow for an update (press d), I get this:

image

The diff buffer is focused and I can move the cursor in it correctly, but the previous buffer is still displayed in the background.

When I press q to exit the diff window, the lazy buffer is correctly focused.

@fredizzimo
Copy link
Member Author

@pidgeon777, are you using g:neovide_transparency=0, that's not really well supported, since it applies the transparency to all background colors, See the discussions here for more information:

Another possible cause could be that Neovim renders several non-floating windows on top of each other and does not clear the underlying window automatically. Essentially the same cause that causing this:

@Kethku Kethku merged commit db8fdb2 into neovide:main May 11, 2024
12 checks passed
@pidgeon777
Copy link

pidgeon777 commented May 13, 2024

I'm experiencing some confusion with the g:neovide_transparency setting in Neovide. In the previous version, setting this parameter to 0 made only the background transparent, leaving text and other elements opaque. However, in the current version, the same setting makes all elements, including text, transparent. I'm looking for guidance on how to make only the background transparent in the current version, as was possible in the previous version. I've included an image from the previous version for reference, where the g:neovide_transparency parameter was set to 0.8, making only the background transparent.

image

@pidgeon777
Copy link

The commit referenced above was identified:

https://github.com/neovide/neovide/actions/runs/8991931441#artifacts

This commit introduces a change where setting the vim.g.neovide_transparency parameter to 0.0 yields a specific visual effect. The effect is demonstrated in the following image:

Neovide Transparency Effect

Upon close inspection of the image, it is evident that the transparency setting primarily affects the background, leaving other elements intact. This behavior aligns with the wished outcome, where only the background transparency is modified.

zbyna pushed a commit to zbyna/neovide that referenced this pull request May 17, 2024
…de#2529)

* Use composition to support transparency with d3d

* Don't enable the D3D debug layer by default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants