13
0

Extremely hacky but somewhat functional passing of keys to VST plugin UIs. Sort-of fixes #3630.

git-svn-id: svn://localhost/ardour2/branches/3.0@8371 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2010-12-29 21:58:44 +00:00
parent fa02a4e61c
commit d367d94c7f
4 changed files with 33 additions and 3 deletions

View File

@ -39,6 +39,7 @@ VSTPluginUI::VSTPluginUI (boost::shared_ptr<PluginInsert> pi, boost::shared_ptr<
preset_box.set_spacing (6);
preset_box.set_border_width (6);
preset_box.pack_end (focus_button, false, false);
preset_box.pack_end (bypass_button, false, false, 10);
preset_box.pack_end (delete_button, false, false);
preset_box.pack_end (save_button, false, false);
@ -134,6 +135,14 @@ VSTPluginUI::configure_handler (GdkEventConfigure* ev, Gtk::Socket *socket)
return false;
}
void
VSTPluginUI::forward_key_event (GdkEventKey* ev)
{
if (ev->type == GDK_KEY_PRESS) {
vst->fst()->pending_key = ev->keyval;
}
}
typedef int (*error_handler_t)( Display *, XErrorEvent *);
static Display *the_gtk_display;
static error_handler_t wine_error_handler;

View File

@ -32,6 +32,9 @@ class VSTPluginUI : public PlugUIBase, public Gtk::VBox
int package (Gtk::Window&);
void forward_key_event (GdkEventKey *);
bool non_gtk_gui () const { return true; }
private:
boost::shared_ptr<ARDOUR::VSTPlugin> vst;
Gtk::Socket socket;

View File

@ -89,6 +89,7 @@ struct _FST
int current_program;
float *want_params;
float *set_params;
int pending_key;
int dispatcher_wantcall;
int dispatcher_opcode;

View File

@ -34,11 +34,11 @@ static int gui_quit = 0;
static LRESULT WINAPI
my_window_proc (HWND w, UINT msg, WPARAM wp, LPARAM lp)
{
#if 0
#if 0
if (msg != WM_TIMER) {
fst_error ("window callback handler, msg = 0x%x win=%p\n", msg, w);
}
#endif
#endif
switch (msg) {
case WM_KEYUP:
@ -73,6 +73,7 @@ fst_new ()
fst->want_program = -1;
fst->want_chunk = 0;
fst->current_program = -1;
fst->pending_key = 0;
return fst;
}
@ -204,10 +205,26 @@ again:
}
pthread_mutex_unlock (&fst->lock);
}
pthread_mutex_unlock (&plugin_mutex);
}
for (fst = fst_first; fst; fst = fst->next) {
if (fst->pending_key) {
msg.message = WM_CHAR;
msg.hwnd = GetFocus ();
msg.wParam = fst->pending_key;
msg.lParam = 0;
DispatchMessageA (&msg);
fst->pending_key = 0;
}
}
}
return 0;