View Issue Details

IDProjectCategoryView StatusLast Update
0002477ardourbugspublic2015-09-18 15:19
Reportercolinf Assigned Tocth103  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product VersionSVN/2.0-ongoing 
Target Version3.0 
Summary0002477: [PATCH] "Toggle Editor Mixer on Top" doesn't always
Description<Alt>+M to toggle the mixer doesn't quite seem to work properly.

Steps to reproduce:
 - start Ardour
 - <Alt>+M
 - close the mixer window with its close button (or click in the editor window, or <Alt>+<Tab> to the editor window)
 - <Alt>+M again doesn't bring the mixer window back to the front
 - <Alt>+M one more time does, however.

TagsNo tags attached.

Activities

cth103

2008-11-29 18:54

administrator   ~0005395

Confirmed. It's tricky because the code currently doesn't find about e.g. Alt+Tab, so it doesn't know what's going on.

2008-12-01 18:04

 

toggle-editor-mixer-hack.patch (2,828 bytes)   
Index: gtk2_ardour/ardour_ui.cc
===================================================================
--- gtk2_ardour/ardour_ui.cc	(revision 4277)
+++ gtk2_ardour/ardour_ui.cc	(working copy)
@@ -199,7 +199,6 @@
 	session_loaded = false;
 	last_speed_displayed = -1.0f;
 	ignore_dual_punch = false;
-	_mixer_on_top = false;
 
 	roll_button.unset_flags (Gtk::CAN_FOCUS);
 	stop_button.unset_flags (Gtk::CAN_FOCUS);
Index: gtk2_ardour/ardour_ui.h
===================================================================
--- gtk2_ardour/ardour_ui.h	(revision 4277)
+++ gtk2_ardour/ardour_ui.h	(working copy)
@@ -171,6 +171,8 @@
 	void toggle_route_params_window ();
 	void toggle_editing_space();
 
+	void goto_editor_window ();
+
 	Gtk::Tooltips& tooltips() { return _tooltips; }
 
 	static sigc::signal<void,bool> Blink;
@@ -276,10 +278,8 @@
 
 	Gtk::Tooltips          _tooltips;
 
-	void                goto_editor_window ();
 	void                goto_mixer_window ();
 	void                toggle_editor_mixer_on_top ();
-	bool                _mixer_on_top;
 
 	GlobalClickBox     *online_control_button;
 	vector<string>      online_control_strings;
Index: gtk2_ardour/ardour_ui_dependents.cc
===================================================================
--- gtk2_ardour/ardour_ui_dependents.cc	(revision 4277)
+++ gtk2_ardour/ardour_ui_dependents.cc	(working copy)
@@ -99,7 +99,6 @@
 
 	editor->show_window ();
 	editor->present();
-	_mixer_on_top = false;
 	flush_pending ();
 }
 
@@ -108,18 +107,13 @@
 {
 	mixer->show_window ();
 	mixer->present();
-	_mixer_on_top = true;
 	flush_pending ();
 }
 
 void
 ARDOUR_UI::toggle_editor_mixer_on_top ()
 {
-	if (_mixer_on_top) {
-		goto_editor_window ();
-	} else {
-		goto_mixer_window ();
-	}
+	goto_mixer_window ();
 }
 
 gint
Index: gtk2_ardour/mixer_ui.cc
===================================================================
--- gtk2_ardour/mixer_ui.cc	(revision 4277)
+++ gtk2_ardour/mixer_ui.cc	(working copy)
@@ -200,6 +200,17 @@
 	list_hpane.add1(list_vpacker);
 	list_hpane.add2(global_hpacker);
 
