1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Windows: Always use WS_POPUP style for windows without a native titlebar or shadow

If we don't do this, the top corners of the window may have unwanted
clipping applied, making the corners appear rounded.
This commit is contained in:
reuk 2024-08-13 15:07:26 +01:00
parent afaf97fe16
commit b90498d79b
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C

View file

@ -2437,7 +2437,6 @@ private:
const auto hasMax = (styleFlags & windowHasMaximiseButton) != 0;
const auto appearsOnTaskbar = (styleFlags & windowAppearsOnTaskbar) != 0;
const auto resizable = (styleFlags & windowIsResizable) != 0;
const auto transparent = (styleFlags & windowIsSemiTransparent) != 0;
if (parentToAddTo != nullptr)
{
@ -2445,16 +2444,25 @@ private:
}
else
{
type |= titled ? (WS_OVERLAPPED | WS_CAPTION) : WS_POPUP;
type |= hasClose ? (WS_SYSMENU | WS_CAPTION) : 0;
type |= hasMin ? (WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU) : 0;
type |= hasMax ? (WS_MAXIMIZEBOX | WS_CAPTION | WS_SYSMENU) : 0;
type |= resizable || windowUsesNativeShadow() ? WS_THICKFRAME : 0;
if (titled || windowUsesNativeShadow())
{
type |= titled ? (WS_OVERLAPPED | WS_CAPTION) : WS_POPUP;
type |= hasClose ? (WS_SYSMENU | WS_CAPTION) : 0;
type |= hasMin ? (WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU) : 0;
type |= hasMax ? (WS_MAXIMIZEBOX | WS_CAPTION | WS_SYSMENU) : 0;
type |= resizable || windowUsesNativeShadow() ? WS_THICKFRAME : 0;
}
else
{
// Transparent windows need WS_POPUP and not WS_OVERLAPPED | WS_CAPTION, otherwise
// the top corners of the window will get rounded unconditionally.
// Unfortunately, this disables nice mouse handling for the caption area.
type |= WS_POPUP;
}
exstyle |= appearsOnTaskbar ? WS_EX_APPWINDOW : WS_EX_TOOLWINDOW;
}
exstyle |= transparent ? WS_EX_LAYERED : 0;
hwnd = CreateWindowEx (exstyle, WindowClassHolder::getInstance()->getWindowClassName(),
L"", type, 0, 0, 0, 0, parentToAddTo, nullptr,
(HINSTANCE) Process::getCurrentModuleInstanceHandle(), nullptr);