mirror of
https://github.com/aristocratos/btop.git
synced 2026-04-21 02:35:43 +02:00
fix: don't always update metrics on redraw
This prevents the graphs values from updating overly fast if you hold down the preset cycle key bind or the 1, 2, 3, or 4 keys. Closes: https://github.com/aristocratos/btop/issues/1497
This commit is contained in:
committed by
GitHub
parent
0c11d73494
commit
c611fe0e9d
@@ -1562,6 +1562,7 @@ namespace Proc {
|
||||
int user_size, thread_size, prog_size, cmd_size, tree_size;
|
||||
int dgraph_x, dgraph_width, d_width, d_x, d_y;
|
||||
bool previous_proc_banner_state = false;
|
||||
atomic<bool> resized (false);
|
||||
|
||||
string box;
|
||||
|
||||
@@ -2206,8 +2207,10 @@ namespace Draw {
|
||||
Global::overlay.clear();
|
||||
Runner::pause_output = false;
|
||||
Runner::redraw = true;
|
||||
Proc::p_counters.clear();
|
||||
Proc::p_graphs.clear();
|
||||
if (not (Proc::resized or Global::resized)) {
|
||||
Proc::p_counters.clear();
|
||||
Proc::p_graphs.clear();
|
||||
}
|
||||
if (Menu::active) Menu::redraw = true;
|
||||
|
||||
Input::mouse_mappings.clear();
|
||||
|
||||
@@ -254,9 +254,11 @@ namespace Input {
|
||||
return;
|
||||
}
|
||||
Config::current_preset = -1;
|
||||
if (Proc::shown) Proc::resized = true;
|
||||
Draw::calcSizes();
|
||||
Draw::update_clock(true);
|
||||
Runner::run("all", false, true);
|
||||
Proc::resized = false;
|
||||
Runner::run("all", true, true);
|
||||
return;
|
||||
}
|
||||
else if (is_in(key, "p", "P") and Config::preset_list.size() > 1) {
|
||||
@@ -273,9 +275,11 @@ namespace Input {
|
||||
Config::current_preset = old_preset;
|
||||
return;
|
||||
}
|
||||
if (Proc::shown) Proc::resized = true;
|
||||
Draw::calcSizes();
|
||||
Draw::update_clock(true);
|
||||
Runner::run("all", false, true);
|
||||
Proc::resized = false;
|
||||
Runner::run("all", true, true);
|
||||
return;
|
||||
} else if (is_in(key, "ctrl_r")) {
|
||||
kill(getpid(), SIGUSR2);
|
||||
|
||||
@@ -354,6 +354,7 @@ namespace Proc {
|
||||
extern int selected_pid, start, selected, collapse, expand, filter_found, selected_depth, toggle_children;
|
||||
extern int scroll_pos;
|
||||
extern string selected_name;
|
||||
extern atomic<bool> resized;
|
||||
|
||||
//? Contains the valid sorting options for processes
|
||||
const vector<string> sort_vector = {
|
||||
|
||||
Reference in New Issue
Block a user