summaryrefslogtreecommitdiff
path: root/gtk2_ardour/ardour_ui_dialogs.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2015-06-26 23:42:11 +0200
committerRobin Gareus <robin@gareus.org>2015-06-27 01:00:03 +0200
commit4fc3d98af81c09c605048ec981d5f0c9dcd84d28 (patch)
tree02b370eddf3343ef9a7689273b19eb0c3b6c73e6 /gtk2_ardour/ardour_ui_dialogs.cc
parent7be99bf6e4d300b374b1612442f8ae7df37f550b (diff)
update Window > Mixer accordingly
Diffstat (limited to 'gtk2_ardour/ardour_ui_dialogs.cc')
-rw-r--r--gtk2_ardour/ardour_ui_dialogs.cc52
1 files changed, 48 insertions, 4 deletions
diff --git a/gtk2_ardour/ardour_ui_dialogs.cc b/gtk2_ardour/ardour_ui_dialogs.cc
index 6556238240..2530e2fa80 100644
--- a/gtk2_ardour/ardour_ui_dialogs.cc
+++ b/gtk2_ardour/ardour_ui_dialogs.cc
@@ -376,14 +376,58 @@ ARDOUR_UI::goto_mixer_window ()
void
ARDOUR_UI::toggle_mixer_window ()
{
- Glib::RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("toggle-mixer"));
- if (!act) {
+ if (!editor || !mixer) {
+ /* can this really happen?
+ * keyboard shortcut during session close, maybe?
+ */
+#ifndef NDEBUG
+ /* one way to find out: */
+ printf("ARDOUR_UI::toggle_mixer_window: Editor: %p Mixer: %p\n", editor, mixer);
+ PBD::stacktrace (std::cerr, 20);
+ assert (0);
+#endif
return;
}
- Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
+ bool show = false;
+ bool obscuring = false;
+
+ if (mixer->not_visible ()) {
+ show = true;
+ }
+ else if (editor->get_screen() == mixer->get_screen()) {
+ gint ex, ey, ew, eh;
+ gint mx, my, mw, mh;
+
+ editor->get_position (ex, ey);
+ editor->get_size (ew, eh);
+ mixer->get_position (mx, my);
+ mixer->get_size (mw, mh);
- if (tact->get_active()) {
+ GdkRectangle e;
+ GdkRectangle m;
+ GdkRectangle r;
+
+ e.x = ex;
+ e.y = ey;
+ e.width = ew;
+ e.height = eh;
+
+ m.x = mx;
+ m.y = my;
+ m.width = mw;
+ m.height = mh;
+
+ if (gdk_rectangle_intersect (&e, &m, &r)) {
+ obscuring = true;
+ }
+ }
+
+ if (obscuring && editor->property_has_toplevel_focus()) {
+ show = true;
+ }
+
+ if (show) {
goto_mixer_window ();
} else {
mixer->hide ();