Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes flickering in borderless mode. Likely solves issue #1284.
Simple demo code to reproduce the flickering can be found in this gist.
On my machine, this (WS_POPUP on master branch) results in black flickering everytime the window gains or loses focus. Most obvious when switching focus by clicking with the mouse on a different window on another screen.
Below is my best understanding of the issue, it contains some speculation.
Just like in #1284, I had originally recognised the flickering issue as
sf::Style::None
still using what I understood as some kind of "pseudo-fullscreen" mode (since the flicker is still present, but much shorter than real fullscreen switches). After doing some experimentation with the code, I concluded that this "pseudo-fullscreen" mode is actually whatWS_POPUP
does.I speculated that the reason
WS_POPUP
was initially added, is that if you try to specify a true borderless style in windows API'sCreateWindow()
, it does not let you and instead gives you some border styles anyways.WS_POPUP
is a value that blocks this behavior, without actually adding any decoration.From analyzing the source code of the 'borderless gaming' program, which is able to turn almost any windowed game into borderless windows without the flickering issue, they never set anything like
WS_POPUP
either.Instead of doing that, in my opinion it is better to specify some known style first, and remove it immediately after creating the window.
Tasks
Tested only on my machine: Windows 11 23H2, 1080 ti driver 551.61, 13900kf.