From fc9a4754bc4c07836fbe34cec4e93138b036bce4 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 26 Apr 2021 10:50:30 -0600 Subject: [PATCH] allow -w to close the preferences window, just other dialogs Preferences is a tabbable, a leftover artifact of when it was, in fact, intended to be a tabbable. Rather than re-engineer this right now, add a key event handler so that Primary-w works for this just like other dialogs --- gtk2_ardour/rc_option_editor.cc | 14 ++++++++++++++ gtk2_ardour/rc_option_editor.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index f165f00597..e7f29dfcde 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -37,6 +37,7 @@ #include #include +#include "gtkmm2ext/keyboard.h" #include "gtkmm2ext/utils.h" #include "gtkmm2ext/gtk_ui.h" #include "gtkmm2ext/window_title.h" @@ -4461,6 +4462,19 @@ These settings will only take effect after %1 is restarted.\n\ set_current_page (_("General")); } +bool +RCOptionEditor::on_key_release_event (GdkEventKey* event) +{ + if (Keyboard::modifier_state_equals (event->state, Keyboard::close_window_modifier)) { + if (event->keyval == Keyboard::close_window_key) { + WindowProxy::hide (); + return true; + } + } + + return false; +} + void RCOptionEditor::set_session (Session *s) { diff --git a/gtk2_ardour/rc_option_editor.h b/gtk2_ardour/rc_option_editor.h index e175cffea7..bac3d9ebea 100644 --- a/gtk2_ardour/rc_option_editor.h +++ b/gtk2_ardour/rc_option_editor.h @@ -46,6 +46,8 @@ public: Gtk::Window* use_own_window (bool and_fill_it); XMLNode& get_state (); + bool on_key_release_event (GdkEventKey*); + private: void parameter_changed (std::string const &); void ltc_generator_volume_changed ();