summaryrefslogtreecommitdiff
path: root/gtk2_ardour/linux_vst_gui_support.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/linux_vst_gui_support.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/linux_vst_gui_support.cc')
-rw-r--r--gtk2_ardour/linux_vst_gui_support.cc37
1 files changed, 22 insertions, 15 deletions
diff --git a/gtk2_ardour/linux_vst_gui_support.cc b/gtk2_ardour/linux_vst_gui_support.cc
index 240ddc4c70..c51cfa6026 100644
--- a/gtk2_ardour/linux_vst_gui_support.cc
+++ b/gtk2_ardour/linux_vst_gui_support.cc
@@ -33,6 +33,7 @@
#include <glibmm/timer.h>
#include "ardour/linux_vst_support.h"
+#include "ardour/vst_plugin.h"
#include <X11/X.h>
#include <X11/Xlib.h>
@@ -189,31 +190,37 @@ dispatch_x_events (XEvent* event, VSTState* vstfx)
int width = event->xconfigure.width;
int height = event->xconfigure.height;
- /*If we get a config notify on the parent window XID then we need to see
- if the size has been changed - some plugins re-size their UI window e.g.
- when opening a preset manager (you might think that should be spawned as a new window...) */
-
- /*if the size has changed, we flag this so that in lxvst_pluginui.cc we can make the
- change to the GTK parent window in ardour, from its UI thread*/
+ /* If we get a config notify on the parent window XID then we need to see
+ * if the size has been changed - some plugins re-size their UI window e.g.
+ * when opening a preset manager.
+ *
+ * if the size has changed, we flag this so that in lxvst_pluginui.cc
+ * we can make the change to the GTK parent window in ardour, from its UI thread */
if (window == (Window) (vstfx->linux_window)) {
- if (width != vstfx->width || height!=vstfx->height) {
+#ifndef NDEBUG
+ printf("dispatch_x_events: ConfigureNotify cfg:(%d %d) plugin:(%d %d)\n",
+ width, height,
+ vstfx->width, vstfx->height
+ );
+#endif
+ if (width != vstfx->width || height != vstfx->height) {
vstfx->width = width;
vstfx->height = height;
- vstfx->want_resize = 1;
+ ARDOUR::VSTPlugin* plug = (ARDOUR::VSTPlugin *)(vstfx->plugin->user);
+ plug->VSTSizeWindow (); /* EMIT SIGNAL */
+ }
- /*QUIRK : Loomer plugins not only resize the UI but throw it into some random
- position at the same time. We need to re-position the window at the origin of
- the parent window*/
+ /* QUIRK : Loomer plugins not only resize the UI but throw it into some random
+ * position at the same time. We need to re-position the window at the origin of
+ * the parent window*/
- if (vstfx->linux_plugin_ui_window) {
- XMoveWindow (LXVST_XDisplay, vstfx->linux_plugin_ui_window, 0, 0);
- }
+ if (vstfx->linux_plugin_ui_window) {
+ XMoveWindow (LXVST_XDisplay, vstfx->linux_plugin_ui_window, 0, 0);
}
}
break;
-
}
/*Reparent Notify - when the plugin UI is reparented into