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 borderless flicker #2975

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

L0laapk3
Copy link

@L0laapk3 L0laapk3 commented May 5, 2024

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 what WS_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's CreateWindow(), 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

  • [N/A] Tested on Linux
  • Tested on Windows
  • [N/A] Tested on macOS
  • [N/A] Tested on iOS
  • [N/A] Tested on Android

Tested only on my machine: Windows 11 23H2, 1080 ti driver 551.61, 13900kf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Review
Development

Successfully merging this pull request may close these issues.

None yet

2 participants