commit d296d262d2813dc46410037844f589d96571ec35
parent e48095291dbd75305dfdd9fc7ef00a66c43c1dca
Author: falkTX <falktx@falktx.com>
Date: Mon, 7 Jun 2021 10:48:05 +0100
Testing changes to fix macOS GL context, WIP
Diffstat:
7 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/dgl/Window.hpp b/dgl/Window.hpp
@@ -362,6 +362,9 @@ public:
DISTRHO_DEPRECATED_BY("runAsModal(bool)")
inline void exec(bool blockWait = false) { runAsModal(blockWait); }
+ // TESTING, DO NOT USE
+ void leaveContext();
+
protected:
/**
A function called when the window is attempted to be closed.
diff --git a/dgl/src/Window.cpp b/dgl/src/Window.cpp
@@ -265,6 +265,11 @@ void Window::runAsModal(bool blockWait)
pData->runAsModal(blockWait);
}
+void Window::leaveContext()
+{
+ pData->leaveContext();
+}
+
void Window::setGeometryConstraints(const uint minimumWidth,
const uint minimumHeight,
const bool keepAspectRatio,
diff --git a/dgl/src/WindowPrivateData.cpp b/dgl/src/WindowPrivateData.cpp
@@ -618,6 +618,14 @@ void Window::PrivateData::runAsModal(const bool blockWait)
}
// -----------------------------------------------------------------------
+// TESTING
+
+void Window::PrivateData::leaveContext()
+{
+ puglBackendLeave(view);
+}
+
+// -----------------------------------------------------------------------
// pugl events
void Window::PrivateData::onPuglConfigure(const double width, const double height)
diff --git a/dgl/src/WindowPrivateData.hpp b/dgl/src/WindowPrivateData.hpp
@@ -158,6 +158,9 @@ struct Window::PrivateData : IdleCallback {
void stopModal();
void runAsModal(bool blockWait);
+ // TESTING
+ void leaveContext();
+
// pugl events
void onPuglConfigure(double width, double height);
void onPuglExpose();
diff --git a/dgl/src/pugl.cpp b/dgl/src/pugl.cpp
@@ -161,6 +161,14 @@ void puglBackendEnter(PuglView* const view)
}
// --------------------------------------------------------------------------------------------------------------------
+// expose backend leave
+
+void puglBackendLeave(PuglView* const view)
+{
+ view->backend->leave(view, NULL);
+}
+
+// --------------------------------------------------------------------------------------------------------------------
// clear minimum size to 0
void puglClearMinSize(PuglView* const view)
diff --git a/dgl/src/pugl.hpp b/dgl/src/pugl.hpp
@@ -46,6 +46,10 @@ PUGL_BEGIN_DECLS
PUGL_API void
puglBackendEnter(PuglView* view);
+// expose backend leave
+PUGL_API void
+puglBackendLeave(PuglView* view);
+
// clear minimum size to 0
PUGL_API void
puglClearMinSize(PuglView* view);
diff --git a/distrho/src/DistrhoUIInternal.hpp b/distrho/src/DistrhoUIInternal.hpp
@@ -96,6 +96,8 @@ public:
g_nextWindowId = 0;
g_nextScaleFactor = 0.0;
g_nextBundlePath = nullptr;
+#else
+ uiData->window->leaveContext();
#endif
UI::PrivateData::s_nextPrivateData = nullptr;