Browse Source

Add CarlaPlugin::getUiBridgeProcessId() function

tags/1.9.6
falkTX 10 years ago
parent
commit
29f7dfb365
6 changed files with 49 additions and 9 deletions
  1. +8
    -1
      source/backend/CarlaPlugin.hpp
  2. +8
    -7
      source/backend/plugin/CarlaPlugin.cpp
  3. +12
    -1
      source/backend/plugin/CarlaPluginDSSI.cpp
  4. +5
    -0
      source/backend/plugin/CarlaPluginLV2.cpp
  5. +9
    -0
      source/utils/CarlaPipeUtils.cpp
  6. +7
    -0
      source/utils/CarlaPipeUtils.hpp

+ 8
- 1
source/backend/CarlaPlugin.hpp View File

@@ -423,7 +423,7 @@ public:
*
* @see getId()
*/
void setId(const uint newId) noexcept;
virtual void setId(const uint newId) noexcept;

/*!
* Set the plugin's name to @a newName.
@@ -838,6 +838,13 @@ public:
*/
virtual const void* getNativeDescriptor() const noexcept;

/*!
* Get the plugin UI bridge process Id.
*/
virtual uintptr_t getUiBridgeProcessId() const noexcept;

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

/*!
* Get the plugin's patchbay nodeId.
* @see setPatchbayNodeId()


+ 8
- 7
source/backend/plugin/CarlaPlugin.cpp View File

@@ -1351,13 +1351,7 @@ void CarlaPlugin::idle()
CarlaString uiTitle(pData->name);
uiTitle += " (GUI)";

uint32_t pid = 0;
#ifndef BUILD_BRIDGE
if (pData->oscData.target != nullptr && pData->childProcess != nullptr)
pid = pData->childProcess->getPID();
#endif

if (CarlaPluginUI::tryTransientWinIdMatch(pid, uiTitle, pData->engine->getOptions().frontendWinId, true))
if (CarlaPluginUI::tryTransientWinIdMatch(getUiBridgeProcessId(), uiTitle, pData->engine->getOptions().frontendWinId, true))
pData->transientTryCounter = 0;
}

@@ -1891,6 +1885,13 @@ const void* CarlaPlugin::getNativeDescriptor() const noexcept
return nullptr;
}

uintptr_t CarlaPlugin::getUiBridgeProcessId() const noexcept
{
return 0;
}

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

uint32_t CarlaPlugin::getPatchbayNodeId() const noexcept
{
return pData->nodeId;


+ 12
- 1
source/backend/plugin/CarlaPluginDSSI.cpp View File

@@ -350,7 +350,13 @@ public:
// -------------------------------------------------------------------
// Set data (internal stuff)

// nothing
void setId(const uint newId) noexcept
{
CarlaPlugin::setId(newId);

// UI osc-url uses Id, so we need to close it when it changes
showCustomUI(false);
}

// -------------------------------------------------------------------
// Set data (plugin-specific stuff)
@@ -2026,6 +2032,11 @@ public:
return fDssiDescriptor;
}

uintptr_t getUiBridgeProcessId() const noexcept override
{
return (pData->oscData.target != nullptr && pData->childProcess != nullptr) ? pData->childProcess->getPID() : 0;
}

const void* getExtraStuff() const noexcept override
{
return fUiFilename;


+ 5
- 0
source/backend/plugin/CarlaPluginLV2.cpp View File

@@ -4621,6 +4621,11 @@ public:
return fDescriptor;
}

uintptr_t getUiBridgeProcessId() const noexcept override
{
return fPipeServer.isPipeRunning() ? fPipeServer.getPID() : 0;
}

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

public:


+ 9
- 0
source/utils/CarlaPipeUtils.cpp View File

@@ -1050,6 +1050,15 @@ CarlaPipeServer::~CarlaPipeServer() /*noexcept*/
stopPipeServer(5*1000);
}

uintptr_t CarlaPipeServer::getPID() const noexcept
{
#ifndef CARLA_OS_WIN
return pData->pid;
#else
return 0;
#endif
}

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

bool CarlaPipeServer::startPipeServer(const char* const filename, const char* const arg1, const char* const arg2) noexcept


+ 7
- 0
source/utils/CarlaPipeUtils.hpp View File

@@ -244,6 +244,13 @@ public:
*/
~CarlaPipeServer() /*noexcept*/ override;

/*!
* Get the process ID of this pipe's matching client.
* Will return 0 if client is not running.
* @note: Unsupported on Windows
*/
uintptr_t getPID() const noexcept;

/*!
* Start the pipe server using @a filename with 2 arguments.
* @see fail()


Loading…
Cancel
Save