all repos — openbox @ 1e36acfd9198a7d8cbad4eef094e15a03eebc291

openbox fork - make it a bit more like ryudo

Allow variable tinting of the shadow. Use *.xft.tint: integer
integer is a number -100 to 100 that specifies the alpha channel, with
negative numbers meaning lighten the background and positive being
darken.
Scott Moynes smoynes@nexus.carleton.ca
commit

1e36acfd9198a7d8cbad4eef094e15a03eebc291

parent

dc4957eed8ea4844dc7bdba0830b7bbd95be3fd2

3 files changed, 20 insertions(+), 10 deletions(-)

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

@@ -49,7 +49,7 @@

#ifdef XFT BFont::BFont(Display *d, BScreen *screen, const string &family, int size, bool bold, bool italic, bool shadow, unsigned char offset, - unsigned char tint, bool antialias) : + int tint, bool antialias) : _display(d), _screen(screen), _family(family),

@@ -265,14 +265,22 @@ XftDraw *draw = XftDrawCreate(_display, d, _screen->getVisual(),

_screen->getColormap()); assert(draw); + if (_shadow) { XftColor c; - c.color.red = 0; - c.color.green = 0; - c.color.blue = 0; - c.color.alpha = _tint | _tint << 8; // transparent shadow - c.pixel = BlackPixel(_display, _screen->getScreenNumber()); - + if (_tint >= 0) { + c.color.red = 0; + c.color.green = 0; + c.color.blue = 0; + c.color.alpha = 0xffff * _tint/100; // transparent shadow + c.pixel = BlackPixel(_display, _screen->getScreenNumber()); + } else { + c.color.red = 0xffff * -_tint/100; + c.color.green = 0xffff * -_tint/100; + c.color.blue = 0xffff * -_tint/100; + c.color.alpha = 0xffff * -_tint/100; + c.pixel = WhitePixel(_display, _screen->getScreenNumber()); + } #ifdef XFT_UTF8 XftDrawStringUtf8( #else
M src/Font.hhsrc/Font.hh

@@ -73,7 +73,7 @@ #ifdef XFT

bool _antialias; bool _shadow; unsigned char _offset; - unsigned char _tint; + int _tint; XftFont *_xftfont;

@@ -99,7 +99,7 @@ #ifdef XFT

// loads an Xft font BFont(Display *d, BScreen *screen, const std::string &family, int size, bool bold, bool italic, bool shadow, unsigned char offset, - unsigned char tint, bool antialias = True); + int 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

@@ -2750,11 +2750,13 @@ if (offset > CHAR_MAX)

offset = 1; } - unsigned char tint = 0x40; + int tint = 25; if (style.getValue(rbasename + "xft.shadow.tint", s)) { tint = atoi(s.c_str()); } + if (tint > 100) tint = 100; + if (tint < -100) tint = -100; BFont *b = new BFont(blackbox->getXDisplay(), this, family, i, bold, italic, dropShadow && resource.shadow_fonts, offset,