summaryrefslogtreecommitdiff
path: root/src/wx
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2019-07-24 20:42:50 +0100
committerCarl Hetherington <cth@carlh.net>2019-07-24 20:42:50 +0100
commit335ef709439cd3678f6813a3fb880110e4c9cb26 (patch)
tree31ce9d5b82eb789d702133ab64493bd7b20ded93 /src/wx
parent697d21c3f9bc6243151372f988936662b9993510 (diff)
Optimise the feel of some GUI functions by doing the seek after
many content changes in an idle handler, rather than blocking the UI update until the seek and image redisplay have finished.
Diffstat (limited to 'src/wx')
-rw-r--r--src/wx/film_viewer.cc21
-rw-r--r--src/wx/film_viewer.h2
2 files changed, 16 insertions, 7 deletions
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc
index a2b055934..edb451e74 100644
--- a/src/wx/film_viewer.cc
+++ b/src/wx/film_viewer.cc
@@ -231,17 +231,22 @@ FilmViewer::refresh_view ()
_state_timer.unset ();
}
+/** @param lazy true if it is *not* important that the display be updated as quickly as possible.
+ * If lazy is true we will try to return from this method quickly and postpone any time-consuming
+ * work until the UI is next idle. Otherwise we will block here and try to get the image on
+ * screen as soon as possible.
+ */
void
-FilmViewer::get ()
+FilmViewer::get (bool lazy)
{
DCPOMATIC_ASSERT (_butler);
++_gets;
do {
Butler::Error e;
- _player_video = _butler->get_video (&e);
+ _player_video = _butler->get_video (!lazy, &e);
if (!_player_video.first && e == Butler::AGAIN) {
- signal_manager->when_idle (boost::bind(&FilmViewer::get, this));
+ signal_manager->when_idle (boost::bind(&FilmViewer::get, this, lazy));
return;
}
} while (
@@ -257,7 +262,11 @@ FilmViewer::get ()
error_dialog (_video_view->get(), e.what());
}
- display_player_video ();
+ if (lazy) {
+ signal_manager->when_idle (boost::bind(&FilmViewer::display_player_video, this));
+ } else {
+ display_player_video ();
+ }
}
void
@@ -322,7 +331,7 @@ FilmViewer::timer ()
return;
}
- get ();
+ get (false);
PositionChanged ();
DCPTime const next = _video_position + one_video_frame();
@@ -541,7 +550,7 @@ FilmViewer::seek (DCPTime t, bool accurate)
_closed_captions_dialog->clear ();
_butler->seek (t, accurate);
- get ();
+ get (true);
if (was_running) {
start ();
diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h
index 5ddb12baf..298e9dd00 100644
--- a/src/wx/film_viewer.h
+++ b/src/wx/film_viewer.h
@@ -151,7 +151,7 @@ private:
void timer ();
void calculate_sizes ();
void player_change (ChangeType type, int, bool);
- void get ();
+ void get (bool lazy);
void display_player_video ();
void film_change (ChangeType, Film::Property);
void recreate_butler ();