diff options
Diffstat (limited to 'gtk2_ardour/plugin_selector.cc')
-rw-r--r-- | gtk2_ardour/plugin_selector.cc | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/gtk2_ardour/plugin_selector.cc b/gtk2_ardour/plugin_selector.cc index 20db1b3944..2ebaaae100 100644 --- a/gtk2_ardour/plugin_selector.cc +++ b/gtk2_ardour/plugin_selector.cc @@ -141,6 +141,7 @@ PluginSelector::PluginSelector (PluginManager *mgr) set_response_sensitive (RESPONSE_APPLY, false); get_vbox()->pack_start (*table); + // Notebook tab order must be the same in here as in set_correct_focus() using namespace Gtk::Notebook_Helpers; notebook.pages().push_back (TabElem (lscroller, _("LADSPA"))); @@ -161,6 +162,7 @@ PluginSelector::PluginSelector (PluginManager *mgr) ladspa_display.signal_button_press_event().connect_notify (mem_fun(*this, &PluginSelector::row_clicked)); ladspa_display.get_selection()->signal_changed().connect (mem_fun(*this, &PluginSelector::ladspa_display_selection_changed)); + ladspa_display.grab_focus(); #ifdef VST_SUPPORT if (Config->get_use_vst()) { @@ -188,6 +190,43 @@ PluginSelector::PluginSelector (PluginManager *mgr) #ifdef HAVE_COREAUDIO au_refiller (); #endif + + signal_show().connect (mem_fun (*this, &PluginSelector::set_correct_focus)); +} + +/** + * Makes sure keyboard focus is always in the plugin list + * of the selected notebook tab. + **/ +void +PluginSelector::set_correct_focus() +{ + int cp = notebook.get_current_page(); + + if (cp == 0) { + ladspa_display.grab_focus(); + return; + } + +#ifdef VST_SUPPORT + if (Config->get_use_vst()) { + cp--; + + if (cp == 0) { + vst_display.grab_focus(); + return; + } + } +#endif + +#ifdef HAVE_COREAUDIO + cp--; + + if (cp == 0) { + au_display.grab_focus(); + return; + } +#endif; } void |