From e9563d14368e0cb27e8affd34d8f76454babd0af Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 4 Jul 2021 12:49:32 +0100 Subject: [PATCH] Directly map VST2 keyup/down to plugin UI events Fixes #296 --- distrho/src/DistrhoUIInternal.hpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/distrho/src/DistrhoUIInternal.hpp b/distrho/src/DistrhoUIInternal.hpp index 3a1234b8..649b8eeb 100644 --- a/distrho/src/DistrhoUIInternal.hpp +++ b/distrho/src/DistrhoUIInternal.hpp @@ -260,7 +260,9 @@ public: void quit() { uiData->window->close(); - uiData->app.quit(); + + if (uiData->app.isStandalone()) + uiData->app.quit(); } #endif @@ -316,20 +318,23 @@ public: return ! uiData->app.isQuiting(); } - bool handlePluginKeyboard(const bool /*press*/, const uint /*key*/, const uint16_t /*mods*/) + bool handlePluginKeyboard(const bool press, const uint key, const uint16_t mods) { -#if 0 /* TODO */ - return glWindow.handlePluginKeyboard(press, key); -#endif - return false; + // TODO also trigger Character input event + Widget::KeyboardEvent ev; + ev.press = press; + ev.key = key; + ev.mod = mods; + return ui->onKeyboard(ev); } - bool handlePluginSpecial(const bool /*press*/, const DGL_NAMESPACE::Key /*key*/, const uint16_t /*mods*/) + bool handlePluginSpecial(const bool press, const DGL_NAMESPACE::Key key, const uint16_t mods) { -#if 0 /* TODO */ - return glWindow.handlePluginSpecial(press, key); -#endif - return false; + Widget::SpecialEvent ev; + ev.press = press; + ev.key = key; + ev.mod = mods; + return ui->onSpecial(ev); } #endif