all repos — openbox @ 402e229e76dfd8b4cda8b7cf1fccaec5acf7570c

openbox fork - make it a bit more like ryudo

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
commit

402e229e76dfd8b4cda8b7cf1fccaec5acf7570c

parent

be127cb4c6682ec1fa8e28e1668d8e332be69ac8

4 files changed, 38 insertions(+), 21 deletions(-)

jump to
M src/Font.ccsrc/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.hhsrc/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.ccsrc/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.ccsrc/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(); } }