fix ordering of track view list & route list resync in editor, to avoid clearing...
[ardour.git] / gtk2_ardour / vst_pluginui.cc
index 1320ccdc7a03ff3642f1565ef5bc875ed6794944..6e39a0ba703e0bd8af58262d5d991bd3a5892e0b 100644 (file)
@@ -18,6 +18,7 @@
 */
 
 #include <fst.h>
+#include <gtk/gtk.h>
 #include <gtk/gtksocket.h>
 #include <ardour/insert.h>
 #include <ardour/vst_plugin.h>
@@ -38,7 +39,7 @@ VSTPluginUI::VSTPluginUI (boost::shared_ptr<PluginInsert> pi, boost::shared_ptr<
 
        preset_box.pack_end (bypass_button, false, false, 10);
        preset_box.pack_end (save_button, false, false);
-       preset_box.pack_end (combo, false, false);
+       preset_box.pack_end (preset_combo, false, false);
 
        bypass_button.set_active (!insert->active());
        
@@ -57,6 +58,12 @@ VSTPluginUI::get_preferred_height ()
        return vst->fst()->height;
 }
 
+int
+VSTPluginUI::get_preferred_width ()
+{
+       return vst->fst()->width;
+}
+
 int
 VSTPluginUI::package (Gtk::Window& win)
 {
@@ -70,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;
 }
 
@@ -112,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 );
+}