aboutsummaryrefslogtreecommitdiff
path: root/src/QuickMedia.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/QuickMedia.cpp')
-rw-r--r--src/QuickMedia.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 2083df3..ddb8c12 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -3228,6 +3228,7 @@ namespace QuickMedia {
PageType previous_page = pop_page_stack();
bool video_loaded = false;
+ bool shutdown = false;
double video_time_pos = 0.0; // Time in media in seconds. Updates every 5 seconds and when starting to watch the video and when seeking.
VideoInfo video_info; // Duration time in seconds. 0 if unknown
bool successfully_fetched_video_duration = false;
@@ -3328,6 +3329,7 @@ namespace QuickMedia {
video_player.reset();
video_info.channel_url.clear();
video_loaded = false;
+ shutdown = false;
successfully_fetched_video_duration = false;
successfully_fetched_time_pos = false;
video_player_window = None;
@@ -3530,6 +3532,7 @@ namespace QuickMedia {
added_recommendations = false;
time_watched_timer.restart();
video_loaded = true;
+ shutdown = false;
update_time_pos = true;
update_window_focus = true;
} else if(strcmp(event_name, "file-loaded") == 0) {
@@ -3545,6 +3548,8 @@ namespace QuickMedia {
} else if(strcmp(event_name, "end-file") == 0) {
if(successfully_fetched_time_pos && successfully_fetched_video_duration)
video_page->set_watch_progress(video_time_pos, video_info.duration);
+ } else if(strcmp(event_name, "shutdown") == 0) {
+ shutdown = true;
}
//fprintf(stderr, "event name: %s\n", event_name);
@@ -3635,16 +3640,7 @@ namespace QuickMedia {
const bool pressing_shift = (CLEANMASK(xev.xkey.state) & ShiftMask);
if(pressed_keysym == XK_q && pressing_ctrl) {
window.close();
- } else if(pressed_keysym == XK_Escape || pressed_keysym == XK_BackSpace) {
- if(window_is_fullscreen(disp, window.get_system_handle())) {
- if(pressed_keysym != XK_Escape)
- video_player->cycle_fullscreen();
- } else {
- current_page = previous_page;
- go_to_previous_page = true;
- break;
- }
- } else if(pressed_keysym == XK_q && !pressing_ctrl) {
+ } else if(pressed_keysym == XK_Escape) {
current_page = previous_page;
go_to_previous_page = true;
break;
@@ -3757,7 +3753,7 @@ namespace QuickMedia {
} else if(update_err == VideoPlayer::Error::EXITED && video_player->exit_status == 0 && (!is_matrix || is_youtube)) {
std::string new_video_url;
- if(!video_page->should_autoplay()) {
+ if(!video_page->should_autoplay() || shutdown) {
current_page = previous_page;
go_to_previous_page = true;
break;
@@ -3903,6 +3899,7 @@ namespace QuickMedia {
window_size.x = window_size_u.x;
window_size.y = window_size_u.y;
+ // TODO: Is this needed? end-file handles this
if(successfully_fetched_time_pos && successfully_fetched_video_duration)
video_page->set_watch_progress(video_time_pos, video_info.duration);
}