aboutsummaryrefslogtreecommitdiff
path: root/src/fluxbox.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/fluxbox.cc')
-rw-r--r--src/fluxbox.cc65
1 files changed, 30 insertions, 35 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 @@
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.65 2002/08/11 20:38:23 fluxgen Exp $ 25// $Id: fluxbox.cc,v 1.66 2002/08/13 21:19:00 fluxgen Exp $
26 26
27//Use GNU extensions 27#include "fluxbox.hh"
28#ifndef _GNU_SOURCE
29#define _GNU_SOURCE
30#endif // _GNU_SOURCE
31
32#ifdef HAVE_CONFIG_H
33# include "../config.h"
34#endif // HAVE_CONFIG_H
35 28
36#include "i18n.hh" 29#include "i18n.hh"
37#include "fluxbox.hh"
38#include "Basemenu.hh" 30#include "Basemenu.hh"
39#include "Clientmenu.hh" 31#include "Clientmenu.hh"
40#include "Rootmenu.hh" 32#include "Rootmenu.hh"
41#include "Screen.hh" 33#include "Screen.hh"
42
43#ifdef SLIT
44#include "Slit.hh"
45#endif // SLIT
46
47#include "Toolbar.hh" 34#include "Toolbar.hh"
48#include "Window.hh" 35#include "Window.hh"
49#include "Workspace.hh" 36#include "Workspace.hh"
@@ -52,6 +39,19 @@
52#include "Resource.hh" 39#include "Resource.hh"
53#include "XrmDatabaseHelper.hh" 40#include "XrmDatabaseHelper.hh"
54 41
42#ifdef SLIT
43#include "Slit.hh"
44#endif // SLIT
45
46//Use GNU extensions
47#ifndef _GNU_SOURCE
48#define _GNU_SOURCE
49#endif // _GNU_SOURCE
50
51#ifdef HAVE_CONFIG_H
52#include "../config.h"
53#endif // HAVE_CONFIG_H
54
55#include <X11/Xlib.h> 55#include <X11/Xlib.h>
56#include <X11/Xutil.h> 56#include <X11/Xutil.h>
57#include <X11/Xresource.h> 57#include <X11/Xresource.h>
@@ -63,11 +63,8 @@
63#endif // SHAPE 63#endif // SHAPE
64 64
65#include <cstdio> 65#include <cstdio>
66 66#include <cstdlib>
67#ifdef STDC_HEADERS 67#include <cstring>
68#include <stdlib.h>
69#include <string.h>
70#endif // STDC_HEADERS
71 68
72#ifdef HAVE_UNISTD_H 69#ifdef HAVE_UNISTD_H
73#include <sys/types.h> 70#include <sys/types.h>
@@ -284,19 +281,12 @@ getString() {
284//static singleton var 281//static singleton var
285Fluxbox *Fluxbox::singleton=0; 282Fluxbox *Fluxbox::singleton=0;
286 283
287//------------ instance ---------------------
288//returns singleton object of Fluxbox class
289//since we only need to create one instance of Fluxbox
290//-------------------------------------------
291Fluxbox *Fluxbox::instance(int m_argc, char **m_argv, char *dpy_name, char *rc) {
292 return singleton;
293}
294//default values for titlebar left and right 284//default values for titlebar left and right
295//don't forget to change last value in m_rc_titlebar_* if you add more to these 285//don't forget to change last value in m_rc_titlebar_* if you add more to these
296Fluxbox::Titlebar Fluxbox::m_titlebar_left[] = {STICK}; 286Fluxbox::Titlebar Fluxbox::m_titlebar_left[] = {STICK};
297Fluxbox::Titlebar Fluxbox::m_titlebar_right[] = {MINIMIZE, MAXIMIZE, CLOSE}; 287Fluxbox::Titlebar Fluxbox::m_titlebar_right[] = {MINIMIZE, MAXIMIZE, CLOSE};
298 288
299Fluxbox::Fluxbox(int m_argc, char **m_argv, char *dpy_name, char *rc) 289Fluxbox::Fluxbox(int m_argc, char **m_argv, const char *dpy_name, const char *rc)
300: BaseDisplay(m_argv[0], dpy_name), 290: BaseDisplay(m_argv[0], dpy_name),
301m_resourcemanager(), m_screen_rm(), 291m_resourcemanager(), m_screen_rm(),
302m_rc_tabs(m_resourcemanager, true, "session.tabs", "Session.Tabs"), 292m_rc_tabs(m_resourcemanager, true, "session.tabs", "Session.Tabs"),
@@ -314,11 +304,16 @@ m_rc_cache_max(m_resourcemanager, 200, "session.cacheMax", "Session.CacheMax"),
314focused_window(0), masked_window(0), 304focused_window(0), masked_window(0),
315timer(this), 305timer(this),
316no_focus(false), 306no_focus(false),
317rc_file(rc), 307rc_file(rc ? rc : ""),
318argv(m_argv), argc(m_argc), 308argv(m_argv), argc(m_argc),
319key(0) 309key(0)
320{ 310{
321 311
312 if (singleton != 0) {
313 cerr<<"Fatal! There can only one instance of fluxbox class."<<endl;
314 abort();
315 }
316
322 //singleton pointer 317 //singleton pointer
323 singleton = this; 318 singleton = this;
324 BaseDisplay::GrabGuard gg(*this); 319 BaseDisplay::GrabGuard gg(*this);
@@ -1911,9 +1906,9 @@ void Fluxbox::save_rc(void) {
1911 XrmMergeDatabases(new_blackboxrc, &old_blackboxrc); //merge database together 1906 XrmMergeDatabases(new_blackboxrc, &old_blackboxrc); //merge database together
1912 XrmPutFileDatabase(old_blackboxrc, dbfile.get()); 1907 XrmPutFileDatabase(old_blackboxrc, dbfile.get());
1913 XrmDestroyDatabase(old_blackboxrc); 1908 XrmDestroyDatabase(old_blackboxrc);
1914 #ifdef DEBUG 1909#ifdef DEBUG
1915 cerr<<__FILE__<<"("<<__LINE__<<"): ------------ SAVING DONE"<<endl; 1910 cerr<<__FILE__<<"("<<__LINE__<<"): ------------ SAVING DONE"<<endl;
1916 #endif 1911#endif // DEBUG
1917} 1912}
1918 1913
1919//-------- getRcFilename ------------- 1914//-------- getRcFilename -------------
@@ -1922,12 +1917,12 @@ void Fluxbox::save_rc(void) {
1922char *Fluxbox::getRcFilename() { 1917char *Fluxbox::getRcFilename() {
1923 char *dbfile=0; 1918 char *dbfile=0;
1924 1919
1925 if (!rc_file) { 1920 if (rc_file.size() == 0) {
1926 string str(getenv("HOME")+string("/.")+RC_PATH+string("/")+RC_INIT_FILE); 1921 string str(getenv("HOME")+string("/.")+RC_PATH+string("/")+RC_INIT_FILE);
1927 return StringUtil::strdup(str.c_str()); 1922 return StringUtil::strdup(str.c_str());
1928 1923
1929 } else 1924 } else
1930 dbfile = StringUtil::strdup(rc_file); 1925 dbfile = StringUtil::strdup(rc_file.c_str());
1931 1926
1932 return dbfile; 1927 return dbfile;
1933} 1928}
@@ -2473,7 +2468,7 @@ void Fluxbox::setFocusedWindow(FluxboxWindow *win) {
2473 old_wkspc->menu()->setItemSelected(old_win->getWindowNumber(), false); 2468 old_wkspc->menu()->setItemSelected(old_win->getWindowNumber(), false);
2474 2469
2475 } 2470 }
2476 2471
2477 if (win && ! win->isIconic()) { 2472 if (win && ! win->isIconic()) {
2478 // make sure we have a valid win pointer with a valid screen 2473 // make sure we have a valid win pointer with a valid screen
2479 ScreenList::iterator winscreen = 2474 ScreenList::iterator winscreen =
@@ -2491,7 +2486,7 @@ void Fluxbox::setFocusedWindow(FluxboxWindow *win) {
2491 wkspc->menu()->setItemSelected(win->getWindowNumber(), true); 2486 wkspc->menu()->setItemSelected(win->getWindowNumber(), true);
2492 } 2487 }
2493 } else 2488 } else
2494 focused_window = (FluxboxWindow *) 0; 2489 focused_window = 0;
2495 2490
2496 if (tbar != 0) 2491 if (tbar != 0)
2497 tbar->redrawWindowLabel(True); 2492 tbar->redrawWindowLabel(True);