Currently I'm fighting with the connectivity between JUCE example host and VST plugins that use LV2 interface.
The main problem is that the events sent by juce_VSTPluginFormat.cpp are not delivered to any of GTK widgets. The behaviour is strange: widgets don't receive button-press-event but always receive button-release-event. Sometimes they receive button-press-event, but it depends on the target platform. I've just added printf for debugging.
Here's the code from JUCE:
Code: Select all
void mouseDown (const MouseEvent& e) override
{
ignoreUnused (e);
#if JUCE_LINUX
printf("mouseDown event, pluginWindow = %x\n", int(pluginWindow));
if (pluginWindow == 0)
return;
toFront (true);
printf("Pass X event to child\n");
XEvent ev;
prepareXEvent (ev, e);
ev.xbutton.type = ButtonPress;
translateJuceToXButtonModifiers (e, ev);
sendEventToChild (ev);
#elif JUCE_WINDOWS
toFront (true);
#endif
}
Code: Select all
pWidget = gtk_window_new (GTK_WINDOW_TOPLEVEL);
if (pWidget == NULL)
return false;
// Realize GTK window
if (!gtk_widget_get_realized(pWidget))
{
gtk_widget_realize(pWidget);
g_assert(gtk_widget_get_realized(pWidget));
}
lsp_trace("set attributes pWidget=%p", pWidget);
gchar *title = g_strdup_printf(LSP_ACRONYM " %s - %s [VST]", m->name, m->description);
gtk_window_set_title(GTK_WINDOW(pWidget), title);
gtk_window_set_default_size (GTK_WINDOW (pWidget), 64, 64);
gtk_container_set_border_width (GTK_CONTAINER (pWidget), 0);
g_free(title);
// Get widget
lsp_trace("create widget hierarchy root=%p", wf->root_widget());
pUIWidget = reinterpret_cast<GtkWidget *>(wf->root_widget());
gtk_container_add(GTK_CONTAINER(pWidget), pUIWidget);
// Reparent window
gdk_display_sync(gdk_display_get_default());
pParent = gdk_window_foreign_new(GdkNativeWindow(uintptr_t(wnd)));
g_assert(pParent);
gdk_window_reparent(gtk_widget_get_window(pWidget), pParent, 0, 0);
// Show window
lsp_trace("create widget hierarchy pWidget=%p", pWidget);
gtk_widget_show_all(pWidget);
gdk_display_sync(gdk_display_get_default());
Also the same problem is with AMSynth from where I took the reparent example.