diff options
-rw-r--r-- | src/Theme.cc | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/src/Theme.cc b/src/Theme.cc index 89db396..dd5b561 100644 --- a/src/Theme.cc +++ b/src/Theme.cc | |||
@@ -41,7 +41,7 @@ | |||
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.24 2002/07/23 18:38:31 fluxgen Exp $ | 44 | // $Id: Theme.cc,v 1.25 2002/08/04 15:41:26 fluxgen Exp $ |
45 | 45 | ||
46 | #ifndef _GNU_SOURCE | 46 | #ifndef _GNU_SOURCE |
47 | #define _GNU_SOURCE | 47 | #define _GNU_SOURCE |
@@ -147,15 +147,15 @@ m_rootcommand(rootcommand==0 ? "" : rootcommand) //we dont want to send 0-pointe | |||
147 | GCForeground, &gcv); | 147 | GCForeground, &gcv); |
148 | 148 | ||
149 | gcv.foreground = m_menustyle.t_text.pixel(); | 149 | gcv.foreground = m_menustyle.t_text.pixel(); |
150 | if (m_menustyle.titlefont.getFontStruct()) | 150 | if (m_menustyle.titlefont.fontStruct()) |
151 | gcv.font = m_menustyle.titlefont.getFontStruct()->fid; | 151 | gcv.font = m_menustyle.titlefont.fontStruct()->fid; |
152 | m_menustyle.t_text_gc = | 152 | m_menustyle.t_text_gc = |
153 | XCreateGC(m_display, rootwindow, | 153 | XCreateGC(m_display, rootwindow, |
154 | gc_value_mask, &gcv); | 154 | gc_value_mask, &gcv); |
155 | 155 | ||
156 | gcv.foreground = m_menustyle.f_text.pixel(); | 156 | gcv.foreground = m_menustyle.f_text.pixel(); |
157 | if (m_menustyle.framefont.getFontStruct()) | 157 | if (m_menustyle.framefont.fontStruct()) |
158 | gcv.font = m_menustyle.framefont.getFontStruct()->fid; | 158 | gcv.font = m_menustyle.framefont.fontStruct()->fid; |
159 | 159 | ||
160 | m_menustyle.f_text_gc = | 160 | m_menustyle.f_text_gc = |
161 | XCreateGC(m_display, rootwindow, | 161 | XCreateGC(m_display, rootwindow, |
@@ -637,7 +637,7 @@ void Theme::loadRootCommand() { | |||
637 | bexec(m_rootcommand.c_str(), const_cast<char *>(displaystring.c_str())); | 637 | bexec(m_rootcommand.c_str(), const_cast<char *>(displaystring.c_str())); |
638 | 638 | ||
639 | #else // __EMX__ | 639 | #else // __EMX__ |
640 | spawnlp(P_NOWAIT, "cmd.exe", "cmd.exe", "/c", m_rootcommand.c_str(), NULL); | 640 | spawnlp(P_NOWAIT, "cmd.exe", "cmd.exe", "/c", m_rootcommand.c_str(), 0); |
641 | #endif // !__EMX__ | 641 | #endif // !__EMX__ |
642 | 642 | ||
643 | } else if (XrmGetResource(m_database, "rootCommand", "RootCommand", | 643 | } else if (XrmGetResource(m_database, "rootCommand", "RootCommand", |
@@ -653,7 +653,7 @@ void Theme::loadRootCommand() { | |||
653 | bexec(value.addr, const_cast<char *>(displaystring.c_str())); | 653 | bexec(value.addr, const_cast<char *>(displaystring.c_str())); |
654 | #else // __EMX__ | 654 | #else // __EMX__ |
655 | 655 | ||
656 | spawnlp(P_NOWAIT, "cmd.exe", "cmd.exe", "/c", value.addr, NULL); | 656 | spawnlp(P_NOWAIT, "cmd.exe", "cmd.exe", "/c", value.addr, 0); |
657 | 657 | ||
658 | #endif // !__EMX__ | 658 | #endif // !__EMX__ |
659 | 659 | ||
@@ -893,7 +893,7 @@ void Theme::readDatabaseFont(char *rname, char *rclass, XFontStruct **font) { | |||
893 | #ifdef DEBUG | 893 | #ifdef DEBUG |
894 | cerr<<__FILE__<<"("<<__LINE__<<"): Load font:"<<value.addr<<endl; | 894 | cerr<<__FILE__<<"("<<__LINE__<<"): Load font:"<<value.addr<<endl; |
895 | #endif | 895 | #endif |
896 | if ((*font = XLoadQueryFont(m_display, value.addr)) == NULL) { | 896 | if ((*font = XLoadQueryFont(m_display, value.addr)) == 0) { |
897 | fprintf(stderr, | 897 | fprintf(stderr, |
898 | I18n::instance()-> | 898 | I18n::instance()-> |
899 | getMessage( | 899 | getMessage( |
@@ -907,8 +907,7 @@ void Theme::readDatabaseFont(char *rname, char *rclass, XFontStruct **font) { | |||
907 | load_default = true; | 907 | load_default = true; |
908 | 908 | ||
909 | if (load_default) { | 909 | if (load_default) { |
910 | if ((*font = XLoadQueryFont(m_display, | 910 | if ((*font = XLoadQueryFont(m_display, defaultFont)) == 0) { |
911 | defaultFont)) == NULL) { | ||
912 | fprintf(stderr, | 911 | fprintf(stderr, |
913 | I18n::instance()-> | 912 | I18n::instance()-> |
914 | getMessage( | 913 | getMessage( |
@@ -969,14 +968,14 @@ void Theme::reconfigure() { | |||
969 | GCForeground, &gcv); | 968 | GCForeground, &gcv); |
970 | 969 | ||
971 | gcv.foreground = m_menustyle.t_text.pixel(); | 970 | gcv.foreground = m_menustyle.t_text.pixel(); |
972 | if (m_menustyle.titlefont.getFontStruct()) | 971 | if (m_menustyle.titlefont.fontStruct()) |
973 | gcv.font = m_menustyle.titlefont.getFontStruct()->fid; | 972 | gcv.font = m_menustyle.titlefont.fontStruct()->fid; |
974 | XChangeGC(m_display, m_menustyle.t_text_gc, | 973 | XChangeGC(m_display, m_menustyle.t_text_gc, |
975 | gc_value_mask, &gcv); | 974 | gc_value_mask, &gcv); |
976 | 975 | ||
977 | gcv.foreground = m_menustyle.f_text.pixel(); | 976 | gcv.foreground = m_menustyle.f_text.pixel(); |
978 | if (m_menustyle.framefont.getFontStruct()) | 977 | if (m_menustyle.framefont.fontStruct()) |
979 | gcv.font = m_menustyle.framefont.getFontStruct()->fid; | 978 | gcv.font = m_menustyle.framefont.fontStruct()->fid; |
980 | 979 | ||
981 | XChangeGC(m_display, m_menustyle.f_text_gc, | 980 | XChangeGC(m_display, m_menustyle.f_text_gc, |
982 | gc_value_mask, &gcv); | 981 | gc_value_mask, &gcv); |
@@ -1044,9 +1043,9 @@ XFontSet Theme::createFontSet(char *fontname) { | |||
1044 | } | 1043 | } |
1045 | 1044 | ||
1046 | getFontElement(fontname, weight, FONT_ELEMENT_SIZE, | 1045 | getFontElement(fontname, weight, FONT_ELEMENT_SIZE, |
1047 | "-medium-", "-bold-", "-demibold-", "-regular-", NULL); | 1046 | "-medium-", "-bold-", "-demibold-", "-regular-", 0); |
1048 | getFontElement(fontname, slant, FONT_ELEMENT_SIZE, | 1047 | getFontElement(fontname, slant, FONT_ELEMENT_SIZE, |
1049 | "-r-", "-i-", "-o-", "-ri-", "-ro-", NULL); | 1048 | "-r-", "-i-", "-o-", "-ri-", "-ro-", 0); |
1050 | getFontSize(fontname, &pixel_size); | 1049 | getFontSize(fontname, &pixel_size); |
1051 | 1050 | ||
1052 | if (! strcmp(weight, "*")) | 1051 | if (! strcmp(weight, "*")) |
@@ -1086,22 +1085,22 @@ const char *Theme::getFontSize(const char *pattern, int *size) { | |||
1086 | 1085 | ||
1087 | for (p=pattern; 1; p++) { | 1086 | for (p=pattern; 1; p++) { |
1088 | if (!*p) { | 1087 | if (!*p) { |
1089 | if (p2!=NULL && n>1 && n<72) { | 1088 | if (p2!=0 && n>1 && n<72) { |
1090 | *size = n; return p2+1; | 1089 | *size = n; return p2+1; |
1091 | } else { | 1090 | } else { |
1092 | *size = 16; return NULL; | 1091 | *size = 16; return 0; |
1093 | } | 1092 | } |
1094 | } else if (*p=='-') { | 1093 | } else if (*p=='-') { |
1095 | if (n>1 && n<72 && p2!=NULL) { | 1094 | if (n>1 && n<72 && p2!=0) { |
1096 | *size = n; | 1095 | *size = n; |
1097 | return p2+1; | 1096 | return p2+1; |
1098 | } | 1097 | } |
1099 | p2=p; n=0; | 1098 | p2=p; n=0; |
1100 | } else if (*p>='0' && *p<='9' && p2!=NULL) { | 1099 | } else if (*p>='0' && *p<='9' && p2!=0) { |
1101 | n *= 10; | 1100 | n *= 10; |
1102 | n += *p-'0'; | 1101 | n += *p-'0'; |
1103 | } else { | 1102 | } else { |
1104 | p2=NULL; n=0; | 1103 | p2=0; n=0; |
1105 | } | 1104 | } |
1106 | } | 1105 | } |
1107 | } | 1106 | } |
@@ -1114,7 +1113,7 @@ const char *Theme::getFontElement(const char *pattern, char *buf, int bufsiz, .. | |||
1114 | va_start(va, bufsiz); | 1113 | va_start(va, bufsiz); |
1115 | buf[bufsiz-1] = 0; | 1114 | buf[bufsiz-1] = 0; |
1116 | buf[bufsiz-2] = '*'; | 1115 | buf[bufsiz-2] = '*'; |
1117 | while((v = va_arg(va, char *)) != NULL) { | 1116 | while((v = va_arg(va, char *)) != 0) { |
1118 | p = StringUtil::strcasestr(pattern, v); | 1117 | p = StringUtil::strcasestr(pattern, v); |
1119 | if (p) { | 1118 | if (p) { |
1120 | strncpy(buf, p+1, bufsiz-2); | 1119 | strncpy(buf, p+1, bufsiz-2); |
@@ -1126,5 +1125,5 @@ const char *Theme::getFontElement(const char *pattern, char *buf, int bufsiz, .. | |||
1126 | } | 1125 | } |
1127 | va_end(va); | 1126 | va_end(va); |
1128 | strncpy(buf, "*", bufsiz); | 1127 | strncpy(buf, "*", bufsiz); |
1129 | return NULL; | 1128 | return 0; |
1130 | } | 1129 | } |