From e7f5d341bc713762caceb3e3a570306df94629e5 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Tue, 13 Aug 2002 21:19:00 +0000 Subject: removed friend main --- src/fluxbox.cc | 65 +++++++++++++++++++++++++++------------------------------- src/fluxbox.hh | 23 +++++++++------------ 2 files changed, 40 insertions(+), 48 deletions(-) diff --git a/src/fluxbox.cc b/src/fluxbox.cc index 8d2d57c..c45c340 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc @@ -22,28 +22,15 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: fluxbox.cc,v 1.65 2002/08/11 20:38:23 fluxgen Exp $ +// $Id: fluxbox.cc,v 1.66 2002/08/13 21:19:00 fluxgen Exp $ -//Use GNU extensions -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif // _GNU_SOURCE - -#ifdef HAVE_CONFIG_H -# include "../config.h" -#endif // HAVE_CONFIG_H +#include "fluxbox.hh" #include "i18n.hh" -#include "fluxbox.hh" #include "Basemenu.hh" #include "Clientmenu.hh" #include "Rootmenu.hh" #include "Screen.hh" - -#ifdef SLIT -#include "Slit.hh" -#endif // SLIT - #include "Toolbar.hh" #include "Window.hh" #include "Workspace.hh" @@ -52,6 +39,19 @@ #include "Resource.hh" #include "XrmDatabaseHelper.hh" +#ifdef SLIT +#include "Slit.hh" +#endif // SLIT + +//Use GNU extensions +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif // _GNU_SOURCE + +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif // HAVE_CONFIG_H + #include #include #include @@ -63,11 +63,8 @@ #endif // SHAPE #include - -#ifdef STDC_HEADERS -#include -#include -#endif // STDC_HEADERS +#include +#include #ifdef HAVE_UNISTD_H #include @@ -284,19 +281,12 @@ getString() { //static singleton var Fluxbox *Fluxbox::singleton=0; -//------------ instance --------------------- -//returns singleton object of Fluxbox class -//since we only need to create one instance of Fluxbox -//------------------------------------------- -Fluxbox *Fluxbox::instance(int m_argc, char **m_argv, char *dpy_name, char *rc) { - return singleton; -} //default values for titlebar left and right //don't forget to change last value in m_rc_titlebar_* if you add more to these Fluxbox::Titlebar Fluxbox::m_titlebar_left[] = {STICK}; Fluxbox::Titlebar Fluxbox::m_titlebar_right[] = {MINIMIZE, MAXIMIZE, CLOSE}; -Fluxbox::Fluxbox(int m_argc, char **m_argv, char *dpy_name, char *rc) +Fluxbox::Fluxbox(int m_argc, char **m_argv, const char *dpy_name, const char *rc) : BaseDisplay(m_argv[0], dpy_name), m_resourcemanager(), m_screen_rm(), m_rc_tabs(m_resourcemanager, true, "session.tabs", "Session.Tabs"), @@ -314,11 +304,16 @@ m_rc_cache_max(m_resourcemanager, 200, "session.cacheMax", "Session.CacheMax"), focused_window(0), masked_window(0), timer(this), no_focus(false), -rc_file(rc), +rc_file(rc ? rc : ""), argv(m_argv), argc(m_argc), key(0) { + if (singleton != 0) { + cerr<<"Fatal! There can only one instance of fluxbox class."<menu()->setItemSelected(old_win->getWindowNumber(), false); } - + if (win && ! win->isIconic()) { // make sure we have a valid win pointer with a valid screen ScreenList::iterator winscreen = @@ -2491,7 +2486,7 @@ void Fluxbox::setFocusedWindow(FluxboxWindow *win) { wkspc->menu()->setItemSelected(win->getWindowNumber(), true); } } else - focused_window = (FluxboxWindow *) 0; + focused_window = 0; if (tbar != 0) tbar->redrawWindowLabel(True); diff --git a/src/fluxbox.hh b/src/fluxbox.hh index ecc9e0f..a8de98c 100644 --- a/src/fluxbox.hh +++ b/src/fluxbox.hh @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: fluxbox.hh,v 1.23 2002/08/11 20:36:43 fluxgen Exp $ +// $Id: fluxbox.hh,v 1.24 2002/08/13 21:18:17 fluxgen Exp $ #ifndef FLUXBOX_HH #define FLUXBOX_HH @@ -69,20 +69,21 @@ */ class Fluxbox : public BaseDisplay, public TimeoutHandler { public: + Fluxbox(int argc, char **argv, const char * dpy_name= 0, const char *rc = 0); + virtual ~Fluxbox(); - - static Fluxbox *instance(int m_argc=0, char **m_argv=0, char *dpy_name=0, char *rc=0); + static Fluxbox *instance() { return singleton; } inline bool useTabs() { return *m_rc_tabs; } inline bool useIconBar() { return *m_rc_iconbar; } inline void saveTabs(bool value) { *m_rc_tabs = value; } inline void saveIconBar(bool value) { m_rc_iconbar = value; } #ifdef HAVE_GETPID - inline const Atom &getFluxboxPidAtom() const { return fluxbox_pid; } + inline Atom getFluxboxPidAtom() const { return fluxbox_pid; } #ifdef KDE //For KDE dock applets - inline const Atom &getKWM1DockwindowAtom() const { return kwm1_dockwindow; } //KDE v1.x - inline const Atom &getKWM2DockwindowAtom() const { return kwm2_dockwindow; } //KDE v2.x + inline Atom getKWM1DockwindowAtom() const { return kwm1_dockwindow; } //KDE v1.x + inline Atom getKWM2DockwindowAtom() const { return kwm2_dockwindow; } //KDE v2.x #endif #endif // HAVE_GETPID @@ -232,7 +233,8 @@ private: bool no_focus, reconfigure_wait, reread_menu_wait; Time last_time; Window masked; - char *rc_file, **argv; + std::string rc_file; ///< resource filename + char **argv; int argc; Keys *key; std::string slitlist_path; @@ -240,7 +242,6 @@ private: static Fluxbox::Titlebar m_titlebar_left[], m_titlebar_right[]; protected: - Fluxbox(int, char **, char * = 0, char * = 0); char *getRcFilename(); void getDefaultDataFilename(char *, std::string &); void load_rc(); @@ -250,11 +251,7 @@ protected: void real_reconfigure(); virtual void process_event(XEvent *); - //only main should be able to creat new blackbox object - //TODO this must be removed! - friend int main(int,char **); - static Fluxbox *singleton; //singleton object ( can only be destroyed by main ) - virtual ~Fluxbox(); + static Fluxbox *singleton; }; -- cgit v0.11.2