Add the base for GUI handling

Still need to embed the opened window into the window provided by the
host.
This commit is contained in:
Robbert van der Helm
2020-03-17 01:50:50 +01:00
parent 44a953c2d2
commit e7e1b26455
6 changed files with 91 additions and 27 deletions
+22 -2
View File
@@ -123,8 +123,28 @@ PluginBridge::PluginBridge(std::string plugin_dll_path,
// lockstep anyway
dispatch_handler = std::thread([&]() {
while (true) {
passthrough_event(host_vst_dispatch, std::nullopt, plugin,
plugin->dispatcher);
passthrough_event(
host_vst_dispatch, std::nullopt, plugin,
[&](AEffect* plugin, int opcode, int index, intptr_t value,
void* data, float option) -> intptr_t {
// TODO: editEffClose
// We have to intercept GUI open calls since we can't use
// the X11 window handle passed by the host
if (opcode == effEditOpen) {
const auto handle = editor.open();
const intptr_t return_value = plugin->dispatcher(
plugin, opcode, index, value, handle, option);
if (return_value == 0) {
return 0;
}
// TODO: Return X11 handle
return return_value;
}
return plugin->dispatcher(plugin, opcode, index, value,
data, option);
});
}
});