mirror of
https://github.com/edeproject/ede.git
synced 2023-08-10 21:13:03 +03:00
Do not run timeout callbacks when panel is hidden. This will prevent reading cpu or memory status when their widgets are not visible.
This commit is contained in:
@@ -142,7 +142,6 @@ CPUMonitor::CPUMonitor() : Fl_Box(0, 0, 45, 25)
|
||||
colors[IWM_IDLE] = FL_BACKGROUND_COLOR;
|
||||
|
||||
layout();
|
||||
Fl::add_timeout(UPDATE_INTERVAL, cpu_timeout_cb, this);
|
||||
}
|
||||
|
||||
void CPUMonitor::clear()
|
||||
@@ -247,6 +246,22 @@ void CPUMonitor::layout() {
|
||||
}
|
||||
}
|
||||
|
||||
int CPUMonitor::handle(int e) {
|
||||
switch(e) {
|
||||
case FL_SHOW: {
|
||||
int ret = Fl_Box::handle(e);
|
||||
Fl::add_timeout(UPDATE_INTERVAL, cpu_timeout_cb, this);
|
||||
return ret;
|
||||
}
|
||||
|
||||
case FL_HIDE:
|
||||
Fl::remove_timeout(cpu_timeout_cb);
|
||||
/* fallthrough */
|
||||
}
|
||||
|
||||
return Fl_Box::handle(e);
|
||||
}
|
||||
|
||||
void CPUMonitor::update_status() {
|
||||
if(!cpu) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user