13
0

Return key-focus to piano-keyboard

This commit is contained in:
Robin Gareus 2019-10-24 05:13:56 +02:00
parent 406bd1bf07
commit aaae93cae3
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 17 additions and 0 deletions

View File

@ -82,6 +82,8 @@ VirtualKeyboardWindow::VirtualKeyboardWindow ()
_highlight_key_range.set_active (false);
_show_note_label.set_active (true);
_send_panic.set_can_focus (false);
_pitchbend = boost::shared_ptr<VKBDControl> (new VKBDControl ("PB", 8192, 16383));
_pitch_slider = manage (new VSliderController (&_pitch_adjustment, _pitchbend, 0, PX_SCALE (15)));
_pitch_slider_tooltip = new Gtkmm2ext::PersistentTooltip (_pitch_slider);
@ -105,6 +107,7 @@ VirtualKeyboardWindow::VirtualKeyboardWindow ()
set_tooltip (_send_panic, "Send MIDI Panic message for current channel");
_pitch_slider_tooltip->set_tip ("Pitchbend: 8192");
_pitch_slider->set_can_focus (false);
/* config */
Table* cfg_tbl = manage (new Table);
@ -361,6 +364,13 @@ VirtualKeyboardWindow::set_state (const XMLNode& root)
update_octave_key ();
}
bool
VirtualKeyboardWindow::on_focus_in_event (GdkEventFocus *ev)
{
_pianomm->grab_focus ();
return ArdourWindow::on_focus_in_event(ev);
}
void
VirtualKeyboardWindow::on_unmap ()
{
@ -371,6 +381,7 @@ VirtualKeyboardWindow::on_unmap ()
bool
VirtualKeyboardWindow::on_key_press_event (GdkEventKey* ev)
{
_pianomm->grab_focus ();
return ARDOUR_UI_UTILS::relay_key_press (ev, this);
}
@ -411,12 +422,14 @@ void
VirtualKeyboardWindow::update_octave_key ()
{
piano_keyboard_set_octave (_piano, _piano_octave_key.get_value_as_int ());
_pianomm->grab_focus ();
}
void
VirtualKeyboardWindow::update_octave_range ()
{
piano_keyboard_set_octave_range (_piano, _piano_octave_range.get_value_as_int ());
_pianomm->grab_focus ();
}
bool
@ -524,6 +537,7 @@ VirtualKeyboardWindow::update_sensitivity ()
bool c = _yaxis_velocity.get_active ();
_piano_min_velocity.set_sensitive (c);
_piano_max_velocity.set_sensitive (c);
_pianomm->grab_focus ();
}
void

View File

@ -92,6 +92,9 @@ public:
XMLNode& get_state ();
void set_state (const XMLNode&);
protected:
bool on_focus_in_event (GdkEventFocus*);
private:
static void _note_on_event_handler (GtkWidget*, int note, int vel, gpointer arg)
{