1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-26 02:14:22 +00:00

OpenGL: Fixed an issue where components using OpenGL would not be restarted correctly when used in the FX docker window in Reaper

This commit is contained in:
hogliux 2018-05-15 12:03:20 +01:00
parent f70a450bd4
commit e91def7fae
4 changed files with 11 additions and 36 deletions

View file

@ -64,10 +64,6 @@ static NSRect flippedScreenRect (NSRect r) noexcept
return r;
}
#if JUCE_MODULE_AVAILABLE_juce_opengl
void componentPeerAboutToChange (Component&, bool);
#endif
//==============================================================================
class NSViewComponentPeer : public ComponentPeer,
private Timer
@ -705,12 +701,8 @@ public:
void redirectWillMoveToWindow (NSWindow* newWindow)
{
#if JUCE_MODULE_AVAILABLE_juce_opengl
if ([view window] == window)
componentPeerAboutToChange (getComponent(), newWindow == nullptr);
#else
ignoreUnused (newWindow);
#endif
if ([view window] == window && newWindow == nullptr)
getComponent().setVisible (false);
}
void sendMouseEvent (NSEvent* ev)
@ -1046,7 +1038,15 @@ public:
void viewMovedToWindow()
{
if (isSharedWindow)
window = [view window];
{
auto* newWindow = [view window];
bool shouldSetVisible = (window == nullptr && newWindow != nullptr);
window = newWindow;
if (shouldSetVisible)
getComponent().setVisible (true);
}
}
void liveResizingStart()

View file

@ -249,14 +249,4 @@ bool OpenGLHelpers::isContextActive()
return CGLGetCurrentContext() != 0;
}
//==============================================================================
void componentPeerAboutToChange (Component& comp, bool shouldSuspend)
{
if (auto* context = OpenGLContext::getContextAttachedTo (comp))
context->overrideCanBeAttached (shouldSuspend);
for (auto* child : comp.getChildren())
componentPeerAboutToChange (*child, shouldSuspend);
}
} // namespace juce

View file

@ -1055,17 +1055,6 @@ void OpenGLContext::execute (OpenGLContext::AsyncWorker::Ptr workerToUse, bool s
jassertfalse; // You must have attached the context to a component
}
void OpenGLContext::overrideCanBeAttached (bool newCanAttach)
{
if (overrideCanAttach != newCanAttach)
{
overrideCanAttach = newCanAttach;
if (auto* a = attachment.get())
a->update();
}
}
//==============================================================================
struct DepthTestDisabler
{

View file

@ -349,10 +349,6 @@ private:
JUCE_DECLARE_NON_COPYABLE (AsyncWorkerFunctor)
};
//==============================================================================
friend void componentPeerAboutToChange (Component&, bool);
void overrideCanBeAttached (bool);
//==============================================================================
CachedImage* getCachedImage() const noexcept;
void execute (AsyncWorker::Ptr, bool);