aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-01-08 00:29:12 (GMT)
committerfluxgen <fluxgen>2002-01-08 00:29:12 (GMT)
commit6b6c41f1f1f835369b0e3ad896f09edbb5610341 (patch)
treec5c8581e60d8c892f8674acf9eca7dd15757ff28
parent351330461f25a138928e970938c9eb4326b5db7c (diff)
downloadfluxbox-6b6c41f1f1f835369b0e3ad896f09edbb5610341.zip
fluxbox-6b6c41f1f1f835369b0e3ad896f09edbb5610341.tar.bz2
replaced char [] with strstream and updated keys creation
-rw-r--r--src/fluxbox.cc24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index 60faf2a..6369212 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -1,6 +1,6 @@
1// fluxbox.cc for Fluxbox. 1// fluxbox.cc for Fluxbox.
2// Copyright (c) 2001 Henrik Kinnunen (fluxgen@linuxmail.org) 2// Copyright (c) 2001 Henrik Kinnunen (fluxgen@linuxmail.org)
3 3//
4// blackbox.cc for blackbox - an X11 Window manager 4// blackbox.cc for blackbox - an X11 Window manager
5// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) 5// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
6// 6//
@@ -116,6 +116,8 @@
116 116
117#include <iostream> 117#include <iostream>
118#include <string> 118#include <string>
119#include <strstream>
120using namespace std;
119 121
120#ifndef HAVE_BASENAME 122#ifndef HAVE_BASENAME
121static inline char *basename (char *); 123static inline char *basename (char *);
@@ -131,7 +133,7 @@ static inline char *basename (char *s) {
131#define RC_PATH "fluxbox" 133#define RC_PATH "fluxbox"
132#define RC_INIT_FILE "init" 134#define RC_INIT_FILE "init"
133 135
134using namespace std; 136
135// X event scanner for enter/leave notifies - adapted from twm 137// X event scanner for enter/leave notifies - adapted from twm
136typedef struct scanargs { 138typedef struct scanargs {
137 Window w; 139 Window w;
@@ -165,7 +167,7 @@ Fluxbox *Fluxbox::instance(int m_argc, char **m_argv, char *dpy_name, char *rc)
165 167
166 168
167Fluxbox::Fluxbox(int m_argc, char **m_argv, char *dpy_name, char *rc) 169Fluxbox::Fluxbox(int m_argc, char **m_argv, char *dpy_name, char *rc)
168 : BaseDisplay(m_argv[0], dpy_name) 170: BaseDisplay(m_argv[0], dpy_name)
169{ 171{
170 172
171 //singleton pointer 173 //singleton pointer
@@ -262,7 +264,7 @@ Fluxbox::Fluxbox(int m_argc, char **m_argv, char *dpy_name, char *rc)
262 timer->fireOnce(True); 264 timer->fireOnce(True);
263 265
264 //create keybindings handler and load keys file 266 //create keybindings handler and load keys file
265 key = new Keys(resource.keys_file); 267 key = new Keys(getXDisplay(), resource.keys_file);
266 268
267 ungrab(); 269 ungrab();
268} 270}
@@ -1689,17 +1691,17 @@ void Fluxbox::save_rc(void) {
1689 delete [] dbfile; 1691 delete [] dbfile;
1690} 1692}
1691 1693
1692//getRcFilename 1694//-------- getRcFilename -------------
1693//returns filename of resource file 1695// Returns filename of resource file
1696//------------------------------------
1694char *Fluxbox::getRcFilename() { 1697char *Fluxbox::getRcFilename() {
1695 char *dbfile=0; 1698 char *dbfile=0;
1696 1699
1697 if (!rc_file) { 1700 if (!rc_file) {
1698 char *homedir = getenv("HOME"); 1701 strstream str;
1699 const int dbfile_size = strlen(homedir) + strlen("/.") +strlen(RC_PATH) + strlen(RC_INIT_FILE) + 24; 1702 str<<getenv("HOME")<<"/."<<RC_PATH<<"/"<<RC_INIT_FILE;
1700 dbfile = new char[dbfile_size]; 1703
1701 snprintf(dbfile, dbfile_size, "%s/.%s/%s", homedir, RC_PATH, RC_INIT_FILE); 1704 return StringUtil::strdup(str.str());
1702
1703 } else 1705 } else
1704 dbfile = StringUtil::strdup(rc_file); 1706 dbfile = StringUtil::strdup(rc_file);
1705 1707