diff options
author | Robin Gareus <robin@gareus.org> | 2017-06-17 15:51:40 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-06-17 16:11:24 +0200 |
commit | 8fa60eaf054204bd3e0f824d222b8768d5a04ff8 (patch) | |
tree | 1a1fdd37d60a33e754f29bd382dc892201757e27 /gtk2_ardour/selection.cc | |
parent | f77540120c62c5c99d4c4dbac7eb3c2c8e728a3e (diff) |
Ignore Selection::set() without actual changes
Diffstat (limited to 'gtk2_ardour/selection.cc')
-rw-r--r-- | gtk2_ardour/selection.cc | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/gtk2_ardour/selection.cc b/gtk2_ardour/selection.cc index 18ae75b386..a1ba890e57 100644 --- a/gtk2_ardour/selection.cc +++ b/gtk2_ardour/selection.cc @@ -1531,6 +1531,43 @@ Selection::set (const TrackViewList& track_list) TrackViewList t = add_grouped_tracks (track_list); CoreSelection& selection (editor->session()->selection()); + +#if 1 // crazy optmization hack + /* check is the selection actually changed, ignore NO-OPs + * + * There are excessive calls from EditorRoutes::selection_changed(): + * Every click calls selection_changed() even if it doesn't change. + * Also re-ordering tracks calls into this due to gtk's odd DnD signal + * messaging (row removed, re-added). + * + * Re-ordering a row results in at least 2 calls to selection_changed() + * without actual change. Calling selection.clear_stripables() + * and re-adding the same tracks every time in turn emits changed signals. + */ + bool changed = false; + CoreSelection::StripableAutomationControls sac; + selection.get_stripables (sac); + for (TrackSelection::const_iterator i = t.begin(); i != t.end(); ++i) { + boost::shared_ptr<Stripable> s = (*i)->stripable (); + boost::shared_ptr<AutomationControl> c = (*i)->control (); + bool found = false; + for (CoreSelection::StripableAutomationControls::iterator j = sac.begin (); j != sac.end (); ++j) { + if (j->stripable == s && j->controllable == c) { + found = true; + sac.erase (j); + break; + } + } + if (!found) { + changed = true; + break; + } + } + if (!changed && sac.size() == 0) { + return; + } +#endif + PresentationInfo::ChangeSuspender cs; selection.clear_stripables (); |