diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2006-06-22 21:04:47 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2006-06-22 21:04:47 +0000 |
commit | 2b5d095464a28ae680cf4454af99b4debd3bcabf (patch) | |
tree | 4ef4347a5f29e186c7d3e8284e7a3dac222fd157 /gtk2_ardour | |
parent | 58c39d50b11592c0482eb9be460889fc20ba7440 (diff) |
correctly forward configure events to plugin windows, and cleanup FST code
git-svn-id: svn://localhost/ardour2/trunk@635 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/main.cc | 8 | ||||
-rw-r--r-- | gtk2_ardour/plugin_ui.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/vst_pluginui.cc | 37 |
3 files changed, 17 insertions, 30 deletions
diff --git a/gtk2_ardour/main.cc b/gtk2_ardour/main.cc index 0a07da0cd2..778355c858 100644 --- a/gtk2_ardour/main.cc +++ b/gtk2_ardour/main.cc @@ -103,12 +103,6 @@ handler (int sig) shutdown (1); } -static void -handler2 (int sig, siginfo_t* ctxt, void* ignored) -{ - handler (sig); -} - static void * signal_thread (void *arg) { @@ -452,7 +446,7 @@ int main (int argc, char *argv[]) try { engine = new ARDOUR::AudioEngine (jack_client_name); - ARDOUR::init (*engine, use_vst, try_hw_optimization, handler2); + ARDOUR::init (*engine, use_vst, try_hw_optimization); ui->set_engine (*engine); } catch (AudioEngine::NoBackendAvailable& err) { gui_jack_error (); diff --git a/gtk2_ardour/plugin_ui.h b/gtk2_ardour/plugin_ui.h index 958b7995c6..e5800e8ece 100644 --- a/gtk2_ardour/plugin_ui.h +++ b/gtk2_ardour/plugin_ui.h @@ -228,7 +228,7 @@ class VSTPluginUI : public PlugUIBase, public Gtk::VBox Gtk::HBox preset_box; Gtk::VBox vpacker; - gboolean configure_handler (GdkEventConfigure*, Gtk::Socket*); + bool configure_handler (GdkEventConfigure*, Gtk::Socket*); void save_plugin_setting (); }; #endif diff --git a/gtk2_ardour/vst_pluginui.cc b/gtk2_ardour/vst_pluginui.cc index fae211f424..7adf702f4d 100644 --- a/gtk2_ardour/vst_pluginui.cc +++ b/gtk2_ardour/vst_pluginui.cc @@ -19,7 +19,7 @@ */ #include <fst.h> - +#include <gtk/gtksocket.h> #include <ardour/insert.h> #include <ardour/vst_plugin.h> @@ -61,16 +61,12 @@ VSTPluginUI::get_preferred_height () int VSTPluginUI::package (Gtk::Window& win) { - /* for GTK+2, remove this: you cannot add to a realized socket */ - - //socket.realize (); - /* forward configure events to plugin window */ - win.signal_configure_event().connect (bind (mem_fun (*this, &VSTPluginUI::configure_handler), &socket)); + win.signal_configure_event().connect (bind (mem_fun (*this, &VSTPluginUI::configure_handler), &socket), false); - /* XXX in GTK2, use add_id() instead of steal, although add_id() - assumes that the window's owner understands the XEmbed protocol. + /* + this assumes that the window's owner understands the XEmbed protocol. */ socket.add_id (fst_get_XID (vst.fst())); @@ -78,45 +74,42 @@ VSTPluginUI::package (Gtk::Window& win) return 0; } -gboolean +bool VSTPluginUI::configure_handler (GdkEventConfigure* ev, Gtk::Socket *socket) { XEvent event; - gint x, y; + GdkWindow* w; - if (socket->gobj() == NULL) { - return FALSE; + if (socket == 0 || ((w = socket->gobj()->plug_window) == 0)) { + return false; } event.xconfigure.type = ConfigureNotify; - event.xconfigure.event = GDK_WINDOW_XWINDOW (socket->get_window()->gobj()); - event.xconfigure.window = GDK_WINDOW_XWINDOW (socket->get_window()->gobj()); + event.xconfigure.event = GDK_WINDOW_XWINDOW (w); + event.xconfigure.window = GDK_WINDOW_XWINDOW (w); /* The ICCCM says that synthetic events should have root relative * coordinates. We still aren't really ICCCM compliant, since * we don't send events when the real toplevel is moved. */ gdk_error_trap_push (); - gdk_window_get_origin (socket->get_window()->gobj(), &x, &y); + gdk_window_get_origin (w, &x, &y); gdk_error_trap_pop (); event.xconfigure.x = x; event.xconfigure.y = y; - event.xconfigure.width = GTK_WIDGET(socket)->allocation.width; - event.xconfigure.height = GTK_WIDGET(socket)->allocation.height; + event.xconfigure.width = GTK_WIDGET(socket->gobj())->allocation.width; + event.xconfigure.height = GTK_WIDGET(socket->gobj())->allocation.height; event.xconfigure.border_width = 0; event.xconfigure.above = None; event.xconfigure.override_redirect = False; gdk_error_trap_push (); - XSendEvent (GDK_WINDOW_XDISPLAY (socket->get_window()->gobj()), - GDK_WINDOW_XWINDOW (socket->get_window()->gobj()), - False, StructureNotifyMask, &event); - // gdk_display_sync (GDK_WINDOW_XDISPLAY (socket->plug_window)); + XSendEvent (GDK_WINDOW_XDISPLAY (w), GDK_WINDOW_XWINDOW (w), False, StructureNotifyMask, &event); gdk_error_trap_pop (); - return FALSE; + return false; } |