From 321147cdb886bb3a01474819fef5bffc01dbf493 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Sun, 8 Jan 2017 14:49:54 -0800 Subject: [PATCH] only redraw the download list if the deleted download was onscreen --- src/ui/download.h | 3 ++- src/ui/download_list.cc | 15 ++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/ui/download.h b/src/ui/download.h index c896c528..d4ba0a7f 100644 --- a/src/ui/download.h +++ b/src/ui/download.h @@ -89,7 +89,8 @@ public: void adjust_up_throttle(int throttle); void adjust_down_throttle(int throttle); - display::Window* window() { return NULL; } + display::Window* window() { return NULL; } + core::Download* download() { return m_download; }; private: Download(const Download&); diff --git a/src/ui/download_list.cc b/src/ui/download_list.cc index 055fbbaf..08ed13be 100644 --- a/src/ui/download_list.cc +++ b/src/ui/download_list.cc @@ -124,16 +124,17 @@ DownloadList::set_current_view(const std::string& name) { return dynamic_cast(m_uiArray[DISPLAY_DOWNLOAD_LIST])->receive_change_view(name); } -// This should also do focus_next() or something. void DownloadList::unfocus_download(core::Download* d) { - if (m_state == DISPLAY_DOWNLOAD) - activate_display(DISPLAY_DOWNLOAD_LIST); + if (m_state == DISPLAY_DOWNLOAD) { + if (d == static_cast(m_uiArray[DISPLAY_DOWNLOAD])->download()) { + activate_display(DISPLAY_DOWNLOAD_LIST); + } + } - if (current_view()->focus() >= current_view()->end_visible() || *current_view()->focus() != d) - return; - - current_view()->next_focus(); + if (*current_view()->focus() == d && current_view()->focus() < current_view()->end_visible()) { + current_view()->next_focus(); + } } void