summaryrefslogtreecommitdiff
path: root/gtk2_ardour/ardour_ui_dialogs.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2013-05-07 13:01:18 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2013-05-07 13:01:26 -0400
commita902737db97e6bdd55493a1536242a26e26a0014 (patch)
tree5aa1cc8abcd0d50bd5245414266dc6cbd6a236fa /gtk2_ardour/ardour_ui_dialogs.cc
parente8301185c0391eafa18a09932bfeb1bd76b4bb04 (diff)
various changes to window visibility mgmt, including use of the mixbus2 code for toggling editor + mixer windows. no longer attempt to track changes made outside of ardour, which is a lost cause
Diffstat (limited to 'gtk2_ardour/ardour_ui_dialogs.cc')
-rw-r--r--gtk2_ardour/ardour_ui_dialogs.cc130
1 files changed, 82 insertions, 48 deletions
diff --git a/gtk2_ardour/ardour_ui_dialogs.cc b/gtk2_ardour/ardour_ui_dialogs.cc
index 2e0d017d0c..ad469ff160 100644
--- a/gtk2_ardour/ardour_ui_dialogs.cc
+++ b/gtk2_ardour/ardour_ui_dialogs.cc
@@ -268,19 +268,21 @@ ARDOUR_UI::goto_editor_window ()
editor->show_window ();
editor->present ();
- flush_pending ();
+ /* mixer should now be on top */
+ WindowManager::instance().set_transient_for (editor);
+ _mixer_on_top = false;
}
void
ARDOUR_UI::goto_mixer_window ()
{
- if (!editor) {
- return;
- }
-
- Glib::RefPtr<Gdk::Window> win = editor->get_window ();
+ Glib::RefPtr<Gdk::Window> win;
Glib::RefPtr<Gdk::Screen> screen;
+ if (editor) {
+ win = editor->get_window ();
+ }
+
if (win) {
screen = win->get_screen();
} else {
@@ -295,10 +297,11 @@ ARDOUR_UI::goto_mixer_window ()
mixer->show_window ();
mixer->present ();
- flush_pending ();
+ /* mixer should now be on top */
+ WindowManager::instance().set_transient_for (mixer);
+ _mixer_on_top = true;
}
-
void
ARDOUR_UI::toggle_mixer_window ()
{
@@ -319,49 +322,80 @@ ARDOUR_UI::toggle_mixer_window ()
void
ARDOUR_UI::toggle_editor_mixer ()
{
- if (editor && mixer) {
-
- if (editor->get_screen() != mixer->get_screen()) {
- // different screens, so don't do anything
- return;
- }
-
- /* See if they are obscuring each other */
-
- 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);
-
- GdkRectangle e;
- GdkRectangle m;
- GdkRectangle r;
-
- e.x = ex;
- e.y = ey;
- e.width = ew;
- e.height = eh;
+ bool obscuring = false;
+ /* currently, if windows are on different
+ screens then we do nothing; but in the
+ future we may want to bring the window
+ to the front or something, so I'm leaving this
+ variable for future use
+ */
+ bool same_screen = true;
+
+ if (editor && mixer) {
- m.x = mx;
- m.y = my;
- m.width = mw;
- m.height = mh;
+ /* remeber: Screen != Monitor (Screen is a separately rendered
+ * continuous geometry that make include 1 or more monitors.
+ */
- if (!gdk_rectangle_intersect (&e, &m, &r)) {
- /* they do not intersect so do not toggle */
- return;
+ if (editor->get_screen() != mixer->get_screen() && (mixer->get_screen() != 0) && (editor->get_screen() != 0)) {
+ // different screens, so don't do anything
+ same_screen = false;
+ } else {
+ // they are on the same screen, see if they are obscuring each other
+
+ 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);
+
+ 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 (mixer && !mixer->not_visible() && mixer->property_has_toplevel_focus()) {
+ if (obscuring && same_screen) {
+ goto_editor_window();
+ }
+ } else if (editor && !editor->not_visible() && editor->property_has_toplevel_focus()) {
+ if (obscuring && same_screen) {
+ goto_mixer_window();
+ }
+ } else if (mixer && mixer->not_visible()) {
+ if (obscuring && same_screen) {
+ goto_mixer_window ();
+ }
+ } else if (editor && editor->not_visible()) {
+ if (obscuring && same_screen) {
+ goto_editor_window ();
+ }
+ } else if (obscuring && same_screen) {
+ //it's unclear what to do here, so just do the opposite of what we did last time (old behavior)
+ if (_mixer_on_top) {
+ goto_editor_window ();
+ } else {
+ goto_mixer_window ();
}
- }
-
- if (mixer && mixer->fully_visible()) {
- goto_editor_window ();
- } else {
- goto_mixer_window ();
- }
+ }
}
void