1
0
Fork 0

Add the special win32-dpi-aware feature on Windows

This commit is contained in:
Robbert van der Helm 2022-03-05 16:01:58 +01:00
parent 9267a8371c
commit 79ab0cd7ed
2 changed files with 12 additions and 4 deletions

View file

@ -137,9 +137,8 @@ pub trait ClapPlugin: Plugin {
const CLAP_DESCRIPTION: &'static str; const CLAP_DESCRIPTION: &'static str;
/// Arbitrary keywords describing the plugin. See the CLAP specification for examples: /// Arbitrary keywords describing the plugin. See the CLAP specification for examples:
/// <https://github.com/free-audio/clap/blob/main/include/clap/plugin.h>. /// <https://github.com/free-audio/clap/blob/main/include/clap/plugin.h>.
// ///
// TODO: CLAP mentions that `win32-dpi-aware` is a special keyword that informs the host that /// On windows `win32-dpi-aware` is automatically added.
// the plugin is DPI aware, can and should we have special handling for this?
const CLAP_FEATURES: &'static [&'static str]; const CLAP_FEATURES: &'static [&'static str];
/// A URL to the plugin's manual, CLAP does not specify what to do when there is none. /// A URL to the plugin's manual, CLAP does not specify what to do when there is none.
// //

View file

@ -60,7 +60,16 @@ impl<P: ClapPlugin> Default for PluginDescriptor<P> {
_phantom: PhantomData, _phantom: PhantomData,
}; };
// The keyword list is an environ-like list of char pointers terminated by a null pointer // The keyword list is an environ-like list of char pointers terminated by a null pointer.
// On Windows `win32-dpi-aware` is a special value informing the host that the plugin is
// DPI-aware.
// TODO: Is this actually what we want? What happens if we don't add it? If this means that
// we need to do our own DPI handling instead of the host passing a scale then we
// don't want that of course.
#[cfg(target_os = "windows")]
descriptor
.clap_features
.push(CString::new("win32-dpi-aware").unwrap());
let mut clap_features_ptrs: Vec<*const c_char> = descriptor let mut clap_features_ptrs: Vec<*const c_char> = descriptor
.clap_features .clap_features
.iter() .iter()