RAM2118 commited on
Commit
5106668
·
verified ·
1 Parent(s): dca94cb

Fix: Make helper foreground process when showing GUI so window buttons work on macOS

Browse files
Files changed (1) hide show
  1. Source/Helper/HelperPluginHost.cpp +10 -5
Source/Helper/HelperPluginHost.cpp CHANGED
@@ -4,14 +4,16 @@
4
  #include <pthread.h>
5
  #include <sched.h>
6
 
7
- // Custom window that actually closes when you click X
8
  class PluginGuiWindow : public juce::DocumentWindow
9
  {
10
  public:
11
  PluginGuiWindow(const juce::String& name)
12
  : DocumentWindow(name, juce::Colour(0xff1a1a2e),
13
- DocumentWindow::closeButton | DocumentWindow::minimiseButton)
14
- {}
 
 
15
 
16
  void closeButtonPressed() override
17
  {
@@ -246,7 +248,10 @@ void HelperPluginHost::showGui()
246
  {
247
  if (!plugin) return;
248
 
249
- // If window exists but hidden, just show it again
 
 
 
250
  if (guiWindow)
251
  {
252
  guiWindow->setVisible(true);
@@ -262,7 +267,7 @@ void HelperPluginHost::showGui()
262
  guiWindow->setResizable(true, true);
263
  guiWindow->centreWithSize(editor->getWidth(), editor->getHeight());
264
  guiWindow->setVisible(true);
265
- guiWindow->setAlwaysOnTop(true);
266
  });
267
  }
268
 
 
4
  #include <pthread.h>
5
  #include <sched.h>
6
 
7
+ // Custom window that hides when X is clicked
8
  class PluginGuiWindow : public juce::DocumentWindow
9
  {
10
  public:
11
  PluginGuiWindow(const juce::String& name)
12
  : DocumentWindow(name, juce::Colour(0xff1a1a2e),
13
+ DocumentWindow::allButtons)
14
+ {
15
+ setUsingNativeTitleBar(true);
16
+ }
17
 
18
  void closeButtonPressed() override
19
  {
 
248
  {
249
  if (!plugin) return;
250
 
251
+ // Make this process a foreground app so window buttons work on macOS
252
+ juce::Process::makeForegroundProcess();
253
+
254
+ // If window exists but hidden, just show it
255
  if (guiWindow)
256
  {
257
  guiWindow->setVisible(true);
 
267
  guiWindow->setResizable(true, true);
268
  guiWindow->centreWithSize(editor->getWidth(), editor->getHeight());
269
  guiWindow->setVisible(true);
270
+ guiWindow->toFront(true);
271
  });
272
  }
273