diff options
author | Mark Tiefenbruck <mark@fluxbox.org> | 2008-05-12 19:16:37 (GMT) |
---|---|---|
committer | Mark Tiefenbruck <mark@fluxbox.org> | 2008-05-12 19:16:37 (GMT) |
commit | dcdc78332431ff2b258c54a99d6fac382c6a0595 (patch) | |
tree | c667adfc3cf2a2a90972d1342147f31bd6beeb40 /src/Keys.hh | |
parent | a56492c0d538c9c3a019812558938df0b6afedeb (diff) | |
download | fluxbox_pavel-dcdc78332431ff2b258c54a99d6fac382c6a0595.zip fluxbox_pavel-dcdc78332431ff2b258c54a99d6fac382c6a0595.tar.bz2 |
only reload the keys file if the contents have changed
Diffstat (limited to 'src/Keys.hh')
-rw-r--r-- | src/Keys.hh | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/src/Keys.hh b/src/Keys.hh index 7ebb0a7..68ff4ec 100644 --- a/src/Keys.hh +++ b/src/Keys.hh | |||
@@ -23,6 +23,7 @@ | |||
23 | #define KEYS_HH | 23 | #define KEYS_HH |
24 | 24 | ||
25 | #include "FbTk/NotCopyable.hh" | 25 | #include "FbTk/NotCopyable.hh" |
26 | #include "FbTk/AutoReloadHelper.hh" | ||
26 | 27 | ||
27 | #include <X11/Xlib.h> | 28 | #include <X11/Xlib.h> |
28 | #include <string> | 29 | #include <string> |
@@ -57,17 +58,6 @@ public: | |||
57 | /// destructor | 58 | /// destructor |
58 | ~Keys(); | 59 | ~Keys(); |
59 | 60 | ||
60 | /** | ||
61 | Load configuration from file | ||
62 | @return true on success, else false | ||
63 | */ | ||
64 | bool load(const char *filename = 0); | ||
65 | /** | ||
66 | Save keybindings to a file | ||
67 | Note: the file will be overwritten | ||
68 | @return true on success, else false | ||
69 | */ | ||
70 | bool save(const char *filename = 0) const; | ||
71 | /// bind a key action from a string | 61 | /// bind a key action from a string |
72 | /// @return false on failure | 62 | /// @return false on failure |
73 | bool addBinding(const std::string &binding); | 63 | bool addBinding(const std::string &binding); |
@@ -83,12 +73,12 @@ public: | |||
83 | /// unregister window | 73 | /// unregister window |
84 | void unregisterWindow(Window win); | 74 | void unregisterWindow(Window win); |
85 | 75 | ||
76 | const std::string& filename() const { return m_filename; } | ||
86 | /** | 77 | /** |
87 | Reload configuration from filename | 78 | Reload configuration from filename |
88 | @return true on success, else false | 79 | @return true on success, else false |
89 | */ | 80 | */ |
90 | bool reconfigure(const char *filename); | 81 | void reconfigure(); |
91 | const std::string& filename() const { return m_filename; } | ||
92 | void keyMode(const std::string& keyMode); | 82 | void keyMode(const std::string& keyMode); |
93 | private: | 83 | private: |
94 | class t_key; // helper class to build a 'keytree' | 84 | class t_key; // helper class to build a 'keytree' |
@@ -104,13 +94,18 @@ private: | |||
104 | void ungrabButtons(); | 94 | void ungrabButtons(); |
105 | void grabWindow(Window win); | 95 | void grabWindow(Window win); |
106 | 96 | ||
107 | // Load default keybindings for when there are errors loading the initial one | 97 | /** |
98 | Load configuration from file | ||
99 | */ | ||
100 | void reload(); | ||
101 | // Load default keybindings for when there are errors loading the keys file | ||
108 | void loadDefaults(); | 102 | void loadDefaults(); |
109 | void setKeyMode(t_key *keyMode); | 103 | void setKeyMode(t_key *keyMode); |
110 | 104 | ||
111 | 105 | ||
112 | // member variables | 106 | // member variables |
113 | std::string m_filename; | 107 | std::string m_filename; |
108 | FbTk::AutoReloadHelper m_reloader; | ||
114 | t_key *m_keylist; | 109 | t_key *m_keylist; |
115 | keyspace_t m_map; | 110 | keyspace_t m_map; |
116 | 111 | ||