diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2009-02-19 14:01:59 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2009-02-19 14:01:59 +0000 |
commit | 7885988df9c4a7690424952d9e8557fc87f3ae18 (patch) | |
tree | f9dacb318cfad5bf07f303e957b43eaf34b2761e /gtk2_ardour | |
parent | ef4e7d7b4c318de046cf91ec93dfbda3eb557bf0 (diff) |
working VST support with VeSTige header and new FST code
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@4637 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/main.cc | 11 | ||||
-rw-r--r-- | gtk2_ardour/vst_pluginui.cc | 28 |
2 files changed, 39 insertions, 0 deletions
diff --git a/gtk2_ardour/main.cc b/gtk2_ardour/main.cc index d9738e9dc0..5d79cf038d 100644 --- a/gtk2_ardour/main.cc +++ b/gtk2_ardour/main.cc @@ -248,10 +248,14 @@ sigpipe_handler (int sig) } #ifdef VST_SUPPORT + +extern int gui_init (int* argc, char** argv[]); + /* this is called from the entry point of a wine-compiled executable that is linked against gtk2_ardour built as a shared library. */ + extern "C" { int ardour_main (int argc, char *argv[]) #else @@ -267,6 +271,13 @@ int main (int argc, char* argv[]) Glib::thread_init(); gtk_set_locale (); +#ifdef VST_SUPPORT + /* this does some magic that is needed to make GTK and Wine's own + X11 client interact properly. + */ + gui_init (&argc, &argv); +#endif + (void) bindtextdomain (PACKAGE, localedir); /* our i18n translations are all in UTF-8, so make sure that even if the user locale doesn't specify UTF-8, diff --git a/gtk2_ardour/vst_pluginui.cc b/gtk2_ardour/vst_pluginui.cc index 6fee847123..6e39a0ba70 100644 --- a/gtk2_ardour/vst_pluginui.cc +++ b/gtk2_ardour/vst_pluginui.cc @@ -18,6 +18,7 @@ */ #include <fst.h> +#include <gtk/gtk.h> #include <gtk/gtksocket.h> #include <ardour/insert.h> #include <ardour/vst_plugin.h> @@ -76,6 +77,8 @@ VSTPluginUI::package (Gtk::Window& win) socket.add_id (fst_get_XID (vst->fst())); + fst_move_window_into_view (vst->fst()); + return 0; } @@ -118,3 +121,28 @@ VSTPluginUI::configure_handler (GdkEventConfigure* ev, Gtk::Socket *socket) return false; } +typedef int (*error_handler_t)( Display *, XErrorEvent *); +static Display *the_gtk_display; +static error_handler_t wine_error_handler; +static error_handler_t gtk_error_handler; + +static int +fst_xerror_handler( Display *disp, XErrorEvent *ev ) +{ + if (disp == the_gtk_display) { + printf ("relaying error to gtk\n"); + return gtk_error_handler (disp, ev); + } else { + printf( "relaying error to wine\n" ); + return wine_error_handler (disp, ev); + } +} + +void +gui_init (int *argc, char **argv[]) +{ + wine_error_handler = XSetErrorHandler (NULL); + gtk_init (argc, argv); + the_gtk_display = gdk_x11_display_get_xdisplay (gdk_display_get_default()); + gtk_error_handler = XSetErrorHandler( fst_xerror_handler ); +} |