Skip to content

Commit

Permalink
Merge pull request #1164 from bakkeby/master
Browse files Browse the repository at this point in the history
High CPU usage when show_age_threshold = -1
  • Loading branch information
fwsmit authored Apr 16, 2023
2 parents 50c819e + 9d82a4e commit d027742
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/dunst.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,17 @@ static gboolean run(void *data)

queues_update(status, now);

bool active = queues_length_displayed() > 0;

if (active) {
// Call draw before showing the window to avoid flickering
draw();
output->win_show(win);
} else {
if (!queues_length_displayed()) {
output->win_hide(win);
return G_SOURCE_REMOVE;
}

if (active) {
gint64 timeout_at = queues_get_next_datachange(now);
// Call draw before showing the window to avoid flickering
draw();
output->win_show(win);

gint64 timeout_at = queues_get_next_datachange(now);
if (timeout_at != -1) {
// Previous computations may have taken time, update `now`
// This might mean that `timeout_at` is now before `now`, so
// we have to make sure that `sleep` is still positive.
Expand Down

0 comments on commit d027742

Please sign in to comment.