Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#1090 Slow rendering of iconbar when title is very long

v1.3.6
closed-fixed
Mathias Gumz
None
7
2014-04-18
2013-06-06
joeytwiddle
No

If some window is foolish enough to set an incredibly long window title, then Fluxbox will slow down a lot when rendering the Iconbar (and maybe the Window Titlebar too).

To reproduce:

You can make your browser's title very long by doing this in the browser console (Chromium here):

document.title = new Array(4999).join(".");

Now try switching desktop, or Alt-Tabbing off and back onto the window, keeping your eye on 'top' or 'gkrellm'.
4999 was enough to hang up Fluxbox for a few seconds on my 32bit 2GHz machine, adjust as required.
You may need to set the IconbarMode to "Workspace".

To fix:

A simple fix would be to temporarily trim the window title down to ~300 chars before rendering the text (in the iconbar or the titlebar), if it is longer than 600 chars. (Perhaps also append "..." to indicate this has happened.)

Thanks. Best window manager ever!! :D

1 Attachments

Discussion

  • Mathias Gumz
    Mathias Gumz
    2013-06-06

    • Group: v1.3.5 --> v1.3.6
     
  • Mathias Gumz
    Mathias Gumz
    2013-06-06

    which version of fluxbox?

    can you set

    screen*tooltipDelay: 0

    in you .fluxbox/init?

     
  • joeytwiddle
    joeytwiddle
    2013-06-06

    Hi Mathias,

    I am running 1.3.2 on Ubuntu.

    Fluxbox is still getting unresponsive for a good few seconds, even after changing tooltipDelay to 0 and restarting.

    I also tried hiding my IconBar. As expected, this made things a bit more responsive, but still slow to recover, as the window title must still be rendered.

    By the way, my style uses window.font: sans-8:bold

    This isn't really Fluxbox's fault. Window titles should never be that long. But we could opt to mitigate the problem for those rare occasions when it does happen.

    (I have now fixed the software that was causing the ridiculously long window title. But it took me a couple of years to realize that was the problem. For ages I thought it was some rare bug in Firefox!)

     
  • Mathias Gumz
    Mathias Gumz
    2013-06-06

    well, no. fluxbox recognizes overlong texts already. i thought i ve seen code that actually prevents overlong titles from being rendered. like

    http://git.fluxbox.org/fluxbox.git/tree/src/FbTk/TextButton.cc#n149
    http://git.fluxbox.org/fluxbox.git/tree/src/FbTk/TextButton.cc#n193
    http://git.fluxbox.org/fluxbox.git/tree/src/IconButton.cc#n123
    

    strange.

     
  • Mathias Gumz
    Mathias Gumz
    2013-06-17

    • status: open --> open-accepted
     
  • Mathias Gumz
    Mathias Gumz
    2013-06-17

     
  • Mathias Gumz
    Mathias Gumz
    2013-06-17

    please try the attached patch, it should fix the issue noticeably.

    the function FbTk::TextUtils::doAlignment() tries to cut off the input-text by reducing the length of it by 1 at a time. i switched to a binary-search-like approach, picked the right value based upon a very small glyph ('.') to get a good nearby value and fixed an issue with 'overlong' texts within the Xft-backend (which is able to handle text-widths up to 32k pixels ... 4000 dots exceeds this limit and thus returns something undefined (-7600 with) which disables the text-cutting completely since -7600 is smaller than any visible with and thus "that text fits perfectly").

    anyway, try the patch please.

     
  • joeytwiddle
    joeytwiddle
    2013-06-18

    Tried the patch and it does indeed fix my problem. Fluxbox no longer lags at all, with 4999, 9999, or 19999 dots. Good find, thanks a lot. :)

     
  • Mathias Gumz
    Mathias Gumz
    2013-06-18

    • status: open-accepted --> closed-fixed