Browse Source

Call createContextIfNeeded early if possible

pull/506/head
falkTX 1 month ago
parent
commit
a1e1dc37db
2 changed files with 10 additions and 1 deletions
  1. +7
    -1
      dgl/src/Window.cpp
  2. +3
    -0
      distrho/src/DistrhoUIPrivateData.hpp

+ 7
- 1
dgl/src/Window.cpp View File

@@ -28,7 +28,11 @@ Window::ScopedGraphicsContext::ScopedGraphicsContext(Window& win)
: window(win),
ppData(nullptr),
active(window.pData->view != nullptr && puglBackendEnter(window.pData->view)),
reenter(false) {}
reenter(false)
{
if (active)
window.pData->createContextIfNeeded();
}

Window::ScopedGraphicsContext::ScopedGraphicsContext(Window& win, Window& transientWin)
: window(win),
@@ -40,6 +44,8 @@ Window::ScopedGraphicsContext::ScopedGraphicsContext(Window& win, Window& transi
{
puglBackendLeave(ppData->view);
active = puglBackendEnter(window.pData->view);
if (active)
window.pData->createContextIfNeeded();
}
}



+ 3
- 0
distrho/src/DistrhoUIPrivateData.hpp View File

@@ -138,7 +138,10 @@ public:

// this is called just before creating UI, ensuring proper context to it
if (pData->initPost())
{
puglBackendEnter(pData->view);
pData->createContextIfNeeded();
}
}

~PluginWindow() override


Loading…
Cancel
Save