Allow for customizing of the dropShadows. If xft.flags: shadow then you can specify the tint with xft.shadow.tint: which should be a number 0 to 255. xft.shadow.offset: will specify how many pixels to add in positioning. Also, try to fix the inheritence in the pressed button borders. Need a style to test this
Scott Moynes smoynes@nexus.carleton.ca
4 files changed,
38 insertions(+),
21 deletions(-)
M
src/Font.cc
→
src/Font.cc
@@ -48,7 +48,8 @@ string BFont::_fallback_font = "fixed";
#ifdef XFT BFont::BFont(Display *d, BScreen *screen, const string &family, int size, - bool bold, bool italic, bool shadow, bool antialias) : + bool bold, bool italic, bool shadow, unsigned char offset, + unsigned char tint, bool antialias) : _display(d), _screen(screen), _family(family),@@ -58,6 +59,8 @@ _bold(bold),
_italic(italic), _antialias(antialias), _shadow(shadow), + _offset(offset), + _tint(tint), _xftfont(0), _font(0), _fontset(0),@@ -267,7 +270,7 @@ XftColor c;
c.color.red = 0; c.color.green = 0; c.color.blue = 0; - c.color.alpha = 0x40 | 0x40 << 8; // transparent shadow + c.color.alpha = _tint | _tint << 8; // transparent shadow c.pixel = BlackPixel(_display, _screen->getScreenNumber()); #ifdef XFT_UTF8@@ -275,8 +278,9 @@ XftDrawStringUtf8(
#else XftDrawString8( #endif - draw, &c, _xftfont, x + 1, _xftfont->ascent + y + 1, - (XftChar8 *) string.c_str(), string.size()); + draw, &c, _xftfont, x + _offset, + _xftfont->ascent + y + _offset, (XftChar8 *) string.c_str(), + string.size()); } XftColor c;
M
src/Font.hh
→
src/Font.hh
@@ -72,6 +72,8 @@
#ifdef XFT bool _antialias; bool _shadow; + unsigned char _offset; + unsigned char _tint; XftFont *_xftfont;@@ -96,7 +98,8 @@ public:
#ifdef XFT // loads an Xft font BFont(Display *d, BScreen *screen, const std::string &family, int size, - bool bold, bool italic, bool shadow, bool antialias = True); + bool bold, bool italic, bool shadow, unsigned char offset, + unsigned char tint, bool antialias = True); #endif // loads a standard X font BFont(Display *d, BScreen *screen, const std::string &xlfd);
M
src/Screen.cc
→
src/Screen.cc
@@ -2733,6 +2733,7 @@ string family = s;
bool bold = False; bool italic = False; bool dropShadow = False; + if (style.getValue(rbasename + "xft.flags", s)) { if (s.find("bold") != string::npos) bold = True;@@ -2742,8 +2743,21 @@ if (s.find("shadow") != string::npos)
dropShadow = True; } + unsigned char offset = 1; + if (style.getValue(rbasename + "xft.shadow.offset", s)) { + offset = atoi(s.c_str()); //doesn't detect errors + if (offset > CHAR_MAX) + offset = 1; + } + + unsigned char tint = 0x40; + if (style.getValue(rbasename + "xft.shadow.tint", s)) { + tint = atoi(s.c_str()); + } + + BFont *b = new BFont(blackbox->getXDisplay(), this, family, i, bold, - italic, dropShadow, resource.aa_fonts); + italic, dropShadow, offset, tint, resource.aa_fonts); if (b->valid()) return b; else
M
src/Window.cc
→
src/Window.cc
@@ -600,21 +600,17 @@ // it allows for some backwards and forwards compatibility.
if (needsPressed) { texture = &(screen->getWindowStyle()->b_pressed); - Pixmap pbutton = texture->render(frame.button_w, frame.button_w, - pbutton); - unsigned long pixel; - - if (!pbutton) { - pixel = texture->color().pixel(); - if (needsPressed & 0x1) - frame.pfbutton_pixel = pixel; - if (needsPressed & 0x2) - frame.pubutton_pixel = pixel; - } else { - if (needsPressed & 0x1) - frame.pfbutton = pbutton; - if (needsPressed & 0x2) - frame.pubutton = pbutton; + if (needsPressed & 0x1) { + frame.pfbutton = texture->render(frame.button_w, frame.button_w, + frame.pfbutton); + if (! frame.pfbutton) + frame.pfbutton_pixel = texture->color().pixel(); + } + if (needsPressed & 0x2) { + frame.pubutton = texture->render(frame.button_w, frame.button_w, + frame.pubutton); + if (! frame.pubutton) + frame.pubutton = texture->color().pixel(); } }