fix(taskbar): `order-list` tasks pushed after unordered on start
parent
4c172ae924
commit
da6296e553
|
@ -806,15 +806,27 @@ Taskbar::~Taskbar()
|
||||||
void Taskbar::update()
|
void Taskbar::update()
|
||||||
{
|
{
|
||||||
if (!order_list_.empty()) {
|
if (!order_list_.empty()) {
|
||||||
|
auto begin = order_list_.begin();
|
||||||
|
auto end = order_list.end();
|
||||||
|
|
||||||
|
// first pass - sort ordered tasks
|
||||||
for (auto& task : tasks_) {
|
for (auto& task : tasks_) {
|
||||||
auto begin = order_list_.begin();
|
auto itr = std::find(begin, end, task->app_id());
|
||||||
auto itr = std::find(begin, order_list_.end(), task->app_id());
|
|
||||||
|
|
||||||
if (itr != std::end(order_list_)) {
|
if (itr != std::end(order_list_)) {
|
||||||
auto index = std::distance(begin, itr);
|
auto index = std::distance(begin, itr);
|
||||||
move_button(task->button_, index);
|
move_button(task->button_, index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// second pass - push unordered to end
|
||||||
|
for (auto& task : tasks_) {
|
||||||
|
auto itr = std::find(begin, end, task->app_id());
|
||||||
|
|
||||||
|
if (itr == std::end(order_list_)) {
|
||||||
|
move_button(task->button_, -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& t : tasks_) {
|
for (auto& t : tasks_) {
|
||||||
|
|
Loading…
Reference in New Issue