From 8002a73374e16f2878e4b2d366768f4cadd89ebd Mon Sep 17 00:00:00 2001 From: fluxgen Date: Fri, 19 Dec 2003 00:35:08 +0000 Subject: cleaning --- src/fluxbox.cc | 206 ++++++++++++++------------------------------------------- src/fluxbox.hh | 32 ++++----- 2 files changed, 64 insertions(+), 174 deletions(-) diff --git a/src/fluxbox.cc b/src/fluxbox.cc index 26bf782..d3fd613 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: fluxbox.cc,v 1.207 2003/12/16 23:36:06 fluxgen Exp $ +// $Id: fluxbox.cc,v 1.208 2003/12/19 00:35:08 fluxgen Exp $ #include "fluxbox.hh" @@ -30,12 +30,7 @@ #include "Screen.hh" #include "Window.hh" #include "Workspace.hh" -#include "StringUtil.hh" -#include "Resource.hh" -#include "XrmDatabaseHelper.hh" #include "AtomHandler.hh" -#include "ImageControl.hh" -#include "EventManager.hh" #include "FbCommands.hh" #include "WinClient.hh" #include "Keys.hh" @@ -44,6 +39,11 @@ #include "FbTk/Image.hh" #include "FbTk/KeyUtil.hh" +#include "FbTk/ImageControl.hh" +#include "FbTk/EventManager.hh" +#include "FbTk/StringUtil.hh" +#include "FbTk/Resource.hh" +#include "FbTk/XrmDatabaseHelper.hh" //Use GNU extensions #ifndef _GNU_SOURCE @@ -160,23 +160,7 @@ setFromString(char const *strval) { *this = false; } -template<> -void FbTk::Resource:: -setFromString(char const *strval) { - // auto raise options here for backwards read compatibility - // they are not supported for saving purposes. Nor does the "AutoRaise" - // part actually do anything - if (strcasecmp(strval, "SloppyFocus") == 0 - || strcasecmp(strval, "AutoRaiseSloppyFocus") == 0) - m_value = Fluxbox::SLOPPYFOCUS; - else if (strcasecmp(strval, "SemiSloppyFocus") == 0 - || strcasecmp(strval, "AutoRaiseSemiSloppyFocus") == 0) - m_value = Fluxbox::SEMISLOPPYFOCUS; - else if (strcasecmp(strval, "ClickToFocus") == 0) - m_value = Fluxbox::CLICKTOFOCUS; - else - setDefaultValue(); -} + template<> void FbTk::Resource:: @@ -238,20 +222,6 @@ template<> std::string FbTk::Resource:: getString() { return **this; } -template<> -std::string FbTk::Resource:: -getString() { - switch (m_value) { - case Fluxbox::SLOPPYFOCUS: - return string("SloppyFocus"); - case Fluxbox::SEMISLOPPYFOCUS: - return string("SemiSloppyFocus"); - case Fluxbox::CLICKTOFOCUS: - return string("ClickToFocus"); - } - // default string - return string("ClickToFocus"); -} template<> std::string FbTk::Resource:: @@ -407,6 +377,8 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile m_rc_colors_per_channel(m_resourcemanager, 4, "session.colorsPerChannel", "Session.ColorsPerChannel"), m_rc_numlayers(m_resourcemanager, 13, "session.numLayers", "Session.NumLayers"), + m_rc_double_click_interval(m_resourcemanager, 250, "session.doubleClickInterval", "Session.DoubleClickInterval"), + m_rc_update_delay_time(m_resourcemanager, 0, "session.updateDelayTime", "Session.UpdateDelayTime"), m_rc_stylefile(m_resourcemanager, "", "session.styleFile", "Session.StyleFile"), m_rc_menufile(m_resourcemanager, DEFAULTMENU, "session.menuFile", "Session.MenuFile"), m_rc_keyfile(m_resourcemanager, DEFAULTKEYSFILE, "session.keyFile", "Session.KeyFile"), @@ -511,8 +483,6 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile cerr<<"Warning: cannot set locale modifiers"<isScreenManaged()) { @@ -589,11 +560,6 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile m_reconfigure_wait = m_reread_menu_wait = false; - m_timer.setTimeout(0); - FbTk::RefCount reconf_cmd(new FbTk::SimpleCommand(*this, &Fluxbox::timed_reconfigure)); - m_timer.setCommand(reconf_cmd); - m_timer.fireOnce(true); - // Create keybindings handler and load keys file m_key.reset(new Keys(StringUtil::expandFilename(*m_rc_keyfile).c_str())); @@ -605,7 +571,11 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile cerr<<"--- resource manager lockdepth = "<isRootColormapInstalled()) screen->imageControl().installRootColormap(); - if (screen->getWorkspacemenu()->isVisible()) - screen->getWorkspacemenu()->hide(); - if (screen->getRootmenu()->isVisible()) - screen->getRootmenu()->hide(); + if (screen->getWorkspacemenu().isVisible()) + screen->getWorkspacemenu().hide(); + if (screen->getRootmenu().isVisible()) + screen->getRootmenu().hide(); } else if (be.button == 2) { int mx = be.x_root - - (screen->getWorkspacemenu()->width() / 2); + (screen->getWorkspacemenu().width() / 2); int my = be.y_root - - (screen->getWorkspacemenu()->titleHeight() / 2); + (screen->getWorkspacemenu().titleHeight() / 2); if (mx < 0) mx = 0; if (my < 0) my = 0; - if (mx + screen->getWorkspacemenu()->width() > + if (mx + screen->getWorkspacemenu().width() > screen->width()) { mx = screen->width()-1 - - screen->getWorkspacemenu()->width() - - 2*screen->getWorkspacemenu()->fbwindow().borderWidth(); + screen->getWorkspacemenu().width() - + 2*screen->getWorkspacemenu().fbwindow().borderWidth(); } - if (my + screen->getWorkspacemenu()->height() > + if (my + screen->getWorkspacemenu().height() > screen->height()) { my = screen->height()-1 - - screen->getWorkspacemenu()->height() - - 2*screen->getWorkspacemenu()->fbwindow().borderWidth(); + screen->getWorkspacemenu().height() - + 2*screen->getWorkspacemenu().fbwindow().borderWidth(); } - screen->getWorkspacemenu()->move(mx, my); + screen->getWorkspacemenu().move(mx, my); - if (! screen->getWorkspacemenu()->isVisible()) { - screen->getWorkspacemenu()->removeParent(); - screen->getWorkspacemenu()->show(); + if (! screen->getWorkspacemenu().isVisible()) { + screen->getWorkspacemenu().removeParent(); + screen->getWorkspacemenu().show(); } } else if (be.button == 3) { //calculate placement of root menu //and show/hide it int mx = be.x_root - - (screen->getRootmenu()->width() / 2); + (screen->getRootmenu().width() / 2); int my = be.y_root - - (screen->getRootmenu()->titleHeight() / 2); - int borderw = screen->getRootmenu()->fbwindow().borderWidth(); + (screen->getRootmenu().titleHeight() / 2); + int borderw = screen->getRootmenu().fbwindow().borderWidth(); if (mx < 0) mx = 0; if (my < 0) my = 0; - if (mx + screen->getRootmenu()->width() + 2*borderw > screen->width()) { + if (mx + screen->getRootmenu().width() + 2*borderw > screen->width()) { mx = screen->width() - - screen->getRootmenu()->width() - + screen->getRootmenu().width() - 2*borderw; } - if (my + screen->getRootmenu()->height() + 2*borderw > + if (my + screen->getRootmenu().height() + 2*borderw > screen->height()) { my = screen->height() - - screen->getRootmenu()->height() - + screen->getRootmenu().height() - 2*borderw; } - screen->getRootmenu()->move(mx, my); + screen->getRootmenu().move(mx, my); - if (! screen->getRootmenu()->isVisible()) { + if (! screen->getRootmenu().isVisible()) { checkMenu(); - screen->getRootmenu()->show(); + screen->getRootmenu().show(); } } else if (screen->isDesktopWheeling() && be.button == 4) { screen->nextWorkspace(1); @@ -1539,15 +1509,6 @@ void Fluxbox::save_rc() { } else cerr<<"database filename is invalid!"<size() == 0) - m_rc_menufile.setDefaultValue(); + m_rc_menufile.setDefaultValue(); if (m_rc_slitlistfile->size() != 0) { *m_rc_slitlistfile = StringUtil::expandFilename(*m_rc_slitlistfile); @@ -1683,29 +1640,6 @@ void Fluxbox::load_rc() { else // expand tilde *m_rc_stylefile = StringUtil::expandFilename(*m_rc_stylefile); - //load file - database = XrmGetFileDatabase(dbfile.c_str()); - if (database==0) { - cerr<<"Fluxbox: Cant open "<fbwindow()->setCurrentClient(*next_focus, true, ignore_event))) { setFocusedWindow(0); // so we don't get dangling m_focused_window pointer switch (screen.getFocusModel()) { - case SLOPPYFOCUS: - case SEMISLOPPYFOCUS: + case BScreen::SLOPPYFOCUS: + case BScreen::SEMISLOPPYFOCUS: XSetInputFocus(FbTk::App::instance()->display(), PointerRoot, None, CurrentTime); break; - case CLICKTOFOCUS: - XSetInputFocus(FbTk::App::instance()->display(), - screen.rootWindow().window(), - RevertToPointerRoot, CurrentTime); + case BScreen::CLICKTOFOCUS: + screen.rootWindow().setInputFocus(RevertToPointerRoot, CurrentTime); break; } } diff --git a/src/fluxbox.hh b/src/fluxbox.hh index fe20625..7f1c43f 100644 --- a/src/fluxbox.hh +++ b/src/fluxbox.hh @@ -22,16 +22,16 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: fluxbox.hh,v 1.75 2003/12/03 00:29:39 fluxgen Exp $ +// $Id: fluxbox.hh,v 1.76 2003/12/19 00:35:08 fluxgen Exp $ #ifndef FLUXBOX_HH #define FLUXBOX_HH -#include "App.hh" -#include "Resource.hh" -#include "Timer.hh" -#include "Observer.hh" -#include "SignalHandler.hh" +#include "FbTk/App.hh" +#include "FbTk/Resource.hh" +#include "FbTk/Timer.hh" +#include "FbTk/Observer.hh" +#include "FbTk/SignalHandler.hh" #include #include @@ -97,9 +97,9 @@ public: BScreen *searchScreen(Window w); - inline const Time &getDoubleClickInterval() const { return resource.double_click_interval; } - inline long getUpdateDelayTime() const { return resource.update_delay_time; } - inline const Time &getLastTime() const { return m_last_time; } + inline unsigned int getDoubleClickInterval() const { return *m_rc_double_click_interval; } + inline unsigned int getUpdateDelayTime() const { return *m_rc_update_delay_time; } + inline unsigned int getLastTime() const { return m_last_time; } void addAtomHandler(AtomHandler *atomh); void removeAtomHandler(AtomHandler *atomh); @@ -107,7 +107,7 @@ public: /// obsolete enum Titlebar{SHADE=0, MINIMIZE, MAXIMIZE, CLOSE, STICK, MENU, EMPTY}; - enum FocusModel { SLOPPYFOCUS=0, SEMISLOPPYFOCUS, CLICKTOFOCUS }; + inline const Bool getIgnoreBorder() const { return *m_rc_ignoreborder; } @@ -188,7 +188,6 @@ public: void timed_reconfigure(); bool isStartup() const { return m_starting; } - enum { B_AMERICANDATE = 1, B_EUROPEANDATE }; typedef std::vector TitlebarList; /// @return whether the timestamps on the menu changed @@ -225,11 +224,7 @@ private: time_t timestamp; } MenuTimestamp; - struct resource { - Time double_click_interval; - long update_delay_time; - } resource; - + std::string getRcFilename(); void load_rc(); @@ -252,8 +247,10 @@ private: FbTk::ResourceManager m_resourcemanager, &m_screen_rm; //--- Resources + FbTk::Resource m_rc_tabs, m_rc_ignoreborder; - FbTk::Resource m_rc_colors_per_channel, m_rc_numlayers; + FbTk::Resource m_rc_colors_per_channel, m_rc_numlayers, + m_rc_double_click_interval, m_rc_update_delay_time; FbTk::Resource m_rc_stylefile, m_rc_menufile, m_rc_keyfile, m_rc_slitlistfile, m_rc_groupfile; @@ -278,7 +275,6 @@ private: ScreenList m_screen_list; WinClient *m_focused_window; - FbTk::Timer m_timer; typedef struct RedirectEvent { BScreen *screen; -- cgit v0.11.2