]> Dogcows Code - chaz/openbox/commitdiff
was ending up using the wrong cache items. now i find and release it every time a...
authorDana Jansens <danakj@orodu.net>
Sat, 6 Jul 2002 00:28:27 +0000 (00:28 +0000)
committerDana Jansens <danakj@orodu.net>
Sat, 6 Jul 2002 00:28:27 +0000 (00:28 +0000)
src/Basemenu.cc
src/Font.cc
src/Font.hh

index 5b4acdf001009f2bf96b6f752c1e26a97158e157..b6b242b6d1562ff0973cc82a987757acf3cf6dbd 100644 (file)
@@ -536,6 +536,7 @@ bool Basemenu::hasSubmenu(int index) {
 
 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 @@ void Basemenu::drawItem(int index, bool highlight, bool clear,
   }
 
   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 :
index f377c5ebf330626104738a0386b4d6f36da37fc8..a3a42f49a9ea5b8c8b252b8dcd138479306acf30 100644 (file)
@@ -61,9 +61,7 @@ BFont::BFont(Display *d, BScreen *screen, const string &family, int size,
 #endif // XFT
                                        _font(0),
                                        _fontset(0),
-                                       _fontset_extents(0),
-                                       _cache(0),
-                                       _item(0) {
+                                       _fontset_extents(0) {
   _valid = init();
 }
 
@@ -76,9 +74,7 @@ BFont::BFont(Display *d, BScreen *screen, const string &xlfd) :
 #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 @@ BFont::~BFont() {
     XFreeFontSet(_display, _fontset);
   if (_font)
     XFreeFont(_display, _font);
-
-  if (_item)
-    _cache->release(_item);
 }
 
 
@@ -262,10 +255,8 @@ void BFont::drawString(Drawable d, int x, int y, const BColor &color,
   }
 #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 @@ void BFont::drawString(Drawable d, int x, int y, const BColor &color,
     XDrawString(_display, d, _item->gc(),
                 x, _font->ascent + y,
                 string.c_str(), string.size());
+
+  _cache->release(_item);
 }
 
 
index 38c4b4f873946bf537619a7e4996f84c4872e52f..4f4624ed60ca30caf1475e4801a9670449235783 100644 (file)
@@ -87,9 +87,6 @@ private:
   bool createFont(void);
   bool parseFontString(const std::string &xlfd);
   
-  mutable BGCCache *_cache;
-  mutable BGCCacheItem *_item;
-
   bool              _valid;
 
 public:
This page took 0.031139 seconds and 4 git commands to generate.