X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fbindings.hh;h=0ae035761437ba5890860684d351e80ce4d6aedc;hb=745e840547b5443ecfb9b6f0a4f14b0d035d59c2;hp=3fbf3b8d773718b6598f95d334738998e8ac8d64;hpb=d7a30f93b517ac76816d0acea92e9c56ad5d6594;p=chaz%2Fopenbox diff --git a/src/bindings.hh b/src/bindings.hh index 3fbf3b8d..0ae03576 100644 --- a/src/bindings.hh +++ b/src/bindings.hh @@ -7,6 +7,7 @@ */ #include "actions.hh" +#include "otk/timer.hh" #include #include @@ -28,7 +29,6 @@ typedef struct Binding { typedef struct BindingTree { Binding binding; - std::string text; int id; // the id given for the binding in add() bool chain; // true if this is a chain to another key (not an action) @@ -50,54 +50,40 @@ public: typedef std::vector StringVect; private: - BindingTree _keytree; // root node of the tree (this doesn't have siblings!) + BindingTree _tree; // root node of the tree (this doesn't have siblings!) BindingTree *_curpos; // position in the keytree - BindingTree *_mousetree; // this tree is a list. it has only siblings + Binding _resetkey; // the key which resets the key chain status + + otk::OBTimer _timer; - int find_key(BindingTree *search) const; - bool translate(const std::string &str, Binding &b, bool askey) const; + int find(BindingTree *search) const; + bool translate(const std::string &str, Binding &b) const; BindingTree *buildtree(const StringVect &keylist, int id) const; void assimilate(BindingTree *node); - void grabMouseOnAll(bool grab); - void grabKeys(bool grab); - + static void reset(OBBindings *self); + public: //! Initializes an OBBinding object OBBindings(); //! Destroys the OBBinding object virtual ~OBBindings(); - //! Adds a new mouse binding - /*! - A binding will fail to be added if the binding already exists, or if the - string is invalid. - @return true if the binding could be added; false if it could not. - */ - bool add_mouse(const std::string &button, int id); - - //! Removes a mouse binding - /*! - @return The id of the binding that was removed, or '< 0' if none were - removed. - */ - int remove_mouse(const std::string &button); - //! Adds a new key binding /*! A binding will fail to be added if the binding already exists (as part of a chain or not), or if any of the strings in the keylist are invalid. @return true if the binding could be added; false if it could not. */ - bool add_key(const StringVect &keylist, int id); + bool add(const StringVect &keylist, int id); //! Removes a key binding /*! @return The id of the binding that was removed, or '< 0' if none were removed. */ - int remove_key(const StringVect &keylist); + int remove(const StringVect &keylist); //! Removes all key bindings void remove_all(); @@ -107,20 +93,13 @@ public: @return -1 if the keybinding was not found but does not conflict with any others; -2 if the keybinding conflicts with another. */ - int find_key(const StringVect &keylist); - - void process(unsigned int modifiers, unsigned int key); + int find(const StringVect &keylist); - // XXX: need an exec() function or something that will be used by openbox - // and hold state for which chain we're in etc. (it could have a timer - // for reseting too...) + void fire(Window window, unsigned int modifiers,unsigned int key, Time time); - void display(); + void setResetKey(const std::string &key); - void fire(OBActions::ActionType type, Window window, unsigned int modifiers, - unsigned int key, Time time); - - void grabMouse(bool grab, const OBClient *client); + void grabKeys(bool grab); }; }