aboutsummaryrefslogtreecommitdiff
path: root/src/Theme.cc
diff options
context:
space:
mode:
authorunknown <unknown>2002-01-11 11:59:54 (GMT)
committerunknown <unknown>2002-01-11 11:59:54 (GMT)
commit61661d638e34b3ce6c986d5a53b8c08c1051d422 (patch)
treef0b87676e95070afee163f76902efd0c4d5b5fe6 /src/Theme.cc
parentf98c3c9045397bd9497621deb55b310366f8a5de (diff)
parenta3d2a1cf0a5ab724e19a91915fe97842f52260d5 (diff)
downloadfluxbox-61661d638e34b3ce6c986d5a53b8c08c1051d422.zip
fluxbox-61661d638e34b3ce6c986d5a53b8c08c1051d422.tar.bz2
This commit was manufactured by cvs2svn to create tagRelease-0_1_6
'Release-0_1_6'.
Diffstat (limited to 'src/Theme.cc')
-rw-r--r--src/Theme.cc205
1 files changed, 98 insertions, 107 deletions
diff --git a/src/Theme.cc b/src/Theme.cc
index 5f54643..5377ecb 100644
--- a/src/Theme.cc
+++ b/src/Theme.cc
@@ -1,5 +1,5 @@
1// Theme.cc for fluxbox 1// Theme.cc for fluxbox
2// Copyright (c) 2001 Henrik Kinnunen (fluxgen@linuxmail.org) 2// Copyright (c) 2001-2002 Henrik Kinnunen (fluxgen@linuxmail.org)
3// 3//
4// Permission is hereby granted, free of charge, to any person obtaining a 4// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"), 5// copy of this software and associated documentation files (the "Software"),
@@ -41,6 +41,8 @@
41// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 41// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
42// DEALINGS IN THE SOFTWARE. 42// DEALINGS IN THE SOFTWARE.
43 43
44// $Id: Theme.cc,v 1.14 2002/01/11 10:43:55 fluxgen Exp $
45
44#ifndef _GNU_SOURCE 46#ifndef _GNU_SOURCE
45#define _GNU_SOURCE 47#define _GNU_SOURCE
46#endif // _GNU_SOURCE 48#endif // _GNU_SOURCE
@@ -49,46 +51,32 @@
49# include "config.h" 51# include "config.h"
50#endif //HAVE_CONFIG_H_ 52#endif //HAVE_CONFIG_H_
51 53
52#ifdef HAVE_CTYPE_H
53# include <ctype.h>
54#endif // HAVE_CTYPE_H
55
56#include "Theme.hh" 54#include "Theme.hh"
55
57#include "i18n.hh" 56#include "i18n.hh"
58#include "Basemenu.hh" 57#include "Basemenu.hh"
59#include "fluxbox.hh" 58#include "StringUtil.hh"
60 59
61#include <X11/Xresource.h> 60#include <X11/Xresource.h>
62#include <stdio.h>
63#include <stdarg.h>
64#include <string.h>
65
66#ifndef FONT_ELEMENT_SIZE
67# define FONT_ELEMENT_SIZE 50
68#endif // FONT_ELEMENT_SIZE
69
70#ifndef HAVE_STRCASESTR
71
72const char * strcasestr(const char *str, const char *ptn) {
73 const char *s2, *p2;
74 for( ; *str; str++) {
75 for(s2=str,p2=ptn; ; s2++,p2++) {
76 if (!*p2) return str;
77 if (toupper(*s2) != toupper(*p2)) break;
78 }
79 }
80 return NULL;
81}
82 61
83#endif 62#ifdef HAVE_CTYPE_H
84 63# include <ctype.h>
85Theme::Theme(Display *display, Colormap colormap, int screennum, BImageControl *ic, const char *filename) { 64#endif // HAVE_CTYPE_H
86 65
87 Window rootwindow = DefaultRootWindow(display); 66#include <cstdio>
88 m_screennum = screennum; 67#include <cstdarg>
89 m_display = display; 68#include <string>
90 m_imagecontrol = ic; 69#include <iostream>
91 m_colormap = colormap; 70using namespace std;
71
72Theme::Theme(Display *display, Window rootwindow, Colormap colormap,
73 int screennum, BImageControl *ic, const char *filename, const char *rootcommand):
74m_imagecontrol(ic),
75m_display(display),
76m_colormap(colormap),
77m_screennum(screennum),
78m_rootcommand(rootcommand==0 ? "" : rootcommand) //we dont want to send 0-pointer to std::string
79{
92 //default settings 80 //default settings
93 m_menustyle.titlefont.set = m_menustyle.framefont.set = m_toolbarstyle.font.set = 81 m_menustyle.titlefont.set = m_menustyle.framefont.set = m_toolbarstyle.font.set =
94 m_windowstyle.font.set = m_windowstyle.tab.font.set = 0; 82 m_windowstyle.font.set = m_windowstyle.tab.font.set = 0;
@@ -271,7 +259,7 @@ void Theme::freeTabStyle() {
271 XFreeFont(m_display, m_windowstyle.tab.font.fontstruct); 259 XFreeFont(m_display, m_windowstyle.tab.font.fontstruct);
272 260
273 if (m_windowstyle.tab.rot_font) 261 if (m_windowstyle.tab.rot_font)
274 XRotUnloadFont(m_display, m_windowstyle.tab.rot_font); 262 DrawUtil::XRotUnloadFont(m_display, m_windowstyle.tab.rot_font);
275 263
276 264
277 XFreeGC(m_display, m_windowstyle.tab.l_text_focus_gc); 265 XFreeGC(m_display, m_windowstyle.tab.l_text_focus_gc);
@@ -300,7 +288,7 @@ void Theme::freeToolbarStyle() {
300//---------- load ------------ 288//---------- load ------------
301// Loads a theme from a file 289// Loads a theme from a file
302//---------------------------- 290//----------------------------
303void Theme::load(const char *filename) { 291void Theme::load(const char *filename){
304 m_database = XrmGetFileDatabase(filename); 292 m_database = XrmGetFileDatabase(filename);
305 if (!m_database) 293 if (!m_database)
306 m_database = XrmGetFileDatabase(DEFAULTSTYLE); 294 m_database = XrmGetFileDatabase(DEFAULTSTYLE);
@@ -346,53 +334,53 @@ void Theme::loadMenuStyle() {
346 "Menu.Title.Justify", &value_type, &value)) { 334 "Menu.Title.Justify", &value_type, &value)) {
347 335
348 if (strstr(value.addr, "right") || strstr(value.addr, "Right")) 336 if (strstr(value.addr, "right") || strstr(value.addr, "Right"))
349 m_menustyle.titlefont.justify = FFont::Right; 337 m_menustyle.titlefont.justify = DrawUtil::Font::RIGHT;
350 else if (strstr(value.addr, "center") || strstr(value.addr, "Center")) 338 else if (strstr(value.addr, "center") || strstr(value.addr, "Center"))
351 m_menustyle.titlefont.justify = FFont::Center; 339 m_menustyle.titlefont.justify = DrawUtil::Font::CENTER;
352 else 340 else
353 m_menustyle.titlefont.justify = FFont::Left; 341 m_menustyle.titlefont.justify = DrawUtil::Font::LEFT;
354 342
355 } else 343 } else
356 m_menustyle.titlefont.justify = FFont::Left; 344 m_menustyle.titlefont.justify = DrawUtil::Font::LEFT;
357 345
358 if (XrmGetResource(m_database, "menu.frame.justify", 346 if (XrmGetResource(m_database, "menu.frame.justify",
359 "Menu.Frame.Justify", &value_type, &value)) { 347 "Menu.Frame.Justify", &value_type, &value)) {
360 348
361 if (strstr(value.addr, "right") || strstr(value.addr, "Right")) 349 if (strstr(value.addr, "right") || strstr(value.addr, "Right"))
362 m_menustyle.framefont.justify = FFont::Right; 350 m_menustyle.framefont.justify = DrawUtil::Font::RIGHT;
363 else if (strstr(value.addr, "center") || strstr(value.addr, "Center")) 351 else if (strstr(value.addr, "center") || strstr(value.addr, "Center"))
364 m_menustyle.framefont.justify = FFont::Center; 352 m_menustyle.framefont.justify = DrawUtil::Font::CENTER;
365 else 353 else
366 m_menustyle.framefont.justify = FFont::Left; 354 m_menustyle.framefont.justify = DrawUtil::Font::LEFT;
367 355
368 } else 356 } else
369 m_menustyle.framefont.justify = FFont::Left; 357 m_menustyle.framefont.justify = DrawUtil::Font::LEFT;
370 358
371 if (XrmGetResource(m_database, "menu.bullet", "Menu.Bullet", 359 if (XrmGetResource(m_database, "menu.bullet", "Menu.Bullet",
372 &value_type, &value)) { 360 &value_type, &value)) {
373 361
374 if (! strncasecmp(value.addr, "empty", value.size)) 362 if (! strncasecmp(value.addr, "empty", value.size))
375 m_menustyle.bullet = Basemenu::Empty; 363 m_menustyle.bullet = Basemenu::EMPTY;
376 else if (! strncasecmp(value.addr, "square", value.size)) 364 else if (! strncasecmp(value.addr, "square", value.size))
377 m_menustyle.bullet = Basemenu::Square; 365 m_menustyle.bullet = Basemenu::SQUARE;
378 else if (! strncasecmp(value.addr, "diamond", value.size)) 366 else if (! strncasecmp(value.addr, "diamond", value.size))
379 m_menustyle.bullet = Basemenu::Diamond; 367 m_menustyle.bullet = Basemenu::DIAMOND;
380 else 368 else
381 m_menustyle.bullet = Basemenu::Triangle; 369 m_menustyle.bullet = Basemenu::TRIANGLE;
382 370
383 } else 371 } else
384 m_menustyle.bullet = Basemenu::Triangle; 372 m_menustyle.bullet = Basemenu::TRIANGLE;
385 373
386 if (XrmGetResource(m_database, "menu.bullet.position", 374 if (XrmGetResource(m_database, "menu.bullet.position",
387 "Menu.Bullet.Position", &value_type, &value)) { 375 "Menu.Bullet.Position", &value_type, &value)) {
388 376
389 if (! strncasecmp(value.addr, "right", value.size)) 377 if (! strncasecmp(value.addr, "right", value.size))
390 m_menustyle.bullet_pos = Basemenu::Right; 378 m_menustyle.bullet_pos = Basemenu::RIGHT;
391 else 379 else
392 m_menustyle.bullet_pos = Basemenu::Left; 380 m_menustyle.bullet_pos = Basemenu::LEFT;
393 381
394 } else 382 } else
395 m_menustyle.bullet_pos = Basemenu::Left; 383 m_menustyle.bullet_pos = Basemenu::LEFT;
396 384
397 //---------- font 385 //---------- font
398 386
@@ -423,8 +411,7 @@ void Theme::loadWindowStyle() {
423 411
424 readDatabaseTexture("window.title.focus", "Window.Title.Focus", 412 readDatabaseTexture("window.title.focus", "Window.Title.Focus",
425 &m_windowstyle.t_focus, 413 &m_windowstyle.t_focus,
426 WhitePixel(m_display, 414 WhitePixel(m_display, m_screennum));
427 m_screennum));
428 readDatabaseTexture("window.title.unfocus", "Window.Title.Unfocus", 415 readDatabaseTexture("window.title.unfocus", "Window.Title.Unfocus",
429 &m_windowstyle.t_unfocus, 416 &m_windowstyle.t_unfocus,
430 BlackPixel(m_display, m_screennum)); 417 BlackPixel(m_display, m_screennum));
@@ -502,18 +489,18 @@ void Theme::loadWindowStyle() {
502 if (XrmGetResource(m_database, "window.justify", "Window.Justify", 489 if (XrmGetResource(m_database, "window.justify", "Window.Justify",
503 &value_type, &value)) { 490 &value_type, &value)) {
504 if (strstr(value.addr, "right") || strstr(value.addr, "Right")) 491 if (strstr(value.addr, "right") || strstr(value.addr, "Right"))
505 m_windowstyle.font.justify = FFont::Right; 492 m_windowstyle.font.justify = DrawUtil::Font::RIGHT;
506 else if (strstr(value.addr, "center") || strstr(value.addr, "Center")) 493 else if (strstr(value.addr, "center") || strstr(value.addr, "Center"))
507 m_windowstyle.font.justify = FFont::Center; 494 m_windowstyle.font.justify = DrawUtil::Font::CENTER;
508 else 495 else
509 m_windowstyle.font.justify = FFont::Left; 496 m_windowstyle.font.justify = DrawUtil::Font::LEFT;
510 } else 497 } else
511 m_windowstyle.font.justify = FFont::Left; 498 m_windowstyle.font.justify = DrawUtil::Font::LEFT;
512 499
513} 500}
514 501
515void Theme::loadTabStyle() { 502void Theme::loadTabStyle() {
516 503
517 if (!readDatabaseTexture("window.tab.title.focus", "Window.Tab.Title.Focus", 504 if (!readDatabaseTexture("window.tab.title.focus", "Window.Tab.Title.Focus",
518 &m_windowstyle.tab.t_focus, 505 &m_windowstyle.tab.t_focus,
519 WhitePixel(m_display, m_screennum))) 506 WhitePixel(m_display, m_screennum)))
@@ -533,7 +520,6 @@ void Theme::loadTabStyle() {
533 &m_windowstyle.tab.l_unfocus, 520 &m_windowstyle.tab.l_unfocus,
534 BlackPixel(m_display, m_screennum))) 521 BlackPixel(m_display, m_screennum)))
535 m_windowstyle.tab.l_unfocus = m_windowstyle.l_unfocus; 522 m_windowstyle.tab.l_unfocus = m_windowstyle.l_unfocus;
536
537 523
538 if (!readDatabaseColor("window.tab.label.focus.textColor", 524 if (!readDatabaseColor("window.tab.label.focus.textColor",
539 "Window.Tab.Label.Focus.TextColor", 525 "Window.Tab.Label.Focus.TextColor",
@@ -550,11 +536,10 @@ void Theme::loadTabStyle() {
550 readDatabaseColor("window.tab.borderColor", "Window.Tab.BorderColor", 536 readDatabaseColor("window.tab.borderColor", "Window.Tab.BorderColor",
551 &m_windowstyle.tab.border_color, 537 &m_windowstyle.tab.border_color,
552 BlackPixel(m_display, m_screennum)); 538 BlackPixel(m_display, m_screennum));
553 539
554
555 XrmValue value; 540 XrmValue value;
556 char *value_type; 541 char *value_type;
557 542
558 if (XrmGetResource(m_database, "window.tab.borderWidth", "Window.Tab.BorderWidth", 543 if (XrmGetResource(m_database, "window.tab.borderWidth", "Window.Tab.BorderWidth",
559 &value_type, &value)) { 544 &value_type, &value)) {
560 if (sscanf(value.addr, "%u", &m_windowstyle.tab.border_width) != 1) 545 if (sscanf(value.addr, "%u", &m_windowstyle.tab.border_width) != 1)
@@ -579,26 +564,24 @@ void Theme::loadTabStyle() {
579 } 564 }
580 565
581 //--------- rotated font for left and right tabs 566 //--------- rotated font for left and right tabs
582
583 // TODO: add extra checking 567 // TODO: add extra checking
584 if (XrmGetResource(m_database, "window.tab.font", "Window.Tab.Font", 568 if (XrmGetResource(m_database, "window.tab.font", "Window.Tab.Font",
585 &value_type, &value)) { 569 &value_type, &value)) {
586 if (! (m_windowstyle.tab.rot_font = XRotLoadFont(m_display, value.addr, 90.0)) ) 570 if (! (m_windowstyle.tab.rot_font = DrawUtil::XRotLoadFont(m_display, value.addr, 90.0)) )
587 m_windowstyle.tab.rot_font = XRotLoadFont(m_display, "fixed", 90); 571 m_windowstyle.tab.rot_font = DrawUtil::XRotLoadFont(m_display, "fixed", 90);
588 } else 572 } else
589 m_windowstyle.tab.rot_font = XRotLoadFont(m_display, "fixed", 90); 573 m_windowstyle.tab.rot_font = DrawUtil::XRotLoadFont(m_display, "fixed", 90);
590
591 574
592 if (XrmGetResource(m_database, "window.tab.justify", "Window.Tab.Justify", 575 if (XrmGetResource(m_database, "window.tab.justify", "Window.Tab.Justify",
593 &value_type, &value)) { 576 &value_type, &value)) {
594 if (strstr(value.addr, "right") || strstr(value.addr, "Right")) 577 if (strstr(value.addr, "right") || strstr(value.addr, "Right"))
595 m_windowstyle.tab.font.justify = FFont::Right; 578 m_windowstyle.tab.font.justify = DrawUtil::Font::RIGHT;
596 else if (strstr(value.addr, "center") || strstr(value.addr, "Center")) 579 else if (strstr(value.addr, "center") || strstr(value.addr, "Center"))
597 m_windowstyle.tab.font.justify = FFont::Center; 580 m_windowstyle.tab.font.justify = DrawUtil::Font::CENTER;
598 else 581 else
599 m_windowstyle.tab.font.justify = FFont::Left; 582 m_windowstyle.tab.font.justify = DrawUtil::Font::LEFT;
600 } else 583 } else
601 m_windowstyle.tab.font.justify = FFont::Left; 584 m_windowstyle.tab.font.justify = DrawUtil::Font::LEFT;
602 585
603} 586}
604 587
@@ -655,52 +638,60 @@ void Theme::loadToolbarStyle() {
655 if (XrmGetResource(m_database, "toolbar.justify", 638 if (XrmGetResource(m_database, "toolbar.justify",
656 "Toolbar.Justify", &value_type, &value)) { 639 "Toolbar.Justify", &value_type, &value)) {
657 if (strstr(value.addr, "right") || strstr(value.addr, "Right")) 640 if (strstr(value.addr, "right") || strstr(value.addr, "Right"))
658 m_toolbarstyle.font.justify = FFont::Right; 641 m_toolbarstyle.font.justify = DrawUtil::Font::RIGHT;
659 else if (strstr(value.addr, "center") || strstr(value.addr, "Center")) 642 else if (strstr(value.addr, "center") || strstr(value.addr, "Center"))
660 m_toolbarstyle.font.justify = FFont::Center; 643 m_toolbarstyle.font.justify = DrawUtil::Font::CENTER;
661 else 644 else
662 m_toolbarstyle.font.justify = FFont::Left; 645 m_toolbarstyle.font.justify = DrawUtil::Font::LEFT;
663 } else 646 } else
664 m_toolbarstyle.font.justify = FFont::Left; 647 m_toolbarstyle.font.justify = DrawUtil::Font::LEFT;
665 648
666} 649}
667 650
668void Theme::loadRootCommand() { 651void Theme::loadRootCommand() {
669 XrmValue value; 652 XrmValue value;
670 char *value_type; 653 char *value_type;
671 Fluxbox *fb=Fluxbox::instance(); 654 #ifdef DEBUG
672// printf("getting root command from fb->getRootCommand()"); 655 cerr<<"rootcommand.size()="<<m_rootcommand.size()<<endl;
673 const char *root_cmd=fb->getRootCommand(); 656 cerr<<"rootcommand="<<m_rootcommand<<endl;
674// printf("root kommandot: %s\n", root_cmd); 657 #endif
675 if (root_cmd) { 658
676 #ifndef __EMX__ 659 if (m_rootcommand.size()) {
677 const int display_strlen = 1024; 660 #ifndef __EMX__
678 char displaystring[display_strlen]; 661 char tmpstring[256]; //to hold m_screennum
679 snprintf(displaystring, display_strlen, "DISPLAY=%s%d", 662 tmpstring[0]=0;
680 DisplayString(m_display), m_screennum); 663 sprintf(tmpstring, "%d", m_screennum);
681 664 string displaystring("DISPLAY=");
682 bexec(root_cmd, displaystring); 665 displaystring.append(DisplayString(m_display));
666 displaystring.append(tmpstring); // append m_screennum
667 cerr<<__FILE__<<"("<<__LINE__<<"): displaystring="<<displaystring.c_str()<<endl;
668
669 bexec(m_rootcommand.c_str(), const_cast<char *>(displaystring.c_str()));
670
683 #else // __EMX__ 671 #else // __EMX__
684 spawnlp(P_NOWAIT, "cmd.exe", "cmd.exe", "/c", root_cmd, NULL); 672 spawnlp(P_NOWAIT, "cmd.exe", "cmd.exe", "/c", m_rootcommand.c_str(), NULL);
685 #endif // !__EMX__ 673 #endif // !__EMX__
686 674
687 #ifdef DEBUG 675 #ifdef DEBUG
688 fprintf(stderr, "rootcommand:%s\n", root_cmd); 676 cerr<<__FILE__<<"("<<__LINE__<<"): Rootcommand: "<<m_rootcommand<<endl;
689 #endif //!DEBUG 677 #endif //!DEBUG
690 678
691 } else if (XrmGetResource(m_database, "rootCommand", 679 } else if (XrmGetResource(m_database, "rootCommand",
692 "RootCommand", &value_type, &value)) { 680 "RootCommand", &value_type, &value)) {
693#ifndef __EMX__ 681 #ifndef __EMX__
694 const int display_strlen = 1024; 682 char tmpstring[256]; //to hold m_screennum
695 char displaystring[display_strlen]; 683 tmpstring[0]=0;
696 684 sprintf(tmpstring, "%d", m_screennum);
697 snprintf(displaystring, display_strlen, "DISPLAY=%s%d", 685 string displaystring("DISPLAY=");
698 DisplayString(m_display), m_screennum); 686 displaystring.append(DisplayString(m_display));
699 687 displaystring.append(tmpstring); // append m_screennum
700 bexec(value.addr, displaystring); 688 cerr<<__FILE__<<"("<<__LINE__<<"): displaystring="<<displaystring.c_str()<<endl;
701#else // __EMX__ 689
690 bexec(value.addr, const_cast<char *>(displaystring.c_str()));
691 #else // __EMX__
702 spawnlp(P_NOWAIT, "cmd.exe", "cmd.exe", "/c", value.addr, NULL); 692 spawnlp(P_NOWAIT, "cmd.exe", "cmd.exe", "/c", value.addr, NULL);
703#endif // !__EMX__ 693 #endif // !__EMX__
694
704 #ifdef DEBUG 695 #ifdef DEBUG
705 fprintf(stderr, "rootcommand:%s\n", value.addr); 696 fprintf(stderr, "rootcommand:%s\n", value.addr);
706 #endif 697 #endif
@@ -767,9 +758,9 @@ bool Theme::readDatabaseTexture(char *rname, char *rclass,
767 &value)) 758 &value))
768 m_imagecontrol->parseTexture(texture, value.addr); 759 m_imagecontrol->parseTexture(texture, value.addr);
769 else 760 else
770 texture->setTexture(BImage_Solid | BImage_Flat); 761 texture->setTexture(BImage::SOLID | BImage::FLAT);
771 762
772 if (texture->getTexture() & BImage_Solid) { 763 if (texture->getTexture() & BImage::SOLID) {
773 int clen = strlen(rclass) + 32, nlen = strlen(rname) + 32; 764 int clen = strlen(rclass) + 32, nlen = strlen(rname) + 32;
774 765
775 char *colorclass = new char[clen], *colorname = new char[nlen]; 766 char *colorclass = new char[clen], *colorname = new char[nlen];
@@ -793,7 +784,7 @@ bool Theme::readDatabaseTexture(char *rname, char *rclass,
793 delete [] colorname; 784 delete [] colorname;
794 785
795 if ((! texture->getColor()->isAllocated()) || 786 if ((! texture->getColor()->isAllocated()) ||
796 (texture->getTexture() & BImage_Flat)) 787 (texture->getTexture() & BImage::FLAT))
797 return retval; 788 return retval;
798 789
799 XColor xcol; 790 XColor xcol;
@@ -830,7 +821,7 @@ bool Theme::readDatabaseTexture(char *rname, char *rclass,
830 xcol.pixel = 0; 821 xcol.pixel = 0;
831 822
832 texture->getLoColor()->setPixel(xcol.pixel); 823 texture->getLoColor()->setPixel(xcol.pixel);
833 } else if (texture->getTexture() & BImage_Gradient) { 824 } else if (texture->getTexture() & BImage::GRADIENT) {
834 int clen = strlen(rclass) + 10, nlen = strlen(rname) + 10; 825 int clen = strlen(rclass) + 10, nlen = strlen(rname) + 10;
835 826
836 char *colorclass = new char[clen], *colorname = new char[nlen], 827 char *colorclass = new char[clen], *colorname = new char[nlen],
@@ -973,7 +964,6 @@ void Theme::readDatabaseFont(char *rname, char *rclass, XFontStruct **font) {
973 964
974void Theme::reconfigure() { 965void Theme::reconfigure() {
975 966
976 //Window rootwindow = DefaultRootWindow(m_display);
977 XGCValues gcv; 967 XGCValues gcv;
978 unsigned long gc_value_mask = GCForeground; 968 unsigned long gc_value_mask = GCForeground;
979 if (! I18n::instance()->multibyte()) 969 if (! I18n::instance()->multibyte())
@@ -1069,6 +1059,7 @@ void Theme::reconfigure() {
1069 1059
1070XFontSet Theme::createFontSet(char *fontname) { 1060XFontSet Theme::createFontSet(char *fontname) {
1071 XFontSet fs; 1061 XFontSet fs;
1062 const int FONT_ELEMENT_SIZE=50;
1072 char **missing, *def = "-"; 1063 char **missing, *def = "-";
1073 int nmissing, pixel_size = 0, buf_size = 0; 1064 int nmissing, pixel_size = 0, buf_size = 0;
1074 char weight[FONT_ELEMENT_SIZE], slant[FONT_ELEMENT_SIZE]; 1065 char weight[FONT_ELEMENT_SIZE], slant[FONT_ELEMENT_SIZE];
@@ -1167,7 +1158,7 @@ const char *Theme::getFontElement(const char *pattern, char *buf, int bufsiz, ..
1167 buf[bufsiz-1] = 0; 1158 buf[bufsiz-1] = 0;
1168 buf[bufsiz-2] = '*'; 1159 buf[bufsiz-2] = '*';
1169 while((v = va_arg(va, char *)) != NULL) { 1160 while((v = va_arg(va, char *)) != NULL) {
1170 p = strcasestr(pattern, v); 1161 p = StringUtil::strcasestr(pattern, v);
1171 if (p) { 1162 if (p) {
1172 strncpy(buf, p+1, bufsiz-2); 1163 strncpy(buf, p+1, bufsiz-2);
1173 p2 = strchr(buf, '-'); 1164 p2 = strchr(buf, '-');