+	/* A hack to make "Toggle Editor Mixer on Top" work better: create an 
+	 * invisible button in the mixer window, with a shortcut key that 
+	 * matches "Toggle Editor Mixer on Top", and make that button bring the
+	 * editor to the top.	 
+	 */	
+	Button *mixer_behind = manage (new Button (_("_M"), true)); 
+	mixer_behind->signal_clicked().connect(mem_fun(ARDOUR_UI::instance(), &ARDOUR_UI::goto_editor_window));
+	mixer_behind->set_size_request(1,1);
+	global_hpacker.pack_end(*mixer_behind, PACK_SHRINK);
+
+
 	rhs_pane1.signal_size_allocate().connect (bind (mem_fun(*this, &Mixer_UI::pane_allocation_handler), 
 							static_cast<Gtk::Paned*> (&rhs_pane1)));
 	list_hpane.signal_size_allocate().connect (bind (mem_fun(*this, &Mixer_UI::pane_allocation_handler), 

toggle-editor-mixer-hack.patch (2,828 bytes)   

colinf

2008-12-01 18:09

updater   ~0005413

OK, here's a hacky patch that makes this work a bit better. It adds a tiny (1x1 pixel) button to the mixer window that brings the editor to the front, and gives the button a shortcut of <Alt>+M.

I'm sure there's a way to do this properly in GTK without resorting to hidden buttons, but I don't know how. However, the principle of having something in the mixer window respond to the accelerator key seems to me to be the right thing to do.

2012-02-14 12:41

 

toggle-editor-mixer-a3.patch (3,510 bytes)   
Index: gtk2_ardour/mixer_ui.cc
===================================================================
--- gtk2_ardour/mixer_ui.cc	(revision 11488)
+++ gtk2_ardour/mixer_ui.cc	(working copy)
@@ -1636,7 +1636,22 @@
 	}
 	
 	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 (k.state() == key.accel_mods && k.key() == key.accel_key) {
+
+			ARDOUR_UI::instance()->goto_editor_window();
+			return true;
+		}
+	} 
+
+
+
+	
 	if (bindings.activate (k, Bindings::Press)) {
 		return true;
 	}
Index: gtk2_ardour/ardour_ui_dependents.cc
===================================================================
--- gtk2_ardour/ardour_ui_dependents.cc	(revision 11488)
+++ gtk2_ardour/ardour_ui_dependents.cc	(working copy)
@@ -133,29 +133,24 @@
 void
 ARDOUR_UI::toggle_mixer_on_top ()
 {
-	Glib::RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("toggle-mixer-on-top"));
-	if (!act) {
-		return;
-	}
 
-	Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
+	// only called if the editor window received the shortcut key or 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.
 
-	if (tact->get_active()) {
+	/* Toggle the mixer to `visible' if required */
+	Glib::RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("toggle-mixer"));
+	if (act) {
+		Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
 
-		/* Toggle the mixer to `visible' if required */
-		act = ActionManager::get_action (X_("Common"), X_("toggle-mixer"));
-		if (act) {
-			tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
-
-			if (!tact->get_active()) {
-				tact->set_active ();
-			}
+		if (!tact->get_active()) {
+			tact->set_active (true);
 		}
-
-		goto_mixer_window ();
-	} else {
-		goto_editor_window ();
 	}
+	goto_mixer_window ();
+	
 }
 
 /** The main editor window has been closed */
Index: gtk2_ardour/ardour_ui_ed.cc
===================================================================
--- gtk2_ardour/ardour_ui_ed.cc	(revision 11488)
+++ gtk2_ardour/ardour_ui_ed.cc	(working copy)
@@ -228,7 +228,7 @@
 	ActionManager::session_sensitive_actions.push_back (act);
 
 	ActionManager::register_toggle_action (common_actions, X_("toggle-mixer"), S_("Window|Mixer"),  sigc::mem_fun(*this, &ARDOUR_UI::toggle_mixer_window));
-	ActionManager::register_toggle_action (common_actions, X_("toggle-mixer-on-top"), _("Mixer on Top"),  sigc::mem_fun(*this, &ARDOUR_UI::toggle_mixer_on_top));
+	ActionManager::register_action (common_actions, X_("toggle-mixer-on-top"), _("Mixer on Top"),  sigc::mem_fun(*this, &ARDOUR_UI::toggle_mixer_on_top));
 	ActionManager::register_toggle_action (common_actions, X_("ToggleRCOptionsEditor"), _("Preferences"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_rc_options_window));
 	ActionManager::register_toggle_action (common_actions, X_("ToggleSessionOptionsEditor"), _("Properties"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_session_options_window));
 	act = ActionManager::register_toggle_action (common_actions, X_("ToggleInspector"), _("Tracks and Busses"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_route_params_window));
