View Issue Details

IDProjectCategoryView StatusLast Update
0001277ardourbugspublic2007-07-18 02:56
Reporterb0ef Assigned Totaybin  
PrioritynormalSeverityminorReproducibilityalways
Status assignedResolutionopen 
Summary0001277: Remember Window Positions
DescriptionArdour does not remember window positions. This is a general problem in ardour.

F.ex:

When clicking on a plugin in the mixer strip and then move the window, then close it, ardour does not remember the position of this window when it is reopened
TagsNo tags attached.

Relationships

related to 0001483 closedtimbyr Tim's Tracking bug for proposed updates for 2.1 

Activities

taybin

2006-11-02 03:53

administrator   ~0002539

You are correct.

The Editor and Mixer windows should already have their positions saved. It is up to your windowmanager to respect it though.

b0ef

2006-11-02 11:26

reporter   ~0002574

This is not working here. I'm using metacity-2.12.1

If I f.ex move the mixer and then close it; then open it again with M-m, it does not pop up where I close it.

Same happens with plugin windows.

timbyr

2007-02-10 09:29

developer   ~0003198

I can reproduce this using svn rev 1442. The Mixer window position will be restored between invocations of ardour but not if it is closed and reopened via Alt+M or Windows -> show Mixer

I'm not sure if this is really a bug but I'm attaching a small patch that "fixes" it for me. It needs review and some further testing etc, Taybin perhaps this could go into the 2.1 branch if you think the code is correct?

Fixing this in a more generic way would be better but this might be ok in the meantime.

taybin

2007-02-14 22:07

administrator   ~0003262

timbyr, I'm trying to keep 2.1-staging for just for updating the libraries so when the time comes, I can just svn cp/mv the directories and not have to bother with merging.

2007-07-17 11:59

 

restore_mixer_window_geom.patch (4,079 bytes)   
diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc
index 85c5ebc..89d7ef5 100644
--- a/gtk2_ardour/mixer_ui.cc
+++ b/gtk2_ardour/mixer_ui.cc
@@ -261,6 +261,8 @@ Mixer_UI::show_window ()
 {
 	present ();
 
+	set_window_pos_and_size ();
+
 	/* now reset each strips width so the right widgets are shown */
 	MixerStrip* ms;
 
@@ -277,6 +279,8 @@ Mixer_UI::show_window ()
 bool
 Mixer_UI::hide_window (GdkEventAny *ev)
 {
+	get_window_pos_and_size ();
+
 	_visible = false;
 	return just_hide_it(ev, static_cast<Gtk::Window *>(this));
 }
@@ -1072,37 +1076,42 @@ Mixer_UI::set_strip_width (Width w)
 	}
 }
 
