A (hopefully) better fix for toggle-mixer-on-top, using gtk_window_is_active() to work out whether the mixer is already on top.
git-svn-id: svn://localhost/ardour2/branches/3.0@12952 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
266030b79c
commit
5ba1996fd7
@ -259,8 +259,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
|
|||||||
void get_process_buffers ();
|
void get_process_buffers ();
|
||||||
void drop_process_buffers ();
|
void drop_process_buffers ();
|
||||||
|
|
||||||
void goto_editor_window ();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class PublicEditor;
|
friend class PublicEditor;
|
||||||
|
|
||||||
@ -286,9 +284,10 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
|
|||||||
ARDOUR::AudioEngine *engine;
|
ARDOUR::AudioEngine *engine;
|
||||||
Gtk::Tooltips _tooltips;
|
Gtk::Tooltips _tooltips;
|
||||||
|
|
||||||
void goto_mixer_window ();
|
void goto_editor_window ();
|
||||||
void toggle_mixer_window ();
|
void goto_mixer_window ();
|
||||||
void toggle_mixer_on_top ();
|
void toggle_mixer_window ();
|
||||||
|
void toggle_mixer_on_top ();
|
||||||
|
|
||||||
int setup_windows ();
|
int setup_windows ();
|
||||||
void setup_transport ();
|
void setup_transport ();
|
||||||
|
@ -133,25 +133,21 @@ ARDOUR_UI::toggle_mixer_window ()
|
|||||||
void
|
void
|
||||||
ARDOUR_UI::toggle_mixer_on_top ()
|
ARDOUR_UI::toggle_mixer_on_top ()
|
||||||
{
|
{
|
||||||
/* Only called if the editor window received the shortcut key or if selected
|
|
||||||
from the editor window menu, so the mixer is definitely not on top, and
|
|
||||||
we can unconditionally make it so here.
|
|
||||||
|
|
||||||
XXX this might not work so well where there is a global menu bar, e.g.
|
|
||||||
on OS X.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Toggle the mixer to `visible' if required */
|
if (gtk_window_is_active(Mixer_UI::instance()->gobj())) {
|
||||||
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("toggle-mixer"));
|
goto_editor_window ();
|
||||||
if (act) {
|
} else {
|
||||||
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
|
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("toggle-mixer"));
|
||||||
|
if (act) {
|
||||||
|
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
|
||||||
|
|
||||||
if (!tact->get_active()) {
|
/* Toggle the mixer to `visible' if required */
|
||||||
tact->set_active (true);
|
if (!tact->get_active ()) {
|
||||||
|
tact->set_active (true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
goto_mixer_window ();
|
||||||
}
|
}
|
||||||
|
|
||||||
goto_mixer_window ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The main editor window has been closed */
|
/** The main editor window has been closed */
|
||||||
|
@ -1565,25 +1565,13 @@ Mixer_UI::on_key_press_event (GdkEventKey* ev)
|
|||||||
if (gtk_window_propagate_key_event (GTK_WINDOW(gobj()), ev)) {
|
if (gtk_window_propagate_key_event (GTK_WINDOW(gobj()), ev)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyboardKey k (ev->state, ev->keyval);
|
KeyboardKey k (ev->state, ev->keyval);
|
||||||
|
|
||||||
GtkAccelKey key;
|
|
||||||
|
|
||||||
/* Handle toggle-mixer-on-top here, so it can do a different thing if the
|
|
||||||
mixer is already on top and received this key press.
|
|
||||||
*/
|
|
||||||
if (gtk_accel_map_lookup_entry("<Actions>/Common/toggle-mixer-on-top", &key)) {
|
|
||||||
if (int (k.state()) == key.accel_mods && k.key() == key.accel_key) {
|
|
||||||
ARDOUR_UI::instance()->goto_editor_window();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bindings.activate (k, Bindings::Press)) {
|
if (bindings.activate (k, Bindings::Press)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return forward_key_press (ev);
|
return forward_key_press (ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user