toggle-editor-mixer-a3.patch (3,510 bytes)   

colinf

2012-02-14 12:48

updater   ~0012794

Here's an updated go at this for A3. It's still rather a hack, but very slightly less so.

Rather than using a tiny button, it checks in Mixer_UI::on_key_press_event() for the shortcut for 'Mixer on Top', and goes to the editor window in that case.

It also removes the tick box from the 'Mixer on Top' menu item, by making its action not a toggle action, since it's impossible for the tick box to be kept in sync with the actual state of whether the mixer is on top without knowing what the user has done via their window manager, which I don't know how to find out.

I suspect also that this approach may fail dismally in the case that there is a global menu bar for the whole application, as on OS X. I don't have any other better ideas for that case, but maybe someone will think of something.

colinf

2012-02-14 12:56

updater   ~0012795

Ah, and I've just found that something I've done here makes A3 crash on closing the mixer window... Updated patch coming as soon as I can work out what.

colinf

2012-02-14 13:05

updater   ~0012796

Ah, got it. Fixed version attached.

2012-02-14 13:11

 

toggle-editor-mixer-2-a3.patch (4,173 bytes)   
Index: gtk2_ardour/mixer_ui.cc
===================================================================
--- gtk2_ardour/mixer_ui.cc	(revision 11488)
+++ gtk2_ardour/mixer_ui.cc	(working copy)
@@ -1636,7 +1636,22 @@
 	}
 	
 	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 (k.state() == key.accel_mods && k.key() == key.accel_key) {
+
+			ARDOUR_UI::instance()->goto_editor_window();
+			return true;
+		}
+	} 
+
+
+
+	
 	if (bindings.activate (k, Bindings::Press)) {
 		return true;
 	}
Index: gtk2_ardour/ardour_ui_dependents.cc
===================================================================
--- gtk2_ardour/ardour_ui_dependents.cc	(revision 11488)
+++ gtk2_ardour/ardour_ui_dependents.cc	(working copy)
@@ -133,29 +133,24 @@
 void
 ARDOUR_UI::toggle_mixer_on_top ()
 {
-	Glib::RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("toggle-mixer-on-top"));
-	if (!act) {
-		return;
-	}
 
-	Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
+	// only called if the editor window received the shortcut key or 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.
 
-	if (tact->get_active()) {
+	/* Toggle the mixer to `visible' if required */
+	Glib::RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("toggle-mixer"));
+	if (act) {
+		Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
 
-		/* Toggle the mixer to `visible' if required */
-		act = ActionManager::get_action (X_("Common"), X_("toggle-mixer"));
-		if (act) {
-			tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
-
-			if (!tact->get_active()) {
-				tact->set_active ();
-			}
+		if (!tact->get_active()) {
+			tact->set_active (true);
 		}
-
-		goto_mixer_window ();
-	} else {
-		goto_editor_window ();
 	}
+	goto_mixer_window ();
+	
 }
 
 /** The main editor window has been closed */
Index: gtk2_ardour/ardour_ui_ed.cc
===================================================================
--- gtk2_ardour/ardour_ui_ed.cc	(revision 11488)
+++ gtk2_ardour/ardour_ui_ed.cc	(working copy)
@@ -228,7 +228,7 @@
 	ActionManager::session_sensitive_actions.push_back (act);
 
 	ActionManager::register_toggle_action (common_actions, X_("toggle-mixer"), S_("Window|Mixer"),  sigc::mem_fun(*this, &ARDOUR_UI::toggle_mixer_window));
