all repos — openbox @ 02c028d8ae0a80206eeb97c662cd3ceebf900977

openbox fork - make it a bit more like ryudo

(optional) drop shadows for fonts
Dana Jansens danakj@orodu.net
commit

02c028d8ae0a80206eeb97c662cd3ceebf900977

parent

a0537f89e71118a7e6a777ccdc38587170efc345

4 files changed, 33 insertions(+), 4 deletions(-)

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

@@ -48,7 +48,7 @@ string BFont::_fallback_font = "fixed";

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

@@ -57,6 +57,7 @@ _size(size),

_bold(bold), _italic(italic), _antialias(antialias), + _shadow(shadow), _xftfont(0), _font(0), _fontset(0),

@@ -91,6 +92,7 @@ _display(d),

_screen(screen), #ifdef XFT _antialias(False), + _shadow(False), _xftfont(0), #endif // XFT _font(0),

@@ -259,6 +261,19 @@ if (_xftfont) {

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 = 0x55 | 0x55 << 8; // transparent shadow + c.pixel = BlackPixel(_display, _screen->getScreenNumber()); + + + XftDrawStringUtf8(draw, &c, _xftfont, x - 1, _xftfont->ascent + y + 1, + (XftChar8 *) string.c_str(), string.size()); + } XftColor c; c.color.red = color.red() | color.red() << 8;
M src/Font.hhsrc/Font.hh

@@ -71,6 +71,7 @@ bool _italic;

#ifdef XFT bool _antialias; + bool _shadow; XftFont *_xftfont;

@@ -95,7 +96,7 @@ public:

#ifdef XFT // loads an Xft font BFont(Display *d, BScreen *screen, const std::string &family, int size, - bool bold, bool italic, bool antialias = True); + bool bold, bool italic, bool shadow, bool antialias = True); #endif // loads a standard X font BFont(Display *d, BScreen *screen, const std::string &xlfd);
M src/Screen.ccsrc/Screen.cc

@@ -407,6 +407,13 @@ config->setValue(screenstr + "antialiasFonts", resource.aa_fonts);

} +void BScreen::saveShadowFonts(bool f) { + resource.shadow_fonts = f; + reconfigure(); + config->setValue(screenstr + "dropShadowFonts", resource.shadow_fonts); +} + + void BScreen::saveHideToolbar(bool h) { resource.hide_toolbar = h; if (resource.hide_toolbar)

@@ -593,6 +600,7 @@ void BScreen::save_rc(void) {

saveSloppyFocus(resource.sloppy_focus); saveAutoRaise(resource.auto_raise); saveImageDither(doImageDither()); + saveShadowFonts(resource.shadow_fonts); saveAAFonts(resource.aa_fonts); saveResizeZones(resource.resize_zones); saveOpaqueMove(resource.opaque_move);

@@ -645,6 +653,9 @@ resource.workspaces = 1;

if (! config->getValue(screenstr + "opaqueMove", resource.opaque_move)) resource.opaque_move = false; + + if (! config->getValue(screenstr + "dropShadowFonts", resource.shadow_fonts)) + resource.shadow_fonts = true; if (! config->getValue(screenstr + "antialiasFonts", resource.aa_fonts)) resource.aa_fonts = true;

@@ -2561,7 +2572,7 @@ italic = True;

} BFont *b = new BFont(blackbox->getXDisplay(), this, family, i, bold, - italic, resource.aa_fonts); + italic, resource.shadow_fonts, resource.aa_fonts); if (b->valid()) return b; else
M src/Screen.hhsrc/Screen.hh

@@ -148,7 +148,7 @@

bool sloppy_focus, auto_raise, auto_edge_balance, ordered_dither, opaque_move, full_max, focus_new, focus_last, click_raise, allow_scroll_lock, hide_toolbar, window_corner_snap, aa_fonts, - ignore_shaded, ignore_maximized, workspace_warping; + ignore_shaded, ignore_maximized, workspace_warping, shadow_fonts; int snap_to_windows, snap_to_edges; unsigned int snap_offset;

@@ -212,6 +212,7 @@ { return root_colormap_installed; }

inline bool doAutoRaise(void) const { return resource.auto_raise; } inline bool doClickRaise(void) const { return resource.click_raise; } inline bool isScreenManaged(void) const { return managed; } + inline bool doShadowFonts(void) const { return resource.shadow_fonts; } inline bool doAAFonts(void) const { return resource.aa_fonts; } inline bool doImageDither(void) const { return image_control->doDither(); } inline bool doOrderedDither(void) const { return resource.ordered_dither; }

@@ -296,6 +297,7 @@ void saveSnapThreshold(int t);

void saveSnapOffset(int o); void saveResistanceSize(int s); void saveImageDither(bool d); + void saveShadowFonts(bool f); void saveAAFonts(bool f); void saveOpaqueMove(bool o); void saveFullMax(bool f);