Fixes #1219 Signed-off-by: falkTX <falktx@falktx.com>tags/v2.3.0-RC1
@@ -945,6 +945,18 @@ public: | |||||
break; | break; | ||||
} | } | ||||
case kPluginBridgeNonRtClientSetWindowTitle: { | |||||
const uint32_t size = fShmNonRtClientControl.readUInt(); | |||||
CARLA_SAFE_ASSERT_BREAK(size > 0); | |||||
char title[size+1]; | |||||
carla_zeroChars(title, size+1); | |||||
fShmNonRtClientControl.readCustomData(title, size); | |||||
plugin->setCustomUITitle(title); | |||||
break; | |||||
} | |||||
case kPluginBridgeNonRtClientGetParameterText: { | case kPluginBridgeNonRtClientGetParameterText: { | ||||
const int32_t index = fShmNonRtClientControl.readInt(); | const int32_t index = fShmNonRtClientControl.readInt(); | ||||
@@ -708,6 +708,14 @@ public: | |||||
CarlaPlugin::setCtrlChannel(channel, sendOsc, sendCallback); | CarlaPlugin::setCtrlChannel(channel, sendOsc, sendCallback); | ||||
} | } | ||||
void setName(const char* const newName) override | |||||
{ | |||||
CarlaPlugin::setName(newName); | |||||
if (pData->uiTitle.isEmpty() && fBridgeVersion >= 8) | |||||
_setUiTitleFromName(); | |||||
} | |||||
// ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
// Set data (plugin-specific stuff) | // Set data (plugin-specific stuff) | ||||
@@ -955,8 +963,30 @@ public: | |||||
// ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
// Set ui stuff | // Set ui stuff | ||||
void setCustomUITitle(const char* const title) noexcept override | |||||
{ | |||||
carla_debug("CarlaPluginBridge::setCustomUITitle(%s)", title); | |||||
if (fBridgeVersion >= 8) | |||||
{ | |||||
const uint32_t size = static_cast<uint32_t>(std::strlen(title)); | |||||
const CarlaMutexLocker _cml(fShmNonRtClientControl.mutex); | |||||
fShmNonRtClientControl.writeOpcode(kPluginBridgeNonRtClientSetWindowTitle); | |||||
fShmNonRtClientControl.writeUInt(size); | |||||
fShmNonRtClientControl.writeCustomData(title, size); | |||||
fShmNonRtClientControl.commitWrite(); | |||||
} | |||||
CarlaPlugin::setCustomUITitle(title); | |||||
} | |||||
void showCustomUI(const bool yesNo) override | void showCustomUI(const bool yesNo) override | ||||
{ | { | ||||
if (yesNo && pData->uiTitle.isEmpty() && fBridgeVersion >= 8) | |||||
_setUiTitleFromName(); | |||||
{ | { | ||||
const CarlaMutexLocker _cml(fShmNonRtClientControl.mutex); | const CarlaMutexLocker _cml(fShmNonRtClientControl.mutex); | ||||
@@ -3090,6 +3120,21 @@ private: | |||||
return true; | return true; | ||||
} | } | ||||
void _setUiTitleFromName() | |||||
{ | |||||
CarlaString uiName(pData->name); | |||||
uiName += " (GUI)"; | |||||
const uint32_t size = static_cast<uint32_t>(uiName.length()); | |||||
const CarlaMutexLocker _cml(fShmNonRtClientControl.mutex); | |||||
fShmNonRtClientControl.writeOpcode(kPluginBridgeNonRtClientSetWindowTitle); | |||||
fShmNonRtClientControl.writeUInt(size); | |||||
fShmNonRtClientControl.writeCustomData(uiName.buffer(), size); | |||||
fShmNonRtClientControl.commitWrite(); | |||||
} | |||||
CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaPluginBridge) | CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaPluginBridge) | ||||
}; | }; | ||||
@@ -1194,6 +1194,7 @@ bool CarlaJackAppClient::handleNonRtData() | |||||
case kPluginBridgeNonRtClientSetMidiProgram: | case kPluginBridgeNonRtClientSetMidiProgram: | ||||
case kPluginBridgeNonRtClientSetCustomData: | case kPluginBridgeNonRtClientSetCustomData: | ||||
case kPluginBridgeNonRtClientSetChunkDataFile: | case kPluginBridgeNonRtClientSetChunkDataFile: | ||||
case kPluginBridgeNonRtClientSetWindowTitle: | |||||
break; | break; | ||||
case kPluginBridgeNonRtClientSetOption: | case kPluginBridgeNonRtClientSetOption: | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
* Carla Bridge definitions | * Carla Bridge definitions | ||||
* Copyright (C) 2013-2019 Filipe Coelho <falktx@falktx.com> | |||||
* Copyright (C) 2013-2020 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 | ||||
@@ -24,7 +24,7 @@ | |||||
#define CARLA_PLUGIN_BRIDGE_API_VERSION_MINIMUM 6 | #define CARLA_PLUGIN_BRIDGE_API_VERSION_MINIMUM 6 | ||||
// current API version, bumped when something is added | // current API version, bumped when something is added | ||||
#define CARLA_PLUGIN_BRIDGE_API_VERSION_CURRENT 7 | |||||
#define CARLA_PLUGIN_BRIDGE_API_VERSION_CURRENT 8 | |||||
// ------------------------------------------------------------------------------------------------------------------- | // ------------------------------------------------------------------------------------------------------------------- | ||||
@@ -77,6 +77,8 @@ enum PluginBridgeNonRtClientOpcode { | |||||
// stuff added in API 7 | // stuff added in API 7 | ||||
kPluginBridgeNonRtClientSetParameterMappedRange, // uint, float, float | kPluginBridgeNonRtClientSetParameterMappedRange, // uint, float, float | ||||
kPluginBridgeNonRtClientSetOptions, // uint | kPluginBridgeNonRtClientSetOptions, // uint | ||||
// stuff added in API 8 | |||||
kPluginBridgeNonRtClientSetWindowTitle, // uint/size, str[] | |||||
}; | }; | ||||
// Client sends these to server during non-RT | // Client sends these to server during non-RT | ||||
@@ -125,6 +125,8 @@ const char* PluginBridgeNonRtClientOpcode2str(const PluginBridgeNonRtClientOpcod | |||||
return "kPluginBridgeNonRtClientSetParameterMappedRange"; | return "kPluginBridgeNonRtClientSetParameterMappedRange"; | ||||
case kPluginBridgeNonRtClientSetOptions: | case kPluginBridgeNonRtClientSetOptions: | ||||
return "kPluginBridgeNonRtClientSetOptions"; | return "kPluginBridgeNonRtClientSetOptions"; | ||||
case kPluginBridgeNonRtClientSetWindowTitle: | |||||
return "kPluginBridgeNonRtClientSetWindowTitle"; | |||||
} | } | ||||
carla_stderr("CarlaBackend::PluginBridgeNonRtClientOpcode2str(%i) - invalid opcode", opcode); | carla_stderr("CarlaBackend::PluginBridgeNonRtClientOpcode2str(%i) - invalid opcode", opcode); | ||||