os x: an initial attempt at fixing loss of keyboard focus after cmd-w to close dialog

This commit is contained in:
Paul Davis 2016-02-22 11:48:26 -05:00
parent 100e156727
commit 3a08ac5e1f
4 changed files with 23 additions and 0 deletions

View file

@ -391,6 +391,8 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
keyboard->set_state (*node, Stateful::loading_state_version);
}
keyboard->GrabFocus.connect (sigc::mem_fun (*this, &ARDOUR_UI::grab_focus_after_dialog));
/* we don't like certain modifiers */
Bindings::set_ignored_state (GDK_LOCK_MASK|GDK_MOD2_MASK|GDK_MOD3_MASK);
@ -5068,3 +5070,13 @@ ARDOUR_UI::cancel_solo ()
_session->clear_all_solo_state (_session->get_routes()); // safeguard, ideally this won't do anything, check the log-window
}
}
void
ARDOUR_UI::grab_focus_after_dialog ()
{
if (mixer && mixer->fully_visible()) {
mixer->grab_focus ();
} else if (editor) {
editor->grab_focus ();
}
}

View file

@ -795,6 +795,8 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
void audioengine_became_silent ();
DuplicateRouteDialog* duplicate_routes_dialog;
void grab_focus_after_dialog ();
};
#endif /* __ardour_gui_h__ */

View file

@ -179,6 +179,7 @@ class LIBGTKMM2EXT_API Keyboard : public sigc::trackable, PBD::Stateful
};
sigc::signal0<void> ZoomVerticalModifierReleased;
sigc::signal0<void> GrabFocus;
protected:
static Keyboard* _the_keyboard;

View file

@ -432,6 +432,14 @@ Keyboard::close_current_dialog ()
if (current_window) {
current_window->hide ();
current_window = 0;
#ifdef __APPLE__
/* Since Apple users has a basically unconfigurable window
manager, and since users there cannot use
focus-follows-mouse, we force focus back to some application
"main window" after closing a dialog via Primary-w.
*/
GrabFocus ();
#endif
}
}