X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fframe.cc;h=23742be8496dad705a7bc9bb5f8d7416d7ff3820;hb=361303715b6eb54d77ed8e1c9ad8f35e44e4ede1;hp=9e97f2b0594e3d91df4506f8c89b2699144fd52e;hpb=2f2d6e736ed4565564e57bdd37e5cb23826d13cf;p=chaz%2Fopenbox diff --git a/src/frame.cc b/src/frame.cc index 9e97f2b0..23742be8 100644 --- a/src/frame.cc +++ b/src/frame.cc @@ -437,36 +437,35 @@ void Frame::renderLabel() otk::ustring t = _client->title(); // the actual text to draw int x = geom.bevel; // x coord for the text - if (x * 2 > geom.label_width) return; // no room at all - - // find a string that will fit inside the area for text - otk::ustring::size_type text_len = t.size(); - int length; - int maxsize = geom.label_width - geom.bevel * 2; + if (x * 2 < geom.label_width) { + // find a string that will fit inside the area for text + otk::ustring::size_type text_len = t.size(); + int length; + int maxsize = geom.label_width - geom.bevel * 2; - do { - t.resize(text_len); - length = font->measureString(t); // this returns an unsigned, so check < 0 - if (length < 0) length = maxsize; // if the string's that long just adjust - } while (length > maxsize && text_len-- > 0); - - if (text_len <= 0) return; // won't fit anything - - // justify the text - switch (style->labelTextJustify()) { - case otk::RenderStyle::RightBottomJustify: - x += maxsize - length; - break; - case otk::RenderStyle::CenterJustify: - x += (maxsize - length) / 2; - break; - case otk::RenderStyle::LeftTopJustify: - break; - } + do { + t.resize(text_len); + length = font->measureString(t);// this returns an unsigned, so check < 0 + if (length < 0) length = maxsize;// if the string's that long just adjust + } while (length > maxsize && text_len-- > 0); + + // justify the text + switch (style->labelTextJustify()) { + case otk::RenderStyle::RightBottomJustify: + x += maxsize - length; + break; + case otk::RenderStyle::CenterJustify: + x += (maxsize - length) / 2; + break; + case otk::RenderStyle::LeftTopJustify: + break; + } - control->drawString(*s, *font, x, 0, - *(_client->focused() ? style->textFocusColor() : - style->textUnfocusColor()), t); + if (text_len > 0) + control->drawString(*s, *font, x, 0, + *(_client->focused() ? style->textFocusColor() : + style->textUnfocusColor()), t); + } XSetWindowBackgroundPixmap(**otk::display, _label, s->pixmap()); XClearWindow(**otk::display, _label); @@ -558,6 +557,11 @@ void Frame::renderIcon() const Icon *icon = _client->icon(otk::Size(geom.button_size, geom.button_size)); control->drawImage(*s, icon->w, icon->h, icon->data); + if (!icon->data) { + Pixmap p = _client->pixmapIcon(), m = _client->pixmapIconMask(); + if (p != None) + control->drawImage(*s, p, m); + } XSetWindowBackgroundPixmap(**otk::display, _icon, s->pixmap()); XClearWindow(**otk::display, _icon);