Implement IPlugView onKey{Up,Down}

This commit is contained in:
Robbert van der Helm
2020-12-21 19:10:29 +01:00
parent d49814d21d
commit 063b480fd0
6 changed files with 96 additions and 6 deletions
+24
View File
@@ -273,6 +273,30 @@ bool Vst3Logger::log_request(bool is_host_vst,
});
}
bool Vst3Logger::log_request(bool is_host_vst,
const YaPlugView::OnKeyDown& request) {
return log_request_base(is_host_vst, [&](auto& message) {
// This static cast is technically not correct of course but it's
// UTF-16, so everything's allowed
message << request.owner_instance_id << ": IPlugView::onKeyDown(key = "
<< static_cast<char>(request.key)
<< ", keyCode = " << request.key_code
<< ", modifiers = " << request.modifiers << ")";
});
}
bool Vst3Logger::log_request(bool is_host_vst,
const YaPlugView::OnKeyUp& request) {
return log_request_base(is_host_vst, [&](auto& message) {
// This static cast is technically not correct of course but it's
// UTF-16, so everything's allowed
message << request.owner_instance_id << ": IPlugView::onKeyUp(key = "
<< static_cast<char>(request.key)
<< ", keyCode = " << request.key_code
<< ", modifiers = " << request.modifiers << ")";
});
}
bool Vst3Logger::log_request(bool is_host_vst,
const YaPlugView::GetSize& request) {
return log_request_base(is_host_vst, [&](auto& message) {
+2
View File
@@ -92,6 +92,8 @@ class Vst3Logger {
bool log_request(bool is_host_vst, const YaPlugView::Attached&);
bool log_request(bool is_host_vst, const YaPlugView::Removed&);
bool log_request(bool is_host_vst, const YaPlugView::OnWheel&);
bool log_request(bool is_host_vst, const YaPlugView::OnKeyDown&);
bool log_request(bool is_host_vst, const YaPlugView::OnKeyUp&);
bool log_request(bool is_host_vst, const YaPlugView::GetSize&);
bool log_request(bool is_host_vst, const YaPluginBase::Initialize&);
bool log_request(bool is_host_vst, const YaPluginBase::Terminate&);
+2
View File
@@ -81,6 +81,8 @@ using ControlRequest = std::variant<Vst3PlugViewProxy::Destruct,
YaPlugView::Attached,
YaPlugView::Removed,
YaPlugView::OnWheel,
YaPlugView::OnKeyDown,
YaPlugView::OnKeyUp,
YaPlugView::GetSize,
YaPluginBase::Initialize,
YaPluginBase::Terminate,
@@ -149,9 +149,55 @@ class YaPlugView : public Steinberg::IPlugView {
};
virtual tresult PLUGIN_API onWheel(float distance) override = 0;
/**
* Message to pass through a call to `IPlugView::onKeyDown(key, keyCode,
* modifiers)` to the Wine plugin host.
*/
struct OnKeyDown {
using Response = UniversalTResult;
native_size_t owner_instance_id;
char16 key;
int16 key_code;
int16 modifiers;
template <typename S>
void serialize(S& s) {
s.value8b(owner_instance_id);
s.value2b(key);
s.value2b(key_code);
s.value2b(modifiers);
}
};
virtual tresult PLUGIN_API onKeyDown(char16 key,
int16 keyCode,
int16 modifiers) override = 0;
/**
* Message to pass through a call to `IPlugView::onKeyUp(key, keyCode,
* modifiers)` to the Wine plugin host.
*/
struct OnKeyUp {
using Response = UniversalTResult;
native_size_t owner_instance_id;
char16 key;
int16 key_code;
int16 modifiers;
template <typename S>
void serialize(S& s) {
s.value8b(owner_instance_id);
s.value2b(key);
s.value2b(key_code);
s.value2b(modifiers);
}
};
virtual tresult PLUGIN_API onKeyUp(char16 key,
int16 keyCode,
int16 modifiers) override = 0;