Fix: Plugin GUI X button now closes window — custom DocumentWindow with closeButtonPressed override
Browse files3 unmodified lines456789101112131415161718192021222324109 unmodified lines134135136122137138139101 unmodified lines2412422432302442452462472482492502512522532542552562572582592392402412422432602612622633 unmodified lines#include <pthread.h>#include <sched.h>
// Custom window that actually closes when you click Xclass PluginGuiWindow : public juce::DocumentWindow{public: PluginGuiWindow(const juce::String& name) : DocumentWindow(name, juce::Colour(0xff1a1a2e), DocumentWindow::closeButton | DocumentWindow::minimiseButton) {}
void closeButtonPressed() override { setVisible(false); }};
HelperPluginHost::HelperPluginHost(){ #if JUCE_PLUGINHOST_VST3109 unmodified lines
void HelperPluginHost::audioProcessingLoop(){ // Set realtime thread priority using native macOS/POSIX API struct sched_param param; param.sched_priority = sched_get_priority_max(SCHED_FIFO); pthread_setschedparam(pthread_self(), SCHED_FIFO, ¶m);101 unmodified linesvoid HelperPluginHost::showGui(){ if (!plugin || !plugin->hasEditor()) return; if (guiWindow) return;
juce::MessageManager::callAsync([this]() { if (!plugin) return;
// If window exists but hidden, just show it again if (guiWindow) { guiWindow->setVisible(true); guiWindow->toFront(true); return; }
auto* editor = plugin->createEditor(); if (!editor) return;
guiWindow = std::make_unique<juce::DocumentWindow>( plugin->getName(), juce::Colour(0xff1a1a2e), juce::DocumentWindow::closeButton | juce::DocumentWindow::minimiseButton);
guiWindow = std::make_unique<PluginGuiWindow>(plugin->getName()); guiWindow->setContentOwned(editor, true); guiWindow->setResizable(true, true); guiWindow->centreWithSize(editor->getWidth(), editor->getHeight());Source/Helper/HelperPluginHost.cpp+24-7