From 644c8b04f27827759a830738820143105c7e2536 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 18 Jun 2021 12:56:26 +0200 Subject: 4chan, soundcloud: move selection to autoplay item --- src/Body.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/Body.cpp') diff --git a/src/Body.cpp b/src/Body.cpp index 2df514b..ba99c62 100644 --- a/src/Body.cpp +++ b/src/Body.cpp @@ -285,6 +285,20 @@ namespace QuickMedia { //page_scroll = 0.0f; } + void Body::set_selected_item(BodyItem *body_item) { + if(!body_item) + return; + + for(size_t i = 0; i < items.size(); ++i) { + if(items[i].get() == body_item) { + selected_item = i; + break; + } + } + + clamp_selection(); + } + void Body::reset_prev_selected_item() { prev_selected_item = selected_item; } @@ -1605,6 +1619,7 @@ namespace QuickMedia { void Body::filter_search_fuzzy(const std::string &text) { current_filter = text; + items_dirty = DirtyState::FALSE; if(text.empty()) { for(auto &item : items) { -- cgit v1.2.3