diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-05-20 02:16:05 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-05-20 02:16:05 +0000 |
commit | 8730620fed4576c732c8818625861ad515fa3eb6 (patch) | |
tree | 8e35ea428401823730c8b6b83734d7468f680128 /gtk2_ardour/plugin_ui.cc | |
parent | c22d09f9ca90f14e5c8b3aa73313304d3f9bd460 (diff) |
make AU Cocoa plugin views with "client-side-windows" versions of GTK+; make keyboard event forwarding work for AU Cocoa plugin views
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@7124 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/plugin_ui.cc')
-rw-r--r-- | gtk2_ardour/plugin_ui.cc | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/gtk2_ardour/plugin_ui.cc b/gtk2_ardour/plugin_ui.cc index 7cdd132d8a..4a006a1d45 100644 --- a/gtk2_ardour/plugin_ui.cc +++ b/gtk2_ardour/plugin_ui.cc @@ -71,8 +71,8 @@ PluginUIWindow::PluginUIWindow (Gtk::Window* win, boost::shared_ptr<PluginInsert : parent (win) { bool have_gui = false; - non_gtk_gui = false; was_visible = false; + _keyboard_focused = false; if (insert->plugin()->has_editor()) { switch (insert->type()) { @@ -110,6 +110,7 @@ PluginUIWindow::PluginUIWindow (Gtk::Window* win, boost::shared_ptr<PluginInsert GenericPluginUI* pu = new GenericPluginUI (insert, scrollable); _pluginui = pu; + _pluginui->KeyboardFocused.connect (sigc::mem_fun (*this, &PluginUIWindow::keyboard_focused)); add (*pu); set_wmclass (X_("ardour_plugin_editor"), PROGRAM_NAME); @@ -243,11 +244,11 @@ PluginUIWindow::create_vst_editor(boost::shared_ptr<PluginInsert> insert) VSTPluginUI* vpu = new VSTPluginUI (insert, vp); _pluginui = vpu; + _pluginui->KeyboardFocused.connect (sigc::mem_fun (*this, &PluginUIWindow::keyboard_focused)); add (*vpu); vpu->package (*this); } - non_gtk_gui = true; return true; #endif } @@ -260,8 +261,8 @@ PluginUIWindow::create_audiounit_editor (boost::shared_ptr<PluginInsert> insert) #else VBox* box; _pluginui = create_au_gui (insert, &box); + _pluginui->KeyboardFocused.connect (sigc::mem_fun (*this, &PluginUIWindow::keyboard_focused)); add (*box); - non_gtk_gui = true; Application::instance()->ActivationChanged.connect (mem_fun (*this, &PluginUIWindow::app_activated)); @@ -309,21 +310,40 @@ PluginUIWindow::create_lv2_editor(boost::shared_ptr<PluginInsert> insert) lpu->package (*this); } - non_gtk_gui = false; return true; #endif } +void +PluginUIWindow::keyboard_focused (bool yn) +{ + _keyboard_focused = yn; +} + bool PluginUIWindow::on_key_press_event (GdkEventKey* event) { - return relay_key_press (event, this); + if (_keyboard_focused) { + if (_pluginui) { + _pluginui->forward_key_event (event); + } + return true; + } else { + return relay_key_press (event, this); + } } bool PluginUIWindow::on_key_release_event (GdkEventKey* event) { - return true; + if (_keyboard_focused) { + if (_pluginui) { + _pluginui->forward_key_event (event); + } + return false; + } else { + return true; + } } void @@ -466,12 +486,14 @@ PlugUIBase::focus_toggled (GdkEventButton* ev) focus_button.add (*focus_out_image); focus_out_image->show (); ARDOUR_UI::instance()->set_tip (&focus_button, string_compose (_("Click to allow the plugin to receive keyboard events that %1 would normally use as a shortcut"), PROGRAM_NAME).c_str(), ""); + KeyboardFocused (false); } else { Keyboard::the_keyboard().magic_widget_grab_focus(); focus_button.remove (); focus_button.add (*focus_in_image); focus_in_image->show (); ARDOUR_UI::instance()->set_tip (&focus_button, string_compose (_("Click to allow normal use of %1 keyboard shortcuts"), PROGRAM_NAME).c_str(), ""); + KeyboardFocused (true); } return true; |