uber patch.
Added configuration options. Added workspace grid changing. Added keychain timeouts. Fixed some whitespace.
This commit is contained in:
parent
b1223a2acc
commit
bd05f7ec58
17 changed files with 785 additions and 396 deletions
|
@ -11,7 +11,7 @@ bin_PROGRAMS = epist
|
||||||
|
|
||||||
man_MANS = epist.1 epistrc.5
|
man_MANS = epist.1 epistrc.5
|
||||||
|
|
||||||
epist_SOURCES = epist.cc window.cc screen.cc main.cc actions.cc yacc_parser.cc parser.cc keytree.cc lex.yy.c
|
epist_SOURCES = epist.cc window.cc screen.cc main.cc actions.cc yacc_parser.cc parser.cc keytree.cc lex.yy.c config.cc
|
||||||
epist_LDADD = ../../src/XAtom.o ../../src/BaseDisplay.o \
|
epist_LDADD = ../../src/XAtom.o ../../src/BaseDisplay.o \
|
||||||
../../src/Util.o ../../src/i18n.o ../../src/Timer.o \
|
../../src/Util.o ../../src/i18n.o ../../src/Timer.o \
|
||||||
../../src/GCCache.o ../../src/Color.o
|
../../src/GCCache.o ../../src/Color.o
|
||||||
|
@ -57,6 +57,9 @@ screen.o: screen.cc ../../src/BaseDisplay.hh ../../src/Timer.hh \
|
||||||
window.o: window.cc epist.hh actions.hh window.hh ../../src/Util.hh \
|
window.o: window.cc epist.hh actions.hh window.hh ../../src/Util.hh \
|
||||||
keytree.hh screen.hh ../../src/BaseDisplay.hh ../../src/Timer.hh \
|
keytree.hh screen.hh ../../src/BaseDisplay.hh ../../src/Timer.hh \
|
||||||
../../src/XAtom.hh
|
../../src/XAtom.hh
|
||||||
|
config.o: config.cc config.hh ../../src/Util.hh \
|
||||||
|
keytree.hh screen.hh ../../src/BaseDisplay.hh ../../src/Timer.hh \
|
||||||
|
../../src/XAtom.hh
|
||||||
yacc_parser.cc: epist.y
|
yacc_parser.cc: epist.y
|
||||||
yacc -d epist.y -o yacc_parser.cc
|
yacc -d epist.y -o yacc_parser.cc
|
||||||
lex.yy.c: epist.l
|
lex.yy.c: epist.l
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// -*- mode: C++; indent-tabs-mode: nil; -*-
|
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||||
// actions.hh for Epistrophy - a key handler for NETWM/EWMH window managers.
|
// actions.hh for Epistrophy - a key handler for NETWM/EWMH window managers.
|
||||||
// Copyright (c) 2002 - 2002 Ben Jansens <ben at orodu.net>
|
// Copyright (c) 2002 - 2002 Ben Jansens <ben at orodu.net>
|
||||||
//
|
//
|
||||||
|
@ -32,7 +32,6 @@ extern "C" {
|
||||||
|
|
||||||
class Action {
|
class Action {
|
||||||
public:
|
public:
|
||||||
// xOr: this is crap.
|
|
||||||
enum ActionType {
|
enum ActionType {
|
||||||
noaction = 0,
|
noaction = 0,
|
||||||
execute, //done
|
execute, //done
|
||||||
|
@ -68,10 +67,20 @@ public:
|
||||||
nextWindowOfClassOnAllWorkspaces, //done for now
|
nextWindowOfClassOnAllWorkspaces, //done for now
|
||||||
prevWindowOfClassOnAllWorkspaces, //done for now
|
prevWindowOfClassOnAllWorkspaces, //done for now
|
||||||
|
|
||||||
|
upWindow,
|
||||||
|
downWindow,
|
||||||
|
leftWindow,
|
||||||
|
rightWindow,
|
||||||
|
|
||||||
changeWorkspace, //done
|
changeWorkspace, //done
|
||||||
nextWorkspace, //done
|
nextWorkspace, //done
|
||||||
prevWorkspace, //done
|
prevWorkspace, //done
|
||||||
|
|
||||||
|
upWorkspace, //all done
|
||||||
|
downWorkspace,
|
||||||
|
leftWorkspace,
|
||||||
|
rightWorkspace,
|
||||||
|
|
||||||
nextScreen, //done for now
|
nextScreen, //done for now
|
||||||
prevScreen, //done for now
|
prevScreen, //done for now
|
||||||
|
|
||||||
|
@ -83,7 +92,7 @@ public:
|
||||||
keyChain,
|
keyChain,
|
||||||
numberChain,
|
numberChain,
|
||||||
|
|
||||||
cancel,
|
cancelChain, //done
|
||||||
|
|
||||||
NUM_ACTIONS
|
NUM_ACTIONS
|
||||||
};
|
};
|
||||||
|
|
86
util/epist/config.cc
Normal file
86
util/epist/config.cc
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||||
|
// config.cc for Epistrophy - a key handler for NETWM/EWMH window managers.
|
||||||
|
// Copyright (c) 2002 - 2002 Ben Jansens <ben at orodu.net>
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
// copy of this software and associated documentation files (the "Software"),
|
||||||
|
// to deal in the Software without restriction, including without limitation
|
||||||
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
// and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
// Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
#include "config.hh"
|
||||||
|
|
||||||
|
Config::Config() {}
|
||||||
|
|
||||||
|
Config::~Config()
|
||||||
|
{
|
||||||
|
ItemList::const_iterator it = items.begin(), end = items.end();
|
||||||
|
for (; it != end; ++it)
|
||||||
|
delete *it;
|
||||||
|
items.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const string &Config::getStringValue(Config::ItemType type) const
|
||||||
|
{
|
||||||
|
ItemList::const_iterator it = items.begin(), end = items.end();
|
||||||
|
for (; it != end; ++it) {
|
||||||
|
if ((*it)->getType() == type)
|
||||||
|
return (*it)->getStringValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int Config::getNumberValue(Config::ItemType type) const
|
||||||
|
{
|
||||||
|
ItemList::const_iterator it = items.begin(), end = items.end();
|
||||||
|
for (; it != end; ++it) {
|
||||||
|
if ((*it)->getType() == type)
|
||||||
|
return (*it)->getNumberValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Config::addOption(ConfigItem *item)
|
||||||
|
{
|
||||||
|
items.push_back(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Config::addOption(const std::string &name, const std::string &value)
|
||||||
|
{
|
||||||
|
const struct {
|
||||||
|
const char *name;
|
||||||
|
Config::ItemType type;
|
||||||
|
}
|
||||||
|
options[] = {
|
||||||
|
{ "notype", Config::noType },
|
||||||
|
{ "chaintimeout", Config::chainTimeout },
|
||||||
|
{ "workspacecolumns", Config::workspaceColumns },
|
||||||
|
{ "", numTypes }
|
||||||
|
};
|
||||||
|
|
||||||
|
size_t i = 0;
|
||||||
|
while (options[i].type != numTypes) {
|
||||||
|
if (strcasecmp(name.c_str(), options[i].name) == 0) {
|
||||||
|
ConfigItem *item = new ConfigItem(options[i].type, value);
|
||||||
|
items.push_back(item);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
75
util/epist/config.hh
Normal file
75
util/epist/config.hh
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||||
|
// config.hh for Epistrophy - a key handler for NETWM/EWMH window managers.
|
||||||
|
// Copyright (c) 2002 - 2002 Ben Jansens <ben at orodu.net>
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
// copy of this software and associated documentation files (the "Software"),
|
||||||
|
// to deal in the Software without restriction, including without limitation
|
||||||
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
// and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
// Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
#ifndef __config_hh
|
||||||
|
#define __config_hh
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <list>
|
||||||
|
|
||||||
|
class ConfigItem;
|
||||||
|
|
||||||
|
class Config {
|
||||||
|
public:
|
||||||
|
enum ItemType {
|
||||||
|
noType,
|
||||||
|
chainTimeout,
|
||||||
|
workspaceColumns,
|
||||||
|
numTypes
|
||||||
|
};
|
||||||
|
|
||||||
|
private:
|
||||||
|
typedef std::list<ConfigItem *> ItemList;
|
||||||
|
ItemList items;
|
||||||
|
|
||||||
|
public:
|
||||||
|
Config();
|
||||||
|
~Config();
|
||||||
|
|
||||||
|
const std::string &getStringValue(Config::ItemType) const;
|
||||||
|
int getNumberValue(Config::ItemType) const;
|
||||||
|
void addOption(ConfigItem *);
|
||||||
|
void addOption(const std::string &, const std::string &);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class ConfigItem {
|
||||||
|
private:
|
||||||
|
Config::ItemType _type;
|
||||||
|
std::string _value;
|
||||||
|
|
||||||
|
public:
|
||||||
|
ConfigItem(Config::ItemType type, std::string value)
|
||||||
|
: _type(type), _value(value) {}
|
||||||
|
~ConfigItem() {}
|
||||||
|
|
||||||
|
inline const std::string &getStringValue() const
|
||||||
|
{ return _value; }
|
||||||
|
|
||||||
|
inline int getNumberValue() const
|
||||||
|
{ return atoi(_value.c_str()); }
|
||||||
|
|
||||||
|
inline Config::ItemType getType() const
|
||||||
|
{ return _type; }
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // __config_hh
|
|
@ -1,4 +1,4 @@
|
||||||
// -*- mode: C++; indent-tabs-mode: nil; -*-
|
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||||
// epist.cc for Epistrophy - a key handler for NETWM/EWMH window managers.
|
// epist.cc for Epistrophy - a key handler for NETWM/EWMH window managers.
|
||||||
// Copyright (c) 2002 - 2002 Ben Jansens <ben at orodu.net>
|
// Copyright (c) 2002 - 2002 Ben Jansens <ben at orodu.net>
|
||||||
//
|
//
|
||||||
|
@ -84,9 +84,15 @@ epist::epist(char **argv, char *dpy_name, char *rc_file)
|
||||||
_rc_file = DEFAULTRC;
|
_rc_file = DEFAULTRC;
|
||||||
|
|
||||||
_xatom = new XAtom(getXDisplay());
|
_xatom = new XAtom(getXDisplay());
|
||||||
|
|
||||||
_active = _clients.end();
|
_active = _clients.end();
|
||||||
|
|
||||||
|
_config = new Config;
|
||||||
|
_ktree = new keytree(getXDisplay(), this);
|
||||||
|
|
||||||
|
// set up the key tree
|
||||||
|
parser p(_ktree, _config);
|
||||||
|
p.parse(_rc_file);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < getNumberOfScreens(); ++i) {
|
for (unsigned int i = 0; i < getNumberOfScreens(); ++i) {
|
||||||
screen *s = new screen(this, i);
|
screen *s = new screen(this, i);
|
||||||
if (s->managed()) {
|
if (s->managed()) {
|
||||||
|
@ -99,12 +105,6 @@ epist::epist(char **argv, char *dpy_name, char *rc_file)
|
||||||
::exit(1);
|
::exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
_ktree = new keytree(getXDisplay());
|
|
||||||
|
|
||||||
// set up the key tree
|
|
||||||
parser p(_ktree);
|
|
||||||
p.parse(_rc_file);
|
|
||||||
|
|
||||||
activateGrabs();
|
activateGrabs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// -*- mode: C++; indent-tabs-mode: nil; -*-
|
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||||
// epist.hh for Epistrophy - a key handler for NETWM/EWMH window managers.
|
// epist.hh for Epistrophy - a key handler for NETWM/EWMH window managers.
|
||||||
// Copyright (c) 2002 - 2002 Ben Jansens <ben at orodu.net>
|
// Copyright (c) 2002 - 2002 Ben Jansens <ben at orodu.net>
|
||||||
//
|
//
|
||||||
|
@ -33,6 +33,7 @@ extern "C" {
|
||||||
#include "actions.hh"
|
#include "actions.hh"
|
||||||
#include "window.hh"
|
#include "window.hh"
|
||||||
#include "keytree.hh"
|
#include "keytree.hh"
|
||||||
|
#include "config.hh"
|
||||||
|
|
||||||
#include "../../src/BaseDisplay.hh"
|
#include "../../src/BaseDisplay.hh"
|
||||||
|
|
||||||
|
@ -45,6 +46,7 @@ private:
|
||||||
XAtom *_xatom;
|
XAtom *_xatom;
|
||||||
char **_argv;
|
char **_argv;
|
||||||
keytree *_ktree;
|
keytree *_ktree;
|
||||||
|
Config *_config;
|
||||||
|
|
||||||
typedef std::vector<screen *> ScreenList;
|
typedef std::vector<screen *> ScreenList;
|
||||||
ScreenList _screens;
|
ScreenList _screens;
|
||||||
|
@ -82,6 +84,7 @@ public:
|
||||||
|
|
||||||
const ActionList &actions(void) { return _actions; }
|
const ActionList &actions(void) { return _actions; }
|
||||||
keytree &getKeyTree(void) { return *_ktree; }
|
keytree &getKeyTree(void) { return *_ktree; }
|
||||||
|
inline const Config *getConfig(void) { return _config; }
|
||||||
|
|
||||||
WindowList& clientsList() { return _clients; }
|
WindowList& clientsList() { return _clients; }
|
||||||
WindowList::iterator& activeWindow() { return _active; }
|
WindowList::iterator& activeWindow() { return _active; }
|
||||||
|
|
|
@ -13,6 +13,8 @@ extern YYSTYPE yylval;
|
||||||
\} return EBRACE;
|
\} return EBRACE;
|
||||||
; return SEMICOLON;
|
; return SEMICOLON;
|
||||||
- return DASH;
|
- return DASH;
|
||||||
|
Options |
|
||||||
|
options return OPTIONS;
|
||||||
Mod1 |
|
Mod1 |
|
||||||
Mod2 |
|
Mod2 |
|
||||||
Mod3 |
|
Mod3 |
|
||||||
|
|
|
@ -20,12 +20,13 @@ void yyerror(const char *c) {
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%token OBRACE EBRACE SEMICOLON DASH NUMBER QUOTES WORD BINDING
|
%token OBRACE EBRACE SEMICOLON DASH NUMBER QUOTES WORD BINDING OPTIONS
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
| commands command
|
| commands command
|
||||||
|
| commands options_block
|
||||||
;
|
;
|
||||||
|
|
||||||
command:
|
command:
|
||||||
|
@ -48,6 +49,10 @@ chain_command:
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
options_block:
|
||||||
|
options_keyword OBRACE options EBRACE
|
||||||
|
;
|
||||||
|
|
||||||
binding:
|
binding:
|
||||||
binding_w_modifier bind_key
|
binding_w_modifier bind_key
|
||||||
;
|
;
|
||||||
|
@ -79,5 +84,18 @@ parameter:
|
||||||
| QUOTES { ((parser*)parser_obj)->setArgumentStr($1); }
|
| QUOTES { ((parser*)parser_obj)->setArgumentStr($1); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
options_keyword:
|
||||||
|
OPTIONS
|
||||||
|
;
|
||||||
|
|
||||||
|
options:
|
||||||
|
| options option
|
||||||
|
;
|
||||||
|
|
||||||
|
option:
|
||||||
|
WORD parameter SEMICOLON
|
||||||
|
{ ((parser*)parser_obj)->setOption($1); }
|
||||||
|
;
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// -*- mode: C++; indent-tabs-mode: nil; -*-
|
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||||
// keytree.cc for Epistrophy - a key handler for NETWM/EWMH window managers.
|
// keytree.cc for Epistrophy - a key handler for NETWM/EWMH window managers.
|
||||||
// Copyright (c) 2002 - 2002 Ben Jansens <ben at orodu.net>
|
// Copyright (c) 2002 - 2002 Ben Jansens <ben at orodu.net>
|
||||||
//
|
//
|
||||||
|
@ -21,23 +21,39 @@
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
#include "keytree.hh"
|
#include "keytree.hh"
|
||||||
|
#include "epist.hh"
|
||||||
|
#include "config.hh"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
|
keytree::keytree(Display *display, epist *ep)
|
||||||
keytree::keytree(Display *display) : _display(display)
|
: _display(display), _timeout_screen(NULL), _timer(NULL), _epist(ep)
|
||||||
{
|
{
|
||||||
_head = new keynode;
|
_head = new keynode;
|
||||||
_head->parent = NULL;
|
_head->parent = NULL;
|
||||||
_head->action = NULL; // head's action is always NULL
|
_head->action = NULL; // head's action is always NULL
|
||||||
_current = _head;
|
_current = _head;
|
||||||
|
// for complete initialization, initialize() has to be called as well. We
|
||||||
|
// call initialize() when we are certain that the config object (which the
|
||||||
|
// timer uses) has been fully initialized. (see parser::parse())
|
||||||
}
|
}
|
||||||
|
|
||||||
keytree::~keytree()
|
keytree::~keytree()
|
||||||
{
|
{
|
||||||
clearTree(_head);
|
clearTree(_head);
|
||||||
|
delete _timer;
|
||||||
|
}
|
||||||
|
|
||||||
|
void keytree::unloadBindings()
|
||||||
|
{
|
||||||
|
ChildList::iterator it, end = _head->children.end();
|
||||||
|
for (it = _head->children.begin(); it != end; ++it)
|
||||||
|
clearTree(*it);
|
||||||
|
|
||||||
|
_head->children.clear();
|
||||||
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void keytree::clearTree(keynode *node)
|
void keytree::clearTree(keynode *node)
|
||||||
|
@ -49,9 +65,12 @@ void keytree::clearTree(keynode *node)
|
||||||
for (it = node->children.begin(); it != end; ++it)
|
for (it = node->children.begin(); it != end; ++it)
|
||||||
clearTree(*it);
|
clearTree(*it);
|
||||||
|
|
||||||
|
node->children.clear();
|
||||||
|
|
||||||
if (node->action)
|
if (node->action)
|
||||||
delete node->action;
|
delete node->action;
|
||||||
delete node;
|
delete node;
|
||||||
|
node = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void keytree::grabDefaults(screen *scr)
|
void keytree::grabDefaults(screen *scr)
|
||||||
|
@ -59,6 +78,14 @@ void keytree::grabDefaults(screen *scr)
|
||||||
grabChildren(_head, scr);
|
grabChildren(_head, scr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void keytree::ungrabDefaults(screen *scr)
|
||||||
|
{
|
||||||
|
ChildList::const_iterator it, end = _head->children.end();
|
||||||
|
for (it = _head->children.begin(); it != end; ++it)
|
||||||
|
if ( (*it)->action )
|
||||||
|
scr->ungrabKey( (*it)->action->keycode(), (*it)->action->modifierMask() );
|
||||||
|
}
|
||||||
|
|
||||||
void keytree::grabChildren(keynode *node, screen *scr)
|
void keytree::grabChildren(keynode *node, screen *scr)
|
||||||
{
|
{
|
||||||
ChildList::const_iterator it, end = node->children.end();
|
ChildList::const_iterator it, end = node->children.end();
|
||||||
|
@ -109,14 +136,29 @@ const Action * keytree::getAction(const XEvent &e, unsigned int state,
|
||||||
for (it = _current->children.begin(); it != end; ++it) {
|
for (it = _current->children.begin(); it != end; ++it) {
|
||||||
act = (*it)->action;
|
act = (*it)->action;
|
||||||
if (e.xkey.keycode == act->keycode() && state == act->modifierMask()) {
|
if (e.xkey.keycode == act->keycode() && state == act->modifierMask()) {
|
||||||
if ( isLeaf(*it) ) {
|
if (act->type() == Action::cancelChain) {
|
||||||
|
// user is cancelling the chain explicitly
|
||||||
|
_current = _head;
|
||||||
|
return (const Action *)NULL;
|
||||||
|
}
|
||||||
|
else if ( isLeaf(*it) ) {
|
||||||
// node is a leaf, so an action will be executed
|
// node is a leaf, so an action will be executed
|
||||||
|
if (_timer->isTiming()) {
|
||||||
|
_timer->stop();
|
||||||
|
_timeout_screen = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
_current = _head;
|
_current = _head;
|
||||||
return act;
|
return act;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// node is not a leaf, so we advance down the tree, and grab the
|
// node is not a leaf, so we advance down the tree, and grab the
|
||||||
// children of the new current node. no action is executed
|
// children of the new current node. no action is executed
|
||||||
|
if (_timer->isTiming())
|
||||||
|
_timer->stop();
|
||||||
|
_timer->start();
|
||||||
|
_timeout_screen = scr;
|
||||||
|
|
||||||
_current = *it;
|
_current = *it;
|
||||||
grabChildren(_current, scr);
|
grabChildren(_current, scr);
|
||||||
return (const Action *)NULL;
|
return (const Action *)NULL;
|
||||||
|
@ -167,3 +209,25 @@ void keytree::setCurrentNodeProps(Action::ActionType action, unsigned int mask,
|
||||||
XStringToKeysym(key.c_str())),
|
XStringToKeysym(key.c_str())),
|
||||||
mask, arg);
|
mask, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void keytree::initialize(void)
|
||||||
|
{
|
||||||
|
int tval = _epist->getConfig()->getNumberValue(Config::chainTimeout);
|
||||||
|
_timer = new BTimer(_epist, this);
|
||||||
|
|
||||||
|
if (tval <= 0)
|
||||||
|
tval = 3000; // set default timeout to 3 seconds
|
||||||
|
|
||||||
|
_timer->setTimeout(tval);
|
||||||
|
}
|
||||||
|
|
||||||
|
void keytree::timeout(void)
|
||||||
|
{
|
||||||
|
assert(_timeout_screen != NULL);
|
||||||
|
|
||||||
|
if (_current != _head) {
|
||||||
|
ungrabChildren(_current, _timeout_screen);
|
||||||
|
_current = _head;
|
||||||
|
}
|
||||||
|
_timeout_screen = NULL;
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// -*- mode: C++; indent-tabs-mode: nil; -*-
|
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||||
// keytree.hh for Epistrophy - a key handler for NETWM/EWMH window managers.
|
// keytree.hh for Epistrophy - a key handler for NETWM/EWMH window managers.
|
||||||
// Copyright (c) 2002 - 2002 Ben Jansens <ben at orodu.net>
|
// Copyright (c) 2002 - 2002 Ben Jansens <ben at orodu.net>
|
||||||
//
|
//
|
||||||
|
@ -24,6 +24,7 @@
|
||||||
#define _keytree_hh
|
#define _keytree_hh
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include "../../src/Timer.hh"
|
||||||
#include "actions.hh"
|
#include "actions.hh"
|
||||||
#include "screen.hh"
|
#include "screen.hh"
|
||||||
|
|
||||||
|
@ -31,42 +32,49 @@ struct keynode; // forward declaration
|
||||||
typedef std::list<keynode *> ChildList;
|
typedef std::list<keynode *> ChildList;
|
||||||
|
|
||||||
struct keynode {
|
struct keynode {
|
||||||
Action *action;
|
Action *action;
|
||||||
keynode *parent;
|
keynode *parent;
|
||||||
ChildList children;
|
ChildList children;
|
||||||
};
|
};
|
||||||
|
|
||||||
class keytree {
|
class keytree : public TimeoutHandler {
|
||||||
public:
|
public:
|
||||||
keytree(Display *);
|
keytree(Display *, epist *);
|
||||||
~keytree();
|
~keytree();
|
||||||
|
|
||||||
void grabDefaults(screen *);
|
void grabDefaults(screen *);
|
||||||
const Action * getAction(const XEvent&, unsigned int, screen *);
|
void ungrabDefaults(screen *);
|
||||||
|
const Action * getAction(const XEvent&, unsigned int, screen *);
|
||||||
|
void unloadBindings();
|
||||||
|
void timeout();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// only mister parser needs to know about our sekrets (BUMMY)
|
// only mister parser needs to know about our sekrets (BUMMY)
|
||||||
friend class parser;
|
friend class parser;
|
||||||
|
|
||||||
void grabChildren(keynode *, screen *);
|
void grabChildren(keynode *, screen *);
|
||||||
void ungrabChildren(keynode *, screen *);
|
void ungrabChildren(keynode *, screen *);
|
||||||
|
|
||||||
void addAction(Action::ActionType, unsigned int, std::string, std::string);
|
void addAction(Action::ActionType, unsigned int, std::string, std::string);
|
||||||
void advanceOnNewNode();
|
void advanceOnNewNode();
|
||||||
void retract();
|
void retract();
|
||||||
void setCurrentNodeProps(Action::ActionType, unsigned int, std::string, std::string);
|
void setCurrentNodeProps(Action::ActionType, unsigned int, std::string, std::string);
|
||||||
|
void initialize();
|
||||||
|
|
||||||
void reset()
|
void reset()
|
||||||
{ _current = _head; }
|
{ _current = _head; }
|
||||||
|
|
||||||
bool isLeaf(keynode *node)
|
bool isLeaf(keynode *node)
|
||||||
{ return node->children.empty(); }
|
{ return node->children.empty(); }
|
||||||
|
|
||||||
void clearTree(keynode *);
|
void clearTree(keynode *);
|
||||||
|
|
||||||
keynode *_head;
|
keynode *_head;
|
||||||
keynode *_current;
|
keynode *_current;
|
||||||
Display *_display;
|
Display *_display;
|
||||||
|
BTimer *_timer;
|
||||||
|
screen *_timeout_screen;
|
||||||
|
epist *_epist;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _keytree_hh
|
#endif // _keytree_hh
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#define YY_FLEX_MINOR_VERSION 5
|
#define YY_FLEX_MINOR_VERSION 5
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
|
/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
|
||||||
#ifdef c_plusplus
|
#ifdef c_plusplus
|
||||||
|
@ -22,15 +22,7 @@
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#ifndef _WIN32
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#else
|
|
||||||
#ifndef YY_ALWAYS_INTERACTIVE
|
|
||||||
#ifndef YY_NEVER_INTERACTIVE
|
|
||||||
extern int isatty YY_PROTO(( int ));
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Use prototypes in function declarations. */
|
/* Use prototypes in function declarations. */
|
||||||
#define YY_USE_PROTOS
|
#define YY_USE_PROTOS
|
||||||
|
@ -290,15 +282,16 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
|
||||||
*yy_cp = '\0'; \
|
*yy_cp = '\0'; \
|
||||||
yy_c_buf_p = yy_cp;
|
yy_c_buf_p = yy_cp;
|
||||||
|
|
||||||
#define YY_NUM_RULES 17
|
#define YY_NUM_RULES 19
|
||||||
#define YY_END_OF_BUFFER 18
|
#define YY_END_OF_BUFFER 20
|
||||||
static yyconst short int yy_accept[42] =
|
static yyconst short int yy_accept[56] =
|
||||||
{ 0,
|
{ 0,
|
||||||
0, 0, 18, 17, 16, 15, 17, 17, 4, 11,
|
0, 0, 20, 19, 18, 17, 19, 19, 4, 13,
|
||||||
3, 13, 13, 13, 13, 1, 2, 16, 0, 0,
|
3, 15, 15, 15, 15, 15, 15, 1, 2, 18,
|
||||||
11, 13, 13, 13, 13, 12, 14, 13, 13, 13,
|
0, 0, 13, 15, 15, 15, 15, 15, 15, 14,
|
||||||
13, 5, 6, 7, 8, 13, 13, 10, 13, 9,
|
16, 15, 15, 15, 15, 15, 15, 7, 8, 9,
|
||||||
0
|
10, 15, 15, 15, 15, 15, 12, 15, 15, 15,
|
||||||
|
15, 11, 5, 6, 0
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
static yyconst int yy_ec[256] =
|
static yyconst int yy_ec[256] =
|
||||||
|
@ -310,13 +303,13 @@ static yyconst int yy_ec[256] =
|
||||||
1, 1, 1, 1, 6, 1, 1, 7, 8, 9,
|
1, 1, 1, 1, 6, 1, 1, 7, 8, 9,
|
||||||
10, 11, 7, 7, 7, 7, 7, 1, 12, 1,
|
10, 11, 7, 7, 7, 7, 7, 1, 12, 1,
|
||||||
1, 1, 1, 1, 13, 13, 14, 13, 13, 13,
|
1, 1, 1, 1, 13, 13, 14, 13, 13, 13,
|
||||||
13, 13, 13, 13, 13, 13, 15, 13, 13, 13,
|
13, 13, 13, 13, 13, 13, 15, 13, 16, 13,
|
||||||
13, 13, 16, 13, 13, 13, 13, 13, 13, 13,
|
13, 13, 17, 13, 13, 13, 13, 13, 13, 13,
|
||||||
1, 1, 1, 1, 13, 1, 13, 13, 13, 17,
|
1, 1, 1, 1, 13, 1, 13, 13, 13, 18,
|
||||||
|
|
||||||
13, 18, 13, 19, 20, 13, 13, 21, 13, 22,
|
13, 19, 13, 20, 21, 13, 13, 22, 13, 23,
|
||||||
23, 13, 13, 24, 13, 25, 13, 13, 13, 13,
|
24, 25, 13, 26, 27, 28, 13, 13, 13, 13,
|
||||||
13, 13, 26, 1, 27, 1, 1, 1, 1, 1,
|
13, 13, 29, 1, 30, 1, 1, 1, 1, 1,
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
|
@ -333,59 +326,63 @@ static yyconst int yy_ec[256] =
|
||||||
1, 1, 1, 1, 1
|
1, 1, 1, 1, 1
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
static yyconst int yy_meta[28] =
|
static yyconst int yy_meta[31] =
|
||||||
{ 0,
|
{ 0,
|
||||||
1, 1, 2, 1, 1, 1, 3, 3, 3, 3,
|
1, 1, 2, 1, 1, 1, 3, 3, 3, 3,
|
||||||
3, 1, 3, 3, 3, 3, 3, 3, 3, 3,
|
3, 1, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||||
3, 3, 3, 3, 3, 1, 1
|
3, 3, 3, 3, 3, 3, 3, 3, 1, 1
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
static yyconst short int yy_base[45] =
|
static yyconst short int yy_base[59] =
|
||||||
{ 0,
|
{ 0,
|
||||||
0, 0, 64, 65, 61, 65, 0, 0, 65, 21,
|
0, 0, 79, 80, 76, 80, 0, 0, 80, 24,
|
||||||
65, 0, 39, 38, 41, 65, 65, 57, 54, 54,
|
80, 0, 53, 52, 50, 54, 48, 80, 80, 70,
|
||||||
26, 0, 34, 38, 34, 49, 65, 27, 30, 33,
|
67, 67, 29, 0, 46, 50, 39, 45, 37, 60,
|
||||||
26, 0, 0, 0, 0, 24, 25, 0, 25, 0,
|
80, 35, 33, 41, 42, 39, 33, 0, 0, 0,
|
||||||
65, 41, 44, 40
|
0, 34, 29, 32, 31, 31, 0, 30, 30, 24,
|
||||||
|
22, 0, 0, 0, 80, 44, 47, 43
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
static yyconst short int yy_def[45] =
|
static yyconst short int yy_def[59] =
|
||||||
{ 0,
|
{ 0,
|
||||||
41, 1, 41, 41, 41, 41, 42, 43, 41, 44,
|
55, 1, 55, 55, 55, 55, 56, 57, 55, 58,
|
||||||
41, 44, 44, 44, 44, 41, 41, 41, 42, 43,
|
55, 58, 58, 58, 58, 58, 58, 55, 55, 55,
|
||||||
44, 44, 44, 44, 44, 42, 41, 44, 44, 44,
|
56, 57, 58, 58, 58, 58, 58, 58, 58, 56,
|
||||||
44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
|
55, 58, 58, 58, 58, 58, 58, 58, 58, 58,
|
||||||
0, 41, 41, 41
|
58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
|
||||||
|
58, 58, 58, 58, 0, 55, 55, 55
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
static yyconst short int yy_nxt[93] =
|
static yyconst short int yy_nxt[111] =
|
||||||
{ 0,
|
{ 0,
|
||||||
4, 5, 6, 7, 8, 9, 10, 10, 10, 10,
|
4, 5, 6, 7, 8, 9, 10, 10, 10, 10,
|
||||||
10, 11, 12, 13, 14, 15, 12, 12, 12, 12,
|
10, 11, 12, 13, 14, 15, 16, 12, 12, 12,
|
||||||
12, 12, 12, 12, 12, 16, 17, 21, 21, 21,
|
12, 12, 12, 17, 12, 12, 12, 12, 18, 19,
|
||||||
21, 21, 21, 21, 21, 21, 21, 32, 33, 34,
|
23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
|
||||||
35, 19, 22, 19, 20, 40, 20, 39, 38, 37,
|
38, 39, 40, 41, 21, 24, 21, 22, 54, 22,
|
||||||
36, 31, 26, 30, 29, 28, 27, 26, 18, 25,
|
53, 52, 51, 50, 49, 48, 47, 46, 45, 44,
|
||||||
24, 23, 18, 41, 3, 41, 41, 41, 41, 41,
|
43, 42, 37, 30, 36, 35, 34, 33, 32, 31,
|
||||||
41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
|
30, 20, 29, 28, 27, 26, 25, 20, 55, 3,
|
||||||
41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
|
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
|
||||||
41, 41
|
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
|
||||||
|
|
||||||
|
55, 55, 55, 55, 55, 55, 55, 55, 55, 55
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
static yyconst short int yy_chk[93] =
|
static yyconst short int yy_chk[111] =
|
||||||
{ 0,
|
{ 0,
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
1, 1, 1, 1, 1, 1, 1, 10, 10, 10,
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
10, 10, 21, 21, 21, 21, 21, 29, 29, 29,
|
10, 10, 10, 10, 10, 23, 23, 23, 23, 23,
|
||||||
29, 42, 44, 42, 43, 39, 43, 37, 36, 31,
|
33, 33, 33, 33, 56, 58, 56, 57, 51, 57,
|
||||||
30, 28, 26, 25, 24, 23, 20, 19, 18, 15,
|
50, 49, 48, 46, 45, 44, 43, 42, 37, 36,
|
||||||
14, 13, 5, 3, 41, 41, 41, 41, 41, 41,
|
35, 34, 32, 30, 29, 28, 27, 26, 25, 22,
|
||||||
41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
|
21, 20, 17, 16, 15, 14, 13, 5, 3, 55,
|
||||||
41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
|
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
|
||||||
41, 41
|
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
|
||||||
|
|
||||||
|
55, 55, 55, 55, 55, 55, 55, 55, 55, 55
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
static yy_state_type yy_last_accepting_state;
|
static yy_state_type yy_last_accepting_state;
|
||||||
|
@ -408,7 +405,7 @@ char *yytext;
|
||||||
|
|
||||||
extern YYSTYPE yylval;
|
extern YYSTYPE yylval;
|
||||||
|
|
||||||
#line 412 "lex.yy.c"
|
#line 409 "lex.yy.c"
|
||||||
|
|
||||||
/* Macros after this point can all be overridden by user definitions in
|
/* Macros after this point can all be overridden by user definitions in
|
||||||
* section 1.
|
* section 1.
|
||||||
|
@ -508,20 +505,9 @@ YY_MALLOC_DECL
|
||||||
YY_FATAL_ERROR( "input in flex scanner failed" ); \
|
YY_FATAL_ERROR( "input in flex scanner failed" ); \
|
||||||
result = n; \
|
result = n; \
|
||||||
} \
|
} \
|
||||||
else \
|
else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
|
||||||
{ \
|
&& ferror( yyin ) ) \
|
||||||
errno=0; \
|
YY_FATAL_ERROR( "input in flex scanner failed" );
|
||||||
while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
|
|
||||||
{ \
|
|
||||||
if( errno != EINTR) \
|
|
||||||
{ \
|
|
||||||
YY_FATAL_ERROR( "input in flex scanner failed" ); \
|
|
||||||
break; \
|
|
||||||
} \
|
|
||||||
errno=0; \
|
|
||||||
clearerr(yyin); \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* No semi-colon after return; correct usage is to write "yyterminate();" -
|
/* No semi-colon after return; correct usage is to write "yyterminate();" -
|
||||||
|
@ -573,7 +559,7 @@ YY_DECL
|
||||||
#line 10 "epist.l"
|
#line 10 "epist.l"
|
||||||
|
|
||||||
|
|
||||||
#line 577 "lex.yy.c"
|
#line 563 "lex.yy.c"
|
||||||
|
|
||||||
if ( yy_init )
|
if ( yy_init )
|
||||||
{
|
{
|
||||||
|
@ -624,13 +610,13 @@ yy_match:
|
||||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||||
{
|
{
|
||||||
yy_current_state = (int) yy_def[yy_current_state];
|
yy_current_state = (int) yy_def[yy_current_state];
|
||||||
if ( yy_current_state >= 42 )
|
if ( yy_current_state >= 56 )
|
||||||
yy_c = yy_meta[(unsigned int) yy_c];
|
yy_c = yy_meta[(unsigned int) yy_c];
|
||||||
}
|
}
|
||||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||||
++yy_cp;
|
++yy_cp;
|
||||||
}
|
}
|
||||||
while ( yy_base[yy_current_state] != 65 );
|
while ( yy_base[yy_current_state] != 80 );
|
||||||
|
|
||||||
yy_find_action:
|
yy_find_action:
|
||||||
yy_act = yy_accept[yy_current_state];
|
yy_act = yy_accept[yy_current_state];
|
||||||
|
@ -679,7 +665,10 @@ return DASH;
|
||||||
case 5:
|
case 5:
|
||||||
#line 17 "epist.l"
|
#line 17 "epist.l"
|
||||||
case 6:
|
case 6:
|
||||||
#line 18 "epist.l"
|
YY_RULE_SETUP
|
||||||
|
#line 17 "epist.l"
|
||||||
|
return OPTIONS;
|
||||||
|
YY_BREAK
|
||||||
case 7:
|
case 7:
|
||||||
#line 19 "epist.l"
|
#line 19 "epist.l"
|
||||||
case 8:
|
case 8:
|
||||||
|
@ -687,46 +676,50 @@ case 8:
|
||||||
case 9:
|
case 9:
|
||||||
#line 21 "epist.l"
|
#line 21 "epist.l"
|
||||||
case 10:
|
case 10:
|
||||||
YY_RULE_SETUP
|
|
||||||
#line 21 "epist.l"
|
|
||||||
yylval = (int) strdup(yytext); return BINDING;
|
|
||||||
YY_BREAK
|
|
||||||
case 11:
|
|
||||||
YY_RULE_SETUP
|
|
||||||
#line 22 "epist.l"
|
#line 22 "epist.l"
|
||||||
yylval = (int) strdup(yytext); return NUMBER;
|
case 11:
|
||||||
YY_BREAK
|
#line 23 "epist.l"
|
||||||
case 12:
|
case 12:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 23 "epist.l"
|
#line 23 "epist.l"
|
||||||
yylval = (int) strdup(yytext); return QUOTES;
|
yylval = (int) strdup(yytext); return BINDING;
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 13:
|
case 13:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 24 "epist.l"
|
#line 24 "epist.l"
|
||||||
yylval = (int) strdup(yytext); return WORD;
|
yylval = (int) strdup(yytext); return NUMBER;
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 14:
|
case 14:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 25 "epist.l"
|
#line 25 "epist.l"
|
||||||
/* ignore */
|
yylval = (int) strdup(yytext); return QUOTES;
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 15:
|
case 15:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 26 "epist.l"
|
#line 26 "epist.l"
|
||||||
/* ignore */
|
yylval = (int) strdup(yytext); return WORD;
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 16:
|
case 16:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 27 "epist.l"
|
#line 27 "epist.l"
|
||||||
/* */
|
/* ignore */
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 17:
|
case 17:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 28 "epist.l"
|
#line 28 "epist.l"
|
||||||
|
/* ignore */
|
||||||
|
YY_BREAK
|
||||||
|
case 18:
|
||||||
|
YY_RULE_SETUP
|
||||||
|
#line 29 "epist.l"
|
||||||
|
/* */
|
||||||
|
YY_BREAK
|
||||||
|
case 19:
|
||||||
|
YY_RULE_SETUP
|
||||||
|
#line 30 "epist.l"
|
||||||
ECHO;
|
ECHO;
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
#line 730 "lex.yy.c"
|
#line 723 "lex.yy.c"
|
||||||
case YY_STATE_EOF(INITIAL):
|
case YY_STATE_EOF(INITIAL):
|
||||||
yyterminate();
|
yyterminate();
|
||||||
|
|
||||||
|
@ -1018,7 +1011,7 @@ static yy_state_type yy_get_previous_state()
|
||||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||||
{
|
{
|
||||||
yy_current_state = (int) yy_def[yy_current_state];
|
yy_current_state = (int) yy_def[yy_current_state];
|
||||||
if ( yy_current_state >= 42 )
|
if ( yy_current_state >= 56 )
|
||||||
yy_c = yy_meta[(unsigned int) yy_c];
|
yy_c = yy_meta[(unsigned int) yy_c];
|
||||||
}
|
}
|
||||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||||
|
@ -1053,11 +1046,11 @@ yy_state_type yy_current_state;
|
||||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||||
{
|
{
|
||||||
yy_current_state = (int) yy_def[yy_current_state];
|
yy_current_state = (int) yy_def[yy_current_state];
|
||||||
if ( yy_current_state >= 42 )
|
if ( yy_current_state >= 56 )
|
||||||
yy_c = yy_meta[(unsigned int) yy_c];
|
yy_c = yy_meta[(unsigned int) yy_c];
|
||||||
}
|
}
|
||||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||||
yy_is_jam = (yy_current_state == 41);
|
yy_is_jam = (yy_current_state == 55);
|
||||||
|
|
||||||
return yy_is_jam ? 0 : yy_current_state;
|
return yy_is_jam ? 0 : yy_current_state;
|
||||||
}
|
}
|
||||||
|
@ -1290,15 +1283,11 @@ YY_BUFFER_STATE b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
#include <unistd.h>
|
|
||||||
#else
|
|
||||||
#ifndef YY_ALWAYS_INTERACTIVE
|
#ifndef YY_ALWAYS_INTERACTIVE
|
||||||
#ifndef YY_NEVER_INTERACTIVE
|
#ifndef YY_NEVER_INTERACTIVE
|
||||||
extern int isatty YY_PROTO(( int ));
|
extern int isatty YY_PROTO(( int ));
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef YY_USE_PROTOS
|
#ifdef YY_USE_PROTOS
|
||||||
void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
|
void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
|
||||||
|
@ -1616,6 +1605,6 @@ int main()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#line 28 "epist.l"
|
#line 30 "epist.l"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,25 @@
|
||||||
|
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||||
|
// parser.cc for Epistrophy - a key handler for NETWM/EWMH window managers.
|
||||||
|
// Copyright (c) 2002 - 2002 Ben Jansens <ben at orodu.net>
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
// copy of this software and associated documentation files (the "Software"),
|
||||||
|
// to deal in the Software without restriction, including without limitation
|
||||||
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
// and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
// Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -8,144 +30,150 @@ extern "C" {
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
parser::parser(keytree *kt)
|
parser::parser(keytree *kt, Config *conf)
|
||||||
: _kt(kt), _mask(0), _action(Action::noaction), _key(""), _arg("")
|
: _kt(kt), _config(conf), _mask(0), _action(Action::noaction),
|
||||||
|
_key(""), _arg("")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
parser::~parser()
|
parser::~parser()
|
||||||
{
|
{
|
||||||
// nothing to see here. move along.
|
// nothing to see here. move along.
|
||||||
}
|
}
|
||||||
|
|
||||||
void parser::parse(string rc_file)
|
void parser::parse(string rc_file)
|
||||||
{
|
{
|
||||||
extern int yyparse(void *);
|
extern int yyparse(void *);
|
||||||
extern FILE *yyin;
|
extern FILE *yyin;
|
||||||
|
|
||||||
yyin = fopen(rc_file.c_str(), "r");
|
yyin = fopen(rc_file.c_str(), "r");
|
||||||
|
|
||||||
yyparse(this);
|
yyparse(this);
|
||||||
|
|
||||||
fclose(yyin);
|
fclose(yyin);
|
||||||
_kt->reset();
|
_kt->reset();
|
||||||
|
_kt->initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void parser::setAction(string act)
|
void parser::setAction(string act)
|
||||||
{
|
{
|
||||||
struct {
|
struct {
|
||||||
const char* str;
|
const char* str;
|
||||||
Action::ActionType act;
|
Action::ActionType act;
|
||||||
|
}
|
||||||
|
actions[] = {
|
||||||
|
{ "noaction", Action::noaction },
|
||||||
|
{ "execute", Action::execute },
|
||||||
|
{ "iconify", Action::iconify },
|
||||||
|
{ "raise", Action::raise },
|
||||||
|
{ "lower", Action::lower },
|
||||||
|
{ "close", Action::close },
|
||||||
|
{ "toggleshade", Action::toggleshade },
|
||||||
|
{ "toggleomnipresent", Action::toggleomnipresent },
|
||||||
|
{ "movewindowup", Action::moveWindowUp },
|
||||||
|
{ "movewindowdown", Action::moveWindowDown },
|
||||||
|
{ "movewindowleft", Action::moveWindowLeft },
|
||||||
|
{ "movewindowright", Action::moveWindowRight },
|
||||||
|
{ "resizewindowwidth", Action::resizeWindowWidth },
|
||||||
|
{ "resizewindowheight", Action::resizeWindowHeight },
|
||||||
|
{ "togglemaximizefull", Action::toggleMaximizeFull },
|
||||||
|
{ "togglemaximizevertical", Action::toggleMaximizeVertical },
|
||||||
|
{ "togglemaximizehorizontal", Action::toggleMaximizeHorizontal },
|
||||||
|
{ "sendtoworkspace", Action::sendToWorkspace },
|
||||||
|
{ "nextwindow", Action::nextWindow },
|
||||||
|
{ "prevwindow", Action::prevWindow },
|
||||||
|
{ "nextwindowonallworkspaces", Action::nextWindowOnAllWorkspaces },
|
||||||
|
{ "prevwindowonallworkspaces", Action::prevWindowOnAllWorkspaces },
|
||||||
|
{ "nextwindowonallscreens", Action::nextWindowOnAllScreens },
|
||||||
|
{ "prevwindowonallscreens", Action::prevWindowOnAllScreens },
|
||||||
|
{ "nextwindowofclass", Action::nextWindowOfClass },
|
||||||
|
{ "prevwindowofclass", Action::prevWindowOfClass },
|
||||||
|
{ "nextwindowofclassonallworkspaces", Action::nextWindowOfClassOnAllWorkspaces },
|
||||||
|
{ "prevwindowofclassonallworkspaces", Action::prevWindowOfClassOnAllWorkspaces },
|
||||||
|
{ "changeworkspace", Action::changeWorkspace },
|
||||||
|
{ "nextworkspace", Action::nextWorkspace },
|
||||||
|
{ "prevworkspace", Action::prevWorkspace },
|
||||||
|
{ "nextworkspacerow", Action::upWorkspace },
|
||||||
|
{ "prevworkspacerow", Action::downWorkspace },
|
||||||
|
{ "prevworkspacecolumn", Action::leftWorkspace },
|
||||||
|
{ "nextworkspacecolumn", Action::rightWorkspace },
|
||||||
|
{ "nextscreen", Action::nextScreen },
|
||||||
|
{ "prevscreen", Action::prevScreen },
|
||||||
|
{ "showrootmenu", Action::showRootMenu },
|
||||||
|
{ "showworkspacemenu", Action::showWorkspaceMenu },
|
||||||
|
{ "stringchain", Action::stringChain },
|
||||||
|
{ "keychain", Action::keyChain },
|
||||||
|
{ "numberchain", Action::numberChain },
|
||||||
|
{ "cancelchain", Action::cancelChain },
|
||||||
|
{ "", Action::noaction }
|
||||||
|
};
|
||||||
|
|
||||||
|
bool found = false;
|
||||||
|
|
||||||
|
for (int i = 0; actions[i].str != ""; ++i) {
|
||||||
|
if ( strcasecmp(actions[i].str, act.c_str()) == 0 ) {
|
||||||
|
_action = actions[i].act;
|
||||||
|
found = true;
|
||||||
}
|
}
|
||||||
actions[] = {
|
}
|
||||||
{ "noaction", Action::noaction },
|
|
||||||
{ "execute", Action::execute },
|
|
||||||
{ "iconify", Action::iconify },
|
|
||||||
{ "raise", Action::raise },
|
|
||||||
{ "lower", Action::lower },
|
|
||||||
{ "close", Action::close },
|
|
||||||
{ "toggleshade", Action::toggleshade },
|
|
||||||
{ "toggleomnipresent", Action::toggleomnipresent },
|
|
||||||
{ "movewindowup", Action::moveWindowUp },
|
|
||||||
{ "movewindowdown", Action::moveWindowDown },
|
|
||||||
{ "movewindowleft", Action::moveWindowLeft },
|
|
||||||
{ "movewindowright", Action::moveWindowRight },
|
|
||||||
{ "resizewindowwidth", Action::resizeWindowWidth },
|
|
||||||
{ "resizewindowheight", Action::resizeWindowHeight },
|
|
||||||
{ "togglemaximizefull", Action::toggleMaximizeFull },
|
|
||||||
{ "togglemaximizevertical", Action::toggleMaximizeVertical },
|
|
||||||
{ "togglemaximizehorizontal", Action::toggleMaximizeHorizontal },
|
|
||||||
{ "sendtoworkspace", Action::sendToWorkspace },
|
|
||||||
{ "nextwindow", Action::nextWindow },
|
|
||||||
{ "prevwindow", Action::prevWindow },
|
|
||||||
{ "nextwindowonallworkspaces", Action::nextWindowOnAllWorkspaces },
|
|
||||||
{ "prevwindowonallworkspaces", Action::prevWindowOnAllWorkspaces },
|
|
||||||
{ "nextwindowonallscreens", Action::nextWindowOnAllScreens },
|
|
||||||
{ "prevwindowonallscreens", Action::prevWindowOnAllScreens },
|
|
||||||
{ "nextwindowofclass", Action::nextWindowOfClass },
|
|
||||||
{ "prevwindowofclass", Action::prevWindowOfClass },
|
|
||||||
{ "nextwindowofclassonallworkspaces", Action::nextWindowOfClassOnAllWorkspaces },
|
|
||||||
{ "prevwindowofclassonallworkspaces", Action::prevWindowOfClassOnAllWorkspaces },
|
|
||||||
{ "changeworkspace", Action::changeWorkspace },
|
|
||||||
{ "nextworkspace", Action::nextWorkspace },
|
|
||||||
{ "prevworkspace", Action::prevWorkspace },
|
|
||||||
{ "nextscreen", Action::nextScreen },
|
|
||||||
{ "prevscreen", Action::prevScreen },
|
|
||||||
{ "showrootmenu", Action::showRootMenu },
|
|
||||||
{ "showworkspacemenu", Action::showWorkspaceMenu },
|
|
||||||
{ "stringchain", Action::stringChain },
|
|
||||||
{ "keychain", Action::keyChain },
|
|
||||||
{ "numberchain", Action::numberChain },
|
|
||||||
{ "cancel", Action::cancel },
|
|
||||||
{ "", Action::noaction }
|
|
||||||
};
|
|
||||||
|
|
||||||
bool found = false;
|
if (!found)
|
||||||
|
_action = Action::noaction;
|
||||||
for (int i = 0; actions[i].str != ""; ++i) {
|
|
||||||
if ( strcasecmp(actions[i].str, act.c_str()) == 0 ) {
|
|
||||||
_action = actions[i].act;
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!found)
|
|
||||||
_action = Action::noaction;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void parser::addModifier(string mod)
|
void parser::addModifier(string mod)
|
||||||
{
|
{
|
||||||
struct {
|
struct {
|
||||||
string str;
|
string str;
|
||||||
unsigned int mask;
|
unsigned int mask;
|
||||||
}
|
}
|
||||||
modifiers[] = {
|
modifiers[] = {
|
||||||
{ "Mod1", Mod1Mask },
|
{ "Mod1", Mod1Mask },
|
||||||
{ "Mod2", Mod2Mask },
|
{ "Mod2", Mod2Mask },
|
||||||
{ "Mod3", Mod3Mask },
|
{ "Mod3", Mod3Mask },
|
||||||
{ "Mod4", Mod4Mask },
|
{ "Mod4", Mod4Mask },
|
||||||
{ "Control", ControlMask },
|
{ "Control", ControlMask },
|
||||||
{ "Shift", ShiftMask },
|
{ "Shift", ShiftMask },
|
||||||
{ "", 0 }
|
{ "", 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
for (int i = 0; modifiers[i].str != ""; ++i) {
|
for (int i = 0; modifiers[i].str != ""; ++i) {
|
||||||
if (modifiers[i].str == mod)
|
if (modifiers[i].str == mod)
|
||||||
_mask |= modifiers[i].mask;
|
_mask |= modifiers[i].mask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void parser::endAction()
|
void parser::endAction()
|
||||||
{
|
{
|
||||||
_kt->addAction(_action, _mask, _key, _arg);
|
_kt->addAction(_action, _mask, _key, _arg);
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void parser::startChain()
|
void parser::startChain()
|
||||||
{
|
{
|
||||||
_kt->advanceOnNewNode();
|
_kt->advanceOnNewNode();
|
||||||
setChainBinding();
|
setChainBinding();
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void parser::endChain()
|
void parser::endChain()
|
||||||
{
|
{
|
||||||
_kt->retract();
|
_kt->retract();
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void parser::setChainBinding()
|
void parser::setChainBinding()
|
||||||
{
|
{
|
||||||
if (_mask != 0 && _key != "") {
|
if (_mask != 0 && _key != "") {
|
||||||
_kt->setCurrentNodeProps(Action::noaction, _mask, _key, "");
|
_kt->setCurrentNodeProps(Action::noaction, _mask, _key, "");
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void parser::reset()
|
void parser::reset()
|
||||||
{
|
{
|
||||||
_mask = 0;
|
_mask = 0;
|
||||||
_action = Action::noaction;
|
_action = Action::noaction;
|
||||||
_key = "";
|
_key = "";
|
||||||
_arg = "";
|
_arg = "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,40 +1,72 @@
|
||||||
|
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||||
|
// parser.hh for Epistrophy - a key handler for NETWM/EWMH window managers.
|
||||||
|
// Copyright (c) 2002 - 2002 Ben Jansens <ben at orodu.net>
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
// copy of this software and associated documentation files (the "Software"),
|
||||||
|
// to deal in the Software without restriction, including without limitation
|
||||||
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
// and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
// Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
#ifndef __parser_hh
|
||||||
|
#define __parser_hh
|
||||||
|
|
||||||
#include "actions.hh"
|
#include "actions.hh"
|
||||||
#include "keytree.hh"
|
#include "keytree.hh"
|
||||||
|
#include "config.hh"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class parser {
|
class parser {
|
||||||
public:
|
public:
|
||||||
parser(keytree *);
|
parser(keytree *, Config *);
|
||||||
~parser();
|
~parser();
|
||||||
|
|
||||||
void parse(std::string);
|
void parse(std::string);
|
||||||
|
|
||||||
void setKey(std::string key)
|
void setKey(std::string key)
|
||||||
{ _key = key; }
|
{ _key = key; }
|
||||||
|
|
||||||
void setArgumentNum(std::string arg)
|
void setArgumentNum(std::string arg)
|
||||||
{ _arg = arg; }
|
{ _arg = arg; }
|
||||||
|
|
||||||
void setArgumentNegNum(std::string arg)
|
void setArgumentNegNum(std::string arg)
|
||||||
{ _arg = "-" + arg; }
|
{ _arg = "-" + arg; }
|
||||||
|
|
||||||
void setArgumentStr(std::string arg)
|
void setArgumentStr(std::string arg)
|
||||||
{ _arg = arg.substr(1, arg.size() - 2); }
|
{ _arg = arg.substr(1, arg.size() - 2); }
|
||||||
|
|
||||||
void setAction(std::string);
|
void setOption(std::string opt)
|
||||||
void addModifier(std::string);
|
{ _config->addOption(opt, _arg); }
|
||||||
void endAction();
|
|
||||||
void startChain();
|
void setAction(std::string);
|
||||||
void setChainBinding();
|
void addModifier(std::string);
|
||||||
void endChain();
|
void endAction();
|
||||||
|
void startChain();
|
||||||
|
void setChainBinding();
|
||||||
|
void endChain();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
keytree *_kt;
|
keytree *_kt;
|
||||||
unsigned int _mask;
|
Config *_config;
|
||||||
Action::ActionType _action;
|
unsigned int _mask;
|
||||||
std::string _key;
|
Action::ActionType _action;
|
||||||
std::string _arg;
|
std::string _key;
|
||||||
|
std::string _arg;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif //__parser_hh
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// -*- mode: C++; indent-tabs-mode: nil; -*-
|
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||||
// screen.cc for Epistrophy - a key handler for NETWM/EWMH window managers.
|
// screen.cc for Epistrophy - a key handler for NETWM/EWMH window managers.
|
||||||
// Copyright (c) 2002 - 2002 Ben Jansens <ben at orodu.net>
|
// Copyright (c) 2002 - 2002 Ben Jansens <ben at orodu.net>
|
||||||
//
|
//
|
||||||
|
@ -48,7 +48,7 @@ using std::string;
|
||||||
#include "../../src/XAtom.hh"
|
#include "../../src/XAtom.hh"
|
||||||
#include "screen.hh"
|
#include "screen.hh"
|
||||||
#include "epist.hh"
|
#include "epist.hh"
|
||||||
|
#include "config.hh"
|
||||||
|
|
||||||
screen::screen(epist *epist, int number)
|
screen::screen(epist *epist, int number)
|
||||||
: _clients(epist->clientsList()),
|
: _clients(epist->clientsList()),
|
||||||
|
@ -222,6 +222,22 @@ void screen::handleKeypress(const XEvent &e) {
|
||||||
changeWorkspace(it->number());
|
changeWorkspace(it->number());
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
case Action::upWorkspace:
|
||||||
|
changeWorkspaceVert(-1);
|
||||||
|
return;
|
||||||
|
|
||||||
|
case Action::downWorkspace:
|
||||||
|
changeWorkspaceVert(1);
|
||||||
|
return;
|
||||||
|
|
||||||
|
case Action::leftWorkspace:
|
||||||
|
changeWorkspaceHorz(-1);
|
||||||
|
return;
|
||||||
|
|
||||||
|
case Action::rightWorkspace:
|
||||||
|
changeWorkspaceHorz(1);
|
||||||
|
return;
|
||||||
|
|
||||||
case Action::execute:
|
case Action::execute:
|
||||||
execCommand(it->string());
|
execCommand(it->string());
|
||||||
return;
|
return;
|
||||||
|
@ -564,6 +580,48 @@ void screen::changeWorkspace(const int num) const {
|
||||||
_xatom->sendClientMessage(_root, XAtom::net_current_desktop, _root, num);
|
_xatom->sendClientMessage(_root, XAtom::net_current_desktop, _root, num);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void screen::changeWorkspaceVert(const int num) const {
|
||||||
|
assert(_managed);
|
||||||
|
const Config *conf = _epist->getConfig();
|
||||||
|
int width = conf->getNumberValue(Config::workspaceColumns);
|
||||||
|
|
||||||
|
if (width > _num_desktops || width <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (num < 0) {
|
||||||
|
int wnum = _active_desktop - width;
|
||||||
|
if (wnum >= 0)
|
||||||
|
changeWorkspace(wnum);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
int wnum = _active_desktop + width;
|
||||||
|
if (wnum < _num_desktops)
|
||||||
|
changeWorkspace(wnum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void screen::changeWorkspaceHorz(const int num) const {
|
||||||
|
assert(_managed);
|
||||||
|
const Config *conf = _epist->getConfig();
|
||||||
|
int width = conf->getNumberValue(Config::workspaceColumns);
|
||||||
|
|
||||||
|
if (width > _num_desktops || width <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (num < 0) {
|
||||||
|
if (_active_desktop % width != 0)
|
||||||
|
changeWorkspace(_active_desktop - 1);
|
||||||
|
else
|
||||||
|
changeWorkspace(_active_desktop + width - 1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (_active_desktop % width != width - 1)
|
||||||
|
changeWorkspace(_active_desktop + 1);
|
||||||
|
else
|
||||||
|
changeWorkspace(_active_desktop - width + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void screen::grabKey(const KeyCode keyCode, const int modifierMask) const {
|
void screen::grabKey(const KeyCode keyCode, const int modifierMask) const {
|
||||||
|
|
||||||
Display *display = _epist->getXDisplay();
|
Display *display = _epist->getXDisplay();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// -*- mode: C++; indent-tabs-mode: nil; -*-
|
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||||
// screen.hh for Epistrophy - a key handler for NETWM/EWMH window managers.
|
// screen.hh for Epistrophy - a key handler for NETWM/EWMH window managers.
|
||||||
// Copyright (c) 2002 - 2002 Ben Jansens <ben at orodu.net>
|
// Copyright (c) 2002 - 2002 Ben Jansens <ben at orodu.net>
|
||||||
//
|
//
|
||||||
|
@ -84,6 +84,9 @@ public:
|
||||||
void cycleWorkspace(const bool forward, const int increment,
|
void cycleWorkspace(const bool forward, const int increment,
|
||||||
const bool loop = true) const;
|
const bool loop = true) const;
|
||||||
void changeWorkspace(const int num) const;
|
void changeWorkspace(const int num) const;
|
||||||
|
void changeWorkspaceVert(const int num) const;
|
||||||
|
void changeWorkspaceHorz(const int num) const;
|
||||||
|
|
||||||
void toggleShaded(const Window win) const;
|
void toggleShaded(const Window win) const;
|
||||||
void execCommand(const std::string &cmd) const;
|
void execCommand(const std::string &cmd) const;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* A Bison parser, made from epist.y
|
/* A Bison parser, made from epist.y
|
||||||
by GNU bison 1.35. */
|
by GNU bison 1.34. */
|
||||||
|
|
||||||
#define YYBISON 1 /* Identify Bison output. */
|
#define YYBISON 1 /* Identify Bison output. */
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@
|
||||||
# define QUOTES 262
|
# define QUOTES 262
|
||||||
# define WORD 263
|
# define WORD 263
|
||||||
# define BINDING 264
|
# define BINDING 264
|
||||||
|
# define OPTIONS 265
|
||||||
|
|
||||||
#line 1 "epist.y"
|
#line 1 "epist.y"
|
||||||
|
|
||||||
|
@ -34,8 +35,7 @@ void yyerror(const char *c) {
|
||||||
|
|
||||||
|
|
||||||
#ifndef YYSTYPE
|
#ifndef YYSTYPE
|
||||||
# define YYSTYPE int
|
#define YYSTYPE int
|
||||||
# define YYSTYPE_IS_TRIVIAL 1
|
|
||||||
#endif
|
#endif
|
||||||
#ifndef YYDEBUG
|
#ifndef YYDEBUG
|
||||||
# define YYDEBUG 0
|
# define YYDEBUG 0
|
||||||
|
@ -43,12 +43,12 @@ void yyerror(const char *c) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define YYFINAL 30
|
#define YYFINAL 40
|
||||||
#define YYFLAG -32768
|
#define YYFLAG -32768
|
||||||
#define YYNTBASE 11
|
#define YYNTBASE 12
|
||||||
|
|
||||||
/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
|
/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
|
||||||
#define YYTRANSLATE(x) ((unsigned)(x) <= 264 ? yytranslate[x] : 21)
|
#define YYTRANSLATE(x) ((unsigned)(x) <= 265 ? yytranslate[x] : 26)
|
||||||
|
|
||||||
/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
|
/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
|
||||||
static const char yytranslate[] =
|
static const char yytranslate[] =
|
||||||
|
@ -79,23 +79,25 @@ static const char yytranslate[] =
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
2, 2, 2, 2, 2, 2, 1, 3, 4, 5,
|
2, 2, 2, 2, 2, 2, 1, 3, 4, 5,
|
||||||
6, 7, 8, 9, 10
|
6, 7, 8, 9, 10, 11
|
||||||
};
|
};
|
||||||
|
|
||||||
#if YYDEBUG
|
#if YYDEBUG
|
||||||
static const short yyprhs[] =
|
static const short yyprhs[] =
|
||||||
{
|
{
|
||||||
0, 0, 1, 4, 6, 8, 13, 18, 21, 23,
|
0, 0, 1, 4, 7, 9, 11, 16, 21, 26,
|
||||||
25, 26, 30, 32, 34, 36, 38, 40, 42, 43,
|
29, 31, 33, 34, 38, 40, 42, 44, 46, 48,
|
||||||
45, 48
|
50, 51, 53, 56, 58, 60, 61, 64
|
||||||
};
|
};
|
||||||
static const short yyrhs[] =
|
static const short yyrhs[] =
|
||||||
{
|
{
|
||||||
-1, 11, 12, 0, 13, 0, 14, 0, 15, 9,
|
-1, 12, 13, 0, 12, 16, 0, 14, 0, 15,
|
||||||
20, 5, 0, 15, 16, 11, 17, 0, 18, 19,
|
0, 17, 9, 22, 5, 0, 17, 18, 12, 19,
|
||||||
0, 3, 0, 4, 0, 0, 10, 6, 18, 0,
|
0, 23, 3, 24, 4, 0, 20, 21, 0, 3,
|
||||||
3, 0, 4, 0, 6, 0, 5, 0, 7, 0,
|
0, 4, 0, 0, 10, 6, 20, 0, 3, 0,
|
||||||
9, 0, 0, 7, 0, 6, 7, 0, 8, 0
|
4, 0, 6, 0, 5, 0, 7, 0, 9, 0,
|
||||||
|
0, 7, 0, 6, 7, 0, 8, 0, 11, 0,
|
||||||
|
0, 24, 25, 0, 9, 22, 5, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -104,9 +106,9 @@ static const short yyrhs[] =
|
||||||
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
||||||
static const short yyrline[] =
|
static const short yyrline[] =
|
||||||
{
|
{
|
||||||
0, 27, 28, 31, 32, 35, 44, 51, 55, 59,
|
0, 27, 28, 29, 32, 33, 36, 45, 52, 56,
|
||||||
63, 64, 67, 69, 70, 71, 72, 73, 76, 77,
|
60, 64, 68, 69, 72, 74, 75, 76, 77, 78,
|
||||||
78, 79
|
81, 82, 83, 84, 87, 91, 92, 95
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -117,26 +119,27 @@ static const short yyrline[] =
|
||||||
static const char *const yytname[] =
|
static const char *const yytname[] =
|
||||||
{
|
{
|
||||||
"$", "error", "$undefined.", "OBRACE", "EBRACE", "SEMICOLON", "DASH",
|
"$", "error", "$undefined.", "OBRACE", "EBRACE", "SEMICOLON", "DASH",
|
||||||
"NUMBER", "QUOTES", "WORD", "BINDING", "commands", "command",
|
"NUMBER", "QUOTES", "WORD", "BINDING", "OPTIONS", "commands", "command",
|
||||||
"action_command", "chain_command", "binding", "obrace", "ebrace",
|
"action_command", "chain_command", "options_block", "binding", "obrace",
|
||||||
"binding_w_modifier", "bind_key", "parameter", 0
|
"ebrace", "binding_w_modifier", "bind_key", "parameter",
|
||||||
|
"options_keyword", "options", "option", 0
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
|
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
|
||||||
static const short yyr1[] =
|
static const short yyr1[] =
|
||||||
{
|
{
|
||||||
0, 11, 11, 12, 12, 13, 14, 15, 16, 17,
|
0, 12, 12, 12, 13, 13, 14, 15, 16, 17,
|
||||||
18, 18, 19, 19, 19, 19, 19, 19, 20, 20,
|
18, 19, 20, 20, 21, 21, 21, 21, 21, 21,
|
||||||
20, 20
|
22, 22, 22, 22, 23, 24, 24, 25
|
||||||
};
|
};
|
||||||
|
|
||||||
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
|
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
|
||||||
static const short yyr2[] =
|
static const short yyr2[] =
|
||||||
{
|
{
|
||||||
0, 0, 2, 1, 1, 4, 4, 2, 1, 1,
|
0, 0, 2, 2, 1, 1, 4, 4, 4, 2,
|
||||||
0, 3, 1, 1, 1, 1, 1, 1, 0, 1,
|
1, 1, 0, 3, 1, 1, 1, 1, 1, 1,
|
||||||
2, 1
|
0, 1, 2, 1, 1, 0, 2, 3
|
||||||
};
|
};
|
||||||
|
|
||||||
/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
|
/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
|
||||||
|
@ -144,46 +147,50 @@ static const short yyr2[] =
|
||||||
error. */
|
error. */
|
||||||
static const short yydefact[] =
|
static const short yydefact[] =
|
||||||
{
|
{
|
||||||
1, 10, 0, 2, 3, 4, 0, 0, 10, 8,
|
1, 12, 0, 24, 2, 4, 5, 3, 0, 0,
|
||||||
18, 1, 12, 13, 15, 14, 16, 17, 7, 11,
|
0, 12, 10, 20, 1, 14, 15, 17, 16, 18,
|
||||||
0, 19, 21, 0, 10, 20, 5, 9, 6, 0,
|
19, 9, 25, 13, 0, 21, 23, 0, 12, 0,
|
||||||
|
22, 6, 11, 7, 8, 20, 26, 0, 27, 0,
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
static const short yydefgoto[] =
|
static const short yydefgoto[] =
|
||||||
{
|
{
|
||||||
1, 3, 4, 5, 6, 11, 28, 7, 18, 23
|
1, 4, 5, 6, 7, 8, 14, 33, 9, 21,
|
||||||
|
27, 10, 29, 36
|
||||||
};
|
};
|
||||||
|
|
||||||
static const short yypact[] =
|
static const short yypact[] =
|
||||||
{
|
{
|
||||||
-32768, 0, 5,-32768,-32768,-32768, 3, -2, -1,-32768,
|
-32768, 0, -1,-32768,-32768,-32768,-32768,-32768, 14, 9,
|
||||||
9,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
|
3, 10,-32768, -4,-32768,-32768,-32768,-32768,-32768,-32768,
|
||||||
6,-32768,-32768, 13, 4,-32768,-32768,-32768,-32768, 19,
|
-32768,-32768,-32768,-32768, 2,-32768,-32768, 16, -3, 15,
|
||||||
|
-32768,-32768,-32768,-32768,-32768, -4,-32768, 17,-32768, 25,
|
||||||
-32768
|
-32768
|
||||||
};
|
};
|
||||||
|
|
||||||
static const short yypgoto[] =
|
static const short yypgoto[] =
|
||||||
{
|
{
|
||||||
10,-32768,-32768,-32768,-32768,-32768,-32768, 12,-32768,-32768
|
12,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 18,-32768,
|
||||||
|
-8,-32768,-32768,-32768
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#define YYLAST 21
|
#define YYLAST 29
|
||||||
|
|
||||||
|
|
||||||
static const short yytable[] =
|
static const short yytable[] =
|
||||||
{
|
{
|
||||||
29, 12, 13, 14, 15, 16, 9, 17, 27, 2,
|
39, 32, 24, 25, 26, 11, 22, 2, 3, 30,
|
||||||
2, 8, 10, 25, 2, 20, 21, 22, 26, 30,
|
2, 3, 15, 16, 17, 18, 19, 12, 20, 34,
|
||||||
19, 24
|
2, 31, 38, 13, 35, 40, 28, 37, 0, 23
|
||||||
};
|
};
|
||||||
|
|
||||||
static const short yycheck[] =
|
static const short yycheck[] =
|
||||||
{
|
{
|
||||||
0, 3, 4, 5, 6, 7, 3, 9, 4, 10,
|
0, 4, 6, 7, 8, 6, 3, 10, 11, 7,
|
||||||
10, 6, 9, 7, 10, 6, 7, 8, 5, 0,
|
10, 11, 3, 4, 5, 6, 7, 3, 9, 4,
|
||||||
8, 11
|
10, 5, 5, 9, 9, 0, 14, 35, -1, 11
|
||||||
};
|
};
|
||||||
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
|
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
|
||||||
#line 3 "/usr/share/bison/bison.simple"
|
#line 3 "/usr/share/bison/bison.simple"
|
||||||
|
@ -254,12 +261,6 @@ static const short yycheck[] =
|
||||||
# define YYSTACK_ALLOC malloc
|
# define YYSTACK_ALLOC malloc
|
||||||
# define YYSTACK_FREE free
|
# define YYSTACK_FREE free
|
||||||
# endif
|
# endif
|
||||||
#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
|
|
||||||
|
|
||||||
|
|
||||||
#if (! defined (yyoverflow) \
|
|
||||||
&& (! defined (__cplusplus) \
|
|
||||||
|| (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
|
|
||||||
|
|
||||||
/* A type that is properly aligned for any stack member. */
|
/* A type that is properly aligned for any stack member. */
|
||||||
union yyalloc
|
union yyalloc
|
||||||
|
@ -286,41 +287,24 @@ union yyalloc
|
||||||
+ YYSTACK_GAP_MAX)
|
+ YYSTACK_GAP_MAX)
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
/* Copy COUNT objects from FROM to TO. The source and destination do
|
/* Relocate the TYPE STACK from its old location to the new one. The
|
||||||
not overlap. */
|
|
||||||
# ifndef YYCOPY
|
|
||||||
# if 1 < __GNUC__
|
|
||||||
# define YYCOPY(To, From, Count) \
|
|
||||||
__builtin_memcpy (To, From, (Count) * sizeof (*(From)))
|
|
||||||
# else
|
|
||||||
# define YYCOPY(To, From, Count) \
|
|
||||||
do \
|
|
||||||
{ \
|
|
||||||
register YYSIZE_T yyi; \
|
|
||||||
for (yyi = 0; yyi < (Count); yyi++) \
|
|
||||||
(To)[yyi] = (From)[yyi]; \
|
|
||||||
} \
|
|
||||||
while (0)
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
|
|
||||||
/* Relocate STACK from its old location to the new one. The
|
|
||||||
local variables YYSIZE and YYSTACKSIZE give the old and new number of
|
local variables YYSIZE and YYSTACKSIZE give the old and new number of
|
||||||
elements in the stack, and YYPTR gives the new location of the
|
elements in the stack, and YYPTR gives the new location of the
|
||||||
stack. Advance YYPTR to a properly aligned location for the next
|
stack. Advance YYPTR to a properly aligned location for the next
|
||||||
stack. */
|
stack. */
|
||||||
# define YYSTACK_RELOCATE(Stack) \
|
# define YYSTACK_RELOCATE(Type, Stack) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
YYSIZE_T yynewbytes; \
|
YYSIZE_T yynewbytes; \
|
||||||
YYCOPY (&yyptr->Stack, Stack, yysize); \
|
yymemcpy ((char *) yyptr, (char *) (Stack), \
|
||||||
|
yysize * (YYSIZE_T) sizeof (Type)); \
|
||||||
Stack = &yyptr->Stack; \
|
Stack = &yyptr->Stack; \
|
||||||
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
|
yynewbytes = yystacksize * sizeof (Type) + YYSTACK_GAP_MAX; \
|
||||||
yyptr += yynewbytes / sizeof (*yyptr); \
|
yyptr += yynewbytes / sizeof (*yyptr); \
|
||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
#endif
|
#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
|
||||||
|
|
||||||
|
|
||||||
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
|
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
|
||||||
|
@ -447,6 +431,33 @@ int yydebug;
|
||||||
# define YYMAXDEPTH 10000
|
# define YYMAXDEPTH 10000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if ! defined (yyoverflow) && ! defined (yymemcpy)
|
||||||
|
# if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
|
||||||
|
# define yymemcpy __builtin_memcpy
|
||||||
|
# else /* not GNU C or C++ */
|
||||||
|
|
||||||
|
/* This is the most reliable way to avoid incompatibilities
|
||||||
|
in available built-in functions on various systems. */
|
||||||
|
static void
|
||||||
|
# if defined (__STDC__) || defined (__cplusplus)
|
||||||
|
yymemcpy (char *yyto, const char *yyfrom, YYSIZE_T yycount)
|
||||||
|
# else
|
||||||
|
yymemcpy (yyto, yyfrom, yycount)
|
||||||
|
char *yyto;
|
||||||
|
const char *yyfrom;
|
||||||
|
YYSIZE_T yycount;
|
||||||
|
# endif
|
||||||
|
{
|
||||||
|
register const char *yyf = yyfrom;
|
||||||
|
register char *yyt = yyto;
|
||||||
|
register YYSIZE_T yyi = yycount;
|
||||||
|
|
||||||
|
while (yyi-- != 0)
|
||||||
|
*yyt++ = *yyf++;
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef YYERROR_VERBOSE
|
#ifdef YYERROR_VERBOSE
|
||||||
|
|
||||||
# ifndef yystrlen
|
# ifndef yystrlen
|
||||||
|
@ -499,7 +510,7 @@ yystpcpy (yydest, yysrc)
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#line 315 "/usr/share/bison/bison.simple"
|
#line 319 "/usr/share/bison/bison.simple"
|
||||||
|
|
||||||
|
|
||||||
/* The user can define YYPARSE_PARAM as the name of an argument to be passed
|
/* The user can define YYPARSE_PARAM as the name of an argument to be passed
|
||||||
|
@ -689,9 +700,6 @@ yyparse (YYPARSE_PARAM_ARG)
|
||||||
yyvs = yyvs1;
|
yyvs = yyvs1;
|
||||||
}
|
}
|
||||||
#else /* no yyoverflow */
|
#else /* no yyoverflow */
|
||||||
# ifndef YYSTACK_RELOCATE
|
|
||||||
goto yyoverflowlab;
|
|
||||||
# else
|
|
||||||
/* Extend the stack our own way. */
|
/* Extend the stack our own way. */
|
||||||
if (yystacksize >= YYMAXDEPTH)
|
if (yystacksize >= YYMAXDEPTH)
|
||||||
goto yyoverflowlab;
|
goto yyoverflowlab;
|
||||||
|
@ -705,16 +713,15 @@ yyparse (YYPARSE_PARAM_ARG)
|
||||||
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
|
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
|
||||||
if (! yyptr)
|
if (! yyptr)
|
||||||
goto yyoverflowlab;
|
goto yyoverflowlab;
|
||||||
YYSTACK_RELOCATE (yyss);
|
YYSTACK_RELOCATE (short, yyss);
|
||||||
YYSTACK_RELOCATE (yyvs);
|
YYSTACK_RELOCATE (YYSTYPE, yyvs);
|
||||||
# if YYLSP_NEEDED
|
# if YYLSP_NEEDED
|
||||||
YYSTACK_RELOCATE (yyls);
|
YYSTACK_RELOCATE (YYLTYPE, yyls);
|
||||||
# endif
|
# endif
|
||||||
# undef YYSTACK_RELOCATE
|
# undef YYSTACK_RELOCATE
|
||||||
if (yyss1 != yyssa)
|
if (yyss1 != yyssa)
|
||||||
YYSTACK_FREE (yyss1);
|
YYSTACK_FREE (yyss1);
|
||||||
}
|
}
|
||||||
# endif
|
|
||||||
#endif /* no yyoverflow */
|
#endif /* no yyoverflow */
|
||||||
|
|
||||||
yyssp = yyss + yysize - 1;
|
yyssp = yyss + yysize - 1;
|
||||||
|
@ -892,67 +899,71 @@ yyreduce:
|
||||||
|
|
||||||
switch (yyn) {
|
switch (yyn) {
|
||||||
|
|
||||||
case 5:
|
case 6:
|
||||||
#line 37 "epist.y"
|
#line 38 "epist.y"
|
||||||
{
|
{
|
||||||
((parser*)parser_obj)->setAction(yyvsp[-2]);
|
((parser*)parser_obj)->setAction(yyvsp[-2]);
|
||||||
((parser*)parser_obj)->endAction();
|
((parser*)parser_obj)->endAction();
|
||||||
}
|
;
|
||||||
break;
|
break;}
|
||||||
case 6:
|
case 7:
|
||||||
#line 46 "epist.y"
|
#line 47 "epist.y"
|
||||||
{
|
{
|
||||||
((parser*)parser_obj)->endChain();
|
((parser*)parser_obj)->endChain();
|
||||||
}
|
;
|
||||||
break;
|
break;}
|
||||||
case 8:
|
case 10:
|
||||||
#line 56 "epist.y"
|
#line 61 "epist.y"
|
||||||
{ ((parser*)parser_obj)->startChain(); }
|
{ ((parser*)parser_obj)->startChain(); ;
|
||||||
break;
|
break;}
|
||||||
case 9:
|
|
||||||
#line 60 "epist.y"
|
|
||||||
{ /* ((parser*)parser_obj)->endChain(); */ }
|
|
||||||
break;
|
|
||||||
case 11:
|
case 11:
|
||||||
#line 64 "epist.y"
|
#line 65 "epist.y"
|
||||||
{ ((parser*)parser_obj)->addModifier(yyvsp[-2]); }
|
{ /* ((parser*)parser_obj)->endChain(); */ ;
|
||||||
break;
|
break;}
|
||||||
case 12:
|
|
||||||
#line 68 "epist.y"
|
|
||||||
{ ((parser*)parser_obj)->setKey(yyvsp[0]); }
|
|
||||||
break;
|
|
||||||
case 13:
|
case 13:
|
||||||
#line 69 "epist.y"
|
#line 69 "epist.y"
|
||||||
{ ((parser*)parser_obj)->setKey(yyvsp[0]); }
|
{ ((parser*)parser_obj)->addModifier(yyvsp[-2]); ;
|
||||||
break;
|
break;}
|
||||||
case 14:
|
case 14:
|
||||||
#line 70 "epist.y"
|
|
||||||
{ ((parser*)parser_obj)->setKey(yyvsp[0]); }
|
|
||||||
break;
|
|
||||||
case 15:
|
|
||||||
#line 71 "epist.y"
|
|
||||||
{ ((parser*)parser_obj)->setKey(yyvsp[0]); }
|
|
||||||
break;
|
|
||||||
case 16:
|
|
||||||
#line 72 "epist.y"
|
|
||||||
{ ((parser*)parser_obj)->setKey(yyvsp[0]); }
|
|
||||||
break;
|
|
||||||
case 17:
|
|
||||||
#line 73 "epist.y"
|
#line 73 "epist.y"
|
||||||
{ ((parser*)parser_obj)->setKey(yyvsp[0]); }
|
{ ((parser*)parser_obj)->setKey(yyvsp[0]); ;
|
||||||
break;
|
break;}
|
||||||
case 19:
|
case 15:
|
||||||
|
#line 74 "epist.y"
|
||||||
|
{ ((parser*)parser_obj)->setKey(yyvsp[0]); ;
|
||||||
|
break;}
|
||||||
|
case 16:
|
||||||
|
#line 75 "epist.y"
|
||||||
|
{ ((parser*)parser_obj)->setKey(yyvsp[0]); ;
|
||||||
|
break;}
|
||||||
|
case 17:
|
||||||
|
#line 76 "epist.y"
|
||||||
|
{ ((parser*)parser_obj)->setKey(yyvsp[0]); ;
|
||||||
|
break;}
|
||||||
|
case 18:
|
||||||
#line 77 "epist.y"
|
#line 77 "epist.y"
|
||||||
{ ((parser*)parser_obj)->setArgumentNum(yyvsp[0]); }
|
{ ((parser*)parser_obj)->setKey(yyvsp[0]); ;
|
||||||
break;
|
break;}
|
||||||
case 20:
|
case 19:
|
||||||
#line 78 "epist.y"
|
#line 78 "epist.y"
|
||||||
{ ((parser*)parser_obj)->setArgumentNegNum(yyvsp[0]); }
|
{ ((parser*)parser_obj)->setKey(yyvsp[0]); ;
|
||||||
break;
|
break;}
|
||||||
case 21:
|
case 21:
|
||||||
#line 79 "epist.y"
|
#line 82 "epist.y"
|
||||||
{ ((parser*)parser_obj)->setArgumentStr(yyvsp[0]); }
|
{ ((parser*)parser_obj)->setArgumentNum(yyvsp[0]); ;
|
||||||
break;
|
break;}
|
||||||
|
case 22:
|
||||||
|
#line 83 "epist.y"
|
||||||
|
{ ((parser*)parser_obj)->setArgumentNegNum(yyvsp[0]); ;
|
||||||
|
break;}
|
||||||
|
case 23:
|
||||||
|
#line 84 "epist.y"
|
||||||
|
{ ((parser*)parser_obj)->setArgumentStr(yyvsp[0]); ;
|
||||||
|
break;}
|
||||||
|
case 27:
|
||||||
|
#line 97 "epist.y"
|
||||||
|
{ ((parser*)parser_obj)->setOption(yyvsp[-2]); ;
|
||||||
|
break;}
|
||||||
}
|
}
|
||||||
|
|
||||||
#line 705 "/usr/share/bison/bison.simple"
|
#line 705 "/usr/share/bison/bison.simple"
|
||||||
|
@ -1186,6 +1197,6 @@ yyreturn:
|
||||||
#endif
|
#endif
|
||||||
return yyresult;
|
return yyresult;
|
||||||
}
|
}
|
||||||
#line 82 "epist.y"
|
#line 100 "epist.y"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
# ifndef YYSTYPE
|
# ifndef YYSTYPE
|
||||||
# define YYSTYPE int
|
# define YYSTYPE int
|
||||||
# define YYSTYPE_IS_TRIVIAL 1
|
|
||||||
# endif
|
# endif
|
||||||
# define OBRACE 257
|
# define OBRACE 257
|
||||||
# define EBRACE 258
|
# define EBRACE 258
|
||||||
|
@ -13,6 +12,7 @@
|
||||||
# define QUOTES 262
|
# define QUOTES 262
|
||||||
# define WORD 263
|
# define WORD 263
|
||||||
# define BINDING 264
|
# define BINDING 264
|
||||||
|
# define OPTIONS 265
|
||||||
|
|
||||||
|
|
||||||
extern YYSTYPE yylval;
|
extern YYSTYPE yylval;
|
||||||
|
|
Loading…
Reference in a new issue