ArdourDialog: API to prevent idle callbacks during response handling

This commit is contained in:
Paul Davis 2022-12-12 10:15:55 -07:00
parent 62bfd34ba8
commit 095b84080a
2 changed files with 11 additions and 1 deletions

View File

@ -42,6 +42,7 @@ ArdourDialog::ArdourDialog (const string& title, bool modal, bool use_seperator)
, _sensitive (true) , _sensitive (true)
, proxy (nullptr) , proxy (nullptr)
, _splash_pushed (false) , _splash_pushed (false)
, allow_idle (true)
{ {
init (); init ();
set_position (Gtk::WIN_POS_MOUSE); set_position (Gtk::WIN_POS_MOUSE);
@ -52,6 +53,7 @@ ArdourDialog::ArdourDialog (Gtk::Window& parent, const string& title, bool modal
, _sensitive (true) , _sensitive (true)
, proxy (nullptr) , proxy (nullptr)
, _splash_pushed (false) , _splash_pushed (false)
, allow_idle (true)
{ {
init (); init ();
set_position (Gtk::WIN_POS_CENTER_ON_PARENT); set_position (Gtk::WIN_POS_CENTER_ON_PARENT);
@ -63,6 +65,10 @@ ArdourDialog::~ArdourDialog ()
Keyboard::the_keyboard ().focus_out_window (nullptr, this); Keyboard::the_keyboard ().focus_out_window (nullptr, this);
WM::Manager::instance ().remove (proxy); WM::Manager::instance ().remove (proxy);
proxy->explicit_delete (); proxy->explicit_delete ();
void
ArdourDialog::disallow_idle ()
{
allow_idle = false;
} }
void void
@ -70,7 +76,9 @@ ArdourDialog::on_response (int response_id)
{ {
pop_splash (); pop_splash ();
hide (); hide ();
ARDOUR::GUIIdle (); if (allow_idle) {
ARDOUR::GUIIdle ();
}
Gtk::Dialog::on_response (response_id); Gtk::Dialog::on_response (response_id);
} }

View File

@ -51,6 +51,7 @@ public:
void on_show (); void on_show ();
virtual void on_response (int); virtual void on_response (int);
void set_ui_sensitive (bool); void set_ui_sensitive (bool);
void disallow_idle ();
protected: protected:
void pop_splash (); void pop_splash ();
@ -61,6 +62,7 @@ private:
WM::ProxyTemporary* proxy; WM::ProxyTemporary* proxy;
bool _splash_pushed; bool _splash_pushed;
void init (); void init ();
bool allow_idle;
static sigc::signal<void> CloseAllDialogs; static sigc::signal<void> CloseAllDialogs;
}; };