aboutsummaryrefslogtreecommitdiff
path: root/src/Keys.hh
diff options
context:
space:
mode:
authorPavel Labath <pavelo@centrum.sk>2011-07-24 14:08:05 (GMT)
committerPavel Labath <pavelo@centrum.sk>2011-07-24 14:08:05 (GMT)
commit281a59d37f688cc316ef37e47234c645acbb717c (patch)
treec4821b96cd372e6214721c12f09c29b803d26ace /src/Keys.hh
parent2127e4045fbaf1c10acf1df6f43216b4c6df2235 (diff)
downloadfluxbox_pavel-281a59d37f688cc316ef37e47234c645acbb717c.zip
fluxbox_pavel-281a59d37f688cc316ef37e47234c645acbb717c.tar.bz2
(More-or-less complete) conversion of keys file to lua
keybindings are added by calling the addBinding method of default_keymode. It keys two parameters: the keys to which the action is bound to and the action itself. The action can be specified as a string (which is passed to CommandParser) or as a lua function. Support for multiple keymodes is forthcoming. For the time being, I removed the BindKey and KeyMode commands, as they will take a bit different form.
Diffstat (limited to 'src/Keys.hh')
-rw-r--r--src/Keys.hh13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/Keys.hh b/src/Keys.hh
index e51911d..33aa398 100644
--- a/src/Keys.hh
+++ b/src/Keys.hh
@@ -34,6 +34,7 @@ class WinClient;
34namespace FbTk { 34namespace FbTk {
35 class EventHandler; 35 class EventHandler;
36 class AutoReloadHelper; 36 class AutoReloadHelper;
37 class Lua;
37} 38}
38 39
39class Keys: private FbTk::NotCopyable, private FbTk::SignalTracker { 40class Keys: private FbTk::NotCopyable, private FbTk::SignalTracker {
@@ -62,10 +63,6 @@ public:
62 /// destructor 63 /// destructor
63 ~Keys(); 64 ~Keys();
64 65
65 /// bind a key action from a string
66 /// @return false on failure
67 bool addBinding(const std::string &binding);
68
69 /** 66 /**
70 do action from XKeyEvent; return false if not bound to anything 67 do action from XKeyEvent; return false if not bound to anything
71 */ 68 */
@@ -84,17 +81,12 @@ public:
84 Load configuration from file 81 Load configuration from file
85 */ 82 */
86 void reload(); 83 void reload();
87 /**
88 Reload configuration if keys file has changed
89 */
90 void keyMode(const std::string& keyMode);
91 84
92 bool inKeychain() const { return saved_keymode != 0; } 85 bool inKeychain() const { return saved_keymode != 0; }
93 86
94private: 87private:
95 class t_key; // helper class to build a 'keytree' 88 class t_key; // helper class to build a 'keytree'
96 typedef FbTk::RefCount<t_key> RefKey; 89 typedef FbTk::RefCount<t_key> RefKey;
97 typedef std::map<std::string, RefKey> keyspace_t;
98 typedef std::map<Window, int> WindowMap; 90 typedef std::map<Window, int> WindowMap;
99 typedef std::map<Window, FbTk::EventHandler*> HandlerMap; 91 typedef std::map<Window, FbTk::EventHandler*> HandlerMap;
100 92
@@ -107,14 +99,13 @@ private:
107 void grabWindow(Window win); 99 void grabWindow(Window win);
108 100
109 // Load default keybindings for when there are errors loading the keys file 101 // Load default keybindings for when there are errors loading the keys file
110 void loadDefaults(); 102 void loadDefaults(FbTk::Lua &l);
111 void setKeyMode(const FbTk::RefCount<t_key> &keyMode); 103 void setKeyMode(const FbTk::RefCount<t_key> &keyMode);
112 104
113 105
114 // member variables 106 // member variables
115 FbTk::AutoReloadHelper* m_reloader; 107 FbTk::AutoReloadHelper* m_reloader;
116 RefKey m_keylist; 108 RefKey m_keylist;
117 keyspace_t m_map;
118 109
119 RefKey next_key; 110 RefKey next_key;
120 RefKey saved_keymode; 111 RefKey saved_keymode;