aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/IconBar.cc30
-rw-r--r--src/Screen.cc39
-rw-r--r--src/Theme.cc101
-rw-r--r--src/Theme.hh10
-rw-r--r--src/Window.cc50
5 files changed, 98 insertions, 132 deletions
diff --git a/src/IconBar.cc b/src/IconBar.cc
index 3ed4f54..3d2919d 100644
--- a/src/IconBar.cc
+++ b/src/IconBar.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: IconBar.cc,v 1.15 2002/08/04 15:23:24 fluxgen Exp $ 22// $Id: IconBar.cc,v 1.16 2002/10/15 17:10:48 fluxgen Exp $
23 23
24#include "IconBar.hh" 24#include "IconBar.hh"
25#include "i18n.hh" 25#include "i18n.hh"
@@ -261,9 +261,9 @@ void IconBar::draw(IconBarObj *obj, int width) {
261 FluxboxWindow *fluxboxwin = obj->getFluxboxWin(); 261 FluxboxWindow *fluxboxwin = obj->getFluxboxWin();
262 Window iconwin = obj->getIconWin(); 262 Window iconwin = obj->getIconWin();
263 unsigned int title_text_w; 263 unsigned int title_text_w;
264 264 /*
265 const int multibyte = I18n::instance()->multibyte(); 265 const int multibyte = I18n::instance()->multibyte();
266 266
267 if (multibyte) { 267 if (multibyte) {
268 XRectangle ink, logical; 268 XRectangle ink, logical;
269 XmbTextExtents(m_screen->getWindowStyle()->font.set, 269 XmbTextExtents(m_screen->getWindowStyle()->font.set,
@@ -273,14 +273,16 @@ void IconBar::draw(IconBarObj *obj, int width) {
273 title_text_w = XTextWidth(m_screen->getWindowStyle()->font.fontstruct, 273 title_text_w = XTextWidth(m_screen->getWindowStyle()->font.fontstruct,
274 fluxboxwin->getIconTitle().c_str(), fluxboxwin->getIconTitle().size()); 274 fluxboxwin->getIconTitle().c_str(), fluxboxwin->getIconTitle().size());
275 } 275 }
276 276 */
277 title_text_w = m_screen->getWindowStyle()->font.textWidth(
278 fluxboxwin->getIconTitle().c_str(), fluxboxwin->getIconTitle().size());
277 int l = title_text_w; 279 int l = title_text_w;
278 unsigned int dlen=fluxboxwin->getIconTitle().size(); 280 unsigned int dlen=fluxboxwin->getIconTitle().size();
279 unsigned int bevel_w = m_screen->getBevelWidth(); 281 unsigned int bevel_w = m_screen->getBevelWidth();
280 int dx=bevel_w*2; 282 int dx=bevel_w*2;
281 283
282 for (; dlen >= 0; dlen--) { 284 for (; dlen >= 0; dlen--) {
283 if (multibyte) { 285 /*if (multibyte) {
284 XRectangle ink, logical; 286 XRectangle ink, logical;
285 XmbTextExtents(m_screen->getWindowStyle()->tab.font.set, 287 XmbTextExtents(m_screen->getWindowStyle()->tab.font.set,
286 fluxboxwin->getIconTitle().c_str(), dlen, 288 fluxboxwin->getIconTitle().c_str(), dlen,
@@ -289,13 +291,16 @@ void IconBar::draw(IconBarObj *obj, int width) {
289 } else 291 } else
290 l = XTextWidth(m_screen->getWindowStyle()->tab.font.fontstruct, 292 l = XTextWidth(m_screen->getWindowStyle()->tab.font.fontstruct,
291 fluxboxwin->getIconTitle().c_str(), dlen); 293 fluxboxwin->getIconTitle().c_str(), dlen);
292 l += (bevel_w * 4); 294 */
293 295 l = m_screen->getWindowStyle()->tab.font.textWidth(
296 fluxboxwin->getIconTitle().c_str(), dlen);
297 l += (bevel_w * 4);
298
294 if (l < width) 299 if (l < width)
295 break; 300 break;
296 } 301 }
297 302
298 switch (m_screen->getWindowStyle()->tab.font.justify) { 303 switch (m_screen->getWindowStyle()->tab.justify) {
299 case DrawUtil::Font::RIGHT: 304 case DrawUtil::Font::RIGHT:
300 dx += width - l; 305 dx += width - l;
301 break; 306 break;
@@ -309,7 +314,7 @@ void IconBar::draw(IconBarObj *obj, int width) {
309 //Draw title to m_iconwin 314 //Draw title to m_iconwin
310 315
311 XClearWindow(m_display, iconwin); 316 XClearWindow(m_display, iconwin);
312 317 /*
313 if (multibyte) { 318 if (multibyte) {
314 XmbDrawString(m_display, iconwin, 319 XmbDrawString(m_display, iconwin,
315 m_screen->getWindowStyle()->tab.font.set, 320 m_screen->getWindowStyle()->tab.font.set,
@@ -322,6 +327,13 @@ void IconBar::draw(IconBarObj *obj, int width) {
322 m_screen->getWindowStyle()->tab.font.fontstruct->ascent + 1, 327 m_screen->getWindowStyle()->tab.font.fontstruct->ascent + 1,
323 fluxboxwin->getIconTitle().c_str(), dlen); 328 fluxboxwin->getIconTitle().c_str(), dlen);
324 } 329 }
330 */
331 m_screen->getWindowStyle()->tab.font.drawText(
332 iconwin,
333 m_screen->getScreenNumber(),
334 m_screen->getWindowStyle()->tab.l_text_focus_gc,
335 fluxboxwin->getIconTitle().c_str(), dlen,
336 dx, m_screen->getWindowStyle()->tab.font.height());
325 337
326} 338}
327 339
diff --git a/src/Screen.cc b/src/Screen.cc
index f70e6e9..4159141 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Screen.cc,v 1.73 2002/10/15 13:05:55 fluxgen Exp $ 25// $Id: Screen.cc,v 1.74 2002/10/15 17:12:23 fluxgen Exp $
26 26
27//use GNU extensions 27//use GNU extensions
28#ifndef _GNU_SOURCE 28#ifndef _GNU_SOURCE
@@ -288,7 +288,7 @@ resource(rm, screenname, altscreenname)
288 "0: 0000 x 0: 0000"); 288 "0: 0000 x 0: 0000");
289 289
290 int l = strlen(s); 290 int l = strlen(s);
291 291 /*
292 if (i18n->multibyte()) { 292 if (i18n->multibyte()) {
293 XRectangle ink, logical; 293 XRectangle ink, logical;
294 XmbTextExtents(theme->getWindowStyle().font.set, s, l, &ink, &logical); 294 XmbTextExtents(theme->getWindowStyle().font.set, s, l, &ink, &logical);
@@ -301,7 +301,10 @@ resource(rm, screenname, altscreenname)
301 301
302 geom_w = XTextWidth(theme->getWindowStyle().font.fontstruct, s, l); 302 geom_w = XTextWidth(theme->getWindowStyle().font.fontstruct, s, l);
303 } 303 }
304 304 */
305 geom_h = theme->getWindowStyle().font.height();
306 geom_w = theme->getWindowStyle().font.textWidth(s, l);
307
305 geom_w += getBevelWidth()*2; 308 geom_w += getBevelWidth()*2;
306 geom_h += getBevelWidth()*2; 309 geom_h += getBevelWidth()*2;
307 310
@@ -527,7 +530,7 @@ void BScreen::reconfigure() {
527 FBNLS::ScreenSet, FBNLS::ScreenPositionLength, 530 FBNLS::ScreenSet, FBNLS::ScreenPositionLength,
528 "0: 0000 x 0: 0000"); 531 "0: 0000 x 0: 0000");
529 int l = strlen(s); 532 int l = strlen(s);
530 533 /*
531 if (i18n->multibyte()) { 534 if (i18n->multibyte()) {
532 XRectangle ink, logical; 535 XRectangle ink, logical;
533 XmbTextExtents(theme->getWindowStyle().font.set, s, l, &ink, &logical); 536 XmbTextExtents(theme->getWindowStyle().font.set, s, l, &ink, &logical);
@@ -540,7 +543,10 @@ void BScreen::reconfigure() {
540 geom_h = theme->getWindowStyle().font.fontstruct->ascent + 543 geom_h = theme->getWindowStyle().font.fontstruct->ascent +
541 theme->getWindowStyle().font.fontstruct->descent; 544 theme->getWindowStyle().font.fontstruct->descent;
542 } 545 }
543 546 */
547 //TODO: repeat from somewhere else?
548 geom_h = theme->getWindowStyle().font.height();
549 geom_w = theme->getWindowStyle().font.textWidth(s, l);
544 geom_w += getBevelWidth()*2; 550 geom_w += getBevelWidth()*2;
545 geom_h += getBevelWidth()*2; 551 geom_h += getBevelWidth()*2;
546 552
@@ -1620,7 +1626,7 @@ void BScreen::showPosition(int x, int y) {
1620 "X: %4d x Y: %4d"), x, y); 1626 "X: %4d x Y: %4d"), x, y);
1621 1627
1622 XClearWindow(getBaseDisplay()->getXDisplay(), geom_window); 1628 XClearWindow(getBaseDisplay()->getXDisplay(), geom_window);
1623 1629 /*
1624 if (I18n::instance()->multibyte()) 1630 if (I18n::instance()->multibyte())
1625 XmbDrawString(getBaseDisplay()->getXDisplay(), geom_window, 1631 XmbDrawString(getBaseDisplay()->getXDisplay(), geom_window,
1626 theme->getWindowStyle().font.set, theme->getWindowStyle().l_text_focus_gc, 1632 theme->getWindowStyle().font.set, theme->getWindowStyle().l_text_focus_gc,
@@ -1633,7 +1639,15 @@ void BScreen::showPosition(int x, int y) {
1633 theme->getBevelWidth(), 1639 theme->getBevelWidth(),
1634 theme->getWindowStyle().font.fontstruct->ascent + 1640 theme->getWindowStyle().font.fontstruct->ascent +
1635 theme->getBevelWidth(), label, strlen(label)); 1641 theme->getBevelWidth(), label, strlen(label));
1636 1642 */
1643 theme->getWindowStyle().font.drawText(
1644 geom_window,
1645 getScreenNumber(),
1646 theme->getWindowStyle().l_text_focus_gc,
1647 label, strlen(label),
1648 theme->getBevelWidth(), theme->getBevelWidth() +
1649 theme->getWindowStyle().font.height());
1650
1637} 1651}
1638 1652
1639 1653
@@ -1664,7 +1678,7 @@ void BScreen::showGeometry(unsigned int gx, unsigned int gy) {
1664 "W: %4d x H: %4d"), gx, gy); 1678 "W: %4d x H: %4d"), gx, gy);
1665 1679
1666 XClearWindow(getBaseDisplay()->getXDisplay(), geom_window); 1680 XClearWindow(getBaseDisplay()->getXDisplay(), geom_window);
1667 1681 /*
1668 if (I18n::instance()->multibyte()) 1682 if (I18n::instance()->multibyte())
1669 XmbDrawString(getBaseDisplay()->getXDisplay(), geom_window, 1683 XmbDrawString(getBaseDisplay()->getXDisplay(), geom_window,
1670 theme->getWindowStyle().font.set, theme->getWindowStyle().l_text_focus_gc, 1684 theme->getWindowStyle().font.set, theme->getWindowStyle().l_text_focus_gc,
@@ -1677,6 +1691,15 @@ void BScreen::showGeometry(unsigned int gx, unsigned int gy) {
1677 theme->getBevelWidth(), 1691 theme->getBevelWidth(),
1678 theme->getWindowStyle().font.fontstruct->ascent + 1692 theme->getWindowStyle().font.fontstruct->ascent +
1679 theme->getBevelWidth(), label, strlen(label)); 1693 theme->getBevelWidth(), label, strlen(label));
1694 */
1695 //TODO: geom window again?! repeat
1696 theme->getWindowStyle().font.drawText(
1697 geom_window,
1698 getScreenNumber(),
1699 theme->getWindowStyle().l_text_focus_gc,
1700 label, strlen(label),
1701 theme->getBevelWidth(), theme->getBevelWidth() +
1702 theme->getWindowStyle().font.height());
1680} 1703}
1681 1704
1682 1705
diff --git a/src/Theme.cc b/src/Theme.cc
index be660d6..a6ea86c 100644
--- a/src/Theme.cc
+++ b/src/Theme.cc
@@ -21,7 +21,7 @@
21// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22// DEALINGS IN THE SOFTWARE. 22// DEALINGS IN THE SOFTWARE.
23 23
24// $Id: Theme.cc,v 1.30 2002/10/15 10:53:01 fluxgen Exp $ 24// $Id: Theme.cc,v 1.31 2002/10/15 17:08:45 fluxgen Exp $
25 25
26#ifndef _GNU_SOURCE 26#ifndef _GNU_SOURCE
27#define _GNU_SOURCE 27#define _GNU_SOURCE
@@ -62,10 +62,8 @@ m_rootcommand(rootcommand==0 ? "" : rootcommand) //we dont want to send 0-pointe
62#endif //DEBUG 62#endif //DEBUG
63 //default settings 63 //default settings
64 64
65 m_windowstyle.font.set = m_toolbarstyle.font.set = m_windowstyle.tab.font.set = 0; 65 m_toolbarstyle.font.set = 0;
66 66 m_toolbarstyle.font.fontstruct = 0;
67 m_toolbarstyle.font.fontstruct = m_windowstyle.font.fontstruct = m_windowstyle.tab.font.fontstruct = 0;
68 m_windowstyle.tab.rot_font = 0;
69 67
70 load(filename); 68 load(filename);
71 //-------- create gc for the styles ------------ 69 //-------- create gc for the styles ------------
@@ -74,9 +72,6 @@ m_rootcommand(rootcommand==0 ? "" : rootcommand) //we dont want to send 0-pointe
74 XGCValues gcv; 72 XGCValues gcv;
75 unsigned long gc_value_mask = GCForeground; 73 unsigned long gc_value_mask = GCForeground;
76 74
77 if (! I18n::instance()->multibyte())
78 gc_value_mask |= GCFont;
79
80 gcv.foreground = WhitePixel(m_display, screennum)^BlackPixel(m_display, screennum); 75 gcv.foreground = WhitePixel(m_display, screennum)^BlackPixel(m_display, screennum);
81 gcv.function = GXxor; 76 gcv.function = GXxor;
82 gcv.subwindow_mode = IncludeInferiors; 77 gcv.subwindow_mode = IncludeInferiors;
@@ -84,24 +79,17 @@ m_rootcommand(rootcommand==0 ? "" : rootcommand) //we dont want to send 0-pointe
84 GCForeground | GCFunction | GCSubwindowMode, &gcv); 79 GCForeground | GCFunction | GCSubwindowMode, &gcv);
85 80
86 gcv.foreground = m_windowstyle.l_text_focus.pixel(); 81 gcv.foreground = m_windowstyle.l_text_focus.pixel();
87 if (m_windowstyle.font.fontstruct)
88 gcv.font = m_windowstyle.font.fontstruct->fid;
89
90 m_windowstyle.l_text_focus_gc = 82 m_windowstyle.l_text_focus_gc =
91 XCreateGC(m_display, rootwindow, 83 XCreateGC(m_display, rootwindow,
92 gc_value_mask, &gcv); 84 gc_value_mask, &gcv);
93 85
94 gcv.foreground = m_windowstyle.l_text_unfocus.pixel(); 86 gcv.foreground = m_windowstyle.l_text_unfocus.pixel();
95 if (m_windowstyle.font.fontstruct)
96 gcv.font = m_windowstyle.font.fontstruct->fid;
97 m_windowstyle.l_text_unfocus_gc = 87 m_windowstyle.l_text_unfocus_gc =
98 XCreateGC(m_display, rootwindow, 88 XCreateGC(m_display, rootwindow,
99 gc_value_mask, &gcv); 89 gc_value_mask, &gcv);
100 90
101 //---- Tab 91 //---- Tab
102 gcv.foreground = m_windowstyle.tab.l_text_focus.pixel(); 92 gcv.foreground = m_windowstyle.tab.l_text_focus.pixel();
103 if (m_windowstyle.tab.font.fontstruct)
104 gcv.font = m_windowstyle.tab.font.fontstruct->fid;
105 93
106 m_windowstyle.tab.l_text_focus_gc = 94 m_windowstyle.tab.l_text_focus_gc =
107 XCreateGC(m_display, rootwindow, 95 XCreateGC(m_display, rootwindow,
@@ -202,15 +190,8 @@ void Theme::freeMenuStyle() {
202 190
203//----- freeWindowStyle ----- 191//----- freeWindowStyle -----
204// free memory allocated for m_windowstyle 192// free memory allocated for m_windowstyle
205// should only be called from ~Theme
206//-------------------- 193//--------------------
207void Theme::freeWindowStyle() { 194void Theme::freeWindowStyle() {
208 if (m_windowstyle.font.set)
209 XFreeFontSet(m_display, m_windowstyle.font.set);
210
211 if (m_windowstyle.font.fontstruct)
212 XFreeFont(m_display, m_windowstyle.font.fontstruct);
213
214 XFreeGC(m_display, m_windowstyle.l_text_focus_gc); 195 XFreeGC(m_display, m_windowstyle.l_text_focus_gc);
215 XFreeGC(m_display, m_windowstyle.l_text_unfocus_gc); 196 XFreeGC(m_display, m_windowstyle.l_text_unfocus_gc);
216 XFreeGC(m_display, m_windowstyle.b_pic_focus_gc); 197 XFreeGC(m_display, m_windowstyle.b_pic_focus_gc);
@@ -219,20 +200,8 @@ void Theme::freeWindowStyle() {
219 200
220//----- freeTabStyle ----- 201//----- freeTabStyle -----
221// free memory allocated for m_windowstyle.tab 202// free memory allocated for m_windowstyle.tab
222// should only be called from ~Theme
223//-------------------- 203//--------------------
224void Theme::freeTabStyle() { 204void Theme::freeTabStyle() {
225
226 if (m_windowstyle.tab.font.set)
227 XFreeFontSet(m_display, m_windowstyle.tab.font.set);
228
229 if (m_windowstyle.tab.font.fontstruct)
230 XFreeFont(m_display, m_windowstyle.tab.font.fontstruct);
231
232 if (m_windowstyle.tab.rot_font)
233 DrawUtil::XRotUnloadFont(m_display, m_windowstyle.tab.rot_font);
234
235
236 XFreeGC(m_display, m_windowstyle.tab.l_text_focus_gc); 205 XFreeGC(m_display, m_windowstyle.tab.l_text_focus_gc);
237 XFreeGC(m_display, m_windowstyle.tab.l_text_unfocus_gc); 206 XFreeGC(m_display, m_windowstyle.tab.l_text_unfocus_gc);
238} 207}
@@ -445,17 +414,7 @@ void Theme::loadWindowStyle() {
445 WhitePixel(m_display, m_screennum)); 414 WhitePixel(m_display, m_screennum));
446 415
447 //----- font 416 //----- font
448 417 loadFontFromDatabase(m_windowstyle.font, "window.font", "Window.Font");
449 if (I18n::instance()->multibyte()) {
450 readDatabaseFontSet("window.font", "Window.Font",
451 &m_windowstyle.font.set);
452
453 m_windowstyle.font.set_extents =
454 XExtentsOfFontSet(m_windowstyle.font.set);
455 } else {
456 readDatabaseFont("window.font", "Window.Font",
457 &m_windowstyle.font.fontstruct);
458 }
459 418
460 XrmValue value; 419 XrmValue value;
461 char *value_type; 420 char *value_type;
@@ -463,13 +422,13 @@ void Theme::loadWindowStyle() {
463 if (XrmGetResource(m_database, "window.justify", "Window.Justify", 422 if (XrmGetResource(m_database, "window.justify", "Window.Justify",
464 &value_type, &value)) { 423 &value_type, &value)) {
465 if (strstr(value.addr, "right") || strstr(value.addr, "Right")) 424 if (strstr(value.addr, "right") || strstr(value.addr, "Right"))
466 m_windowstyle.font.justify = DrawUtil::Font::RIGHT; 425 m_windowstyle.justify = DrawUtil::Font::RIGHT;
467 else if (strstr(value.addr, "center") || strstr(value.addr, "Center")) 426 else if (strstr(value.addr, "center") || strstr(value.addr, "Center"))
468 m_windowstyle.font.justify = DrawUtil::Font::CENTER; 427 m_windowstyle.justify = DrawUtil::Font::CENTER;
469 else 428 else
470 m_windowstyle.font.justify = DrawUtil::Font::LEFT; 429 m_windowstyle.justify = DrawUtil::Font::LEFT;
471 } else 430 } else
472 m_windowstyle.font.justify = DrawUtil::Font::LEFT; 431 m_windowstyle.justify = DrawUtil::Font::LEFT;
473 432
474} 433}
475 434
@@ -523,38 +482,29 @@ void Theme::loadTabStyle() {
523 482
524 m_windowstyle.tab.border_width_2x = m_windowstyle.tab.border_width*2; 483 m_windowstyle.tab.border_width_2x = m_windowstyle.tab.border_width*2;
525 484
526 //---------- font 485 loadFontFromDatabase(m_windowstyle.tab.font, "window.tab.font", "Window.Tab.Font");
527
528 if (I18n::instance()->multibyte()) {
529 readDatabaseFontSet("window.tab.font", "Window.Tab.Font",
530 &m_windowstyle.tab.font.set);
531
532 m_windowstyle.tab.font.set_extents =
533 XExtentsOfFontSet(m_windowstyle.tab.font.set);
534 } else {
535 readDatabaseFont("window.tab.font", "Window.Tab.Font",
536 &m_windowstyle.tab.font.fontstruct);
537 }
538 486
487 //TODO: fix rotated font
539 //--------- rotated font for left and right tabs 488 //--------- rotated font for left and right tabs
540 // TODO: add extra checking 489 // TODO: add extra checking
541 if (XrmGetResource(m_database, "window.tab.font", "Window.Tab.Font", 490 /*if (XrmGetResource(m_database, "window.tab.font", "Window.Tab.Font",
542 &value_type, &value)) { 491 &value_type, &value)) {
543 if (! (m_windowstyle.tab.rot_font = DrawUtil::XRotLoadFont(m_display, value.addr, 90.0)) ) 492 if (! (m_windowstyle.tab.rot_font = DrawUtil::XRotLoadFont(m_display, value.addr, 90.0)) )
544 m_windowstyle.tab.rot_font = DrawUtil::XRotLoadFont(m_display, "fixed", 90); 493 m_windowstyle.tab.rot_font = DrawUtil::XRotLoadFont(m_display, "fixed", 90);
545 } else 494 } else
546 m_windowstyle.tab.rot_font = DrawUtil::XRotLoadFont(m_display, "fixed", 90); 495 m_windowstyle.tab.rot_font = DrawUtil::XRotLoadFont(m_display, "fixed", 90);
496 */
547 497
548 if (XrmGetResource(m_database, "window.tab.justify", "Window.Tab.Justify", 498 if (XrmGetResource(m_database, "window.tab.justify", "Window.Tab.Justify",
549 &value_type, &value)) { 499 &value_type, &value)) {
550 if (strstr(value.addr, "right") || strstr(value.addr, "Right")) 500 if (strstr(value.addr, "right") || strstr(value.addr, "Right"))
551 m_windowstyle.tab.font.justify = DrawUtil::Font::RIGHT; 501 m_windowstyle.tab.justify = DrawUtil::Font::RIGHT;
552 else if (strstr(value.addr, "center") || strstr(value.addr, "Center")) 502 else if (strstr(value.addr, "center") || strstr(value.addr, "Center"))
553 m_windowstyle.tab.font.justify = DrawUtil::Font::CENTER; 503 m_windowstyle.tab.justify = DrawUtil::Font::CENTER;
554 else 504 else
555 m_windowstyle.tab.font.justify = DrawUtil::Font::LEFT; 505 m_windowstyle.tab.justify = DrawUtil::Font::LEFT;
556 } else 506 } else
557 m_windowstyle.tab.font.justify = DrawUtil::Font::LEFT; 507 m_windowstyle.tab.justify = DrawUtil::Font::LEFT;
558 508
559} 509}
560 510
@@ -920,8 +870,6 @@ void Theme::reconfigure(bool antialias) {
920 870
921 XGCValues gcv; 871 XGCValues gcv;
922 unsigned long gc_value_mask = GCForeground; 872 unsigned long gc_value_mask = GCForeground;
923 if (! I18n::instance()->multibyte())
924 gc_value_mask |= GCFont;
925 873
926 XChangeGC(m_display, m_opgc, 874 XChangeGC(m_display, m_opgc,
927 GCForeground | GCFunction | GCSubwindowMode, &gcv); 875 GCForeground | GCFunction | GCSubwindowMode, &gcv);
@@ -933,8 +881,8 @@ void Theme::reconfigure(bool antialias) {
933 GCForeground | GCFunction | GCSubwindowMode, &gcv); 881 GCForeground | GCFunction | GCSubwindowMode, &gcv);
934 882
935 gcv.foreground = m_windowstyle.l_text_focus.pixel(); 883 gcv.foreground = m_windowstyle.l_text_focus.pixel();
936 if (m_windowstyle.font.fontstruct) 884 if (m_windowstyle.font.isAntialias() != antialias)
937 gcv.font = m_windowstyle.font.fontstruct->fid; 885 m_windowstyle.font.setAntialias(antialias);
938 886
939 XChangeGC(m_display, m_windowstyle.l_text_focus_gc, 887 XChangeGC(m_display, m_windowstyle.l_text_focus_gc,
940 gc_value_mask, &gcv); 888 gc_value_mask, &gcv);
@@ -945,9 +893,8 @@ void Theme::reconfigure(bool antialias) {
945 893
946 //---- Tab 894 //---- Tab
947 gcv.foreground = m_windowstyle.tab.l_text_focus.pixel(); 895 gcv.foreground = m_windowstyle.tab.l_text_focus.pixel();
948 if (m_windowstyle.tab.font.fontstruct) 896 if (m_windowstyle.tab.font.isAntialias() != antialias)
949 gcv.font = m_windowstyle.tab.font.fontstruct->fid; 897 m_windowstyle.tab.font.setAntialias(antialias);
950
951 XChangeGC(m_display, m_windowstyle.tab.l_text_focus_gc, 898 XChangeGC(m_display, m_windowstyle.tab.l_text_focus_gc,
952 gc_value_mask, &gcv); 899 gc_value_mask, &gcv);
953 900
@@ -970,7 +917,7 @@ void Theme::reconfigure(bool antialias) {
970 m_menustyle.titlefont.setAntialias(antialias); 917 m_menustyle.titlefont.setAntialias(antialias);
971 918
972 XChangeGC(m_display, m_menustyle.t_text_gc, 919 XChangeGC(m_display, m_menustyle.t_text_gc,
973 gc_value_mask, &gcv); 920 gc_value_mask|GCForeground, &gcv);
974 921
975 gcv.foreground = m_menustyle.f_text.pixel(); 922 gcv.foreground = m_menustyle.f_text.pixel();
976 if (m_menustyle.framefont.isAntialias() != antialias) 923 if (m_menustyle.framefont.isAntialias() != antialias)
@@ -994,7 +941,8 @@ void Theme::reconfigure(bool antialias) {
994 gcv.foreground = m_toolbarstyle.l_text.pixel(); 941 gcv.foreground = m_toolbarstyle.l_text.pixel();
995 if (m_toolbarstyle.font.fontstruct) 942 if (m_toolbarstyle.font.fontstruct)
996 gcv.font = m_toolbarstyle.font.fontstruct->fid; 943 gcv.font = m_toolbarstyle.font.fontstruct->fid;
997 944
945 gc_value_mask |= GCFont;
998 XChangeGC(m_display, m_toolbarstyle.l_text_gc, 946 XChangeGC(m_display, m_toolbarstyle.l_text_gc,
999 gc_value_mask, &gcv); 947 gc_value_mask, &gcv);
1000 948
@@ -1138,7 +1086,8 @@ void Theme::loadFontFromDatabase(FbTk::Font &dest, const char *name, const char
1138#ifdef DEBUG 1086#ifdef DEBUG
1139 std::cerr<<__FILE__<<"("<<__LINE__<<"): Load font:"<<value.addr<<std::endl; 1087 std::cerr<<__FILE__<<"("<<__LINE__<<"): Load font:"<<value.addr<<std::endl;
1140#endif // DEBUG 1088#endif // DEBUG
1141 dest.load(value.addr); 1089 if (!dest.load(value.addr))
1090 cerr<<"Failed to load font: "<<value.addr<<endl;
1142 } 1091 }
1143 1092
1144 1093
diff --git a/src/Theme.hh b/src/Theme.hh
index fa1dabe..3ab4f27 100644
--- a/src/Theme.hh
+++ b/src/Theme.hh
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Theme.hh,v 1.15 2002/10/15 10:52:18 fluxgen Exp $ 25// $Id: Theme.hh,v 1.16 2002/10/15 17:07:32 fluxgen Exp $
26 26
27#ifndef THEME_HH 27#ifndef THEME_HH
28#define THEME_HH 28#define THEME_HH
@@ -59,12 +59,14 @@ public:
59 int bullet, bullet_pos; 59 int bullet, bullet_pos;
60 } MenuStyle; 60 } MenuStyle;
61 61
62 typedef struct LabelStyle 62 typedef struct LabelStyle {
63 { 63 LabelStyle(const char *fontname="fixed"):font(fontname) { }
64
64 FbTk::Texture l_focus, l_unfocus, 65 FbTk::Texture l_focus, l_unfocus,
65 t_focus, t_unfocus; 66 t_focus, t_unfocus;
66 GC l_text_focus_gc, l_text_unfocus_gc; 67 GC l_text_focus_gc, l_text_unfocus_gc;
67 DrawUtil::Font font; 68 FbTk::Font font;
69 DrawUtil::Font::FontJustify justify;
68 FbTk::Color l_text_focus, l_text_unfocus; 70 FbTk::Color l_text_focus, l_text_unfocus;
69 } LabelStyle; 71 } LabelStyle;
70 72
diff --git a/src/Window.cc b/src/Window.cc
index 438cfb4..f5aac4c 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Window.cc,v 1.88 2002/10/13 21:54:36 fluxgen Exp $ 25// $Id: Window.cc,v 1.89 2002/10/15 17:17:00 fluxgen Exp $
26 26
27#include "Window.hh" 27#include "Window.hh"
28 28
@@ -1014,15 +1014,7 @@ void FluxboxWindow::reconfigure() {
1014 screen->getBorderWidth(); 1014 screen->getBorderWidth();
1015 1015
1016 if (getTitle().size() > 0) { 1016 if (getTitle().size() > 0) {
1017 if (I18n::instance()->multibyte()) { 1017 client.title_text_w = screen->getWindowStyle()->font.textWidth(getTitle().c_str(), getTitle().size());
1018 XRectangle ink, logical;
1019 XmbTextExtents(screen->getWindowStyle()->font.set,
1020 getTitle().c_str(), getTitle().size(), &ink, &logical);
1021 client.title_text_w = logical.width;
1022 } else {
1023 client.title_text_w = XTextWidth(screen->getWindowStyle()->font.fontstruct,
1024 getTitle().c_str(), getTitle().size());
1025 }
1026 1018
1027 client.title_text_w += (frame.bevel_w * 4); 1019 client.title_text_w += (frame.bevel_w * 4);
1028 } 1020 }
@@ -1121,17 +1113,8 @@ void FluxboxWindow::getWMName() {
1121 FBNLS::WindowSet, FBNLS::WindowUnnamed, 1113 FBNLS::WindowSet, FBNLS::WindowUnnamed,
1122 "Unnamed"); 1114 "Unnamed");
1123 } 1115 }
1124 1116 //Note: repeated?
1125 if (i18n->multibyte()) { 1117 client.title_text_w = screen->getWindowStyle()->font.textWidth(getTitle().c_str(), getTitle().size());
1126 XRectangle ink, logical;
1127 XmbTextExtents(screen->getWindowStyle()->font.set,
1128 getTitle().c_str(), getTitle().size(), &ink, &logical);
1129 client.title_text_w = logical.width;
1130 } else {
1131 client.title_text_w = XTextWidth(screen->getWindowStyle()->font.fontstruct,
1132 getTitle().c_str(), getTitle().size());
1133 }
1134
1135 client.title_text_w += (frame.bevel_w * 4); 1118 client.title_text_w += (frame.bevel_w * 4);
1136 1119
1137} 1120}
@@ -2445,15 +2428,18 @@ void FluxboxWindow::redrawLabel() {
2445 XSetWindowBackground(display, frame.label, frame.ulabel_pixel); 2428 XSetWindowBackground(display, frame.label, frame.ulabel_pixel);
2446 } 2429 }
2447 2430
2431 XClearWindow(display, frame.label);
2432
2448 //no need to draw the title if we don't have any 2433 //no need to draw the title if we don't have any
2449 if (getTitle().size()!=0) { 2434 if (getTitle().size() != 0) {
2450 GC gc = ((focused) ? screen->getWindowStyle()->l_text_focus_gc : 2435 GC gc = ((focused) ? screen->getWindowStyle()->l_text_focus_gc :
2451 screen->getWindowStyle()->l_text_unfocus_gc); 2436 screen->getWindowStyle()->l_text_unfocus_gc);
2452 2437 screen->getWindowStyle()->font.drawText(
2453 DrawUtil::DrawString(display, frame.label, gc, 2438 frame.label,
2454 &screen->getWindowStyle()->font, 2439 screen->getScreenNumber(),
2455 client.title_text_w, frame.label_w, 2440 gc,
2456 frame.bevel_w, getTitle().c_str()); 2441 getTitle().c_str(), getTitle().size(),
2442 frame.bevel_w, frame.bevel_w + screen->getWindowStyle()->font.height());
2457 } 2443 }
2458} 2444}
2459 2445
@@ -3633,14 +3619,8 @@ void FluxboxWindow::upsize() {
3633 frame.bevel_w = screen->getBevelWidth(); 3619 frame.bevel_w = screen->getBevelWidth();
3634 frame.mwm_border_w = screen->getFrameWidth() * decorations.border; 3620 frame.mwm_border_w = screen->getFrameWidth() * decorations.border;
3635 3621
3636 if (I18n::instance()->multibyte()) { 3622 frame.title_h = screen->getWindowStyle()->font.height() +
3637 frame.title_h = (screen->getWindowStyle()->font.set_extents-> 3623 (frame.bevel_w*2 + 2)*decorations.titlebar;
3638 max_ink_extent.height +
3639 (frame.bevel_w * 2) + 2) * decorations.titlebar;
3640 } else
3641 frame.title_h = (screen->getWindowStyle()->font.fontstruct->ascent +
3642 screen->getWindowStyle()->font.fontstruct->descent +
3643 (frame.bevel_w * 2) + 2) * decorations.titlebar;
3644 3624
3645 frame.label_h = (frame.title_h - (frame.bevel_w * 2)) * decorations.titlebar; 3625 frame.label_h = (frame.title_h - (frame.bevel_w * 2)) * decorations.titlebar;
3646 frame.button_w = frame.button_h = frame.label_h - 2; 3626 frame.button_w = frame.button_h = frame.label_h - 2;