#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,
+ int tint, bool antialias) :
_display(d),
_screen(screen),
_family(family),
_italic(italic),
_antialias(antialias),
_shadow(shadow),
+ _offset(offset),
+ _tint(tint),
_xftfont(0),
_font(0),
_fontset(0),
if (_shadow) {
XftColor c;
- c.color.red = 0;
- c.color.green = 0;
- c.color.blue = 0;
- c.color.alpha = 0x40 | 0x40 << 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
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;
_display, _xftfont, (XftChar8 *) string.c_str(),
string.size(), &info);
- return info.xOff + (_shadow ? 1 : 0);
+ return info.xOff + (_shadow ? std::abs(_offset) : 0);
}
#endif // XFT
#ifdef XFT
if (_xftfont)
- return _xftfont->height + (_shadow ? 1 : 0);
+ return _xftfont->height + (_shadow ? std::abs(_offset) : 0);
#endif // XFT
if (i18n.multibyte())
#ifdef XFT
bool _antialias;
bool _shadow;
+ unsigned char _offset;
+ int _tint;
XftFont *_xftfont;
#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,
+ int tint, bool antialias = True);
#endif
// loads a standard X font
BFont(Display *d, BScreen *screen, const std::string &xlfd);
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;
if (s.find("italic") != string::npos)
italic = True;
+ 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, resource.shadow_fonts, resource.aa_fonts);
+ italic, dropShadow && resource.shadow_fonts, offset,
+ tint, resource.aa_fonts);
if (b->valid())
return b;
else
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();
}
}
if (dh > client.max_height) dh = client.max_height;
}
- assert(dw >= base_width && dh >= base_height);
-
if (client.width_inc > 1) {
dw -= base_width;
dw /= client.width_inc;
+ * Fixed (hopefully) the ugly bugly that would cause (Marius)
+ epist to hog the keyboard on invalid keys.
+
+ * Added stackedCyclingRaise option, to allow windows (Marius)
+ to raise on focus when stacked is on.
+
+ * Small fixes, better sanity checks, much better (Marius)
+ error reporting on bad keys and modifiers.
+
2.1.0
* Improved parser: much better error reporting for
}
bool_options[] = {
{ "stackedcycling", Config::stackedCycling },
+ { "stackedcyclingraise", Config::stackedCyclingRaise },
{ "", NUM_BOOL_TYPES }
};
enum BoolType {
NO_BOOL_TYPE,
stackedCycling,
+ stackedCyclingRaise,
NUM_BOOL_TYPES
};
\fBepist\fR [options]
.SH DESCRIPTION
\fBepist\fR is intended to provide keygrabbing for the OpenBox window manager
-for the X Windows System. This allows you to control things with keypresses
+for the X Window System. This allows you to control things with keypresses
rather than the mouse.
.SH OPTIONS
.TP
.br
}
.SH OPTIONS
-.SS stackedCycling (boolean)
+.SS stackedCycling (boolean, default=off)
When this option is set to True, any window cycling actions, such as nextWindow,
prevWindow, nextWindowOfClass, etc., will cause the windows to focus, but they will
not be raised until the modifiers are released. When the modifier is released,
the focused (and now raised) window will be moved to the top of the stacking order,
so if you execute nextWindow and release the modifiers multiple times, focus will
cycle between two windows.
-.SS chainTimeout (number)
+.SS stackedCyclingRaise (boolean, default=off)
+This option modifies the window raise behavior when stackedCycling is turned on.
+When true, windows will be raised immediatly on focus, rather than when the
+keys are released. This may be desirable if you frequently have windows that are
+obscured by other windows.
+.SS chainTimeout (number, default=3500)
Specifies the period of time after which a started key chain will
be timed out. It takes a number argument specifying the number of
milliseconds to wait. It defaults to 4000.
-.SS workspaceColumns (number)
+.SS workspaceColumns (number, default=0, disabled)
Specifies the number of columns of your workspace layout if you are using
your workspaces in a 2-dimensional manner. This option must exist if one of
the prevWorkspaceColumn, prevWorkspaceRow, nextWorkspaceColumn,
#include "config.hh"
#include <string>
+#include <iostream>
using std::string;
void keytree::ungrabDefaults(screen *scr)
{
+ Action *act;
+
ChildList::const_iterator it, end = _head->children.end();
- for (it = _head->children.begin(); it != end; ++it)
- if ( (*it)->action && (*it)->action->type() != Action::toggleGrabs)
- scr->ungrabKey( (*it)->action->keycode(), (*it)->action->modifierMask() );
+ for (it = _head->children.begin(); it != end; ++it) {
+ act = (*it)->action;
+ if (act && act->type() != Action::toggleGrabs)
+ scr->ungrabKey(act->keycode(), act->modifierMask());
+ }
}
void keytree::grabChildren(keynode *node, screen *scr)
{
+ Action *act;
+
ChildList::const_iterator it, end = node->children.end();
- for (it = node->children.begin(); it != end; ++it)
- if ( (*it)->action )
- scr->grabKey( (*it)->action->keycode(), (*it)->action->modifierMask() );
+ for (it = node->children.begin(); it != end; ++it) {
+ act = (*it)->action;
+ if (act)
+ scr->grabKey(act->keycode(), act->modifierMask());
+ }
}
void keytree::ungrabChildren(keynode *node, screen *scr)
void keytree::addAction(Action::ActionType action, unsigned int mask,
string key, string arg)
{
- keynode *tmp = new keynode;
-
if (action == Action::toggleGrabs && _current != _head) {
// the toggleGrabs key can only be set up as a root key, since if
// it was a chain key, we'd have to not ungrab the whole chain up
return;
}
+ KeySym sym = XStringToKeysym(key.c_str());
+ keynode *tmp = new keynode;
+
tmp->action = new Action(action,
- XKeysymToKeycode(_display,
- XStringToKeysym(key.c_str())),
+ XKeysymToKeycode(_display, sym),
mask, arg);
tmp->parent = _current;
_current->children.push_back(tmp);
{
if (_current->action)
delete _current->action;
-
+
+ KeySym sym = XStringToKeysym(key.c_str());
_current->action = new Action(action,
- XKeysymToKeycode(_display,
- XStringToKeysym(key.c_str())),
+ XKeysymToKeycode(_display, sym),
mask, arg);
}
yyin = fopen(rc_file.c_str(), "r");
- yyparse(this);
+ if (yyin) {
+ yyparse(this);
+ fclose(yyin);
+ } else {
+ std::cerr << "ERROR: Configuration file could not be opened/found.\n";
+ }
- fclose(yyin);
_kt->reset();
_kt->initialize();
}
+void parser::setKey(string key)
+{
+ KeySym sym = XStringToKeysym(key.c_str());
+
+ if (sym == 0) {
+ std::cerr << "ERROR: Invalid key (" << key << ")! This may cause odd behavior.\n";
+ _add = false;
+ } else {
+ _key = key;
+ }
+}
+
void parser::setAction(string act)
{
struct {
void parser::setChainBinding()
{
- if (_mask != 0 && _key != "") {
- if (!_add) {
- cout << "Error: Bad modifier detected on chain's root key.\n";
- _add = true;
- }
+ if (_add)
_kt->setCurrentNodeProps(Action::noaction, _mask, _key, "");
- reset();
- }
+
+ _add = true;
+ reset();
}
void parser::reset()
void parse(std::string);
- void setKey(std::string key)
- { _key = key; }
-
void setArgumentNum(std::string arg)
{ _arg = arg; }
void setOption(std::string opt)
{ _config->addOption(opt, _arg); }
+ void setKey(std::string);
void setAction(std::string);
void addModifier(std::string);
void endAction();
screen::screen(epist *epist, int number)
: _clients(epist->clientsList()), _active(epist->activeWindow()),
_config(epist->getConfig()), _grabbed(true), _cycling(false),
- _stacked_cycling(false)
+ _stacked_cycling(false), _stacked_raise(false)
{
_epist = epist;
_xatom = _epist->xatom();
_root = _info->getRootWindow();
_config->getValue(Config::stackedCycling, _stacked_cycling);
+ if (_stacked_cycling)
+ _config->getValue(Config::stackedCyclingRaise, _stacked_raise);
// find a window manager supporting NETWM, waiting for it to load if we must
int count = 20; // try for 20 seconds
// if the window is on another desktop, we can't use XSetInputFocus, since
// it doesn't imply a workspace change.
- if (t->desktop() == _active_desktop || t->desktop() == 0xffffffff)
- t->focus(false); // focus, but don't raise
+ if (_stacked_raise || (t->desktop() != _active_desktop &&
+ t->desktop() != 0xffffffff))
+ t->focus(); // raise
else
- t->focus(); // change workspace and focus
+ t->focus(false); // don't raise
}
else {
t->focus();
bool _grabbed; // used for keygrab toggle function
bool _cycling; // used for stacked cycling
bool _stacked_cycling;
+ bool _stacked_raise;
XWindow *findWindow(const XEvent &e) const;
void updateNumDesktops();