diff options
author | Robin Gareus <robin@gareus.org> | 2013-07-07 19:29:42 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2013-07-07 19:29:42 +0200 |
commit | cb6f16ac2df2db18e4a87aa2617625a3195d45c9 (patch) | |
tree | 755edef0f438a2cf5b6af511a6428b897bcfa0fd /gtk2_ardour/window_manager.cc | |
parent | 3c6ff2f02f66eca9796cdc4ced5e39d91b4e22b7 (diff) |
fix save/restore [plugin] window pos&size (without save)
Diffstat (limited to 'gtk2_ardour/window_manager.cc')
-rw-r--r-- | gtk2_ardour/window_manager.cc | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gtk2_ardour/window_manager.cc b/gtk2_ardour/window_manager.cc index b76958d4d4..730668d7e4 100644 --- a/gtk2_ardour/window_manager.cc +++ b/gtk2_ardour/window_manager.cc @@ -263,8 +263,27 @@ ProxyBase::toggle() _window->show_all(); /* we'd like to just call this and nothing else */ _window->present (); + + if (_width != -1 && _height != -1) { + _window->set_default_size (_width, _height); + } + if (_x_off != -1 && _y_off != -1) { + _window->move (_x_off, _y_off); + } + } else { + if (_window->is_mapped()) { + save_pos_and_size(); + } vistracker->cycle_visibility (); + if (_window->is_mapped()) { + if (_width != -1 && _height != -1) { + _window->set_default_size (_width, _height); + } + if (_x_off != -1 && _y_off != -1) { + _window->move (_x_off, _y_off); + } + } } } @@ -325,6 +344,7 @@ ProxyBase::setup () assert (_window); vistracker = new Gtkmm2ext::VisibilityTracker (*_window); + _window->signal_delete_event().connect (sigc::mem_fun (*this, &ProxyBase::handle_win_event)); if (_width != -1 || _height != -1 || _x_off != -1 || _y_off != -1) { /* cancel any mouse-based positioning */ @@ -379,10 +399,17 @@ ProxyBase::hide () { Gtk::Window* win = get (false); if (win) { + save_pos_and_size(); win->hide (); } } +void +ProxyBase::save_pos_and_size () +{ + _window->get_position (_x_off, _y_off); + _window->get_size (_width, _height); +} /*-----------------------*/ ProxyTemporary::ProxyTemporary (const string& name, Gtk::Window* win) |