mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-06-16 16:33:55 +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);
|
assert(plugin && plugin->plugin_data && id);
|
||||||
auto self = static_cast<const clap_plugin_proxy*>(plugin->plugin_data);
|
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;
|
const void* extension_ptr = nullptr;
|
||||||
if (self->supported_extensions_.supports_audio_ports &&
|
if (self->supported_extensions_.supports_audio_ports &&
|
||||||
strcmp(id, CLAP_EXT_AUDIO_PORTS) == 0) {
|
strcmp(id, CLAP_EXT_AUDIO_PORTS) == 0) {
|
||||||
|
|||||||
@@ -420,12 +420,22 @@ void ClapBridge::run() {
|
|||||||
-> clap::ext::gui::plugin::SetScale::Response {
|
-> clap::ext::gui::plugin::SetScale::Response {
|
||||||
const auto& [instance, _] = get_instance(request.instance_id);
|
const auto& [instance, _] = get_instance(request.instance_id);
|
||||||
|
|
||||||
return main_context_
|
if (config_.editor_disable_host_scaling) {
|
||||||
.run_in_context([&, plugin = instance.plugin.get(),
|
std::cerr << "The host requested the editor GUI to be "
|
||||||
gui = instance.extensions.gui]() {
|
"scaled by a factor of "
|
||||||
return gui->set_scale(plugin, request.scale);
|
<< request.scale
|
||||||
})
|
<< ", but the 'editor_disable_host_scaling' "
|
||||||
.get();
|
"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)
|
[&](const clap::ext::gui::plugin::GetSize& request)
|
||||||
-> clap::ext::gui::plugin::GetSize::Response {
|
-> clap::ext::gui::plugin::GetSize::Response {
|
||||||
|
|||||||
Reference in New Issue
Block a user