Browse Source

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

tags/2021-05-28
hogliux 7 years ago
parent
commit
e91def7fae
4 changed files with 11 additions and 36 deletions
  1. +11
    -11
      modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm
  2. +0
    -10
      modules/juce_opengl/native/juce_OpenGL_osx.h
  3. +0
    -11
      modules/juce_opengl/opengl/juce_OpenGLContext.cpp
  4. +0
    -4
      modules/juce_opengl/opengl/juce_OpenGLContext.h

+ 11
- 11
modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm 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()


+ 0
- 10
modules/juce_opengl/native/juce_OpenGL_osx.h 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

+ 0
- 11
modules/juce_opengl/opengl/juce_OpenGLContext.cpp 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
{


+ 0
- 4
modules/juce_opengl/opengl/juce_OpenGLContext.h 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);


Loading…
Cancel
Save