mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
Add editor_disable_host_scaling support for CLAP
This commit is contained in:
@@ -236,9 +236,6 @@ clap_plugin_proxy::plugin_get_extension(const struct clap_plugin* plugin,
|
||||
assert(plugin && plugin->plugin_data && id);
|
||||
auto self = static_cast<const clap_plugin_proxy*>(plugin->plugin_data);
|
||||
|
||||
// TODO: When implementing the GUI option, add a `clap_no_scaling` option to
|
||||
// disable HiDPI scaling just like we have for VST3. Or rename the
|
||||
// existing one.
|
||||
const void* extension_ptr = nullptr;
|
||||
if (self->supported_extensions_.supports_audio_ports &&
|
||||
strcmp(id, CLAP_EXT_AUDIO_PORTS) == 0) {
|
||||
|
||||
@@ -420,12 +420,22 @@ void ClapBridge::run() {
|
||||
-> clap::ext::gui::plugin::SetScale::Response {
|
||||
const auto& [instance, _] = get_instance(request.instance_id);
|
||||
|
||||
return main_context_
|
||||
.run_in_context([&, plugin = instance.plugin.get(),
|
||||
gui = instance.extensions.gui]() {
|
||||
return gui->set_scale(plugin, request.scale);
|
||||
})
|
||||
.get();
|
||||
if (config_.editor_disable_host_scaling) {
|
||||
std::cerr << "The host requested the editor GUI to be "
|
||||
"scaled by a factor of "
|
||||
<< request.scale
|
||||
<< ", but the 'editor_disable_host_scaling' "
|
||||
"option is enabled. Ignoring the request."
|
||||
<< std::endl;
|
||||
return false;
|
||||
} else {
|
||||
return main_context_
|
||||
.run_in_context([&, plugin = instance.plugin.get(),
|
||||
gui = instance.extensions.gui]() {
|
||||
return gui->set_scale(plugin, request.scale);
|
||||
})
|
||||
.get();
|
||||
}
|
||||
},
|
||||
[&](const clap::ext::gui::plugin::GetSize& request)
|
||||
-> clap::ext::gui::plugin::GetSize::Response {
|
||||
|
||||
Reference in New Issue
Block a user