fix embedded plugin UI keyboard handling

When the GUI is opened the first time all is fine, focus is on the
embedded widget. However once a user presses one of the preset buttons
(Add, Save,...) there is no possibility to return focus to the
embedded widget. Ardour always 'sees' it as focus=GtkButton and passes
the event to the editor.
This commit is contained in:
Robin Gareus 2015-02-21 03:16:04 +01:00
parent 642e4950b9
commit a0eeb80885
6 changed files with 24 additions and 1 deletions

View file

@ -341,6 +341,8 @@ LV2PluginUI::lv2ui_instantiate(const std::string& title)
container->add(*Gtk::manage(Glib::wrap(c_widget)));
}
container->show_all();
gtk_widget_set_can_focus(c_widget, true);
gtk_widget_grab_focus(c_widget);
} else {
_external_ui_ptr = (struct lv2_external_ui*)GET_WIDGET(_inst);
}
@ -368,6 +370,15 @@ LV2PluginUI::lv2ui_instantiate(const std::string& title)
}
}
void
LV2PluginUI::grab_focus()
{
if (_inst && !_lv2->is_external_ui()) {
GtkWidget* c_widget = (GtkWidget*)GET_WIDGET(_inst);
gtk_widget_grab_focus(c_widget);
}
}
void
LV2PluginUI::lv2ui_free()
{