aboutsummaryrefslogtreecommitdiff
path: root/src/Keys.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Keys.cc')
-rw-r--r--src/Keys.cc21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/Keys.cc b/src/Keys.cc
index fc53353..3ef0b64 100644
--- a/src/Keys.cc
+++ b/src/Keys.cc
@@ -188,7 +188,11 @@ Keys::Keys():
188 m_reloader(new FbTk::AutoReloadHelper()), 188 m_reloader(new FbTk::AutoReloadHelper()),
189 m_keylist(0), 189 m_keylist(0),
190 next_key(0), saved_keymode(0) { 190 next_key(0), saved_keymode(0) {
191
191 m_reloader->setReloadCmd(FbTk::RefCount<FbTk::Command<void> >(new FbTk::SimpleCommand<Keys>(*this, &Keys::reload))); 192 m_reloader->setReloadCmd(FbTk::RefCount<FbTk::Command<void> >(new FbTk::SimpleCommand<Keys>(*this, &Keys::reload)));
193 m_reloader->setMainFile(*Fluxbox::instance()->getKeysResource());
194 join(Fluxbox::instance()->getKeysResource().modifiedSig(),
195 MemFun(*m_reloader, &FbTk::AutoReloadHelper::setMainFile));
192} 196}
193 197
194Keys::~Keys() { 198Keys::~Keys() {
@@ -282,8 +286,9 @@ void Keys::grabWindow(Window win) {
282void Keys::reload() { 286void Keys::reload() {
283 // an intentionally empty file will still have one root mapping 287 // an intentionally empty file will still have one root mapping
284 bool firstload = m_map.empty(); 288 bool firstload = m_map.empty();
289 const std::string filename = FbTk::StringUtil::expandFilename(*Fluxbox::instance()->getKeysResource());
285 290
286 if (m_filename.empty()) { 291 if (filename.empty()) {
287 if (firstload) 292 if (firstload)
288 loadDefaults(); 293 loadDefaults();
289 return; 294 return;
@@ -291,12 +296,12 @@ void Keys::reload() {
291 296
292 FbTk::App::instance()->sync(false); 297 FbTk::App::instance()->sync(false);
293 298
294 if (! FbTk::FileUtil::isRegularFile(m_filename.c_str())) { 299 if (! FbTk::FileUtil::isRegularFile(filename.c_str())) {
295 return; 300 return;
296 } 301 }
297 302
298 // open the file 303 // open the file
299 ifstream infile(m_filename.c_str()); 304 ifstream infile(filename.c_str());
300 if (!infile) { 305 if (!infile) {
301 if (firstload) 306 if (firstload)
302 loadDefaults(); 307 loadDefaults();
@@ -607,16 +612,6 @@ void Keys::unregisterWindow(Window win) {
607 m_window_map.erase(win); 612 m_window_map.erase(win);
608} 613}
609 614
610/**
611 deletes the tree and load configuration
612 returns true on success else false
613*/
614void Keys::reconfigure() {
615 m_filename = FbTk::StringUtil::expandFilename(Fluxbox::instance()->getKeysFilename());
616 m_reloader->setMainFile(m_filename);
617 m_reloader->checkReload();
618}
619
620void Keys::regrab() { 615void Keys::regrab() {
621 setKeyMode(m_keylist); 616 setKeyMode(m_keylist);
622} 617}