From 67f733bb9768e60fe7108613b3f9335675c7d08d Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 1 Sep 2018 21:32:57 +0200 Subject: [PATCH] Restore mixer scroll offset after spill --- gtk2_ardour/mixer_ui.cc | 11 +++++++++++ gtk2_ardour/mixer_ui.h | 1 + 2 files changed, 12 insertions(+) diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index b9b9eccaca..4f029e9b4b 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -106,6 +106,7 @@ Mixer_UI::Mixer_UI () , _monitor_section (0) , _plugin_selector (0) , _strip_width (UIConfiguration::instance().get_default_narrow_ms() ? Narrow : Wide) + , _spill_scroll_position (0) , ignore_reorder (false) , _in_group_rebuild_or_clear (false) , _route_deletion_in_progress (false) @@ -1450,6 +1451,9 @@ Mixer_UI::redisplay_track_list () if (ss) { boost::shared_ptr sv = boost::dynamic_pointer_cast (ss); if (sv) { + if (_spill_scroll_position <= 0 && scroller.get_hscrollbar()) { + _spill_scroll_position = scroller.get_hscrollbar()->get_adjustment()->get_value(); + } spill_redisplay (sv); return; } @@ -1541,6 +1545,13 @@ Mixer_UI::redisplay_track_list () } _group_tabs->set_dirty (); + + if (_spill_scroll_position > 0 && scroller.get_hscrollbar()) { + Adjustment* adj = scroller.get_hscrollbar()->get_adjustment(); + adj->set_value (max (adj->get_lower(), min (adj->get_upper(), _spill_scroll_position))); + } + _spill_scroll_position = 0; + } void diff --git a/gtk2_ardour/mixer_ui.h b/gtk2_ardour/mixer_ui.h index 2469f74503..1315f74f5d 100644 --- a/gtk2_ardour/mixer_ui.h +++ b/gtk2_ardour/mixer_ui.h @@ -348,6 +348,7 @@ private: bool vca_button_release_event (GdkEventButton*, VCAMasterStrip*); Width _strip_width; + double _spill_scroll_position; void presentation_info_changed (PBD::PropertyChange const &); void sync_treeview_from_presentation_info (PBD::PropertyChange const &);