Prefer key-event dispatch over emulated events for VST plugins.
authorRobin Gareus <robin@gareus.org>
Thu, 1 Nov 2018 18:14:25 +0000 (19:14 +0100)
committerRobin Gareus <robin@gareus.org>
Thu, 1 Nov 2018 19:09:20 +0000 (20:09 +0100)
gtk2_ardour/lxvst_plugin_ui.cc
gtk2_ardour/windows_vst_plugin_ui.cc

index baad5722ad17cc09f265719e53bd34580ff17c16..161ceabe47610b7e070b0183a39ff0ae8b7d5107 100644 (file)
@@ -141,10 +141,10 @@ LXVSTPluginUI::forward_key_event (GdkEventKey* gdk_key)
        xev.xany.send_event = true; /* pretend we are using XSendEvent */
        xev.xany.display = GDK_WINDOW_XDISPLAY (gdk_window->gobj());
 
-       if (!_vst->state()->eventProc) {
-               XSendEvent (xev.xany.display, xev.xany.window, TRUE, mask, &xev);
-       } else {
+       if (_vst->state()->eventProc) {
                _vst->state()->eventProc (&xev);
+       } else if (!dispatch_effeditkey (gdk_key)) {
+               XSendEvent (xev.xany.display, xev.xany.window, TRUE, mask, &xev);
        }
 }
 
index c38b545bf5a809fe7aa897259e64cfc8fde677f4..7d71ef0f7824afed304d0ef7870d8ab8a56aafa0 100644 (file)
@@ -114,6 +114,10 @@ WindowsVSTPluginUI::package (Gtk::Window& win)
 void
 WindowsVSTPluginUI::forward_key_event (GdkEventKey* ev)
 {
+       if (dispatch_effeditkey (ev)) {
+               return;
+       }
+#ifndef PLATFORM_WINDOWS /* linux + wine ; libs/fst/vstwin.c */
        if (ev->type != GDK_KEY_PRESS) {
                return;
        }
@@ -156,6 +160,7 @@ WindowsVSTPluginUI::forward_key_event (GdkEventKey* ev)
        fst->n_pending_keys++;
 
        pthread_mutex_unlock (&fst->lock);
+#endif
 }
 
 int