diff options
author | Henrik Kinnunen <fluxgen@fluxbox.org> | 2008-05-13 15:07:30 (GMT) |
---|---|---|
committer | Henrik Kinnunen <fluxgen@fluxbox.org> | 2008-05-13 15:07:30 (GMT) |
commit | 7f45bae4629f345906e96c1fcb3a3d1e49c36382 (patch) | |
tree | b09708632d29ac4471c57446eb726e5401c8570f /src/fluxbox.cc | |
parent | 5ecebae4770cbe7e4feea46d2c074a818f1c9662 (diff) | |
parent | d7aa526d9275f7c94f0b1ce27464eaf3dae0d78d (diff) | |
download | fluxbox-7f45bae4629f345906e96c1fcb3a3d1e49c36382.zip fluxbox-7f45bae4629f345906e96c1fcb3a3d1e49c36382.tar.bz2 |
Merge branch 'master' of fluxbox@git.fluxbox.org:fluxbox
Diffstat (limited to 'src/fluxbox.cc')
-rw-r--r-- | src/fluxbox.cc | 88 |
1 files changed, 5 insertions, 83 deletions
diff --git a/src/fluxbox.cc b/src/fluxbox.cc index 300d683..076ae45 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc | |||
@@ -307,7 +307,7 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile | |||
307 | // Create keybindings handler and load keys file | 307 | // Create keybindings handler and load keys file |
308 | // Note: this needs to be done before creating screens | 308 | // Note: this needs to be done before creating screens |
309 | m_key.reset(new Keys); | 309 | m_key.reset(new Keys); |
310 | m_key->load(StringUtil::expandFilename(*m_rc_keyfile).c_str()); | 310 | m_key->reconfigure(); |
311 | 311 | ||
312 | vector<int> screens; | 312 | vector<int> screens; |
313 | int i; | 313 | int i; |
@@ -399,7 +399,7 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile | |||
399 | //XSynchronize(disp, False); | 399 | //XSynchronize(disp, False); |
400 | sync(false); | 400 | sync(false); |
401 | 401 | ||
402 | m_reconfigure_wait = m_reread_menu_wait = false; | 402 | m_reconfigure_wait = false; |
403 | 403 | ||
404 | m_resourcemanager.unlock(); | 404 | m_resourcemanager.unlock(); |
405 | ungrab(); | 405 | ungrab(); |
@@ -437,8 +437,6 @@ Fluxbox::~Fluxbox() { | |||
437 | delete (*it).first; | 437 | delete (*it).first; |
438 | } | 438 | } |
439 | m_atomhandler.clear(); | 439 | m_atomhandler.clear(); |
440 | |||
441 | clearMenuFilenames(); | ||
442 | } | 440 | } |
443 | 441 | ||
444 | 442 | ||
@@ -753,7 +751,7 @@ void Fluxbox::handleEvent(XEvent * const e) { | |||
753 | XRefreshKeyboardMapping(&e->xmapping); | 751 | XRefreshKeyboardMapping(&e->xmapping); |
754 | FbTk::KeyUtil::instance().init(); // reinitialise the key utils | 752 | FbTk::KeyUtil::instance().init(); // reinitialise the key utils |
755 | // reconfigure keys (if the mapping changes, they don't otherwise update | 753 | // reconfigure keys (if the mapping changes, they don't otherwise update |
756 | m_key->reconfigure(StringUtil::expandFilename(*m_rc_keyfile).c_str()); | 754 | m_key->reconfigure(); |
757 | } | 755 | } |
758 | break; | 756 | break; |
759 | case CreateNotify: | 757 | case CreateNotify: |
@@ -1445,7 +1443,7 @@ void Fluxbox::real_reconfigure() { | |||
1445 | for_each(m_screen_list.begin(), m_screen_list.end(), mem_fun(&BScreen::reconfigure)); | 1443 | for_each(m_screen_list.begin(), m_screen_list.end(), mem_fun(&BScreen::reconfigure)); |
1446 | 1444 | ||
1447 | //reconfigure keys | 1445 | //reconfigure keys |
1448 | m_key->reconfigure(StringUtil::expandFilename(*m_rc_keyfile).c_str()); | 1446 | m_key->reconfigure(); |
1449 | 1447 | ||
1450 | // and atomhandlers | 1448 | // and atomhandlers |
1451 | for (AtomHandlerContainerIt it= m_atomhandler.begin(); | 1449 | for (AtomHandlerContainerIt it= m_atomhandler.begin(); |
@@ -1469,87 +1467,11 @@ BScreen *Fluxbox::findScreen(int id) { | |||
1469 | return *it; | 1467 | return *it; |
1470 | } | 1468 | } |
1471 | 1469 | ||
1472 | bool Fluxbox::menuTimestampsChanged() const { | ||
1473 | list<MenuTimestamp *>::const_iterator it = m_menu_timestamps.begin(); | ||
1474 | list<MenuTimestamp *>::const_iterator it_end = m_menu_timestamps.end(); | ||
1475 | for (; it != it_end; ++it) { | ||
1476 | |||
1477 | time_t timestamp = FbTk::FileUtil::getLastStatusChangeTimestamp((*it)->filename.c_str()); | ||
1478 | |||
1479 | if (timestamp != (*it)->timestamp) | ||
1480 | return true; | ||
1481 | } | ||
1482 | |||
1483 | // no timestamp changed | ||
1484 | return false; | ||
1485 | } | ||
1486 | |||
1487 | void Fluxbox::rereadMenu(bool show_after_reread) { | ||
1488 | m_reread_menu_wait = true; | ||
1489 | m_show_menu_after_reread = show_after_reread; | ||
1490 | m_reconfig_timer.start(); | ||
1491 | } | ||
1492 | |||
1493 | |||
1494 | void Fluxbox::real_rereadMenu() { | ||
1495 | |||
1496 | clearMenuFilenames(); | ||
1497 | |||
1498 | for_each(m_screen_list.begin(), | ||
1499 | m_screen_list.end(), | ||
1500 | mem_fun(&BScreen::rereadMenu)); | ||
1501 | |||
1502 | if(m_show_menu_after_reread) { | ||
1503 | |||
1504 | FbCommands::ShowRootMenuCmd showcmd; | ||
1505 | showcmd.execute(); | ||
1506 | |||
1507 | m_show_menu_after_reread = false; | ||
1508 | } | ||
1509 | } | ||
1510 | |||
1511 | void Fluxbox::saveMenuFilename(const char *filename) { | ||
1512 | if (filename == 0) | ||
1513 | return; | ||
1514 | |||
1515 | bool found = false; | ||
1516 | |||
1517 | list<MenuTimestamp *>::iterator it = m_menu_timestamps.begin(); | ||
1518 | list<MenuTimestamp *>::iterator it_end = m_menu_timestamps.end(); | ||
1519 | for (; it != it_end; ++it) { | ||
1520 | if ((*it)->filename == filename) { | ||
1521 | found = true; | ||
1522 | break; | ||
1523 | } | ||
1524 | } | ||
1525 | |||
1526 | if (! found) { | ||
1527 | time_t timestamp = FbTk::FileUtil::getLastStatusChangeTimestamp(filename); | ||
1528 | |||
1529 | MenuTimestamp *ts = new MenuTimestamp; | ||
1530 | |||
1531 | ts->filename = filename; | ||
1532 | ts->timestamp = timestamp; | ||
1533 | |||
1534 | m_menu_timestamps.push_back(ts); | ||
1535 | } | ||
1536 | } | ||
1537 | |||
1538 | void Fluxbox::clearMenuFilenames() { | ||
1539 | while(!m_menu_timestamps.empty()) { | ||
1540 | delete m_menu_timestamps.back(); | ||
1541 | m_menu_timestamps.pop_back(); | ||
1542 | } | ||
1543 | } | ||
1544 | |||
1545 | void Fluxbox::timed_reconfigure() { | 1470 | void Fluxbox::timed_reconfigure() { |
1546 | if (m_reconfigure_wait) | 1471 | if (m_reconfigure_wait) |
1547 | real_reconfigure(); | 1472 | real_reconfigure(); |
1548 | 1473 | ||
1549 | if (m_reread_menu_wait) | 1474 | m_reconfigure_wait = false; |
1550 | real_rereadMenu(); | ||
1551 | |||
1552 | m_reconfigure_wait = m_reread_menu_wait = false; | ||
1553 | } | 1475 | } |
1554 | 1476 | ||
1555 | void Fluxbox::revertFocus() { | 1477 | void Fluxbox::revertFocus() { |