diff options
author | fluxgen <fluxgen> | 2003-08-11 16:06:51 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-08-11 16:06:51 (GMT) |
commit | e9e60037b0ea3c9824b7bd59d1725095aeb292e7 (patch) | |
tree | 134b5f6116fe2071efcdfe780e9c25ab65d989d9 /src/fluxbox.cc | |
parent | f35a4840ef66051deab9ce0e53ed24507a306f0d (diff) | |
download | fluxbox-e9e60037b0ea3c9824b7bd59d1725095aeb292e7.zip fluxbox-e9e60037b0ea3c9824b7bd59d1725095aeb292e7.tar.bz2 |
fixed minor focus bug and updated to use timer command
Diffstat (limited to 'src/fluxbox.cc')
-rw-r--r-- | src/fluxbox.cc | 81 |
1 files changed, 21 insertions, 60 deletions
diff --git a/src/fluxbox.cc b/src/fluxbox.cc index f910e7b..d6ece65 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: fluxbox.cc,v 1.179 2003/08/10 12:50:04 rathnor Exp $ | 25 | // $Id: fluxbox.cc,v 1.180 2003/08/11 16:06:51 fluxgen Exp $ |
26 | 26 | ||
27 | #include "fluxbox.hh" | 27 | #include "fluxbox.hh" |
28 | 28 | ||
@@ -410,7 +410,6 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile | |||
410 | m_rc_cache_life(m_resourcemanager, 5, "session.cacheLife", "Session.CacheLife"), | 410 | m_rc_cache_life(m_resourcemanager, 5, "session.cacheLife", "Session.CacheLife"), |
411 | m_rc_cache_max(m_resourcemanager, 200, "session.cacheMax", "Session.CacheMax"), | 411 | m_rc_cache_max(m_resourcemanager, 200, "session.cacheMax", "Session.CacheMax"), |
412 | m_focused_window(0), m_masked_window(0), | 412 | m_focused_window(0), m_masked_window(0), |
413 | m_timer(this), | ||
414 | m_mousescreen(0), | 413 | m_mousescreen(0), |
415 | m_keyscreen(0), | 414 | m_keyscreen(0), |
416 | m_watching_screen(0), m_watch_keyrelease(0), | 415 | m_watching_screen(0), m_watch_keyrelease(0), |
@@ -472,6 +471,8 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile | |||
472 | #endif // HAVE_RANDR | 471 | #endif // HAVE_RANDR |
473 | 472 | ||
474 | load_rc(); | 473 | load_rc(); |
474 | // setup theme manager to have our style file ready to be scanned | ||
475 | FbTk::ThemeManager::instance().load(getStyleFilename()); | ||
475 | 476 | ||
476 | // setup atom handlers before we create any windows | 477 | // setup atom handlers before we create any windows |
477 | #ifdef USE_GNOME | 478 | #ifdef USE_GNOME |
@@ -541,7 +542,7 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile | |||
541 | #ifdef USE_TOOLBAR | 542 | #ifdef USE_TOOLBAR |
542 | m_atomhandler.push_back(new ToolbarHandler(*screen)); | 543 | m_atomhandler.push_back(new ToolbarHandler(*screen)); |
543 | #endif // USE_TOOLBAR | 544 | #endif // USE_TOOLBAR |
544 | 545 | ||
545 | // attach screen signals to this | 546 | // attach screen signals to this |
546 | screen->currentWorkspaceSig().attach(this); | 547 | screen->currentWorkspaceSig().attach(this); |
547 | screen->workspaceCountSig().attach(this); | 548 | screen->workspaceCountSig().attach(this); |
@@ -552,6 +553,7 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile | |||
552 | for (size_t atomh=0; atomh<m_atomhandler.size(); ++atomh) { | 553 | for (size_t atomh=0; atomh<m_atomhandler.size(); ++atomh) { |
553 | m_atomhandler[atomh]->initForScreen(*screen); | 554 | m_atomhandler[atomh]->initForScreen(*screen); |
554 | } | 555 | } |
556 | |||
555 | } | 557 | } |
556 | m_keyscreen = m_mousescreen = m_screen_list.front(); | 558 | m_keyscreen = m_mousescreen = m_screen_list.front(); |
557 | 559 | ||
@@ -561,12 +563,15 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile | |||
561 | "Make sure you don't have another window manager running."); | 563 | "Make sure you don't have another window manager running."); |
562 | } | 564 | } |
563 | 565 | ||
566 | |||
564 | XSynchronize(disp, False); | 567 | XSynchronize(disp, False); |
565 | XSync(disp, False); | 568 | XSync(disp, False); |
566 | 569 | ||
567 | m_reconfigure_wait = m_reread_menu_wait = false; | 570 | m_reconfigure_wait = m_reread_menu_wait = false; |
568 | 571 | ||
569 | m_timer.setTimeout(0); | 572 | m_timer.setTimeout(0); |
573 | FbTk::RefCount<FbTk::Command> reconf_cmd(new FbTk::SimpleCommand<Fluxbox>(*this, &Fluxbox::timed_reconfigure)); | ||
574 | m_timer.setCommand(reconf_cmd); | ||
570 | m_timer.fireOnce(true); | 575 | m_timer.fireOnce(true); |
571 | 576 | ||
572 | // Create keybindings handler and load keys file | 577 | // Create keybindings handler and load keys file |
@@ -895,7 +900,7 @@ void Fluxbox::handleEvent(XEvent * const e) { | |||
895 | break; | 900 | break; |
896 | 901 | ||
897 | WinClient *winclient = searchWindow(e->xfocus.window); | 902 | WinClient *winclient = searchWindow(e->xfocus.window); |
898 | if (winclient && !(m_focused_window == winclient)) | 903 | if (winclient && m_focused_window != winclient) |
899 | setFocusedWindow(winclient); | 904 | setFocusedWindow(winclient); |
900 | 905 | ||
901 | } break; | 906 | } break; |
@@ -910,6 +915,8 @@ void Fluxbox::handleEvent(XEvent * const e) { | |||
910 | cerr<<__FILE__<<"("<<__FUNCTION__<<") Focus out is not a FluxboxWindow !!"<<endl; | 915 | cerr<<__FILE__<<"("<<__FUNCTION__<<") Focus out is not a FluxboxWindow !!"<<endl; |
911 | #endif // DEBUG | 916 | #endif // DEBUG |
912 | 917 | ||
918 | } else { | ||
919 | |||
913 | } | 920 | } |
914 | } | 921 | } |
915 | break; | 922 | break; |
@@ -1284,7 +1291,9 @@ void Fluxbox::update(FbTk::Subject *changedsub) { | |||
1284 | // make sure each workspace get this | 1291 | // make sure each workspace get this |
1285 | BScreen &scr = win.screen(); | 1292 | BScreen &scr = win.screen(); |
1286 | scr.removeWindow(&win); | 1293 | scr.removeWindow(&win); |
1287 | 1294 | if (m_focused_window == &win.winClient()) | |
1295 | m_focused_window = 0; | ||
1296 | |||
1288 | } else if ((&(win.workspaceSig())) == changedsub) { // workspace signal | 1297 | } else if ((&(win.workspaceSig())) == changedsub) { // workspace signal |
1289 | for (size_t i=0; i<m_atomhandler.size(); ++i) { | 1298 | for (size_t i=0; i<m_atomhandler.size(); ++i) { |
1290 | if (m_atomhandler[i]->update()) | 1299 | if (m_atomhandler[i]->update()) |
@@ -1321,6 +1330,7 @@ void Fluxbox::update(FbTk::Subject *changedsub) { | |||
1321 | } | 1330 | } |
1322 | } | 1331 | } |
1323 | } else if (typeid(*changedsub) == typeid(WinClient::WinClientSubj)) { | 1332 | } else if (typeid(*changedsub) == typeid(WinClient::WinClientSubj)) { |
1333 | |||
1324 | WinClient::WinClientSubj *subj = dynamic_cast<WinClient::WinClientSubj *>(changedsub); | 1334 | WinClient::WinClientSubj *subj = dynamic_cast<WinClient::WinClientSubj *>(changedsub); |
1325 | WinClient &client = subj->winClient(); | 1335 | WinClient &client = subj->winClient(); |
1326 | 1336 | ||
@@ -1337,7 +1347,10 @@ void Fluxbox::update(FbTk::Subject *changedsub) { | |||
1337 | if (m_focused_window == &client) | 1347 | if (m_focused_window == &client) |
1338 | revertFocus(screen); | 1348 | revertFocus(screen); |
1339 | 1349 | ||
1340 | removeWindowSearch(client.window()); | 1350 | removeWindowSearch(client.window()); |
1351 | // failed to revert focus? | ||
1352 | if (m_focused_window == &client) | ||
1353 | m_focused_window = 0; | ||
1341 | } | 1354 | } |
1342 | } | 1355 | } |
1343 | 1356 | ||
@@ -1540,27 +1553,12 @@ void Fluxbox::save_rc() { | |||
1540 | placement.c_str()); | 1553 | placement.c_str()); |
1541 | XrmPutLineResource(&new_blackboxrc, rc_string); | 1554 | XrmPutLineResource(&new_blackboxrc, rc_string); |
1542 | 1555 | ||
1543 | // load_rc(screen); | 1556 | |
1544 | // these are static, but may not be saved in the users resource file, | 1557 | // these are static, but may not be saved in the users resource file, |
1545 | // writing these resources will allow the user to edit them at a later | 1558 | // writing these resources will allow the user to edit them at a later |
1546 | // time... but loading the defaults before saving allows us to rewrite the | 1559 | // time... but loading the defaults before saving allows us to rewrite the |
1547 | // users changes... | 1560 | // users changes... |
1548 | 1561 | ||
1549 | #ifdef HAVE_STRFTIME | ||
1550 | sprintf(rc_string, "session.screen%d.strftimeFormat: %s", screen_number, | ||
1551 | screen->getStrftimeFormat()); | ||
1552 | XrmPutLineResource(&new_blackboxrc, rc_string); | ||
1553 | #else // !HAVE_STRFTIME | ||
1554 | sprintf(rc_string, "session.screen%d.dateFormat: %s", screen_number, | ||
1555 | ((screen->getDateFormat() == B_EUROPEANDATE) ? | ||
1556 | "European" : "American")); | ||
1557 | XrmPutLineResource(&new_blackboxrc, rc_string); | ||
1558 | |||
1559 | sprintf(rc_string, "session.screen%d.clockFormat: %d", screen_number, | ||
1560 | ((screen->isClock24Hour()) ? 24 : 12)); | ||
1561 | XrmPutLineResource(&new_blackboxrc, rc_string); | ||
1562 | #endif // HAVE_STRFTIME | ||
1563 | |||
1564 | // write out the users workspace names | 1562 | // write out the users workspace names |
1565 | sprintf(rc_string, "session.screen%d.workspaceNames: ", screen_number); | 1563 | sprintf(rc_string, "session.screen%d.workspaceNames: ", screen_number); |
1566 | string workspaces_string(rc_string); | 1564 | string workspaces_string(rc_string); |
@@ -1774,42 +1772,6 @@ void Fluxbox::load_rc(BScreen &screen) { | |||
1774 | } else | 1772 | } else |
1775 | screen.savePlacementPolicy(BScreen::ROWSMARTPLACEMENT); | 1773 | screen.savePlacementPolicy(BScreen::ROWSMARTPLACEMENT); |
1776 | 1774 | ||
1777 | #ifdef HAVE_STRFTIME | ||
1778 | sprintf(name_lookup, "session.screen%d.strftimeFormat", screen_number); | ||
1779 | sprintf(class_lookup, "Session.Screen%d.StrftimeFormat", screen_number); | ||
1780 | if (XrmGetResource(*database, name_lookup, class_lookup, &value_type, | ||
1781 | &value)) | ||
1782 | screen.saveStrftimeFormat(value.addr); | ||
1783 | else | ||
1784 | screen.saveStrftimeFormat("%I:%M %p"); | ||
1785 | #else // HAVE_STRFTIME | ||
1786 | |||
1787 | sprintf(name_lookup, "session.screen%d.dateFormat", screen_number); | ||
1788 | sprintf(class_lookup, "Session.Screen%d.DateFormat", screen_number); | ||
1789 | if (XrmGetResource(*database, name_lookup, class_lookup, &value_type, | ||
1790 | &value)) { | ||
1791 | if (strncasecmp(value.addr, "european", value.size)) | ||
1792 | screen.saveDateFormat(B_AMERICANDATE); | ||
1793 | else | ||
1794 | screen.saveDateFormat(B_EUROPEANDATE); | ||
1795 | } else | ||
1796 | screen.saveDateFormat(B_AMERICANDATE); | ||
1797 | |||
1798 | sprintf(name_lookup, "session.screen%d.clockFormat", screen_number); | ||
1799 | sprintf(class_lookup, "Session.Screen%d.ClockFormat", screen_number); | ||
1800 | if (XrmGetResource(*database, name_lookup, class_lookup, &value_type, | ||
1801 | &value)) { | ||
1802 | int clock; | ||
1803 | if (sscanf(value.addr, "%d", &clock) != 1) | ||
1804 | screen.saveClock24Hour(false); | ||
1805 | else if (clock == 24) | ||
1806 | screen.saveClock24Hour(true); | ||
1807 | else | ||
1808 | screen.saveClock24Hour(false); | ||
1809 | } else | ||
1810 | screen.saveClock24Hour(false); | ||
1811 | #endif // HAVE_STRFTIME | ||
1812 | |||
1813 | } | 1775 | } |
1814 | 1776 | ||
1815 | void Fluxbox::loadRootCommand(BScreen &screen) { | 1777 | void Fluxbox::loadRootCommand(BScreen &screen) { |
@@ -1859,7 +1821,6 @@ void Fluxbox::real_reconfigure() { | |||
1859 | if (old_blackboxrc) | 1821 | if (old_blackboxrc) |
1860 | XrmDestroyDatabase(old_blackboxrc); | 1822 | XrmDestroyDatabase(old_blackboxrc); |
1861 | 1823 | ||
1862 | |||
1863 | ScreenList::iterator sit = m_screen_list.begin(); | 1824 | ScreenList::iterator sit = m_screen_list.begin(); |
1864 | ScreenList::iterator sit_end = m_screen_list.end(); | 1825 | ScreenList::iterator sit_end = m_screen_list.end(); |
1865 | for (; sit != sit_end; ++sit) | 1826 | for (; sit != sit_end; ++sit) |
@@ -1956,7 +1917,7 @@ void Fluxbox::clearMenuFilenames() { | |||
1956 | m_menu_timestamps.erase(m_menu_timestamps.begin(), m_menu_timestamps.end()); | 1917 | m_menu_timestamps.erase(m_menu_timestamps.begin(), m_menu_timestamps.end()); |
1957 | } | 1918 | } |
1958 | 1919 | ||
1959 | void Fluxbox::timeout() { | 1920 | void Fluxbox::timed_reconfigure() { |
1960 | if (m_reconfigure_wait) | 1921 | if (m_reconfigure_wait) |
1961 | real_reconfigure(); | 1922 | real_reconfigure(); |
1962 | 1923 | ||