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-11-01 09:57:23 (GMT)
commit8ee8a7798c73731724a8e982ed027394a45f6b58 (patch)
treeea12ca08f17eea045301d0be846b170eb35deaad /src/Keys.hh
parentab0fd035167f053966225a239dae189d5f439ecd (diff)
downloadfluxbox_paul-8ee8a7798c73731724a8e982ed027394a45f6b58.zip
fluxbox_paul-8ee8a7798c73731724a8e982ed027394a45f6b58.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 076387b..9e31f0e 100644
--- a/src/Keys.hh
+++ b/src/Keys.hh
@@ -35,6 +35,7 @@ class WinClient;
35namespace FbTk { 35namespace FbTk {
36 class EventHandler; 36 class EventHandler;
37 class AutoReloadHelper; 37 class AutoReloadHelper;
38 class Lua;
38} 39}
39 40
40class Keys: private FbTk::NotCopyable, private FbTk::SignalTracker { 41class Keys: private FbTk::NotCopyable, private FbTk::SignalTracker {
@@ -63,10 +64,6 @@ public:
63 /// destructor 64 /// destructor
64 ~Keys(); 65 ~Keys();
65 66
66 /// bind a key action from a string
67 /// @return false on failure
68 bool addBinding(const std::string &binding);
69
70 /** 67 /**
71 do action from XKeyEvent; return false if not bound to anything 68 do action from XKeyEvent; return false if not bound to anything
72 */ 69 */
@@ -85,17 +82,12 @@ public:
85 Load configuration from file 82 Load configuration from file
86 */ 83 */
87 void reload(); 84 void reload();
88 /**
89 Reload configuration if keys file has changed
90 */
91 void keyMode(const std::string& keyMode);
92 85
93 bool inKeychain() const { return saved_keymode != 0; } 86 bool inKeychain() const { return saved_keymode != 0; }
94 87
95private: 88private:
96 class t_key; // helper class to build a 'keytree' 89 class t_key; // helper class to build a 'keytree'
97 typedef FbTk::RefCount<t_key> RefKey; 90 typedef FbTk::RefCount<t_key> RefKey;
98 typedef std::map<std::string, RefKey> keyspace_t;
99 typedef std::map<Window, int> WindowMap; 91 typedef std::map<Window, int> WindowMap;
100 typedef std::map<Window, FbTk::EventHandler*> HandlerMap; 92 typedef std::map<Window, FbTk::EventHandler*> HandlerMap;
101 93
@@ -108,14 +100,13 @@ private:
108 void grabWindow(Window win); 100 void grabWindow(Window win);
109 101
110 // Load default keybindings for when there are errors loading the keys file 102 // Load default keybindings for when there are errors loading the keys file
111 void loadDefaults(); 103 void loadDefaults(FbTk::Lua &l);
112 void setKeyMode(const FbTk::RefCount<t_key> &keyMode); 104 void setKeyMode(const FbTk::RefCount<t_key> &keyMode);
113 105
114 106
115 // member variables 107 // member variables
116 FbTk::AutoReloadHelper* m_reloader; 108 FbTk::AutoReloadHelper* m_reloader;
117 RefKey m_keylist; 109 RefKey m_keylist;
118 keyspace_t m_map;
119 110
120 RefKey next_key; 111 RefKey next_key;
121 RefKey saved_keymode; 112 RefKey saved_keymode;