diff options
author | Mathias Gumz <akira at fluxbox dot org> | 2013-06-18 15:43:28 (GMT) |
---|---|---|
committer | Mathias Gumz <akira at fluxbox dot org> | 2013-06-18 15:43:28 (GMT) |
commit | 118ea25f9d581de6fc2c57dde7b8737cbba6faf4 (patch) | |
tree | c1ade88f6cc1de44c3eab0d7190a57d80e44a236 /src/RowSmartPlacement.hh | |
parent | 1f24e6decdc1b34b46565f4e9b76a4b6fa91a063 (diff) | |
download | fluxbox-118ea25f9d581de6fc2c57dde7b8737cbba6faf4.zip fluxbox-118ea25f9d581de6fc2c57dde7b8737cbba6faf4.tar.bz2 |
Speedup overlong text detection
Detecting very long window titles is done via FbTk::TextUtils::doAlignment().
Instead of removing one char from the title at a time to see if it fits into a
given 'max_width', we now use a binary-search like approach to get faster to
the right value. This massively improves the speed for windows with
(arbitrary) long window titles (see bug #1090, javascript
document.title = new Array(4999).join(".");
leads to massive waiting for fluxbox to detect that this window has a very
long title).
In addition to that Xft returns 'wrapped' shorts ('integer overflows') for
long texts: XGlpyhInfo.xOff is declared as signed short, it's able to hold
~32k pixels. A monospace font with font-size 10 produces an integer
overflow after 3276 chars / glyphs, thus rendering the check
if (text_width < max_width) { /* ... */ }
pointless and leading rendering the whole title. By calculating some kind of
upper limit for a pseudo-wide glyph ("WW") and strictly cutting off the input
string at that limit prevents this issue.
Diffstat (limited to 'src/RowSmartPlacement.hh')
0 files changed, 0 insertions, 0 deletions