Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 136077 | Differences between
and this patch

Collapse All | Expand All

(-)../work/ion-3/de/brush.c (+22 lines)
Lines 47-52 Link Here
47
    
47
    
48
    gr_stylespec_init(&brush->current_attr);
48
    gr_stylespec_init(&brush->current_attr);
49
    
49
    
50
#ifdef XFT
51
    brush->draw=NULL;
52
#endif /* XFT */
50
    style->usecount++;
53
    style->usecount++;
51
54
52
    if(!grbrush_init(&(brush->grbrush))){
55
    if(!grbrush_init(&(brush->grbrush))){
Lines 127-132 Link Here
127
{
130
{
128
    destyle_unref(brush->d);
131
    destyle_unref(brush->d);
129
    brush->d=NULL;
132
    brush->d=NULL;
133
#ifdef XFT
134
    if(brush->draw!=NULL)
135
	    XftDrawDestroy(brush->draw);
136
#endif /* XFT */
130
    gr_stylespec_unalloc(&brush->current_attr);
137
    gr_stylespec_unalloc(&brush->current_attr);
131
    grbrush_deinit(&(brush->grbrush));
138
    grbrush_deinit(&(brush->grbrush));
132
}
139
}
Lines 138-143 Link Here
138
}
145
}
139
146
140
147
148
#ifdef XFT
149
XftDraw *debrush_get_draw(DEBrush *brush, Drawable d)
150
{
151
	if(brush->draw==NULL)
152
		brush->draw=XftDrawCreate(ioncore_g.dpy, d,
153
					  XftDEDefaultVisual(),
154
					  DefaultColormap(ioncore_g.dpy,
155
							  0));
156
	else
157
		XftDrawChange(brush->draw, d);
158
159
	return brush->draw;
160
}
161
#endif
162
141
/*}}}*/
163
/*}}}*/
142
164
143
165
(-)../work/ion-3/de/brush.h (+9 lines)
Lines 17-22 Link Here
17
#include <ioncore/common.h>
17
#include <ioncore/common.h>
18
#include <ioncore/gr.h>
18
#include <ioncore/gr.h>
19
#include <ioncore/rectangle.h>
19
#include <ioncore/rectangle.h>
20
#ifdef XFT
21
#include <X11/Xft/Xft.h>
22
#endif /* XFT */
20
23
21
INTRCLASS(DEBrush);
24
INTRCLASS(DEBrush);
22
25
Lines 36-41 Link Here
36
DECLCLASS(DEBrush){
39
DECLCLASS(DEBrush){
37
    GrBrush grbrush;
40
    GrBrush grbrush;
38
    DEStyle *d;
41
    DEStyle *d;
42
#ifdef XFT
43
    XftDraw *draw;
44
#endif
39
    DEBrushExtrasFn *extras_fn;
45
    DEBrushExtrasFn *extras_fn;
40
    int indicator_w;
46
    int indicator_w;
41
    Window win;
47
    Window win;
Lines 111-115 Link Here
111
extern void debrush_fill_area(DEBrush *brush, const WRectangle *geom);
117
extern void debrush_fill_area(DEBrush *brush, const WRectangle *geom);
112
extern void debrush_clear_area(DEBrush *brush, const WRectangle *geom);
118
extern void debrush_clear_area(DEBrush *brush, const WRectangle *geom);
113
119
120
#ifdef XFT
121
XftDraw *debrush_get_draw(DEBrush *brush, Drawable d);
122
#endif
114
123
115
#endif /* ION_DE_BRUSH_H */
124
#endif /* ION_DE_BRUSH_H */
(-)../work/ion-3/de/colour.c (+34 lines)
Lines 15-23 Link Here
15
15
16
bool de_alloc_colour(WRootWin *rootwin, DEColour *ret, const char *name)
16
bool de_alloc_colour(WRootWin *rootwin, DEColour *ret, const char *name)
17
{
17
{
18
#ifndef XFT
18
    XColor c;
19
    XColor c;
19
    bool ok=FALSE;
20
    bool ok=FALSE;
21
#else /* XFT */
22
    if(name==NULL)
23
	    return FALSE;
24
    return XftColorAllocName(
25
	    ioncore_g.dpy,
26
	    XftDEDefaultVisual(),
27
	    rootwin->default_cmap,
28
	    name,
29
	    ret);
30
#endif /* XFT */
20
31
32
#ifndef XFT
21
    if(name==NULL)
33
    if(name==NULL)
22
        return FALSE;
34
        return FALSE;
23
35
Lines 28-38 Link Here
28
    }
40
    }
29
    
41
    
30
    return ok;
42
    return ok;
43
#endif /* ! XFT */
31
}
44
}
32
45
33
46
34
bool de_duplicate_colour(WRootWin *rootwin, DEColour in, DEColour *out)
47
bool de_duplicate_colour(WRootWin *rootwin, DEColour in, DEColour *out)
35
{
48
{
49
#ifndef XFT
36
    XColor c;
50
    XColor c;
37
    c.pixel=in;
51
    c.pixel=in;
38
    XQueryColor(ioncore_g.dpy, rootwin->default_cmap, &c);
52
    XQueryColor(ioncore_g.dpy, rootwin->default_cmap, &c);
Lines 41-51 Link Here
41
        return TRUE;
55
        return TRUE;
42
    }
56
    }
