Browse Source

Add macos plugin standalone init, fixing focus

tags/v2.3.2
falkTX 3 years ago
parent
commit
f41dc1bcdc
4 changed files with 26 additions and 2 deletions
  1. +8
    -0
      source/bridges-plugin/CarlaBridgePlugin.cpp
  2. +5
    -0
      source/bridges-ui/CarlaBridgeToolkitNative.cpp
  3. +7
    -1
      source/utils/CarlaMacUtils.cpp
  4. +6
    -1
      source/utils/CarlaMacUtils.hpp

+ 8
- 0
source/bridges-plugin/CarlaBridgePlugin.cpp View File

@@ -27,6 +27,10 @@
#include "CarlaMainLoop.hpp" #include "CarlaMainLoop.hpp"
#include "CarlaMIDI.h" #include "CarlaMIDI.h"


#ifdef CARLA_OS_MAC
# include "CarlaMacUtils.hpp"
#endif

#ifdef CARLA_OS_UNIX #ifdef CARLA_OS_UNIX
# include <signal.h> # include <signal.h>
#endif #endif
@@ -582,6 +586,10 @@ int main(int argc, char* argv[])


const bool testing = std::getenv("CARLA_BRIDGE_TESTING") != nullptr; const bool testing = std::getenv("CARLA_BRIDGE_TESTING") != nullptr;


#ifdef CARLA_OS_MAC
initStandaloneApplication();
#endif

#ifdef CARLA_OS_WIN #ifdef CARLA_OS_WIN
OleInitialize(nullptr); OleInitialize(nullptr);
CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);


+ 5
- 0
source/bridges-ui/CarlaBridgeToolkitNative.cpp View File

@@ -21,6 +21,10 @@
#include "CarlaMainLoop.hpp" #include "CarlaMainLoop.hpp"
#include "CarlaPluginUI.hpp" #include "CarlaPluginUI.hpp"


#if defined(CARLA_OS_MAC) && defined(BRIDGE_COCOA)
# include "CarlaMacUtils.hpp"
#endif

#if defined(HAVE_X11) && defined(BRIDGE_X11) #if defined(HAVE_X11) && defined(BRIDGE_X11)
# include <X11/Xlib.h> # include <X11/Xlib.h>
#endif #endif
@@ -57,6 +61,7 @@ public:
const CarlaBridgeFormat::Options& options(fPlugin->getOptions()); const CarlaBridgeFormat::Options& options(fPlugin->getOptions());


#if defined(CARLA_OS_MAC) && defined(BRIDGE_COCOA) #if defined(CARLA_OS_MAC) && defined(BRIDGE_COCOA)
initStandaloneApplication();
fHostUI = CarlaPluginUI::newCocoa(this, 0, options.isStandalone, options.isResizable); fHostUI = CarlaPluginUI::newCocoa(this, 0, options.isStandalone, options.isResizable);
#elif defined(CARLA_OS_WIN) && defined(BRIDGE_HWND) #elif defined(CARLA_OS_WIN) && defined(BRIDGE_HWND)
fHostUI = CarlaPluginUI::newWindows(this, 0, options.isStandalone, options.isResizable); fHostUI = CarlaPluginUI::newWindows(this, 0, options.isStandalone, options.isResizable);


+ 7
- 1
source/utils/CarlaMacUtils.cpp View File

@@ -1,6 +1,6 @@
/* /*
* Carla macOS utils * Carla macOS utils
* Copyright (C) 2018 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2018-2021 Filipe Coelho <falktx@falktx.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
@@ -28,6 +28,12 @@ CARLA_BACKEND_START_NAMESPACE


// -------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------


void initStandaloneApplication()
{
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
[NSApp activateIgnoringOtherApps:YES];
}

const char* findBinaryInBundle(const char* const bundleDir) const char* findBinaryInBundle(const char* const bundleDir)
{ {
const CFURLRef urlRef = CFURLCreateFromFileSystemRepresentation(0, (const UInt8*)bundleDir, (CFIndex)strlen(bundleDir), true); const CFURLRef urlRef = CFURLCreateFromFileSystemRepresentation(0, (const UInt8*)bundleDir, (CFIndex)strlen(bundleDir), true);


+ 6
- 1
source/utils/CarlaMacUtils.hpp View File

@@ -1,6 +1,6 @@
/* /*
* Carla macOS utils * Carla macOS utils
* Copyright (C) 2018 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2018-2021 Filipe Coelho <falktx@falktx.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
@@ -28,6 +28,11 @@ CARLA_BACKEND_START_NAMESPACE


// -------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------


/*
* ...
*/
void initStandaloneApplication();

/* /*
* ... * ...
*/ */


Loading…
Cancel
Save