aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcorvid <corvid@lavabit.com>2011-07-21 01:29:53 +0000
committercorvid <corvid@lavabit.com>2011-07-21 01:29:53 +0000
commit5dc9e10627a82d0b72ed1735f802364d9d2d9315 (patch)
treef7d7361842e8cdf994d7eacfc25dab24f9646569
parentbef04134059ea4dea274294eb2484ddd24dc4872 (diff)
work around a fl_width() bug
Pretty easy workaround, yes? :)
-rw-r--r--dw/fltkplatform.cc4
-rw-r--r--dw/fltkui.cc8
2 files changed, 9 insertions, 3 deletions
diff --git a/dw/fltkplatform.cc b/dw/fltkplatform.cc
index d28dbdea..62f2daba 100644
--- a/dw/fltkplatform.cc
+++ b/dw/fltkplatform.cc
@@ -123,7 +123,9 @@ FltkFont::FltkFont (core::style::FontAttrs *attrs)
font = family->get (fa);
fl_font(font, size);
- spaceWidth = misc::max(0, (int)fl_width(' ') + letterSpacing);
+ /* WORKAROUND: fl_width(uint_t) is not working on non-xft X.
+ * Reported to FLTK as STR #2688 */
+ spaceWidth = misc::max(0, (int)fl_width(" ") + letterSpacing);
int xx, xy, xw, xh;
fl_text_extents("x", xx, xy, xw, xh);
xHeight = xh;
diff --git a/dw/fltkui.cc b/dw/fltkui.cc
index 5405d92e..788df084 100644
--- a/dw/fltkui.cc
+++ b/dw/fltkui.cc
@@ -539,8 +539,10 @@ void FltkEntryResource::sizeRequest (core::Requisition *requisition)
if (displayed() && style) {
FltkFont *font = (FltkFont*)style->font;
fl_font(font->font,font->size);
+ /* WORKAROUND: fl_width(uint_t) is not working on non-xft X.
+ * Reported to FLTK as STR #2688 */
requisition->width =
- (int)fl_width ('n')
+ (int)fl_width ("n")
* (maxLength == UNLIMITED_MAX_LENGTH ? 10 : maxLength)
+ label_w + (2 * RELIEF_X_THICKNESS);
requisition->ascent = font->ascent + RELIEF_Y_THICKNESS;
@@ -657,8 +659,10 @@ void FltkMultiLineTextResource::sizeRequest (core::Requisition *requisition)
if (style) {
FltkFont *font = (FltkFont*)style->font;
fl_font(font->font,font->size);
+ /* WORKAROUND: fl_width(uint_t) is not working on non-xft X.
+ * Reported to FLTK as STR #2688 */
requisition->width =
- (int)fl_width ('n') * numCols + 2 * RELIEF_X_THICKNESS;
+ (int)fl_width ("n") * numCols + 2 * RELIEF_X_THICKNESS;
requisition->ascent =
RELIEF_Y_THICKNESS + font->ascent +
(font->ascent + font->descent) * (numRows - 1);