43
    return FALSE;
57
    return FALSE;
58
#else /* XFT */
59
    return XftColorAllocName(
60
	    ioncore_g.dpy,
61
	    XftDEDefaultVisual(),
62
	    rootwin->default_cmap,
63
	    &(in.color),
64
	    out);
65
#endif /* XFT */
44
}
66
}
45
67
46
68
47
void de_free_colour_group(WRootWin *rootwin, DEColourGroup *cg)
69
void de_free_colour_group(WRootWin *rootwin, DEColourGroup *cg)
48
{
70
{
71
#ifndef XFT
49
    DEColour pixels[5];
72
    DEColour pixels[5];
50
    
73
    
51
    pixels[0]=cg->bg;
74
    pixels[0]=cg->bg;
Lines 57-71 Link Here
57
    XFreeColors(ioncore_g.dpy, rootwin->default_cmap, pixels, 5, 0);
80
    XFreeColors(ioncore_g.dpy, rootwin->default_cmap, pixels, 5, 0);
58
    
81
    
59
    gr_stylespec_unalloc(&cg->spec);
82
    gr_stylespec_unalloc(&cg->spec);
83
#else /* XFT */
84
    de_free_colour(rootwin, cg->bg);
85
    de_free_colour(rootwin, cg->fg);
86
    de_free_colour(rootwin, cg->hl);
87
    de_free_colour(rootwin, cg->sh);
88
    de_free_colour(rootwin, cg->pad);
89
#endif /* XFT */
60
}
90
}
61
91
62
92
63
void de_free_colour(WRootWin *rootwin, DEColour col)
93
void de_free_colour(WRootWin *rootwin, DEColour col)
64
{
94
{
95
#ifndef XFT
65
    DEColour pixels[1];
96
    DEColour pixels[1];
66
    
97
    
67
    pixels[0]=col;
98
    pixels[0]=col;
68
    
99
    
69
    XFreeColors(ioncore_g.dpy, rootwin->default_cmap, pixels, 1, 0);
100
    XFreeColors(ioncore_g.dpy, rootwin->default_cmap, pixels, 1, 0);
101
#else /* XFT */
102
    XftColorFree(ioncore_g.dpy, XftDEDefaultVisual(), rootwin->default_cmap, &col);
103
#endif /* XFT */
70
}
104
}
71
105
(-)../work/ion-3/de/colour.h (+8 lines)
Lines 15-26 Link Here
15
#include <ioncore/common.h>
15
#include <ioncore/common.h>
16
#include <ioncore/global.h>
16
#include <ioncore/global.h>
17
#include <ioncore/rootwin.h>
17
#include <ioncore/rootwin.h>
18
#ifdef XFT
19
#include <X11/Xft/Xft.h>
20
#endif /* XFT */
18
21
19
22
20
INTRSTRUCT(DEColourGroup);
23
INTRSTRUCT(DEColourGroup);
21
24
22
25
26
#ifndef XFT
23
typedef unsigned long DEColour;
27
typedef unsigned long DEColour;
28
#else /* XFT */
29
typedef XftColor DEColour;
30
#endif /* XFT */
24
31
25
32
26
DECLSTRUCT(DEColourGroup){
33
DECLSTRUCT(DEColourGroup){
Lines 37-41 Link Here
37
bool de_duplicate_colour(WRootWin *rootwin, DEColour in, DEColour *out);
44
bool de_duplicate_colour(WRootWin *rootwin, DEColour in, DEColour *out);
38
void de_free_colour_group(WRootWin *rootwin, DEColourGroup *cg);
45
void de_free_colour_group(WRootWin *rootwin, DEColourGroup *cg);
39
void de_free_colour(WRootWin *rootwin, DEColour col);
46
void de_free_colour(WRootWin *rootwin, DEColour col);
47
#define XftDEDefaultVisual()    DefaultVisual(ioncore_g.dpy, 0)
40
48
41
#endif /* ION_DE_COLOUR_H */
49
#endif /* ION_DE_COLOUR_H */
(-)../work/ion-3/de/draw.c (-16 / +22 lines)
Lines 22-27 Link Here
22
#include <X11/extensions/shape.h>
22
#include <X11/extensions/shape.h>
23
23
24
24
25
#ifndef XFT
26
#define PIXEL(x) x
27
#else /* XFT */
28
#define PIXEL(x) x.pixel
29
#endif /* XFT */
30
31
32
25
/*{{{ Colour group lookup */
33
/*{{{ Colour group lookup */
26
34
27
35
Lines 86-93 Link Here
86
    w--;
94
    w--;
87
    h--;
95
    h--;
88
96
89
    XSetForeground(ioncore_g.dpy, gc, tlc);
97
    XSetForeground(ioncore_g.dpy, gc, PIXEL(tlc));
90
91
    
98
    
92
    a=(br!=0);
99
    a=(br!=0);
93
    b=0;
100
    b=0;
Lines 104-112 Link Here
104
    
111
    
105
        XDrawLines(ioncore_g.dpy, win, gc, points, 3, CoordModeOrigin);
112
        XDrawLines(ioncore_g.dpy, win, gc, points, 3, CoordModeOrigin);
106
    }
113
    }
107
108
    
114
    
109
    XSetForeground(ioncore_g.dpy, gc, brc);
115
    XSetForeground(ioncore_g.dpy, gc, PIXEL(brc));
110
116
111
    a=(tl!=0);
117
    a=(tl!=0);
112
    b=0;
118
    b=0;
Lines 143-165 Link Here
143
                            GrBorderLine line)
143
                            GrBorderLine line)
144
{
144
{
145
    if(line==GR_BORDERLINE_LEFT && geom->h>0 && tl>0){
145
    if(line==GR_BORDERLINE_LEFT && geom->h>0 && tl>0){
146
        XSetForeground(ioncore_g.dpy, gc, tlc);
146
        XSetForeground(ioncore_g.dpy, gc, PIXEL(tlc));
147
        XSetBackground(ioncore_g.dpy, gc, tlc);
147
        XSetBackground(ioncore_g.dpy, gc, PIXEL(tlc));
148
        XFillRectangle(ioncore_g.dpy, win, gc, geom->x, geom->y, tl, geom->h);
148
        XFillRectangle(ioncore_g.dpy, win, gc, geom->x, geom->y, tl, geom->h);
149
        geom->x+=tl;
149
        geom->x+=tl;
150
    }else if(line==GR_BORDERLINE_TOP && geom->w>0 && tl>0){
150
    }else if(line==GR_BORDERLINE_TOP && geom->w>0 && tl>0){
151
        XSetForeground(ioncore_g.dpy, gc, tlc);
151
        XSetForeground(ioncore_g.dpy, gc, PIXEL(tlc));
152
        XSetBackground(ioncore_g.dpy, gc, tlc);
152
        XSetBackground(ioncore_g.dpy, gc, PIXEL(tlc));
153
        XFillRectangle(ioncore_g.dpy, win, gc, geom->x, geom->y, geom->w, tl);
153
        XFillRectangle(ioncore_g.dpy, win, gc, geom->x, geom->y, geom->w, tl);
154
        geom->y+=tl;
154
        geom->y+=tl;
155
    }else if(line==GR_BORDERLINE_RIGHT && geom->h>0 && br>0){
155
    }else if(line==GR_BORDERLINE_RIGHT && geom->h>0 && br>0){
156
        XSetForeground(ioncore_g.dpy, gc, brc);
156
        XSetForeground(ioncore_g.dpy, gc, PIXEL(brc));
157
        XSetBackground(ioncore_g.dpy, gc, brc);
157
        XSetBackground(ioncore_g.dpy, gc, PIXEL(brc));
158
        XFillRectangle(ioncore_g.dpy, win, gc, geom->x+geom->w-br, geom->y, br, geom->h);
158
        XFillRectangle(ioncore_g.dpy, win, gc, geom->x+geom->w-br, geom->y, br, geom->h);
159
        geom->w-=br;
159
        geom->w-=br;
160
    }else if(line==GR_BORDERLINE_BOTTOM && geom->w>0 && br>0){
160
    }else if(line==GR_BORDERLINE_BOTTOM && geom->w>0 && br>0){
161
        XSetForeground(ioncore_g.dpy, gc, brc);
161
        XSetForeground(ioncore_g.dpy, gc, PIXEL(brc));
162
        XSetBackground(ioncore_g.dpy, gc, brc);
162
        XSetBackground(ioncore_g.dpy, gc, PIXEL(brc));
163
        XFillRectangle(ioncore_g.dpy, win, gc, geom->x, geom->y+geom->h-br, geom->w, br);
163
        XFillRectangle(ioncore_g.dpy, win, gc, geom->x, geom->y+geom->h-br, geom->w, br);
164
        geom->h-=br;
164
        geom->h-=br;
165
    }
165
    }
Lines 293-299 Link Here
293
    }
299
    }
294
    
300
    
295
    if(ISSET(a2, GR_ATTR(tagged)) || ISSET(a1, GR_ATTR(tagged))){
301
    if(ISSET(a2, GR_ATTR(tagged)) || ISSET(a1, GR_ATTR(tagged))){
296
        XSetForeground(ioncore_g.dpy, d->copy_gc, cg->fg);
302
        XSetForeground(ioncore_g.dpy, d->copy_gc, PIXEL(cg->fg));
297
            
303
            
298
        copy_masked(brush, d->tag_pixmap, brush->win, 0, 0,
304
        copy_masked(brush, d->tag_pixmap, brush->win, 0, 0,
299
                    d->tag_pixmap_w, d->tag_pixmap_h,
305
                    d->tag_pixmap_w, d->tag_pixmap_h,
Lines 348-354 Link Here
348
    GC gc=brush->d->normal_gc;
354
    GC gc=brush->d->normal_gc;
349
    
355
    
350
    if(TRUE/*needfill*/){
356
    if(TRUE/*needfill*/){
351
        XSetForeground(ioncore_g.dpy, gc, cg->bg);
357
        XSetForeground(ioncore_g.dpy, gc, PIXEL(cg->bg));
352
        XFillRectangle(ioncore_g.dpy, brush->win, gc, geom->x, geom->y, 
358
        XFillRectangle(ioncore_g.dpy, brush->win, gc, geom->x, geom->y, 
353
                       geom->w, geom->h);
359
                       geom->w, geom->h);
354
    }
360
    }
Lines 513-519 Link Here
513
        attr.background_pixmap=ParentRelative;
519
        attr.background_pixmap=ParentRelative;
514
    }else{
520
    }else{
515
        attrflags=CWBackPixel;
521
        attrflags=CWBackPixel;
516
        attr.background_pixel=brush->d->cgrp.bg;
522
        attr.background_pixel=brush->d->PIXEL(cgrp.bg);
517
    }
523
    }
518
    
524
    
519
    XChangeWindowAttributes(ioncore_g.dpy, brush->win, attrflags, &attr);
525
    XChangeWindowAttributes(ioncore_g.dpy, brush->win, attrflags, &attr);
Lines 529-535 Link Here
529
    if(cg==NULL)
535
    if(cg==NULL)
530
        return;
536
        return;
531
    
537
    
532
    XSetForeground(ioncore_g.dpy, gc, cg->bg);
538
    XSetForeground(ioncore_g.dpy, gc, PIXEL(cg->bg));
533
    XFillRectangle(ioncore_g.dpy, brush->win, gc, 
539
    XFillRectangle(ioncore_g.dpy, brush->win, gc, 
534
                   geom->x, geom->y, geom->w, geom->h);
540
                   geom->x, geom->y, geom->w, geom->h);
535
}
541
}
(-)../work/ion-3/de/font.c (-6 / +101 lines)
Lines 14-20 Link Here
14
#include <libtu/objp.h>
14
#include <libtu/objp.h>
15
#include <ioncore/common.h>
15
#include <ioncore/common.h>
16
#include "font.h"
16
#include "font.h"
17
#ifndef XFT
17
#include "fontset.h"
18
#include "fontset.h"
19
#endif /* ! XFT */
18
#include "brush.h"
20
#include "brush.h"
19
21
20
22
Lines 26-31 Link Here
26
28
27
DEFont *de_load_font(const char *fontname)
29
DEFont *de_load_font(const char *fontname)
28
{
30
{
31
#ifdef XFT
32
    XftFont *font;
33
#endif
29
    DEFont *fnt;
34
    DEFont *fnt;
30
    XFontSet fontset=NULL;
35
    XFontSet fontset=NULL;
31
    XFontStruct *fontstruct=NULL;
36
    XFontStruct *fontstruct=NULL;
Lines 40-45 Link Here
40
        }
45
        }
41
    }
46
    }
42
    
47
    
48
#ifndef XFT
43
    if(ioncore_g.use_mb){
49
    if(ioncore_g.use_mb){
44
        fontset=de_create_font_set(fontname);
50
        fontset=de_create_font_set(fontname);
45
        if(fontset!=NULL){
51
        if(fontset!=NULL){
Lines 66-78 Link Here
66
        return NULL;
72
        return NULL;
67
    }
73
    }
68
    
74
    
75
#else /* XFT */
76
    if(strncmp(fontname, "xft:", 4)==0){
77
	    font=XftFontOpenName(ioncore_g.dpy, DefaultScreen(ioncore_g.dpy),
78
				 fontname+4);
79
    }else{
80
	    font=XftFontOpenXlfd(ioncore_g.dpy, DefaultScreen(ioncore_g.dpy), fontname);
81
    }
82
    
83
    if(font==NULL){
84
	    if(strcmp(fontname, CF_FALLBACK_FONT_NAME)!=0){
85
		    warn(TR("Could not load font \"%s\", trying \"%s\""),
86
			 fontname, CF_FALLBACK_FONT_NAME);
87
		    return de_load_font(CF_FALLBACK_FONT_NAME);
88
	    }
89
	    return NULL;
90
    }
91
#endif /* XFT */
69
    fnt=ALLOC(DEFont);
92
    fnt=ALLOC(DEFont);
70
    
93
    
71
    if(fnt==NULL)
94
    if(fnt==NULL)
72
        return NULL;
95
        return NULL;
73
    
96
    
97
#ifndef XFT
74
    fnt->fontset=fontset;
98
    fnt->fontset=fontset;
75
    fnt->fontstruct=fontstruct;
99
    fnt->fontstruct=fontstruct;
100
#else
101
    fnt->font=font;
102
#endif
76
    fnt->pattern=scopy(fontname);
103
    fnt->pattern=scopy(fontname);
77
    fnt->next=NULL;
104
    fnt->next=NULL;
78
    fnt->prev=NULL;
105
    fnt->prev=NULL;
Lines 92-102 Link Here
92
    style->font=font;
119
    style->font=font;
93
    font->refcount++;
120
    font->refcount++;
94
    
121
    
122
#ifndef XFT
95
    if(style->font->fontstruct!=NULL){
123
    if(style->font->fontstruct!=NULL){
96
        XSetFont(ioncore_g.dpy, style->normal_gc, 
124
        XSetFont(ioncore_g.dpy, style->normal_gc, 
97
                 style->font->fontstruct->fid);
125
                 style->font->fontstruct->fid);
98
    }
126
    }
99
127
128
#endif /* ! XFT */
100
    return TRUE;
129
    return TRUE;
101
}
130
}
102
131
Lines 111-121 Link Here
111
    if(style->font==NULL)
140
    if(style->font==NULL)
112
        return FALSE;
141
        return FALSE;
113
    
142
    
143
#ifndef XFT
114
    if(style->font->fontstruct!=NULL){
144
    if(style->font->fontstruct!=NULL){
115
        XSetFont(ioncore_g.dpy, style->normal_gc, 
145
        XSetFont(ioncore_g.dpy, style->normal_gc, 
116
                 style->font->fontstruct->fid);
146
                 style->font->fontstruct->fid);
117
    }
147
    }
118
    
148
    
149
#endif /* ! XFT */
119
    return TRUE;
150
    return TRUE;
120
}
151
}
121
152
Lines 125-134 Link Here
125
    if(--font->refcount!=0)
156
    if(--font->refcount!=0)
126
        return;
157
        return;
127
    
158
    
159
#ifndef XFT
128
    if(font->fontset!=NULL)
160
    if(font->fontset!=NULL)
129
        XFreeFontSet(ioncore_g.dpy, font->fontset);
161
        XFreeFontSet(ioncore_g.dpy, font->fontset);
130
    if(font->fontstruct!=NULL)
162
    if(font->fontstruct!=NULL)
131
        XFreeFont(ioncore_g.dpy, font->fontstruct);
163
        XFreeFont(ioncore_g.dpy, font->fontstruct);
164
#else /* XFT */
165
    if(font->font!=NULL)
166
	    XftFontClose(ioncore_g.dpy, font->font);
167
#endif /* XFT */
132
    if(font->pattern!=NULL)
168
    if(font->pattern!=NULL)
133
        free(font->pattern);
169
        free(font->pattern);
134
    
170
    
Lines 156-161 Link Here
156
192
157
void defont_get_font_extents(DEFont *font, GrFontExtents *fnte)
193
void defont_get_font_extents(DEFont *font, GrFontExtents *fnte)
158
{
194
{
195
#ifndef XFT
159
    if(font->fontset!=NULL){
196
    if(font->fontset!=NULL){
160
        XFontSetExtents *ext=XExtentsOfFontSet(font->fontset);
197
        XFontSetExtents *ext=XExtentsOfFontSet(font->fontset);
161
        if(ext==NULL)
198
        if(ext==NULL)
Lines 171-177 Link Here
171
        fnte->baseline=fnt->ascent;
208
        fnte->baseline=fnt->ascent;
172
        return;
209
        return;
173
    }
210
    }
174
    
211
#else /* XFT */
212
    if(font->font!=NULL){
213
	    fnte->max_height=font->font->ascent+font->font->descent;
214
	    fnte->max_width=font->font->max_advance_width;
215
	    fnte->baseline=font->font->ascent;
216
	    return;
217
    }
218
#endif /* XFT */
175
fail:
219
fail:
176
    DE_RESET_FONT_EXTENTS(fnte);
220
    DE_RESET_FONT_EXTENTS(fnte);
177
}
221
}
Lines 188-207 Link Here
188
232
189
uint defont_get_text_width(DEFont *font, const char *text, uint len)
233
uint defont_get_text_width(DEFont *font, const char *text, uint len)
190
{
234
{
235
#ifndef XFT
191
    if(font->fontset!=NULL){
236
    if(font->fontset!=NULL){
192
        XRectangle lext;
237
        XRectangle lext;
193
#ifdef CF_DE_USE_XUTF8
238
#ifdef CF_DE_USE_XUTF8
194
        if(ioncore_g.enc_utf8)
239
	if(ioncore_g.enc_utf8)
195
            Xutf8TextExtents(font->fontset, text, len, NULL, &lext);
240
		Xutf8TextExtents(font->fontset, text, len, NULL, &lext);
196
        else
241
	else
197
#endif
242
#endif
198
            XmbTextExtents(font->fontset, text, len, NULL, &lext);
243
		XmbTextExtents(font->fontset, text, len, NULL, &lext);
199
        return lext.width;
244
	return lext.width;
200
    }else if(font->fontstruct!=NULL){
245
    }else if(font->fontstruct!=NULL){
201
        return XTextWidth(font->fontstruct, text, len);
246
        return XTextWidth(font->fontstruct, text, len);
202
    }else{
247
    }else{
203
        return 0;
248
        return 0;
204
    }
249
    }
250
#else /* XFT */
251
    if(font->font!=NULL){
252
	    XGlyphInfo extents;
253
	    if(ioncore_g.enc_utf8)
254
		    XftTextExtentsUtf8(ioncore_g.dpy, font->font, (XftChar8 *)text, len,
255
				       &extents);
256
	    else
257
		    XftTextExtents8(ioncore_g.dpy, font->font, (XftChar8 *)text, len,
258
				    &extents);
259
	    return extents.xOff;
260
    }else{
261
	    return 0;
262
    }
263
#endif /* XFT */
205
}
264
}
206
265
207
266
Lines 211-216 Link Here
211
/*{{{ String drawing */
270
/*{{{ String drawing */
212
271
213
272
273
#ifndef XFT
214
void debrush_do_draw_string_default(DEBrush *brush, int x, int y,
274
void debrush_do_draw_string_default(DEBrush *brush, int x, int y,
215
                                    const char *str, int len, bool needfill, 
275
                                    const char *str, int len, bool needfill, 
216
                                    DEColourGroup *colours)
276
                                    DEColourGroup *colours)
Lines 256-261 Link Here
256
    }
316
    }
257
}
317
}
258
318
319
#else /* XFT */
320
void debrush_do_draw_string_default(DEBrush *brush, 
321
				    int x, int y, const char *str,
322
				    int len, bool needfill, 
323
				    DEColourGroup *colours)
