Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

High CPU usage in windowlist when it's too wide #150

Open
lcolitti opened this issue May 24, 2023 · 1 comment · May be fixed by #156
Open

High CPU usage in windowlist when it's too wide #150

lcolitti opened this issue May 24, 2023 · 1 comment · May be fixed by #156

Comments

@lcolitti
Copy link
Contributor

To Reproduce
Steps to reproduce the behavior:

  1. Use wf-panel
  2. Use one panel on bottom of screen with several widgets including a window list,
  3. Create lots of windows, such that the window list width is constrained by available panel width

Expected behavior
Windows icons in list get smaller and CPU usage stays low.

Actual behaviour
wf-panel starts consuming 100% of one CPU. WayfireWindowList::on_draw continuously runs this code - maybe once every frame?

    /* We have changed the size/number of toplevels. On top of that, our list
     * is longer that the max size, so we need to re-layout the buttons */
    if (preferred_width > allocated_width && toplevels.size() > 0)
        set_button_width(get_target_button_width());

Wayfire version
0.7.4-2 from debian testing

Panel configuration

widgets_left = menu launchers spacing4 window-list
widgets_center = none
widgets_right = volume network battery clock
# ... configuration for 6 launchers
launchers_spacing = 0
launchers_size = 34
@lcolitti
Copy link
Contributor Author

I hacked this locally and it seems better, but I don't think it's completely correct:

     /* We have changed the size/number of toplevels. On top of that, our list
      * is longer that the max size, so we need to re-layout the buttons */
-    if (preferred_width > allocated_width && toplevels.size() > 0)
+    if (allocated_width != this->last_allocated_width
+            && preferred_width > allocated_width
+            && toplevels.size() > 0) {
         set_button_width(get_target_button_width());
+    }
+
+    this->last_allocated_width = allocated_width;
 }

@NamorNiradnug NamorNiradnug linked a pull request Jul 9, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant