1 diff -Naur ../work/ion-3/de/brush.c ion-3ds-20070203/de/brush.c
2 --- ../work/ion-3/de/brush.c 2007-02-03 17:50:52.000000000 +0300
3 +++ ion-3ds-20070203/de/brush.c 2007-02-21 13:11:57.000000000 +0300
6 gr_stylespec_init(&brush->current_attr);
13 if(!grbrush_init(&(brush->grbrush))){
16 destyle_unref(brush->d);
19 + if(brush->draw!=NULL)
20 + XftDrawDestroy(brush->draw);
22 gr_stylespec_unalloc(&brush->current_attr);
23 grbrush_deinit(&(brush->grbrush));
30 +XftDraw *debrush_get_draw(DEBrush *brush, Drawable d)
32 + if(brush->draw==NULL)
33 + brush->draw=XftDrawCreate(ioncore_g.dpy, d,
34 + XftDEDefaultVisual(),
35 + DefaultColormap(ioncore_g.dpy,
38 + XftDrawChange(brush->draw, d);
47 diff -Naur ../work/ion-3/de/brush.h ion-3ds-20070203/de/brush.h
48 --- ../work/ion-3/de/brush.h 2007-02-03 17:50:52.000000000 +0300
49 +++ ion-3ds-20070203/de/brush.h 2007-02-21 13:11:57.000000000 +0300
51 #include <ioncore/common.h>
52 #include <ioncore/gr.h>
53 #include <ioncore/rectangle.h>
55 +#include <X11/Xft/Xft.h>
67 DEBrushExtrasFn *extras_fn;
71 extern void debrush_fill_area(DEBrush *brush, const WRectangle *geom);
72 extern void debrush_clear_area(DEBrush *brush, const WRectangle *geom);
75 +XftDraw *debrush_get_draw(DEBrush *brush, Drawable d);
78 #endif /* ION_DE_BRUSH_H */
79 diff -Naur ../work/ion-3/de/colour.c ion-3ds-20070203/de/colour.c
80 --- ../work/ion-3/de/colour.c 2007-02-03 17:50:52.000000000 +0300
81 +++ ion-3ds-20070203/de/colour.c 2007-02-21 13:11:57.000000000 +0300
84 bool de_alloc_colour(WRootWin *rootwin, DEColour *ret, const char *name)
92 + return XftColorAllocName(
94 + XftDEDefaultVisual(),
95 + rootwin->default_cmap,
112 bool de_duplicate_colour(WRootWin *rootwin, DEColour in, DEColour *out)
117 XQueryColor(ioncore_g.dpy, rootwin->default_cmap, &c);
123 + return XftColorAllocName(
125 + XftDEDefaultVisual(),
126 + rootwin->default_cmap,
133 void de_free_colour_group(WRootWin *rootwin, DEColourGroup *cg)
140 XFreeColors(ioncore_g.dpy, rootwin->default_cmap, pixels, 5, 0);
142 gr_stylespec_unalloc(&cg->spec);
144 + de_free_colour(rootwin, cg->bg);
145 + de_free_colour(rootwin, cg->fg);
146 + de_free_colour(rootwin, cg->hl);
147 + de_free_colour(rootwin, cg->sh);
148 + de_free_colour(rootwin, cg->pad);
153 void de_free_colour(WRootWin *rootwin, DEColour col)
160 XFreeColors(ioncore_g.dpy, rootwin->default_cmap, pixels, 1, 0);
162 + XftColorFree(ioncore_g.dpy, XftDEDefaultVisual(), rootwin->default_cmap, &col);
166 diff -Naur ../work/ion-3/de/colour.h ion-3ds-20070203/de/colour.h
167 --- ../work/ion-3/de/colour.h 2007-02-03 17:50:52.000000000 +0300
168 +++ ion-3ds-20070203/de/colour.h 2007-02-21 13:11:57.000000000 +0300
170 #include <ioncore/common.h>
171 #include <ioncore/global.h>
172 #include <ioncore/rootwin.h>
174 +#include <X11/Xft/Xft.h>
178 INTRSTRUCT(DEColourGroup);
182 typedef unsigned long DEColour;
184 +typedef XftColor DEColour;
188 DECLSTRUCT(DEColourGroup){
190 bool de_duplicate_colour(WRootWin *rootwin, DEColour in, DEColour *out);
191 void de_free_colour_group(WRootWin *rootwin, DEColourGroup *cg);
192 void de_free_colour(WRootWin *rootwin, DEColour col);
193 +#define XftDEDefaultVisual() DefaultVisual(ioncore_g.dpy, 0)
195 #endif /* ION_DE_COLOUR_H */
196 diff -Naur ../work/ion-3/de/draw.c ion-3ds-20070203/de/draw.c
197 --- ../work/ion-3/de/draw.c 2007-02-03 17:50:52.000000000 +0300
198 +++ ion-3ds-20070203/de/draw.c 2007-02-21 13:11:57.000000000 +0300
200 #include <X11/extensions/shape.h>
206 +#define PIXEL(x) x.pixel
211 /*{{{ Colour group lookup */
218 - XSetForeground(ioncore_g.dpy, gc, tlc);
220 + XSetForeground(ioncore_g.dpy, gc, PIXEL(tlc));
226 XDrawLines(ioncore_g.dpy, win, gc, points, 3, CoordModeOrigin);
230 - XSetForeground(ioncore_g.dpy, gc, brc);
231 + XSetForeground(ioncore_g.dpy, gc, PIXEL(brc));
235 @@ -143,23 +143,23 @@
238 if(line==GR_BORDERLINE_LEFT && geom->h>0 && tl>0){
239 - XSetForeground(ioncore_g.dpy, gc, tlc);
240 - XSetBackground(ioncore_g.dpy, gc, tlc);
241 + XSetForeground(ioncore_g.dpy, gc, PIXEL(tlc));
242 + XSetBackground(ioncore_g.dpy, gc, PIXEL(tlc));
243 XFillRectangle(ioncore_g.dpy, win, gc, geom->x, geom->y, tl, geom->h);
245 }else if(line==GR_BORDERLINE_TOP && geom->w>0 && tl>0){
246 - XSetForeground(ioncore_g.dpy, gc, tlc);
247 - XSetBackground(ioncore_g.dpy, gc, tlc);
248 + XSetForeground(ioncore_g.dpy, gc, PIXEL(tlc));
249 + XSetBackground(ioncore_g.dpy, gc, PIXEL(tlc));
250 XFillRectangle(ioncore_g.dpy, win, gc, geom->x, geom->y, geom->w, tl);
252 }else if(line==GR_BORDERLINE_RIGHT && geom->h>0 && br>0){
253 - XSetForeground(ioncore_g.dpy, gc, brc);
254 - XSetBackground(ioncore_g.dpy, gc, brc);
255 + XSetForeground(ioncore_g.dpy, gc, PIXEL(brc));
256 + XSetBackground(ioncore_g.dpy, gc, PIXEL(brc));
257 XFillRectangle(ioncore_g.dpy, win, gc, geom->x+geom->w-br, geom->y, br, geom->h);
259 }else if(line==GR_BORDERLINE_BOTTOM && geom->w>0 && br>0){
260 - XSetForeground(ioncore_g.dpy, gc, brc);
261 - XSetBackground(ioncore_g.dpy, gc, brc);
262 + XSetForeground(ioncore_g.dpy, gc, PIXEL(brc));
263 + XSetBackground(ioncore_g.dpy, gc, PIXEL(brc));
264 XFillRectangle(ioncore_g.dpy, win, gc, geom->x, geom->y+geom->h-br, geom->w, br);
270 if(ISSET(a2, GR_ATTR(tagged)) || ISSET(a1, GR_ATTR(tagged))){
271 - XSetForeground(ioncore_g.dpy, d->copy_gc, cg->fg);
272 + XSetForeground(ioncore_g.dpy, d->copy_gc, PIXEL(cg->fg));
274 copy_masked(brush, d->tag_pixmap, brush->win, 0, 0,
275 d->tag_pixmap_w, d->tag_pixmap_h,
277 GC gc=brush->d->normal_gc;
279 if(TRUE/*needfill*/){
280 - XSetForeground(ioncore_g.dpy, gc, cg->bg);
281 + XSetForeground(ioncore_g.dpy, gc, PIXEL(cg->bg));
282 XFillRectangle(ioncore_g.dpy, brush->win, gc, geom->x, geom->y,
286 attr.background_pixmap=ParentRelative;
288 attrflags=CWBackPixel;
289 - attr.background_pixel=brush->d->cgrp.bg;
290 + attr.background_pixel=brush->d->PIXEL(cgrp.bg);
293 XChangeWindowAttributes(ioncore_g.dpy, brush->win, attrflags, &attr);
298 - XSetForeground(ioncore_g.dpy, gc, cg->bg);
299 + XSetForeground(ioncore_g.dpy, gc, PIXEL(cg->bg));
300 XFillRectangle(ioncore_g.dpy, brush->win, gc,
301 geom->x, geom->y, geom->w, geom->h);
303 diff -Naur ../work/ion-3/de/font.c ion-3ds-20070203/de/font.c
304 --- ../work/ion-3/de/font.c 2007-02-03 17:50:52.000000000 +0300
305 +++ ion-3ds-20070203/de/font.c 2007-02-21 13:11:57.000000000 +0300
307 #include <libtu/objp.h>
308 #include <ioncore/common.h>
318 DEFont *de_load_font(const char *fontname)
324 XFontSet fontset=NULL;
325 XFontStruct *fontstruct=NULL;
331 if(ioncore_g.use_mb){
332 fontset=de_create_font_set(fontname);
339 + if(strncmp(fontname, "xft:", 4)==0){
340 + font=XftFontOpenName(ioncore_g.dpy, DefaultScreen(ioncore_g.dpy),
343 + font=XftFontOpenXlfd(ioncore_g.dpy, DefaultScreen(ioncore_g.dpy), fontname);
347 + if(strcmp(fontname, CF_FALLBACK_FONT_NAME)!=0){
348 + warn(TR("Could not load font \"%s\", trying \"%s\""),
349 + fontname, CF_FALLBACK_FONT_NAME);
350 + return de_load_font(CF_FALLBACK_FONT_NAME);
361 fnt->fontset=fontset;
362 fnt->fontstruct=fontstruct;
366 fnt->pattern=scopy(fontname);
374 if(style->font->fontstruct!=NULL){
375 XSetFont(ioncore_g.dpy, style->normal_gc,
376 style->font->fontstruct->fid);
383 @@ -111,11 +140,13 @@
384 if(style->font==NULL)
388 if(style->font->fontstruct!=NULL){
389 XSetFont(ioncore_g.dpy, style->normal_gc,
390 style->font->fontstruct->fid);
397 @@ -125,10 +156,15 @@
398 if(--font->refcount!=0)
402 if(font->fontset!=NULL)
403 XFreeFontSet(ioncore_g.dpy, font->fontset);
404 if(font->fontstruct!=NULL)
405 XFreeFont(ioncore_g.dpy, font->fontstruct);
407 + if(font->font!=NULL)
408 + XftFontClose(ioncore_g.dpy, font->font);
410 if(font->pattern!=NULL)
415 void defont_get_font_extents(DEFont *font, GrFontExtents *fnte)
418 if(font->fontset!=NULL){
419 XFontSetExtents *ext=XExtentsOfFontSet(font->fontset);
422 fnte->baseline=fnt->ascent;
427 + if(font->font!=NULL){
428 + fnte->max_height=font->font->ascent+font->font->descent;
429 + fnte->max_width=font->font->max_advance_width;
430 + fnte->baseline=font->font->ascent;
435 DE_RESET_FONT_EXTENTS(fnte);
437 @@ -188,20 +232,35 @@
439 uint defont_get_text_width(DEFont *font, const char *text, uint len)
442 if(font->fontset!=NULL){
444 #ifdef CF_DE_USE_XUTF8
445 - if(ioncore_g.enc_utf8)
446 - Xutf8TextExtents(font->fontset, text, len, NULL, &lext);
448 + if(ioncore_g.enc_utf8)
449 + Xutf8TextExtents(font->fontset, text, len, NULL, &lext);
452 - XmbTextExtents(font->fontset, text, len, NULL, &lext);
454 + XmbTextExtents(font->fontset, text, len, NULL, &lext);
456 }else if(font->fontstruct!=NULL){
457 return XTextWidth(font->fontstruct, text, len);
462 + if(font->font!=NULL){
463 + XGlyphInfo extents;
464 + if(ioncore_g.enc_utf8)
465 + XftTextExtentsUtf8(ioncore_g.dpy, font->font, (XftChar8 *)text, len,
468 + XftTextExtents8(ioncore_g.dpy, font->font, (XftChar8 *)text, len,
470 + return extents.xOff;
479 /*{{{ String drawing */
483 void debrush_do_draw_string_default(DEBrush *brush, int x, int y,
484 const char *str, int len, bool needfill,
485 DEColourGroup *colours)
491 +void debrush_do_draw_string_default(DEBrush *brush,
492 + int x, int y, const char *str,
493 + int len, bool needfill,
494 + DEColourGroup *colours)
496 + Window win = brush->win;
497 + GC gc=brush->d->normal_gc;
501 + if(brush->d->font==NULL)
504 + font=brush->d->font->font;
505 + draw=debrush_get_draw(brush, win);
508 + XGlyphInfo extents;
509 + if(ioncore_g.enc_utf8)
510 + XftTextExtentsUtf8(ioncore_g.dpy, font, (XftChar8 *)str, len,
513 + XftTextExtents8(ioncore_g.dpy, font, (XftChar8 *)str, len, &extents);
514 + XftDrawRect(draw, &(colours->bg), x-extents.x, y-extents.y,
515 + extents.width+10, extents.height);
518 + if(ioncore_g.enc_utf8)
519 + XftDrawStringUtf8(draw, &(colours->fg), font, x, y, (XftChar8 *)str,
522 + XftDrawString8(draw, &(colours->fg), font, x, y, (XftChar8 *)str, len);
526 void debrush_do_draw_string(DEBrush *brush, int x, int y,
527 const char *str, int len, bool needfill,
528 diff -Naur ../work/ion-3/de/font.h ion-3ds-20070203/de/font.h
529 --- ../work/ion-3/de/font.h 2007-02-03 17:50:52.000000000 +0300
530 +++ ion-3ds-20070203/de/font.h 2007-02-21 13:11:57.000000000 +0300
533 #include <ioncore/common.h>
534 #include <ioncore/gr.h>
536 +#include <X11/Xft/Xft.h>
544 XFontStruct *fontstruct;
545 +#ifdef XFT /* XFT */
551 diff -Naur ../work/ion-3/de/init.c ion-3ds-20070203/de/init.c
552 --- ../work/ion-3/de/init.c 2007-02-03 17:50:52.000000000 +0300
553 +++ ion-3ds-20070203/de/init.c 2007-02-21 13:11:57.000000000 +0300
554 @@ -165,17 +165,26 @@
559 + DEColour black, white;
562 + de_alloc_colour(rootwin, &black, "black");
563 + de_alloc_colour(rootwin, &white, "white");
565 + black=DE_BLACK(rootwin);
566 + white=DE_WHITE(rootwin);
569 de_get_colour(rootwin, &(cg->hl), tab, "highlight_colour",
570 - (based_on ? based_on->cgrp.hl : DE_WHITE(rootwin)));
571 + (based_on ? based_on->cgrp.hl : white));
572 de_get_colour(rootwin, &(cg->sh), tab, "shadow_colour",
573 - (based_on ? based_on->cgrp.sh : DE_WHITE(rootwin)));
574 + (based_on ? based_on->cgrp.sh : white));
575 de_get_colour(rootwin, &(cg->fg), tab, "foreground_colour",
576 - (based_on ? based_on->cgrp.fg : DE_WHITE(rootwin)));
577 + (based_on ? based_on->cgrp.fg : white));
578 bgset=de_get_colour(rootwin, &(cg->bg), tab, "background_colour",
579 - (based_on ? based_on->cgrp.bg : DE_BLACK(rootwin)));
580 + (based_on ? based_on->cgrp.bg : black));
582 - padinh=(based_on ? based_on->cgrp.pad : DE_WHITE(rootwin));
583 + padinh=(based_on ? based_on->cgrp.pad : white);
585 de_get_colour_(rootwin, &(cg->pad), tab, "padding_colour",
586 (bgset ? cg->bg : padinh), padinh);
587 diff -Naur ../work/ion-3/de/style.c ion-3ds-20070203/de/style.c
588 --- ../work/ion-3/de/style.c 2007-02-03 17:50:52.000000000 +0300
589 +++ ion-3ds-20070203/de/style.c 2007-02-21 13:11:57.000000000 +0300
591 /*gcv.function=GXclear;*/
592 gcv.stipple=stipple_pixmap;
593 gcvmask=GCFillStyle|GCStipple/*|GCFunction*/;
595 if(style->font!=NULL && style->font->fontstruct!=NULL){
596 gcv.font=style->font->fontstruct->fid;
600 +// if(style->font!=NULL){
601 +// gcv.font=style->font;
606 style->stipple_gc=XCreateGC(dpy, root, gcvmask, &gcv);
607 XCopyGC(dpy, style->normal_gc,
610 bool destyle_init(DEStyle *style, WRootWin *rootwin, const char *name)
612 + DEColour black, white;
614 + de_alloc_colour(rootwin, &black, "black");
615 + de_alloc_colour(rootwin, &white, "white");
617 + black=DE_BLACK(rootwin);
618 + white=DE_WHITE(rootwin);
620 if(!gr_stylespec_load(&style->spec, name))
623 @@ -226,11 +241,11 @@
624 style->textalign=DEALIGN_CENTER;
626 style->cgrp_alloced=FALSE;
627 - style->cgrp.bg=DE_BLACK(rootwin);
628 - style->cgrp.pad=DE_BLACK(rootwin);
629 - style->cgrp.fg=DE_WHITE(rootwin);
630 - style->cgrp.hl=DE_WHITE(rootwin);
631 - style->cgrp.sh=DE_WHITE(rootwin);
632 + style->cgrp.bg=black;
633 + style->cgrp.pad=black;
634 + style->cgrp.fg=white;
635 + style->cgrp.hl=white;
636 + style->cgrp.sh=white;
637 gr_stylespec_init(&style->cgrp.spec);
640 diff -Naur ../work/ion-3/de/style.h ion-3ds-20070203/de/style.h
641 --- ../work/ion-3/de/style.h 2007-02-03 17:50:52.000000000 +0300
642 +++ ion-3ds-20070203/de/style.h 2007-02-21 13:11:57.000000000 +0300
649 DEStyle *next, *prev;
651 --- ../work/ion-3/system.mk 2007-05-10 22:45:16.000000000 +0400
652 +++ ion-3ds-20070203/system.mk 2007-05-10 22:45:07.000000000 +0400
654 #EXTRA_LIBS += -lintl
664 +EXTRA_INCLUDES += `xft-config --cflags` -DXFT
665 +EXTRA_LIBS += `xft-config --libs`