mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
OpenGL: Ensure window repainting messages are emitted correctly on Windows
This fixes an issue introduced in
340f531c71 where embedded OpenGL windows
would incorrectly have the WS_EX_LAYERED style bit set, which in turn
prevented them from displaying correctly.
Before the window-transparency refactoring, OpenGL windows would not
have the layered bit set because only peers with windowIsSemiTransparent
were created with the layered bit, and the layered bit was only updated
if the peer alpha was changed.
The new behaviour is to always set WS_EX_LAYERED if the peer's component
is non-opaque with no titlebar, or if the component has an alpha < 1.0f.
The OpenGLContext's placeholder component has no titlebar, so it must be
opaque in order to avoid setting the layered style bit.
This commit is contained in:
parent
109ec550b9
commit
735f99418c
1 changed files with 9 additions and 5 deletions
|
|
@ -47,7 +47,7 @@ public:
|
|||
bool /*useMultisampling*/,
|
||||
OpenGLVersion version)
|
||||
{
|
||||
dummyComponent.reset (new DummyComponent (*this));
|
||||
placeholderComponent.reset (new PlaceholderComponent (*this));
|
||||
createNativeWindow (component);
|
||||
|
||||
PIXELFORMATDESCRIPTOR pfd;
|
||||
|
|
@ -263,9 +263,13 @@ private:
|
|||
}
|
||||
|
||||
//==============================================================================
|
||||
struct DummyComponent : public Component
|
||||
struct PlaceholderComponent : public Component
|
||||
{
|
||||
DummyComponent (NativeContext& c) : context (c) {}
|
||||
explicit PlaceholderComponent (NativeContext& c)
|
||||
: context (c)
|
||||
{
|
||||
setOpaque (true);
|
||||
}
|
||||
|
||||
// The windowing code will call this when a paint callback happens
|
||||
void handleCommandMessage (int) override { context.triggerRepaint(); }
|
||||
|
|
@ -295,7 +299,7 @@ private:
|
|||
auto* parentHWND = topComp->getWindowHandle();
|
||||
|
||||
ScopedThreadDPIAwarenessSetter setter { parentHWND };
|
||||
nativeWindow.reset (createNonRepaintingEmbeddedWindowsPeer (*dummyComponent, topComp));
|
||||
nativeWindow.reset (createNonRepaintingEmbeddedWindowsPeer (*placeholderComponent, topComp));
|
||||
}
|
||||
|
||||
if (auto* peer = topComp->getPeer())
|
||||
|
|
@ -383,7 +387,7 @@ private:
|
|||
};
|
||||
|
||||
CriticalSection mutex;
|
||||
std::unique_ptr<DummyComponent> dummyComponent;
|
||||
std::unique_ptr<PlaceholderComponent> placeholderComponent;
|
||||
std::unique_ptr<ComponentPeer> nativeWindow;
|
||||
std::unique_ptr<ScopedThreadDPIAwarenessSetter> threadAwarenessSetter;
|
||||
Component::SafePointer<Component> safeComponent;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue