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_spacing (6);
preset_box.set_border_width (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 (bypass_button, false, false, 10);
preset_box.pack_end (delete_button, false, false); preset_box.pack_end (delete_button, false, false);
preset_box.pack_end (save_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; 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 *); typedef int (*error_handler_t)( Display *, XErrorEvent *);
static Display *the_gtk_display; static Display *the_gtk_display;
static error_handler_t wine_error_handler; static error_handler_t wine_error_handler;

View File

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

View File

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

View File

@ -73,6 +73,7 @@ fst_new ()
fst->want_program = -1; fst->want_program = -1;
fst->want_chunk = 0; fst->want_chunk = 0;
fst->current_program = -1; fst->current_program = -1;
fst->pending_key = 0;
return fst; return fst;
} }
@ -204,10 +205,26 @@ again:
} }
pthread_mutex_unlock (&fst->lock); pthread_mutex_unlock (&fst->lock);
} }
pthread_mutex_unlock (&plugin_mutex); 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; return 0;