Browse Source

Route VST2 keystrokes to ExternalWindow

pull/314/head
Luciano Iam 4 years ago
parent
commit
4c17fc87d9
3 changed files with 21 additions and 9 deletions
  1. +9
    -0
      distrho/extra/ExternalWindow.hpp
  2. +0
    -8
      distrho/src/DistrhoPluginVST2.cpp
  3. +12
    -1
      distrho/src/DistrhoUIInternal.hpp

+ 9
- 0
distrho/extra/ExternalWindow.hpp View File

@@ -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;


+ 0
- 8
distrho/src/DistrhoPluginVST2.cpp View File

@@ -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<SmallStackBuffer> 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


+ 12
- 1
distrho/src/DistrhoUIInternal.hpp View File

@@ -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


Loading…
Cancel
Save