From 6971383a34068ce8ce1b9626a2a2f4c5cbb77338 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 30 Oct 2023 23:39:14 +0100 Subject: Revert "Dont hardcode backspace/q to exit, use the input.conf file for that" This reverts commit bcd40f1beeb5cde7f9ac20ade692a6246dd4deab. --- src/QuickMedia.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index e00bb85..1ec178d 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -3211,7 +3211,6 @@ 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; @@ -3312,7 +3311,6 @@ 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; @@ -3515,7 +3513,6 @@ 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) { @@ -3531,8 +3528,6 @@ 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); @@ -3623,7 +3618,16 @@ 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) { + } 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) { current_page = previous_page; go_to_previous_page = true; break; @@ -3736,7 +3740,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() || shutdown) { + if(!video_page->should_autoplay()) { current_page = previous_page; go_to_previous_page = true; break; @@ -3882,7 +3886,6 @@ 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); } -- cgit v1.2.3