diff --git a/libs/gtkmm2ext/gtkmm2ext/keyboard.h b/libs/gtkmm2ext/gtkmm2ext/keyboard.h index 89679b2c6f..6dd6216f10 100644 --- a/libs/gtkmm2ext/gtkmm2ext/keyboard.h +++ b/libs/gtkmm2ext/gtkmm2ext/keyboard.h @@ -169,7 +169,7 @@ class LIBGTKMM2EXT_API Keyboard : public sigc::trackable, PBD::Stateful static void magic_widget_drop_focus (); static Gtk::Window* get_current_window () { return current_window; }; - static void close_current_dialog (); + static bool close_current_dialog (); static void keybindings_changed (); static void save_keybindings (); @@ -183,6 +183,8 @@ class LIBGTKMM2EXT_API Keyboard : public sigc::trackable, PBD::Stateful static void save_keybindings (std::string const& path); static std::string binding_filename_suffix; + static const int close_window_key; + static guint close_window_modifier; int reset_bindings (); diff --git a/libs/gtkmm2ext/keyboard.cc b/libs/gtkmm2ext/keyboard.cc index 2755d1eb17..65dffbcd5c 100644 --- a/libs/gtkmm2ext/keyboard.cc +++ b/libs/gtkmm2ext/keyboard.cc @@ -121,6 +121,9 @@ Keyboard* Keyboard::_the_keyboard = 0; Gtk::Window* Keyboard::current_window = 0; bool Keyboard::_some_magic_widget_has_focus = false; +const int Keyboard::close_window_key = GDK_w; +guint Keyboard::close_window_modifier = Keyboard::PrimaryModifier; + std::string Keyboard::user_keybindings_path; bool Keyboard::can_save_keybindings = false; bool Keyboard::bindings_changed_after_save_became_legal = false; @@ -309,9 +312,10 @@ Keyboard::snooper (GtkWidget *widget, GdkEventKey *event) */ switch (event->keyval) { - case GDK_w: - close_current_dialog (); - ret = true; + case close_window_key: + if (close_current_dialog ()) { + ret = true; + } break; } } @@ -339,7 +343,7 @@ Keyboard::reset_relevant_modifier_key_mask () RelevantModifierKeysChanged(); /* EMIT SIGNAL */ } -void +bool Keyboard::close_current_dialog () { if (current_window) { @@ -353,7 +357,11 @@ Keyboard::close_current_dialog () pre_dialog_active_window->present (); pre_dialog_active_window = 0; } + + return true; } + + return false; } bool