all repos — openbox @ 5282d92b627041047b2603b0c2d013c221f4dd56

openbox fork - make it a bit more like ryudo

was ending up using the wrong cache items. now i find and release it every time a string is drawn
Dana Jansens danakj@orodu.net
commit

5282d92b627041047b2603b0c2d013c221f4dd56

parent

6716bd33235b6fda4aeea75aea7c446e9f27fe40

3 files changed, 8 insertions(+), 16 deletions(-)

jump to
M src/Basemenu.ccsrc/Basemenu.cc

@@ -536,6 +536,7 @@

void Basemenu::drawItem(int index, bool highlight, bool clear, int x, int y, unsigned int w, unsigned int h) { + fprintf(stderr, "DRAW ITEM\n"); BasemenuItem *item = find(index); if (! item) return;

@@ -628,6 +629,7 @@ XFillRectangle(display, menu.frame, hipen.gc(), sel_x, sel_y, half_w, half_w);

} if (dotext && text) { + fprintf(stderr, "FONT: %s\nTEXT: %s\n", style->f_font->name().c_str(), text); style->f_font->drawString(menu.frame, text_x, text_y, (highlight ? style->h_text : (item->isEnabled() ? style->f_text :
M src/Font.ccsrc/Font.cc

@@ -61,9 +61,7 @@ _xftfont(0),

#endif // XFT _font(0), _fontset(0), - _fontset_extents(0), - _cache(0), - _item(0) { + _fontset_extents(0) { _valid = init(); }

@@ -76,9 +74,7 @@ _xftfont(0),

#endif // XFT _font(0), _fontset(0), - _fontset_extents(0), - _cache(0), - _item(0) { + _fontset_extents(0) { string int_xlfd; if (xlfd.empty()) int_xlfd = _fallback_font;

@@ -160,9 +156,6 @@ if (i18n.multibyte() && _fontset)

XFreeFontSet(_display, _fontset); if (_font) XFreeFont(_display, _font); - - if (_item) - _cache->release(_item); }

@@ -262,10 +255,8 @@ return;

} #endif // XFT - if (! _cache) - _cache = color.display()->gcCache(); - if (! _item) - _item = _cache->find(color, _font, GXcopy, ClipByChildren); + BGCCache *_cache = color.display()->gcCache(); + BGCCacheItem *_item = _cache->find(color, _font, GXcopy, ClipByChildren); assert(_cache); assert(_item);

@@ -278,6 +269,8 @@ else

XDrawString(_display, d, _item->gc(), x, _font->ascent + y, string.c_str(), string.size()); + + _cache->release(_item); }
M src/Font.hhsrc/Font.hh

@@ -87,9 +87,6 @@ bool init(const std::string &xlfd = "");

bool createFont(void); bool parseFontString(const std::string &xlfd); - mutable BGCCache *_cache; - mutable BGCCacheItem *_item; - bool _valid; public: