removed friend main

This commit is contained in:
fluxgen 2002-08-13 21:19:00 +00:00
parent 7b02be7b19
commit e7f5d341bc
2 changed files with 40 additions and 48 deletions

View file

@ -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 <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xresource.h>
@ -63,11 +63,8 @@
#endif // SHAPE
#include <cstdio>
#ifdef STDC_HEADERS
#include <stdlib.h>
#include <string.h>
#endif // STDC_HEADERS
#include <cstdlib>
#include <cstring>
#ifdef HAVE_UNISTD_H
#include <sys/types.h>
@ -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."<<endl;
abort();
}
//singleton pointer
singleton = this;
BaseDisplay::GrabGuard gg(*this);
@ -1911,9 +1906,9 @@ void Fluxbox::save_rc(void) {
XrmMergeDatabases(new_blackboxrc, &old_blackboxrc); //merge database together
XrmPutFileDatabase(old_blackboxrc, dbfile.get());
XrmDestroyDatabase(old_blackboxrc);
#ifdef DEBUG
#ifdef DEBUG
cerr<<__FILE__<<"("<<__LINE__<<"): ------------ SAVING DONE"<<endl;
#endif
#endif // DEBUG
}
//-------- getRcFilename -------------
@ -1922,12 +1917,12 @@ void Fluxbox::save_rc(void) {
char *Fluxbox::getRcFilename() {
char *dbfile=0;
if (!rc_file) {
if (rc_file.size() == 0) {
string str(getenv("HOME")+string("/.")+RC_PATH+string("/")+RC_INIT_FILE);
return StringUtil::strdup(str.c_str());
} else
dbfile = StringUtil::strdup(rc_file);
dbfile = StringUtil::strdup(rc_file.c_str());
return dbfile;
}
@ -2473,7 +2468,7 @@ void Fluxbox::setFocusedWindow(FluxboxWindow *win) {
old_wkspc->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);

View file

@ -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;
};