-	ActionManager::register_toggle_action (common_actions, X_("toggle-mixer-on-top"), _("Mixer on Top"),  sigc::mem_fun(*this, &ARDOUR_UI::toggle_mixer_on_top));
+	ActionManager::register_action (common_actions, X_("toggle-mixer-on-top"), _("Mixer on Top"),  sigc::mem_fun(*this, &ARDOUR_UI::toggle_mixer_on_top));
 	ActionManager::register_toggle_action (common_actions, X_("ToggleRCOptionsEditor"), _("Preferences"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_rc_options_window));
 	ActionManager::register_toggle_action (common_actions, X_("ToggleSessionOptionsEditor"), _("Properties"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_session_options_window));
 	act = ActionManager::register_toggle_action (common_actions, X_("ToggleInspector"), _("Tracks and Busses"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_route_params_window));
Index: gtk2_ardour/ardour_ui_mixer.cc
===================================================================
--- gtk2_ardour/ardour_ui_mixer.cc	(revision 11488)
+++ gtk2_ardour/ardour_ui_mixer.cc	(working copy)
@@ -44,7 +44,6 @@
 
 	mixer->signal_window_state_event().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::main_window_state_event_handler), false));
 	mixer->signal_unmap().connect (sigc::bind (sigc::ptr_fun (&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/toggle-mixer")));
-	mixer->signal_unmap().connect (sigc::bind (sigc::ptr_fun (&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/toggle-mixer-on-top")));
 
 	return 0;
 }
toggle-editor-mixer-2-a3.patch (4,173 bytes)   

colinf

2012-05-22 17:39

updater   ~0013276

Does anyone have any thoughts on this? I know the patch isn't perfect (it introduces a warning, for one thing), but it would be nice to see this fixed.

cth103

2012-06-13 21:18

administrator   ~0013513

Applied to SVN 12714. Thanks!

colinf

2012-06-14 10:05

updater   ~0013528

Last edited: 2012-06-14 10:13

Thanks for applying!

A little caution: I have a feeling that r12599 (from 0004808) may not work as intended now: it tries to set the ticked state of the toggle-mixer action that this patch removes.

[EDIT] Ah, no, I think it's OK: this patch removes the tickable property from toggle-mixer-on-top, not toggle-mixer, so all should be well...

colinf

2015-09-18 15:19

updater   ~0017283

Closing old issues reported by me: these have long since been fixed.

Issue History

Date Modified Username Field Change
2008-11-27 19:38 colinf New Issue
2008-11-29 18:54 cth103 Note Added: 0005395
2008-11-29 18:54 cth103 Status new => confirmed
2008-12-01 18:04 colinf File Added: toggle-editor-mixer-hack.patch
2008-12-01 18:09 colinf Note Added: 0005413
2010-04-24 10:28 cth103 Category bugs => bugs2
2010-04-24 10:32 cth103 Category bugs2 => bugs
2012-02-14 12:41 colinf File Added: toggle-editor-mixer-a3.patch
2012-02-14 12:48 colinf Note Added: 0012794
2012-02-14 12:56 colinf Note Added: 0012795
2012-02-14 13:05 colinf Note Added: 0012796
2012-02-14 13:11 colinf File Added: toggle-editor-mixer-2-a3.patch
2012-05-22 17:37 colinf Summary "Toggle Editor Mixer on Top" doesn't always => [PATCH] "Toggle Editor Mixer on Top" doesn't always
2012-05-22 17:39 colinf Note Added: 0013276
2012-05-23 15:05 cth103 cost => 0.00
2012-05-23 15:05 cth103 Target Version => 3.0
2012-06-13 21:18 cth103 Note Added: 0013513
2012-06-13 21:18 cth103 Status confirmed => resolved
2012-06-13 21:18 cth103 Resolution open => fixed
2012-06-13 21:18 cth103 Assigned To => cth103
2012-06-14 10:05 colinf Note Added: 0013528
2012-06-14 10:13 colinf Note Edited: 0013528
2015-09-18 15:19 colinf Note Added: 0017283
2015-09-18 15:19 colinf Status resolved => closed