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

Windows: Fix issue where windows with titlebars reported the wrong transparency kind

This commit is contained in:
reuk 2024-08-23 12:52:45 +01:00
parent 9a93fb03a4
commit 0ed2ae64fa
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C

View file

@ -1693,16 +1693,6 @@ public:
TransparencyKind getTransparencyKind() const
{
if (hasTitleBar())
{
// If you hit this assertion, you're trying to create a window with a native titlebar
// and per-pixel transparency. If you want a semi-transparent window, then remove the
// native title bar. Otherwise, ensure that the window's component is opaque.
jassert (transparencyKind != TransparencyKind::perPixel);
return transparencyKind == TransparencyKind::perPixel ? TransparencyKind::opaque
: TransparencyKind::constant;
}
return transparencyKind;
}
@ -2622,12 +2612,17 @@ private:
}
}
static TransparencyKind computeTransparencyKind (const Component& comp)
TransparencyKind computeTransparencyKind() const
{
if (! comp.isOpaque())
if (! hasTitleBar() && ! component.isOpaque())
return TransparencyKind::perPixel;
if (comp.getAlpha() < 1.0f)
// If you hit this assertion, you're trying to create a window with a native titlebar
// and per-pixel transparency. If you want a semi-transparent window, then remove the
// native title bar. Otherwise, ensure that the window's component is opaque.
jassert (! hasTitleBar() || component.isOpaque());
if (component.getAlpha() < 1.0f)
return TransparencyKind::constant;
return TransparencyKind::opaque;
@ -2635,7 +2630,7 @@ private:
void setLayeredWindow()
{
const auto old = std::exchange (transparencyKind, computeTransparencyKind (component));
const auto old = std::exchange (transparencyKind, computeTransparencyKind());
if (old == getTransparencyKind())
return;