diff options
author | Carl Hetherington <carl@carlh.net> | 2012-06-26 00:07:45 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2012-06-26 00:07:45 +0000 |
commit | 098f0157dfc46ab089253eb822364e9a4425fd8e (patch) | |
tree | 3ea2d18f0f1ffa179632e9a581fa59a0baf5dbd7 | |
parent | cc9ed077be02bc7102807aaa791076da0d87cd1f (diff) |
Allow new idle visual changer calls to be requested while
the current changer is executing; fixes #4567.
git-svn-id: svn://localhost/ardour2/branches/3.0@12934 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/editor.cc | 23 | ||||
-rw-r--r-- | gtk2_ardour/editor.h | 5 |
2 files changed, 24 insertions, 4 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index a08b9f8e5f..9daf72c589 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -4241,6 +4241,18 @@ Editor::_idle_visual_changer (void* arg) int Editor::idle_visual_changer () { + /* set_horizontal_position() below (and maybe other calls) call + gtk_main_iteration(), so it's possible that a signal will be handled + half-way through this method. If this signal wants an + idle_visual_changer we must schedule another one after this one, so + mark the idle_handler_id as -1 here to allow that. Also make a note + that we are doing the visual change, so that changes in response to + super-rapid-screen-update can be dropped if we are still processing + the last one. + */ + pending_visual_change.idle_handler_id = -1; + pending_visual_change.being_handled = true; + VisualChange::Type p = pending_visual_change.pending; pending_visual_change.pending = (VisualChange::Type) 0; @@ -4269,7 +4281,7 @@ Editor::idle_visual_changer () _summary->set_overlays_dirty (); - pending_visual_change.idle_handler_id = -1; + pending_visual_change.being_handled = false; return 0; /* this is always a one-shot call */ } @@ -5191,7 +5203,14 @@ Editor::super_rapid_screen_update () if (!_stationary_playhead) { - if (!_dragging_playhead && _follow_playhead && _session->requested_return_frame() < 0) { + if (!_dragging_playhead && _follow_playhead && _session->requested_return_frame() < 0 && !pending_visual_change.being_handled) { + /* We only do this if we aren't already + handling a visual change (ie if + pending_visual_change.being_handled is + false) so that these requests don't stack + up there are too many of them to handle in + time. + */ reset_x_origin_to_follow_playhead (); } diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 7b4b1dcbbf..59014b04e7 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -1029,14 +1029,15 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD double y_origin; int idle_handler_id; + /** true if we are currently in the idle handler */ + bool being_handled; - VisualChange() : pending ((VisualChange::Type) 0), time_origin (0), frames_per_unit (0), idle_handler_id (-1) {} + VisualChange() : pending ((VisualChange::Type) 0), time_origin (0), frames_per_unit (0), idle_handler_id (-1), being_handled (false) {} void add (Type t) { pending = Type (pending | t); } }; - VisualChange pending_visual_change; static int _idle_visual_changer (void *arg); |