+void
+Mixer_UI::set_window_pos_and_size ()
+{
+	resize (m_width, m_height);
+	move (m_root_x, m_root_y);
+}
+
+	void
+Mixer_UI::get_window_pos_and_size ()
+{
+	get_position(m_root_x, m_root_y);
+	get_size(m_width, m_height);
+}
 
 int
 Mixer_UI::set_state (const XMLNode& node)
 {
 	const XMLProperty* prop;
 	XMLNode* geometry;
-	Gdk::Geometry g;
-	int x, y, xoff, yoff;
 	
 	if ((geometry = find_named_node (node, "geometry")) == 0) {
 
-		g.base_width = default_width;
-		g.base_height = default_height;
-		x = 1;
-		y = 1;
-		xoff = 0;
-		yoff = 21;
+		m_width = default_width;
+		m_height = default_height;
+		m_root_x = 1;
+		m_root_y = 1;
 
 	} else {
 
-		g.base_width = atoi(geometry->property("x_size")->value().c_str());
-		g.base_height = atoi(geometry->property("y_size")->value().c_str());
-		x = atoi(geometry->property("x_pos")->value().c_str());
-		y = atoi(geometry->property("y_pos")->value().c_str());
-		xoff = atoi(geometry->property("x_off")->value().c_str());
-		yoff = atoi(geometry->property("y_off")->value().c_str());
+		m_width = atoi(geometry->property("x_size")->value().c_str());
+		m_height = atoi(geometry->property("y_size")->value().c_str());
+		m_root_x = atoi(geometry->property("x_pos")->value().c_str());
+		m_root_y = atoi(geometry->property("y_pos")->value().c_str());
 	}
 
-	set_geometry_hints (global_vpacker, g, Gdk::HINT_BASE_SIZE);
-	set_default_size(g.base_width, g.base_height);
-	move (x, y);
+	set_window_pos_and_size ();
 
 	if ((prop = node.property ("narrow-strips"))) {
 		if (prop->value() == "yes") {
@@ -1128,25 +1137,24 @@ Mixer_UI::get_state (void)
 
 	if (is_realized()) {
 		Glib::RefPtr<Gdk::Window> win = get_window();
-		
-		int x, y, xoff, yoff, width, height;
-		win->get_root_origin(x, y);
-		win->get_position(xoff, yoff);
-		win->get_size(width, height);
+	
+		get_window_pos_and_size ();
 
 		XMLNode* geometry = new XMLNode ("geometry");
 		char buf[32];
-		snprintf(buf, sizeof(buf), "%d", width);
+		snprintf(buf, sizeof(buf), "%d", m_width);
 		geometry->add_property(X_("x_size"), string(buf));
-		snprintf(buf, sizeof(buf), "%d", height);
+		snprintf(buf, sizeof(buf), "%d", m_height);
 		geometry->add_property(X_("y_size"), string(buf));
-		snprintf(buf, sizeof(buf), "%d", x);
+		snprintf(buf, sizeof(buf), "%d", m_root_x);
 		geometry->add_property(X_("x_pos"), string(buf));
-		snprintf(buf, sizeof(buf), "%d", y);
+		snprintf(buf, sizeof(buf), "%d", m_root_y);
 		geometry->add_property(X_("y_pos"), string(buf));
-		snprintf(buf, sizeof(buf), "%d", xoff);
+		
+		// written only for compatibility, they are not used.
+		snprintf(buf, sizeof(buf), "%d", 0);
 		geometry->add_property(X_("x_off"), string(buf));
-		snprintf(buf, sizeof(buf), "%d", yoff);
+		snprintf(buf, sizeof(buf), "%d", 0);
 		geometry->add_property(X_("y_off"), string(buf));
 
 		snprintf(buf,sizeof(buf), "%d",gtk_paned_get_position (static_cast<Paned*>(&rhs_pane1)->gobj()));
diff --git a/gtk2_ardour/mixer_ui.h b/gtk2_ardour/mixer_ui.h
index 2851763..3c9355e 100644
--- a/gtk2_ardour/mixer_ui.h
+++ b/gtk2_ardour/mixer_ui.h
@@ -102,6 +102,12 @@ class Mixer_UI : public Gtk::Window
 	Gtk::HBox				out_packer;
 	Gtk::HPaned				list_hpane;
 
+	// for restoring window geometry.
+	int m_root_x, m_root_y, m_width, m_height;
+	
+	void set_window_pos_and_size ();
+	void get_window_pos_and_size ();
+
 	bool on_key_press_event (GdkEventKey*);
 
 	void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);

timbyr

2007-07-17 12:03

developer   ~0004141

I've updated the patch so that it applies to trunk and 2.0-ongoing.

It attempts to fix restoring of the mixer window geometry and not for any other windows such as for plugins as that needs a bit more thought/working out etc.

timbyr

2007-07-18 02:56

developer   ~0004152

The patch for restoring the mixer window position has been applied to trunk as of revision 2141.

Issue History

Date Modified Username Field Change
2006-10-18 23:34 b0ef New Issue
2006-11-02 03:53 taybin Note Added: 0002539
2006-11-02 03:53 taybin Status new => assigned
2006-11-02 03:53 taybin Assigned To => taybin
2006-11-02 11:26 b0ef Note Added: 0002574
2007-02-10 09:29 timbyr Note Added: 0003198
2007-02-10 09:30 timbyr File Added: mixer-window-geom.diff
2007-02-10 10:23 timbyr Relationship added related to 0001483
2007-02-14 22:07 taybin Note Added: 0003262
2007-07-17 11:58 timbyr File Deleted: mixer-window-geom.diff
2007-07-17 11:59 timbyr File Added: restore_mixer_window_geom.patch
2007-07-17 12:03 timbyr Note Added: 0004141
2007-07-18 02:56 timbyr Note Added: 0004152