From e4a7e5a239d0b5646c7057181405e3238eb7ed7f Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 26 Feb 2016 18:51:23 -0500 Subject: [PATCH] improve size and positioning of Tabbable's after being torn off, hidden, reshown, etc --- libs/gtkmm2ext/gtkmm2ext/window_proxy.h | 1 + libs/gtkmm2ext/tabbable.cc | 1 + libs/gtkmm2ext/window_proxy.cc | 18 +++++++++++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/libs/gtkmm2ext/gtkmm2ext/window_proxy.h b/libs/gtkmm2ext/gtkmm2ext/window_proxy.h index abacca2428..c5949701d9 100644 --- a/libs/gtkmm2ext/gtkmm2ext/window_proxy.h +++ b/libs/gtkmm2ext/gtkmm2ext/window_proxy.h @@ -87,6 +87,7 @@ class LIBGTKMM2EXT_API WindowProxy : public PBD::StatefulDestructible, public vi void save_pos_and_size (); void set_pos_and_size (); + void set_pos (); virtual bool delete_event_handler (GdkEventAny *ev); diff --git a/libs/gtkmm2ext/tabbable.cc b/libs/gtkmm2ext/tabbable.cc index be898a5555..a0ff199096 100644 --- a/libs/gtkmm2ext/tabbable.cc +++ b/libs/gtkmm2ext/tabbable.cc @@ -197,6 +197,7 @@ void Tabbable::make_visible () { if (_window && (current_toplevel() == _window)) { + set_pos (); _window->present (); } else { diff --git a/libs/gtkmm2ext/window_proxy.cc b/libs/gtkmm2ext/window_proxy.cc index b40e373046..6ad6a4d86b 100644 --- a/libs/gtkmm2ext/window_proxy.cc +++ b/libs/gtkmm2ext/window_proxy.cc @@ -333,7 +333,7 @@ WindowProxy::set_pos_and_size () } if (_width != -1 && _height != -1) { - _window->set_default_size (_width, _height); + _window->resize (_width, _height); } if (_x_off != -1 && _y_off != -1) { @@ -341,3 +341,19 @@ WindowProxy::set_pos_and_size () } } +void +WindowProxy::set_pos () +{ + if (!_window) { + return; + } + + if (_width != -1 || _height != -1 || _x_off != -1 || _y_off != -1) { + /* cancel any mouse-based positioning */ + _window->set_position (Gtk::WIN_POS_NONE); + } + + if (_x_off != -1 && _y_off != -1) { + _window->move (_x_off, _y_off); + } +}