diff --git a/distrho/extra/ExternalWindow.hpp b/distrho/extra/ExternalWindow.hpp index 5284ebaf..c4d502e2 100644 --- a/distrho/extra/ExternalWindow.hpp +++ b/distrho/extra/ExternalWindow.hpp @@ -410,6 +410,15 @@ protected: return; (void)winId; } + /** + A callback for host keystrokes. + */ + virtual bool onPluginKeyboard(const bool press, const uint key, const uint16_t mods) + { + // unused, meant for custom implementations + return false; (void)press; (void)key; (void)mods; + } + private: friend class PluginWindow; friend class UI; diff --git a/distrho/src/DistrhoPluginVST2.cpp b/distrho/src/DistrhoPluginVST2.cpp index e8af1507..b0260e03 100644 --- a/distrho/src/DistrhoPluginVST2.cpp +++ b/distrho/src/DistrhoPluginVST2.cpp @@ -190,9 +190,7 @@ public: nullptr, plugin->getInstancePointer(), scaleFactor) -# if !DISTRHO_PLUGIN_HAS_EXTERNAL_UI , fKeyboardModifiers(0) -# endif # if DISTRHO_PLUGIN_WANT_MIDI_INPUT , fNotesRingBuffer() # endif @@ -253,7 +251,6 @@ public: } # endif -# if !DISTRHO_PLUGIN_HAS_EXTERNAL_UI int handlePluginKeyEvent(const bool down, int32_t index, const intptr_t value) { d_stdout("handlePluginKeyEvent %i %i %li\n", down, index, (long int)value); @@ -369,7 +366,6 @@ public: return 0; } -# endif // !DISTRHO_PLUGIN_HAS_EXTERNAL_UI // ------------------------------------------------------------------- @@ -435,9 +431,7 @@ private: // Plugin UI UIExporter fUI; -# if !DISTRHO_PLUGIN_HAS_EXTERNAL_UI uint16_t fKeyboardModifiers; -# endif # if DISTRHO_PLUGIN_WANT_MIDI_INPUT RingBufferControl fNotesRingBuffer; # endif @@ -761,7 +755,6 @@ public: fVstUI->idle(); break; -# if !DISTRHO_PLUGIN_HAS_EXTERNAL_UI case effEditKeyDown: if (fVstUI != nullptr) return fVstUI->handlePluginKeyEvent(true, index, value); @@ -771,7 +764,6 @@ public: if (fVstUI != nullptr) return fVstUI->handlePluginKeyEvent(false, index, value); break; -# endif #endif // DISTRHO_PLUGIN_HAS_UI #if DISTRHO_PLUGIN_WANT_STATE diff --git a/distrho/src/DistrhoUIInternal.hpp b/distrho/src/DistrhoUIInternal.hpp index 591dc992..45e72741 100644 --- a/distrho/src/DistrhoUIInternal.hpp +++ b/distrho/src/DistrhoUIInternal.hpp @@ -257,7 +257,18 @@ public: return ! uiData->app.isQuitting(); } -#if !DISTRHO_PLUGIN_HAS_EXTERNAL_UI +#if DISTRHO_PLUGIN_HAS_EXTERNAL_UI + bool handlePluginKeyboard(const bool press, const uint key, const uint16_t mods) + { + return ui->onPluginKeyboard(press, key, mods); + } + + bool handlePluginSpecial(const bool press, const DGL_NAMESPACE::Key key, const uint16_t mods) + { + // unsupported + return false; (void)press; (void)key; (void)mods; + } +#else bool handlePluginKeyboard(const bool press, const uint key, const uint16_t mods) { // TODO also trigger Character input event