Browse Source

Fix Mac standalone window focus

pull/304/head
Luciano Iam Filipe Coelho <falktx@falktx.com> 4 years ago
parent
commit
d6d58b33d1
3 changed files with 18 additions and 0 deletions
  1. +5
    -0
      dgl/src/ApplicationPrivateData.cpp
  2. +9
    -0
      dgl/src/pugl.cpp
  3. +4
    -0
      dgl/src/pugl.hpp

+ 5
- 0
dgl/src/ApplicationPrivateData.cpp View File

@@ -64,6 +64,11 @@ Application::PrivateData::PrivateData(const bool standalone)
#ifdef HAVE_X11
sofdFileDialogSetup(world);
#endif

#ifdef DISTRHO_OS_MAC
if (standalone)
puglMacOSActivateApp();
#endif
}

Application::PrivateData::~PrivateData()


+ 9
- 0
dgl/src/pugl.cpp View File

@@ -391,6 +391,15 @@ bool puglMacOSFilePanelOpen(PuglView* const view,

return true;
}

// --------------------------------------------------------------------------------------------------------------------
// macOS specific, allow standalone window to gain focus

void puglMacOSActivateApp()
{
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
[NSApp activateIgnoringOtherApps:YES];
}
#endif

#ifdef DISTRHO_OS_WINDOWS


+ 4
- 0
dgl/src/pugl.hpp View File

@@ -90,6 +90,10 @@ puglFallbackOnResize(PuglView* view);
// macOS specific, setup file browser dialog
typedef void (*openPanelCallback)(PuglView* view, const char* path);
bool puglMacOSFilePanelOpen(PuglView* view, const char* startDir, const char* title, uint flags, openPanelCallback callback);

// macOS specific, allow standalone window to gain focus
PUGL_API void
puglMacOSActivateApp();
#endif

#ifdef DISTRHO_OS_WINDOWS


Loading…
Cancel
Save