Removed Fluxbox dependency

This commit is contained in:
fluxgen 2002-01-08 00:12:51 +00:00
parent 76d74c214e
commit f8f2b874a7

View file

@ -41,6 +41,8 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: Theme.cc,v 1.8 2002/01/08 00:12:51 fluxgen Exp $
#ifndef _GNU_SOURCE #ifndef _GNU_SOURCE
#define _GNU_SOURCE #define _GNU_SOURCE
#endif // _GNU_SOURCE #endif // _GNU_SOURCE
@ -49,31 +51,35 @@
# include "config.h" # include "config.h"
#endif //HAVE_CONFIG_H_ #endif //HAVE_CONFIG_H_
#include "Theme.hh"
#include "i18n.hh"
#include "Basemenu.hh"
#include "StringUtil.hh"
#include <X11/Xresource.h>
#ifdef HAVE_CTYPE_H #ifdef HAVE_CTYPE_H
# include <ctype.h> # include <ctype.h>
#endif // HAVE_CTYPE_H #endif // HAVE_CTYPE_H
#include "Theme.hh" #include <cstdio>
#include "i18n.hh" #include <cstdarg>
#include "Basemenu.hh" #include <string>
#include "fluxbox.hh" #include <strstream>
#include "StringUtil.hh" #include <iostream>
using namespace std;
#include <X11/Xresource.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#ifndef FONT_ELEMENT_SIZE Theme::Theme(Display *display, Window rootwindow, Colormap colormap,
# define FONT_ELEMENT_SIZE 50 int screennum, BImageControl *ic, const char *filename, const char *rootcommand):
#endif // FONT_ELEMENT_SIZE m_imagecontrol(ic),
m_display(display),
m_colormap(colormap),
m_screennum(screennum),
m_rootcommand(rootcommand)
{
Theme::Theme(Display *display, Window rootwindow, Colormap colormap, int screennum, BImageControl *ic, const char *filename) {
m_screennum = screennum;
m_display = display;
m_imagecontrol = ic;
m_colormap = colormap;
//default settings //default settings
m_menustyle.titlefont.set = m_menustyle.framefont.set = m_toolbarstyle.font.set = m_menustyle.titlefont.set = m_menustyle.framefont.set = m_toolbarstyle.font.set =
m_windowstyle.font.set = m_windowstyle.tab.font.set = 0; m_windowstyle.font.set = m_windowstyle.tab.font.set = 0;
@ -648,39 +654,42 @@ void Theme::loadToolbarStyle() {
void Theme::loadRootCommand() { void Theme::loadRootCommand() {
XrmValue value; XrmValue value;
char *value_type; char *value_type;
Fluxbox *fb=Fluxbox::instance();
const char *root_cmd=fb->getRootCommand(); if (m_rootcommand.size()) {
if (root_cmd) {
#ifndef __EMX__ #ifndef __EMX__
const int display_strlen = 1024; //const int display_strlen = 1024;
char displaystring[display_strlen]; //char displaystring[display_strlen];
snprintf(displaystring, display_strlen, "DISPLAY=%s%d", strstream displaystring;
DisplayString(m_display), m_screennum); displaystring<<"DISPLAY="<<DisplayString(m_display)<<m_screennum;
cerr<<__FILE__<<"("<<__LINE__<<"): displaystring="<<displaystring.str()<<endl;
//snprintf(displaystring, display_strlen, "DISPLAY=%s%d",
//DisplayString(m_display), m_screennum);
bexec(root_cmd, displaystring); bexec(m_rootcommand.c_str(), displaystring.str());
#else // __EMX__ #else // __EMX__
spawnlp(P_NOWAIT, "cmd.exe", "cmd.exe", "/c", root_cmd, NULL); spawnlp(P_NOWAIT, "cmd.exe", "cmd.exe", "/c", m_rootcommand.c_str(), NULL);
#endif // !__EMX__ #endif // !__EMX__
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "rootcommand:%s\n", root_cmd); cerr<<__FILE__<<"("<<__LINE__<<"): Rootcommand: "<<m_rootcommand<<endl;
#endif //!DEBUG #endif //!DEBUG
} else if (XrmGetResource(m_database, "rootCommand", } else if (XrmGetResource(m_database, "rootCommand",
"RootCommand", &value_type, &value)) { "RootCommand", &value_type, &value)) {
#ifndef __EMX__ #ifndef __EMX__
const int display_strlen = 1024; //const int display_strlen = 1024;
char displaystring[display_strlen]; //char displaystring[display_strlen];
strstream displaystring;
displaystring<<"DISPLAY="<<DisplayString(m_display)<<m_screennum;
cerr<<__FILE__<<"("<<__LINE__<<"): displaystring="<<displaystring.str()<<endl;
//snprintf(displaystring, display_strlen, "DISPLAY=%s%d",
// DisplayString(m_display), m_screennum);
snprintf(displaystring, display_strlen, "DISPLAY=%s%d", bexec(value.addr, displaystring.str());
DisplayString(m_display), m_screennum);
bexec(value.addr, displaystring);
#else // __EMX__ #else // __EMX__
spawnlp(P_NOWAIT, "cmd.exe", "cmd.exe", "/c", value.addr, NULL); spawnlp(P_NOWAIT, "cmd.exe", "cmd.exe", "/c", value.addr, NULL);
#endif // !__EMX__ #endif // !__EMX__
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "rootcommand:%s\n", value.addr); fprintf(stderr, "rootcommand:%s\n", value.addr);
#endif #endif
@ -1049,6 +1058,7 @@ void Theme::reconfigure() {
XFontSet Theme::createFontSet(char *fontname) { XFontSet Theme::createFontSet(char *fontname) {
XFontSet fs; XFontSet fs;
const int FONT_ELEMENT_SIZE=50;
char **missing, *def = "-"; char **missing, *def = "-";
int nmissing, pixel_size = 0, buf_size = 0; int nmissing, pixel_size = 0, buf_size = 0;
char weight[FONT_ELEMENT_SIZE], slant[FONT_ELEMENT_SIZE]; char weight[FONT_ELEMENT_SIZE], slant[FONT_ELEMENT_SIZE];