324
{
325
   Window win = brush->win;
326
   GC gc=brush->d->normal_gc;
327
   XftDraw *draw;
328
   XftFont *font;
329
330
   if(brush->d->font==NULL)
331
	   return;
332
   
333
   font=brush->d->font->font;
334
   draw=debrush_get_draw(brush, win);
335
   
336
   if(needfill){
337
	   XGlyphInfo extents;
338
	   if(ioncore_g.enc_utf8)
339
		   XftTextExtentsUtf8(ioncore_g.dpy, font, (XftChar8 *)str, len,
340
				      &extents);
341
	   else
342
		   XftTextExtents8(ioncore_g.dpy, font, (XftChar8 *)str, len, &extents);
343
	   XftDrawRect(draw, &(colours->bg), x-extents.x, y-extents.y,
344
		       extents.width+10, extents.height);
345
   }
346
   
347
   if(ioncore_g.enc_utf8)
348
	   XftDrawStringUtf8(draw, &(colours->fg), font, x, y, (XftChar8 *)str,
349
			     len);
350
   else
351
	   XftDrawString8(draw, &(colours->fg), font, x, y, (XftChar8 *)str, len);
352
}
353
#endif /* XFT */
259
354
260
void debrush_do_draw_string(DEBrush *brush, int x, int y,
355
void debrush_do_draw_string(DEBrush *brush, int x, int y,
261
                            const char *str, int len, bool needfill, 
356
                            const char *str, int len, bool needfill, 
(-)../work/ion-3/de/font.h (+6 lines)
Lines 14-19 Link Here
14
14
15
#include <ioncore/common.h>
15
#include <ioncore/common.h>
16
#include <ioncore/gr.h>
16
#include <ioncore/gr.h>
17
#ifdef XFT
18
#include <X11/Xft/Xft.h>
19
#endif /* XFT */
17
20
18
INTRSTRUCT(DEFont);
21
INTRSTRUCT(DEFont);
19
22
Lines 29-34 Link Here
29
    int refcount;
32
    int refcount;
30
    XFontSet fontset;
33
    XFontSet fontset;
31
    XFontStruct *fontstruct;
34
    XFontStruct *fontstruct;
35
#ifdef XFT /* XFT */
36
    XftFont *font;
37
#endif /* XFT */
32
    DEFont *next, *prev;
38
    DEFont *next, *prev;
33
};
39
};
34
40
(-)../work/ion-3/de/init.c (-6 / +15 lines)
Lines 165-181 Link Here
165
{
165
{
166
    bool bgset;
166
    bool bgset;
167
    DEColour padinh;
167
    DEColour padinh;
168
    
168
    DEColour black, white;
169
170
#ifdef XFT
171
    de_alloc_colour(rootwin, &black, "black");
172
    de_alloc_colour(rootwin, &white, "white");
173
#else
174
    black=DE_BLACK(rootwin);
175
    white=DE_WHITE(rootwin);
176
#endif
177
169
    de_get_colour(rootwin, &(cg->hl), tab, "highlight_colour",
178
    de_get_colour(rootwin, &(cg->hl), tab, "highlight_colour",
170
                  (based_on ? based_on->cgrp.hl : DE_WHITE(rootwin)));
179
                  (based_on ? based_on->cgrp.hl : white));
171
    de_get_colour(rootwin, &(cg->sh), tab, "shadow_colour",
180
    de_get_colour(rootwin, &(cg->sh), tab, "shadow_colour",
172
                  (based_on ? based_on->cgrp.sh : DE_WHITE(rootwin)));
181
                  (based_on ? based_on->cgrp.sh : white));
173
    de_get_colour(rootwin, &(cg->fg), tab, "foreground_colour",
182
    de_get_colour(rootwin, &(cg->fg), tab, "foreground_colour",
174
                  (based_on ? based_on->cgrp.fg : DE_WHITE(rootwin)));
183
                  (based_on ? based_on->cgrp.fg : white));
175
    bgset=de_get_colour(rootwin, &(cg->bg), tab, "background_colour",
184
    bgset=de_get_colour(rootwin, &(cg->bg), tab, "background_colour",
176
                        (based_on ? based_on->cgrp.bg : DE_BLACK(rootwin)));
185
                        (based_on ? based_on->cgrp.bg : black));
177
                        
186
                        
178
    padinh=(based_on ? based_on->cgrp.pad : DE_WHITE(rootwin));
187
    padinh=(based_on ? based_on->cgrp.pad : white);
179
    
188
    
180
    de_get_colour_(rootwin, &(cg->pad), tab, "padding_colour", 
189
    de_get_colour_(rootwin, &(cg->pad), tab, "padding_colour", 
181
                   (bgset ? cg->bg : padinh), padinh);
190
                   (bgset ? cg->bg : padinh), padinh);
(-)../work/ion-3/de/style.c (-5 / +20 lines)
Lines 74-83 Link Here
74
    /*gcv.function=GXclear;*/
74
    /*gcv.function=GXclear;*/
75
    gcv.stipple=stipple_pixmap;
75
    gcv.stipple=stipple_pixmap;
76
    gcvmask=GCFillStyle|GCStipple/*|GCFunction*/;
76
    gcvmask=GCFillStyle|GCStipple/*|GCFunction*/;
77
#ifndef XFT
77
    if(style->font!=NULL && style->font->fontstruct!=NULL){
78
    if(style->font!=NULL && style->font->fontstruct!=NULL){
78
        gcv.font=style->font->fontstruct->fid;
79
        gcv.font=style->font->fontstruct->fid;
79
        gcvmask|=GCFont;
80
        gcvmask|=GCFont;
80
    }
81
    }
82
#else /* XFT */
83
//    if(style->font!=NULL){
84
//        gcv.font=style->font;
85
//        gcvmask|=GCFont;
86
//    }
87
#endif /* XFT */
81
88
82
    style->stipple_gc=XCreateGC(dpy, root, gcvmask, &gcv);
89
    style->stipple_gc=XCreateGC(dpy, root, gcvmask, &gcv);
83
    XCopyGC(dpy, style->normal_gc, 
90
    XCopyGC(dpy, style->normal_gc, 
Lines 205-210 Link Here
205
212
206
bool destyle_init(DEStyle *style, WRootWin *rootwin, const char *name)
213
bool destyle_init(DEStyle *style, WRootWin *rootwin, const char *name)
207
{
214
{
215
    DEColour black, white;
216
#ifdef XFT
217
    de_alloc_colour(rootwin, &black, "black");
218
    de_alloc_colour(rootwin, &white, "white");
219
#else
220
    black=DE_BLACK(rootwin);
221
    white=DE_WHITE(rootwin);
222
#endif /* XFT */
208
    if(!gr_stylespec_load(&style->spec, name))
223
    if(!gr_stylespec_load(&style->spec, name))
209
        return FALSE;
224
        return FALSE;
210
    
225
    
Lines 226-236 Link Here
226
    style->textalign=DEALIGN_CENTER;
241
    style->textalign=DEALIGN_CENTER;
227
242
228
    style->cgrp_alloced=FALSE;
243
    style->cgrp_alloced=FALSE;
229
    style->cgrp.bg=DE_BLACK(rootwin);
244
    style->cgrp.bg=black;
230
    style->cgrp.pad=DE_BLACK(rootwin);
245
    style->cgrp.pad=black;
231
    style->cgrp.fg=DE_WHITE(rootwin);
246
    style->cgrp.fg=white;
232
    style->cgrp.hl=DE_WHITE(rootwin);
247
    style->cgrp.hl=white;
233
    style->cgrp.sh=DE_WHITE(rootwin);
248
    style->cgrp.sh=white;
234
    gr_stylespec_init(&style->cgrp.spec);
249
    gr_stylespec_init(&style->cgrp.spec);
235
    
250
    
236
    style->font=NULL;
251
    style->font=NULL;
(-)../work/ion-3/de/style.h (+1 lines)
Lines 76-81 Link Here
76
    Pixmap tag_pixmap;
76
    Pixmap tag_pixmap;
77
    int tag_pixmap_w;
77
    int tag_pixmap_w;
78
    int tag_pixmap_h;
78
    int tag_pixmap_h;
79
    int xft_style;
79
    
80
    
80
    DEStyle *next, *prev;
81
    DEStyle *next, *prev;
81
};
82
};
(-)../work/ion-3/system.mk (+10 lines)
Lines 115-120 Link Here
115
#EXTRA_LIBS += -lintl
115
#EXTRA_LIBS += -lintl
116
#EXTRA_INCLUDES +=
116
#EXTRA_INCLUDES +=
117
117
118
##
119
## Xft support
120
##
121
122
#USE_XFT=1
123
124
ifeq ($(USE_XFT),1)
125
EXTRA_INCLUDES += `xft-config --cflags` -DXFT
126
EXTRA_LIBS += `xft-config --libs`
127
endif
118
128
119
##
129
##
120
## C compiler
130
## C compiler

Return to bug 136077