summaryrefslogtreecommitdiff
path: root/gtk2_ardour/windows_vst_plugin_ui.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2017-03-07 18:38:01 +0100
committerRobin Gareus <robin@gareus.org>2017-03-08 13:03:46 +0100
commit819d9fa3cd2421bbf6918e456f443cfe86f635de (patch)
treea064e022b10b7bd7164f502e9dcc5a807d07ece9 /gtk2_ardour/windows_vst_plugin_ui.cc
parent4b982ef895e1e5d36b0be0b20e7a2810e3f16945 (diff)
VST UI sizeing rework
* prefer signal over timer-poll for VST size changes * properly offset VST window (Windows) * constrain window size (Windows) * explicitly notify re-parent'ed child window (Linux)
Diffstat (limited to 'gtk2_ardour/windows_vst_plugin_ui.cc')
-rw-r--r--gtk2_ardour/windows_vst_plugin_ui.cc41
1 files changed, 39 insertions, 2 deletions
diff --git a/gtk2_ardour/windows_vst_plugin_ui.cc b/gtk2_ardour/windows_vst_plugin_ui.cc
index 7f14819986..c38b545bf5 100644
--- a/gtk2_ardour/windows_vst_plugin_ui.cc
+++ b/gtk2_ardour/windows_vst_plugin_ui.cc
@@ -20,7 +20,8 @@
#include <gtkmm.h>
#include <gtk/gtk.h>
#include <gtk/gtksocket.h>
-#include <fst.h>
+#include "gtkmm2ext/gui_thread.h"
+#include "fst.h"
#include "ardour/plugin_insert.h"
#include "ardour/windows_vst_plugin.h"
@@ -64,12 +65,48 @@ WindowsVSTPluginUI::~WindowsVSTPluginUI ()
// and then our PluginUIWindow does the rest
}
+void
+WindowsVSTPluginUI::top_box_allocated (Gtk::Allocation& a)
+{
+ int h = a.get_height() + 12; // 2 * 6px spacing
+ if (_vst->state()->voffset != h) {
+#ifndef NDEBUG
+ printf("WindowsVSTPluginUI:: update voffset to %d px\n", h);
+#endif
+ _vst->state()->voffset = h;
+ resize_callback ();
+ }
+}
+
+void
+WindowsVSTPluginUI::resize_callback ()
+{
+ void* gtk_parent_window = _vst->state()->gtk_window_parent;
+ if (gtk_parent_window) {
+ int width = _vst->state()->width + _vst->state()->hoffset;
+ int height = _vst->state()->height + _vst->state()->voffset;
+#ifndef NDEBUG
+ printf ("WindowsVSTPluginUI::resize_callback %d x %d\n", width, height);
+#endif
+ set_size_request (width, height);
+ ((Gtk::Window*) gtk_parent_window)->set_size_request (width, height);
+ ((Gtk::Window*) gtk_parent_window)->resize (width, height);
+ fst_move_window_into_view (_vst->state ());
+ }
+}
+
int
WindowsVSTPluginUI::package (Gtk::Window& win)
{
+#ifndef NDEBUG
+ printf ("WindowsVSTPluginUI::package\n");
+#endif
VSTPluginUI::package (win);
+ _vst->state()->gtk_window_parent = (void*) (&win);
+
+ _vst->VSTSizeWindow.connect (_resize_connection, invalidator (*this), boost::bind (&WindowsVSTPluginUI::resize_callback, this), gui_context());
- fst_move_window_into_view (_vst->state ());
+ resize_callback ();
return 0;
}