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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/SFML/Window/Win32/WindowImplWin32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ m_cursorGrabbed(m_fullscreen)
DWORD win32Style = WS_VISIBLE;
if (style == Style::None)
{
win32Style |= WS_POPUP;
// You cannot spawn a window as a true borderless window. Remove the caption after creation.
win32Style |= WS_CAPTION;
}
else
{
Expand Down Expand Up @@ -235,6 +236,14 @@ m_cursorGrabbed(m_fullscreen)
if (m_fullscreen)
switchToFullscreen(mode);

if (style == Style::None)
{
// For a true borderless window, remove the titlebar now.
// from: https://github.com/Codeusa/Borderless-Gaming/blob/3cc4dc6bd580b263287be45981f1e36036daf4eb/BorderlessGaming.Logic/Windows/Manipulation.cs#L71-L94
constexpr long long borderlessStyleRemove = WS_CAPTION | WS_THICKFRAME | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX;
SetWindowLongPtr(m_handle, GWL_STYLE, GetWindowLongPtr(m_handle, GWL_STYLE) & ~borderlessStyleRemove);
}

// Increment window count
++windowCount;
}
Expand Down