for AU plugin GUIs, since configure events don't seem to be handled correctly in GTK/Quartz, store and restore window positions at show+hide as well as app activate and deactivate

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@12730 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-06-15 19:41:52 +00:00
parent 737db3a504
commit cc7b2c5de6
2 changed files with 22 additions and 0 deletions

View File

@ -71,6 +71,10 @@ PluginUIWindow::PluginUIWindow (Gtk::Window* win, boost::shared_ptr<PluginInsert
: parent (win) : parent (win)
, was_visible (false) , was_visible (false)
, _keyboard_focused (false) , _keyboard_focused (false)
#ifdef HAVE_AUDIOUNITS
, pre_deactivate_x (-1)
, pre_deactivate_y (-1)
#endif
{ {
bool have_gui = false; bool have_gui = false;
@ -199,6 +203,11 @@ PluginUIWindow::on_show ()
} }
if (_pluginui) { if (_pluginui) {
#if defined (HAVE_AUDIOUNITS) && defined(GTKOSX)
if (pre_deactivate_x >= 0) {
move (pre_deactivate_x, pre_deactivate_y);
}
#endif
if (_pluginui->on_window_show (_title)) { if (_pluginui->on_window_show (_title)) {
Window::on_show (); Window::on_show ();
} }
@ -212,6 +221,10 @@ PluginUIWindow::on_show ()
void void
PluginUIWindow::on_hide () PluginUIWindow::on_hide ()
{ {
#if defined (HAVE_AUDIOUNITS) && defined(GTKOSX)
get_position (pre_deactivate_x, pre_deactivate_y);
#endif
Window::on_hide (); Window::on_hide ();
if (_pluginui) { if (_pluginui) {
@ -277,12 +290,16 @@ PluginUIWindow::app_activated (bool yn)
if (yn) { if (yn) {
if (was_visible) { if (was_visible) {
_pluginui->activate (); _pluginui->activate ();
if (pre_deactivate_x >= 0) {
move (pre_deactivate_x, pre_deactivate_y);
}
// present (); // present ();
show (); show ();
was_visible = true; was_visible = true;
} }
} else { } else {
was_visible = is_visible(); was_visible = is_visible();
get_position (pre_deactivate_x, pre_deactivate_y);
hide (); hide ();
_pluginui->deactivate (); _pluginui->deactivate ();
} }

View File

@ -249,6 +249,11 @@ class PluginUIWindow : public Gtk::Window
Gtk::VBox vbox; Gtk::VBox vbox;
bool was_visible; bool was_visible;
bool _keyboard_focused; bool _keyboard_focused;
#ifdef HAVE_AUDIOUNITS
int pre_deactivate_x;
int pre_deactivate_y;
#endif
void keyboard_focused (bool yn); void keyboard_focused (bool yn);
void app_activated (bool); void app_activated (bool);