summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2009-02-17 00:12:22 +0000
committerCarl Hetherington <carl@carlh.net>2009-02-17 00:12:22 +0000
commit4565b73a3993b0cb5ccb9170e276180f2b5c1372 (patch)
tree18ab6fc28523856e88832917c6ab92c36db6310b
parent3e1eb6bcbd1bf5b9f3bfb64d8b9a5ad68c01368c (diff)
Fix for visual glitch due to race between Editor::update_current_screen being called and a locate event being processed.
git-svn-id: svn://localhost/ardour2/branches/3.0@4608 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/editor.cc13
-rw-r--r--gtk2_ardour/editor.h3
-rw-r--r--gtk2_ardour/editor_mixer.cc8
-rw-r--r--gtk2_ardour/editor_mouse.cc2
-rw-r--r--libs/ardour/ardour/session.h3
-rw-r--r--libs/ardour/session_transport.cc4
6 files changed, 32 insertions, 1 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index 719ac2a266..c7cdd1aa3c 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -248,7 +248,8 @@ Editor::Editor ()
/* nudge */
nudge_clock (X_("nudge"), false, X_("NudgeClock"), true, true),
- meters_running(false)
+ meters_running(false),
+ _pending_locate_request (false)
{
constructed = false;
@@ -1280,6 +1281,8 @@ Editor::connect_to_session (Session *t)
session_connections.push_back (session->tempo_map().StateChanged.connect (mem_fun(*this, &Editor::tempo_map_changed)));
+ session_connections.push_back (session->Located.connect (mem_fun (*this, &Editor::located)));
+
edit_groups_changed ();
edit_point_clock.set_mode(AudioClock::BBT);
@@ -5346,3 +5349,11 @@ Editor::idle_resize ()
resize_idle_id = -1;
return false;
}
+
+void
+Editor::located ()
+{
+ ENSURE_GUI_THREAD (mem_fun (*this, &Editor::located));
+
+ _pending_locate_request = false;
+}
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index f0e28677f7..420dc3c457 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -2376,6 +2376,9 @@ public:
void visible_order_range (int*, int*) const;
bool y_movement_disallowed (int, int, int, int, int, std::bitset<512> const &, std::vector<int32_t> const &) const;
+
+ void located ();
+ bool _pending_locate_request;
};
#endif /* __ardour_editor_h__ */
diff --git a/gtk2_ardour/editor_mixer.cc b/gtk2_ardour/editor_mixer.cc
index 618d59455e..04caa99f28 100644
--- a/gtk2_ardour/editor_mixer.cc
+++ b/gtk2_ardour/editor_mixer.cc
@@ -232,6 +232,14 @@ double current = 0.0;
void
Editor::update_current_screen ()
{
+ if (_pending_locate_request) {
+ /* we don't update things when there's a pending locate request, otherwise
+ when the editor requests a locate there is a chance that this method
+ will move the playhead before the locate request is processed, causing
+ a visual glitch. */
+ return;
+ }
+
if (session && session->engine().running()) {
nframes64_t const frame = session->audible_frame();
diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc
index 157bda3f79..49c067746d 100644
--- a/gtk2_ardour/editor_mouse.cc
+++ b/gtk2_ardour/editor_mouse.cc
@@ -2429,6 +2429,7 @@ Editor::cursor_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event
if (item == &playhead_cursor->canvas_item) {
if (session) {
session->request_locate (playhead_cursor->current_frame, drag_info.was_rolling);
+ _pending_locate_request = true;
}
}
}
@@ -2443,6 +2444,7 @@ Editor::cursor_drag_finished_ensure_locate_callback (ArdourCanvas::Item* item, G
if (item == &playhead_cursor->canvas_item) {
if (session) {
session->request_locate (playhead_cursor->current_frame, drag_info.was_rolling);
+ _pending_locate_request = true;
}
}
}
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index ef25ebaea3..ef67d0cc79 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -371,6 +371,9 @@ class Session : public PBD::StatefulDestructible
sigc::signal<void,nframes_t> Xrun;
sigc::signal<void> TransportLooped;
+ /** emitted when a locate has occurred */
+ sigc::signal<void> Located;
+
sigc::signal<void,RouteList&> RouteAdded;
void request_roll_at_and_return (nframes_t start, nframes_t return_to);
diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc
index 86c285e600..ff00d278a3 100644
--- a/libs/ardour/session_transport.cc
+++ b/libs/ardour/session_transport.cc
@@ -643,6 +643,10 @@ Session::start_locate (nframes_t target_frame, bool with_roll, bool with_flush,
}
+ /* XXX: not sure if this should be emitted here; perhaps it should happen
+ when the slave is actually followed */
+ Located (); /* EMIT SIGNAL */
+
} else {
locate (target_frame, with_roll, with_flush, with_loop);