fix embedded plugin UI keyboard handling
[ardour.git] / gtk2_ardour / plugin_ui.cc
index 190fd2ad969bddb5f6b1a0c253fc86aa8ac0fbe0..b4e8e0001efdc62b4690e4afb4680bd519ceafc9 100644 (file)
@@ -73,6 +73,7 @@
 
 using namespace std;
 using namespace ARDOUR;
+using namespace ARDOUR_UI_UTILS;
 using namespace PBD;
 using namespace Gtkmm2ext;
 using namespace Gtk;
@@ -332,6 +333,7 @@ PluginUIWindow::create_lv2_editor(boost::shared_ptr<PluginInsert> insert)
                _pluginui = lpu;
                add (*lpu);
                lpu->package (*this);
+               _pluginui->KeyboardFocused.connect (sigc::mem_fun (*this, &PluginUIWindow::keyboard_focused));
        }
 
        return true;
@@ -351,6 +353,7 @@ PluginUIWindow::on_key_press_event (GdkEventKey* event)
 {
        if (_keyboard_focused) {
                if (_pluginui) {
+                       _pluginui->grab_focus();
                        if (_pluginui->non_gtk_gui()) {
                                _pluginui->forward_key_event (event);
                        } else {
@@ -364,6 +367,7 @@ PluginUIWindow::on_key_press_event (GdkEventKey* event)
                */
 
                if (_pluginui) {
+                       _pluginui->grab_focus();
                        if (_pluginui->non_gtk_gui()) {
                                /* pass editor window as the window for the event
                                   to be handled in, not this one, because there are
@@ -447,7 +451,7 @@ PlugUIBase::PlugUIBase (boost::shared_ptr<PluginInsert> pi)
        bypass_button.set_name ("plugin bypass button");
        bypass_button.set_text (_("Bypass"));
        bypass_button.set_active (!pi->active());
-       bypass_button.signal_button_release_event().connect (sigc::mem_fun(*this, &PlugUIBase::bypass_button_release));
+       bypass_button.signal_button_release_event().connect (sigc::mem_fun(*this, &PlugUIBase::bypass_button_release), false);
        focus_button.add_events (Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK);
 
        focus_button.signal_button_release_event().connect (sigc::mem_fun(*this, &PlugUIBase::focus_toggled));