all repos — fluxbox @ 25f7f0034524fea4fbd455b17fef8288ffd0aa54

custom fork of the fluxbox windowmanager

setting font id in XFontImp now and reading font from database here
fluxgen fluxgen
commit

25f7f0034524fea4fbd455b17fef8288ffd0aa54

parent

4d1713cb87db91e691d54902f31fcd52e1dd0a7b

1 files changed, 33 insertions(+), 37 deletions(-)

jump to
M src/Theme.ccsrc/Theme.cc

@@ -1,5 +1,7 @@

// Theme.cc for fluxbox // Copyright (c) 2001-2002 Henrik Kinnunen (fluxgen@linuxmail.org) +// Some code based on: +// Screen.cc - Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"),

@@ -13,35 +15,13 @@ // all copies or substantial portions of the Software.

// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// A lot of the code base is taken from Screen.cc in Blackbox 0.61.1 -// and Brad Hughes (bhuges@tcac.net) should get alot of credit for it -// Screen.cc - Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -// $Id: Theme.cc,v 1.28 2002/09/14 23:25:44 fluxgen Exp $ +// $Id: Theme.cc,v 1.29 2002/10/13 22:32:49 fluxgen Exp $ #ifndef _GNU_SOURCE #define _GNU_SOURCE

@@ -71,16 +51,15 @@ using namespace std;

Theme::Theme(Display *display, Window rootwindow, Colormap colormap, int screennum, BImageControl *ic, const char *filename, const char *rootcommand): -m_menustyle(display), m_imagecontrol(ic), m_display(display), m_colormap(colormap), m_screennum(screennum), m_rootcommand(rootcommand==0 ? "" : rootcommand) //we dont want to send 0-pointer to std::string { - #ifdef DEBUG +#ifdef DEBUG cerr<<__FILE__<<"("<<__LINE__<<"): Creating."<<endl; - #endif //DEBUG +#endif //DEBUG //default settings m_windowstyle.font.set = m_toolbarstyle.font.set = m_windowstyle.tab.font.set = 0;

@@ -147,15 +126,15 @@ XCreateGC(m_display, rootwindow,

GCForeground, &gcv); gcv.foreground = m_menustyle.t_text.pixel(); - if (m_menustyle.titlefont.fontStruct()) - gcv.font = m_menustyle.titlefont.fontStruct()->fid; + //if (m_menustyle.titlefont.fontStruct()) + // gcv.font = m_menustyle.titlefont.fontStruct()->fid; m_menustyle.t_text_gc = XCreateGC(m_display, rootwindow, gc_value_mask, &gcv); gcv.foreground = m_menustyle.f_text.pixel(); - if (m_menustyle.framefont.fontStruct()) - gcv.font = m_menustyle.framefont.fontStruct()->fid; + //if (m_menustyle.framefont.fontStruct()) + // gcv.font = m_menustyle.framefont.fontStruct()->fid; m_menustyle.f_text_gc = XCreateGC(m_display, rootwindow,

@@ -375,8 +354,8 @@ } else

m_menustyle.bullet_pos = Basemenu::LEFT; //---------- font - m_menustyle.framefont.loadFromDatabase(m_database, "menu.frame.font", "Menu.Frame.Font"); - m_menustyle.titlefont.loadFromDatabase(m_database, "menu.title.font", "Menu.Title.Font"); + loadFontFromDatabase(m_menustyle.framefont, "menu.frame.font", "Menu.Frame.Font"); + loadFontFromDatabase(m_menustyle.titlefont, "menu.title.font", "Menu.Title.Font"); }

@@ -987,14 +966,14 @@ XChangeGC(m_display, m_windowstyle.b_pic_unfocus_gc,

GCForeground, &gcv); gcv.foreground = m_menustyle.t_text.pixel(); - if (m_menustyle.titlefont.fontStruct()) - gcv.font = m_menustyle.titlefont.fontStruct()->fid; +// if (m_menustyle.titlefont.fontStruct()) +// gcv.font = m_menustyle.titlefont.fontStruct()->fid; XChangeGC(m_display, m_menustyle.t_text_gc, gc_value_mask, &gcv); gcv.foreground = m_menustyle.f_text.pixel(); - if (m_menustyle.framefont.fontStruct()) - gcv.font = m_menustyle.framefont.fontStruct()->fid; +// if (m_menustyle.framefont.fontStruct()) +// gcv.font = m_menustyle.framefont.fontStruct()->fid; XChangeGC(m_display, m_menustyle.f_text_gc, gc_value_mask, &gcv);

@@ -1146,3 +1125,20 @@ va_end(va);

strncpy(buf, "*", bufsiz); return 0; } + +void Theme::loadFontFromDatabase(FbTk::Font &dest, const char *name, const char *altname) { + assert(name); + assert(altname); + + XrmValue value; + char *value_type; + + if (XrmGetResource(m_database, name, altname, &value_type, &value)) { +#ifdef DEBUG + std::cerr<<__FILE__<<"("<<__LINE__<<"): Load font:"<<value.addr<<std::endl; +#endif // DEBUG + dest.load(value.addr); + } + + +}