Browse Source

Notify of embed resizes on bridges

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.4.2
falkTX 2 years ago
parent
commit
2a55bbaef4
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
5 changed files with 35 additions and 7 deletions
  1. +13
    -1
      source/backend/engine/CarlaEngineBridge.cpp
  2. +14
    -2
      source/backend/plugin/CarlaPluginBridge.cpp
  3. +2
    -1
      source/backend/plugin/CarlaPluginJack.cpp
  4. +2
    -1
      source/utils/CarlaBridgeDefines.hpp
  5. +4
    -2
      source/utils/CarlaBridgeUtils.hpp

+ 13
- 1
source/backend/engine/CarlaEngineBridge.cpp View File

@@ -711,6 +711,18 @@ public:
} }
break; break;


case ENGINE_CALLBACK_EMBED_UI_RESIZED: {
CARLA_SAFE_ASSERT_BREAK(value1 > 1);
CARLA_SAFE_ASSERT_BREAK(value2 > 1);

const CarlaMutexLocker _cml(fShmNonRtServerControl.mutex);

fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerResizeEmbedUI);
fShmNonRtServerControl.writeUInt(static_cast<uint>(value1));
fShmNonRtServerControl.writeUInt(static_cast<uint>(value2));
fShmNonRtServerControl.commitWrite();
} break;

case ENGINE_CALLBACK_RELOAD_PARAMETERS: case ENGINE_CALLBACK_RELOAD_PARAMETERS:
if (const CarlaPluginPtr plugin = pData->plugins[0].plugin) if (const CarlaPluginPtr plugin = pData->plugins[0].plugin)
{ {
@@ -1108,7 +1120,7 @@ public:


const CarlaMutexLocker _cml(fShmNonRtServerControl.mutex); const CarlaMutexLocker _cml(fShmNonRtServerControl.mutex);


fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerEmbedUI);
fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerRespEmbedUI);
fShmNonRtServerControl.writeULong(reinterpret_cast<uint64_t>(resp)); fShmNonRtServerControl.writeULong(reinterpret_cast<uint64_t>(resp));
fShmNonRtServerControl.commitWrite(); fShmNonRtServerControl.commitWrite();
break; break;


+ 14
- 2
source/backend/plugin/CarlaPluginBridge.cpp View File

@@ -2132,8 +2132,12 @@ public:
pData->hints = hints | PLUGIN_IS_BRIDGE; pData->hints = hints | PLUGIN_IS_BRIDGE;
pData->options = optionEn; pData->options = optionEn;


#ifdef HAVE_X11
if (fBridgeVersion < 9) if (fBridgeVersion < 9)
#endif
{
pData->hints &= ~PLUGIN_HAS_CUSTOM_EMBED_UI; pData->hints &= ~PLUGIN_HAS_CUSTOM_EMBED_UI;
}


fInfo.category = static_cast<PluginCategory>(category); fInfo.category = static_cast<PluginCategory>(category);
fInfo.optionsAvailable = optionAv; fInfo.optionsAvailable = optionAv;
@@ -2562,15 +2566,23 @@ public:
fSaved = true; fSaved = true;
break; break;


case kPluginBridgeNonRtServerEmbedUI:
case kPluginBridgeNonRtServerRespEmbedUI:
fPendingEmbedCustomUI = fShmNonRtServerControl.readULong(); fPendingEmbedCustomUI = fShmNonRtServerControl.readULong();
break; break;


case kPluginBridgeNonRtServerResizeEmbedUI: {
const uint width = fShmNonRtServerControl.readUInt();
const uint height = fShmNonRtServerControl.readUInt();
pData->engine->callback(true, true, ENGINE_CALLBACK_EMBED_UI_RESIZED, pData->id, width, height,
0, 0.0f, nullptr);
} break;

case kPluginBridgeNonRtServerUiClosed: case kPluginBridgeNonRtServerUiClosed:
#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
pData->transientTryCounter = 0; pData->transientTryCounter = 0;
#endif #endif
pData->engine->callback(true, true, ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, 0, 0, 0, 0.0f, nullptr);
pData->engine->callback(true, true, ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id,
0, 0, 0, 0.0f, nullptr);
break; break;


case kPluginBridgeNonRtServerError: { case kPluginBridgeNonRtServerError: {


+ 2
- 1
source/backend/plugin/CarlaPluginJack.cpp View File

@@ -1533,7 +1533,8 @@ public:
case kPluginBridgeNonRtServerMidiProgramData: case kPluginBridgeNonRtServerMidiProgramData:
case kPluginBridgeNonRtServerSetCustomData: case kPluginBridgeNonRtServerSetCustomData:
case kPluginBridgeNonRtServerVersion: case kPluginBridgeNonRtServerVersion:
case kPluginBridgeNonRtServerEmbedUI:
case kPluginBridgeNonRtServerRespEmbedUI:
case kPluginBridgeNonRtServerResizeEmbedUI:
break; break;


case kPluginBridgeNonRtServerSetChunkDataFile: case kPluginBridgeNonRtServerSetChunkDataFile:


+ 2
- 1
source/utils/CarlaBridgeDefines.hpp View File

@@ -118,7 +118,8 @@ enum PluginBridgeNonRtServerOpcode {
// stuff added in API 7 // stuff added in API 7
kPluginBridgeNonRtServerVersion, // uint kPluginBridgeNonRtServerVersion, // uint
// stuff added in API 9 // stuff added in API 9
kPluginBridgeNonRtServerEmbedUI, // ulong
kPluginBridgeNonRtServerRespEmbedUI, // ulong
kPluginBridgeNonRtServerResizeEmbedUI, // uint/width, uint/height
}; };


// used for kPluginBridgeNonRtServerPortName // used for kPluginBridgeNonRtServerPortName


+ 4
- 2
source/utils/CarlaBridgeUtils.hpp View File

@@ -202,8 +202,10 @@ const char* PluginBridgeNonRtServerOpcode2str(const PluginBridgeNonRtServerOpcod
return "kPluginBridgeNonRtServerError"; return "kPluginBridgeNonRtServerError";
case kPluginBridgeNonRtServerVersion: case kPluginBridgeNonRtServerVersion:
return "kPluginBridgeNonRtServerVersion"; return "kPluginBridgeNonRtServerVersion";
case kPluginBridgeNonRtServerEmbedUI:
return "kPluginBridgeNonRtServerEmbedUI";
case kPluginBridgeNonRtServerRespEmbedUI:
return "kPluginBridgeNonRtServerRespEmbedUI";
case kPluginBridgeNonRtServerResizeEmbedUI:
return "kPluginBridgeNonRtServerResizeEmbedUI";
} }


carla_stderr("CarlaBackend::PluginBridgeNonRtServerOpcode2str%i) - invalid opcode", opcode); carla_stderr("CarlaBackend::PluginBridgeNonRtServerOpcode2str%i) - invalid opcode", opcode);


Loading…
Cancel
Save