···
1
+
diff -ur notion-3-2015061300/de/brush.c notion-3-2015061300-PATCHED/de/brush.c
2
+
--- notion-3-2015061300/de/brush.c 2015-06-13 10:37:26.000000000 -0400
3
+
+++ notion-3-2015061300-PATCHED/de/brush.c 2015-07-13 10:37:23.093298917 -0400
6
+
gr_stylespec_init(&brush->current_attr);
13
+
if(!grbrush_init(&(brush->grbrush))){
14
+
@@ -128,6 +131,10 @@
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));
25
+
@@ -139,6 +146,21 @@
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);
40
+
+ return brush->draw;
47
+
diff -ur notion-3-2015061300/de/brush.h notion-3-2015061300-PATCHED/de/brush.h
48
+
--- notion-3-2015061300/de/brush.h 2015-06-13 10:37:26.000000000 -0400
49
+
+++ notion-3-2015061300-PATCHED/de/brush.h 2015-07-13 10:37:23.096298747 -0400
51
+
#include <ioncore/gr.h>
52
+
#include <ioncore/rectangle.h>
55
+
+#include <X11/Xft/Xft.h>
68
+
DEBrushExtrasFn *extras_fn;
72
+
extern void debrush_fill_area(DEBrush *brush, const WRectangle *geom);
73
+
extern void debrush_clear_area(DEBrush *brush, const WRectangle *geom);
76
+
+XftDraw *debrush_get_draw(DEBrush *brush, Drawable d);
79
+
#endif /* ION_DE_BRUSH_H */
80
+
diff -ur notion-3-2015061300/de/colour.c notion-3-2015061300-PATCHED/de/colour.c
81
+
--- notion-3-2015061300/de/colour.c 2015-06-13 10:37:26.000000000 -0400
82
+
+++ notion-3-2015061300-PATCHED/de/colour.c 2015-07-13 10:37:23.098298633 -0400
85
+
bool de_alloc_colour(WRootWin *rootwin, DEColour *ret, const char *name)
93
+
+ return XftColorAllocName(
95
+
+ XftDEDefaultVisual(),
96
+
+ rootwin->default_cmap,
105
+
@@ -25,11 +37,13 @@
109
+
+#endif /* ! XFT */
113
+
bool de_duplicate_colour(WRootWin *rootwin, DEColour in, DEColour *out)
118
+
XQueryColor(ioncore_g.dpy, rootwin->default_cmap, &c);
119
+
@@ -38,11 +52,20 @@
124
+
+ return XftColorAllocName(
126
+
+ XftDEDefaultVisual(),
127
+
+ rootwin->default_cmap,
134
+
void de_free_colour_group(WRootWin *rootwin, DEColourGroup *cg)
137
+
DEColour pixels[5];
140
+
@@ -54,15 +77,26 @@
141
+
XFreeColors(ioncore_g.dpy, rootwin->default_cmap, pixels, 5, 0);
143
+
gr_stylespec_unalloc(&cg->spec);
145
+
+ de_free_colour(rootwin, cg->bg);
146
+
+ de_free_colour(rootwin, cg->fg);
147
+
+ de_free_colour(rootwin, cg->hl);
148
+
+ de_free_colour(rootwin, cg->sh);
149
+
+ de_free_colour(rootwin, cg->pad);
154
+
void de_free_colour(WRootWin *rootwin, DEColour col)
157
+
DEColour pixels[1];
161
+
XFreeColors(ioncore_g.dpy, rootwin->default_cmap, pixels, 1, 0);
163
+
+ XftColorFree(ioncore_g.dpy, XftDEDefaultVisual(), rootwin->default_cmap, &col);
167
+
diff -ur notion-3-2015061300/de/colour.h notion-3-2015061300-PATCHED/de/colour.h
168
+
--- notion-3-2015061300/de/colour.h 2015-06-13 10:37:26.000000000 -0400
169
+
+++ notion-3-2015061300-PATCHED/de/colour.h 2015-07-13 10:37:23.099298576 -0400
170
+
@@ -12,12 +12,19 @@
171
+
#include <ioncore/common.h>
172
+
#include <ioncore/global.h>
173
+
#include <ioncore/rootwin.h>
175
+
+#include <X11/Xft/Xft.h>
179
+
INTRSTRUCT(DEColourGroup);
183
+
typedef unsigned long DEColour;
185
+
+typedef XftColor DEColour;
189
+
DECLSTRUCT(DEColourGroup){
191
+
bool de_duplicate_colour(WRootWin *rootwin, DEColour in, DEColour *out);
192
+
void de_free_colour_group(WRootWin *rootwin, DEColourGroup *cg);
193
+
void de_free_colour(WRootWin *rootwin, DEColour col);
194
+
+#define XftDEDefaultVisual() DefaultVisual(ioncore_g.dpy, 0)
196
+
#endif /* ION_DE_COLOUR_H */
197
+
diff -ur notion-3-2015061300/de/draw.c notion-3-2015061300-PATCHED/de/draw.c
198
+
--- notion-3-2015061300/de/draw.c 2015-06-13 10:37:26.000000000 -0400
199
+
+++ notion-3-2015061300-PATCHED/de/draw.c 2015-07-13 10:37:23.109298008 -0400
201
+
#include <X11/extensions/shape.h>
205
+
+#define PIXEL(x) x
207
+
+#define PIXEL(x) x.pixel
212
+
/*{{{ Colour group lookup */
219
+
- XSetForeground(ioncore_g.dpy, gc, tlc);
221
+
+ XSetForeground(ioncore_g.dpy, gc, PIXEL(tlc));
225
+
@@ -104,7 +111,7 @@
229
+
- XSetForeground(ioncore_g.dpy, gc, brc);
230
+
+ XSetForeground(ioncore_g.dpy, gc, PIXEL(brc));
234
+
@@ -141,23 +148,23 @@
237
+
if(line==GR_BORDERLINE_LEFT && geom->h>0 && tl>0){
238
+
- XSetForeground(ioncore_g.dpy, gc, tlc);
239
+
- XSetBackground(ioncore_g.dpy, gc, tlc);
240
+
+ XSetForeground(ioncore_g.dpy, gc, PIXEL(tlc));
241
+
+ XSetBackground(ioncore_g.dpy, gc, PIXEL(tlc));
242
+
XFillRectangle(ioncore_g.dpy, win, gc, geom->x, geom->y, tl, geom->h);
244
+
}else if(line==GR_BORDERLINE_TOP && geom->w>0 && tl>0){
245
+
- XSetForeground(ioncore_g.dpy, gc, tlc);
246
+
- XSetBackground(ioncore_g.dpy, gc, tlc);
247
+
+ XSetForeground(ioncore_g.dpy, gc, PIXEL(tlc));
248
+
+ XSetBackground(ioncore_g.dpy, gc, PIXEL(tlc));
249
+
XFillRectangle(ioncore_g.dpy, win, gc, geom->x, geom->y, geom->w, tl);
251
+
}else if(line==GR_BORDERLINE_RIGHT && geom->h>0 && br>0){
252
+
- XSetForeground(ioncore_g.dpy, gc, brc);
253
+
- XSetBackground(ioncore_g.dpy, gc, brc);
254
+
+ XSetForeground(ioncore_g.dpy, gc, PIXEL(brc));
255
+
+ XSetBackground(ioncore_g.dpy, gc, PIXEL(brc));
256
+
XFillRectangle(ioncore_g.dpy, win, gc, geom->x+geom->w-br, geom->y, br, geom->h);
258
+
}else if(line==GR_BORDERLINE_BOTTOM && geom->w>0 && br>0){
259
+
- XSetForeground(ioncore_g.dpy, gc, brc);
260
+
- XSetBackground(ioncore_g.dpy, gc, brc);
261
+
+ XSetForeground(ioncore_g.dpy, gc, PIXEL(brc));
262
+
+ XSetBackground(ioncore_g.dpy, gc, PIXEL(brc));
263
+
XFillRectangle(ioncore_g.dpy, win, gc, geom->x, geom->y+geom->h-br, geom->w, br);
266
+
@@ -388,7 +395,7 @@
269
+
if(ISSET(a2, GR_ATTR(tagged)) || ISSET(a1, GR_ATTR(tagged))){
270
+
- XSetForeground(ioncore_g.dpy, d->copy_gc, cg->fg);
271
+
+ XSetForeground(ioncore_g.dpy, d->copy_gc, PIXEL(cg->fg));
273
+
copy_masked(brush, d->tag_pixmap, brush->win, 0, 0,
274
+
d->tag_pixmap_w, d->tag_pixmap_h,
275
+
@@ -437,7 +444,7 @@
276
+
GC gc=brush->d->normal_gc;
278
+
if(TRUE/*needfill*/){
279
+
- XSetForeground(ioncore_g.dpy, gc, cg->bg);
280
+
+ XSetForeground(ioncore_g.dpy, gc, PIXEL(cg->bg));
281
+
XFillRectangle(ioncore_g.dpy, brush->win, gc, geom->x, geom->y,
284
+
@@ -605,7 +612,7 @@
285
+
attr.background_pixmap=ParentRelative;
287
+
attrflags=CWBackPixel;
288
+
- attr.background_pixel=brush->d->cgrp.bg;
289
+
+ attr.background_pixel=brush->d->PIXEL(cgrp.bg);
292
+
XChangeWindowAttributes(ioncore_g.dpy, brush->win, attrflags, &attr);
293
+
@@ -621,7 +628,7 @@
297
+
- XSetForeground(ioncore_g.dpy, gc, cg->bg);
298
+
+ XSetForeground(ioncore_g.dpy, gc, PIXEL(cg->bg));
299
+
XFillRectangle(ioncore_g.dpy, brush->win, gc,
300
+
geom->x, geom->y, geom->w, geom->h);
302
+
diff -ur notion-3-2015061300/de/font.c notion-3-2015061300-PATCHED/de/font.c
303
+
--- notion-3-2015061300/de/font.c 2015-06-13 10:37:26.000000000 -0400
304
+
+++ notion-3-2015061300-PATCHED/de/font.c 2015-07-13 10:37:23.118297497 -0400
306
+
#include <ioncore/common.h>
307
+
#include <ioncore/log.h>
310
+
#include "fontset.h"
311
+
+#endif /* ! XFT */
313
+
#include "precompose.h"
315
+
@@ -106,6 +108,9 @@
317
+
DEFont *de_load_font(const char *fontname)
323
+
XFontSet fontset=NULL;
324
+
XFontStruct *fontstruct=NULL;
325
+
@@ -120,7 +125,8 @@
332
+
if(ioncore_g.use_mb && !(ioncore_g.enc_utf8 && iso10646_font(fontname))){
333
+
LOG(DEBUG, FONT, "Loading fontset %s", fontname);
334
+
fontset=de_create_font_set(fontname);
335
+
@@ -149,13 +155,34 @@
340
+
+ if(strncmp(fontname, "xft:", 4)==0){
341
+
+ font=XftFontOpenName(ioncore_g.dpy, DefaultScreen(ioncore_g.dpy),
344
+
+ font=XftFontOpenXlfd(ioncore_g.dpy, DefaultScreen(ioncore_g.dpy), fontname);
348
+
+ if(strcmp(fontname, CF_FALLBACK_FONT_NAME)!=0){
349
+
+ warn(TR("Could not load font \"%s\", trying \"%s\""),
350
+
+ fontname, CF_FALLBACK_FONT_NAME);
351
+
+ return de_load_font(CF_FALLBACK_FONT_NAME);
362
+
fnt->fontset=fontset;
363
+
fnt->fontstruct=fontstruct;
367
+
fnt->pattern=scopy(fontname);
370
+
@@ -175,11 +202,13 @@
375
+
if(style->font->fontstruct!=NULL){
376
+
XSetFont(ioncore_g.dpy, style->normal_gc,
377
+
style->font->fontstruct->fid);
380
+
+#endif /* ! XFT */
384
+
@@ -194,11 +223,13 @@
385
+
if(style->font==NULL)
389
+
if(style->font->fontstruct!=NULL){
390
+
XSetFont(ioncore_g.dpy, style->normal_gc,
391
+
style->font->fontstruct->fid);
394
+
+#endif /* ! XFT */
398
+
@@ -208,10 +239,15 @@
399
+
if(--font->refcount!=0)
403
+
if(font->fontset!=NULL)
404
+
XFreeFontSet(ioncore_g.dpy, font->fontset);
405
+
if(font->fontstruct!=NULL)
406
+
XFreeFont(ioncore_g.dpy, font->fontstruct);
408
+
+ if(font->font!=NULL)
409
+
+ XftFontClose(ioncore_g.dpy, font->font);
411
+
if(font->pattern!=NULL)
412
+
free(font->pattern);
414
+
@@ -239,6 +275,7 @@
416
+
void defont_get_font_extents(DEFont *font, GrFontExtents *fnte)
419
+
if(font->fontset!=NULL){
420
+
XFontSetExtents *ext=XExtentsOfFontSet(font->fontset);
422
+
@@ -254,7 +291,14 @@
423
+
fnte->baseline=fnt->ascent;
428
+
+ if(font->font!=NULL){
429
+
+ fnte->max_height=font->font->ascent+font->font->descent;
430
+
+ fnte->max_width=font->font->max_advance_width;
431
+
+ fnte->baseline=font->font->ascent;
436
+
DE_RESET_FONT_EXTENTS(fnte);
438
+
@@ -271,6 +315,7 @@
440
+
uint defont_get_text_width(DEFont *font, const char *text, uint len)
443
+
if(font->fontset!=NULL){
445
+
#ifdef CF_DE_USE_XUTF8
446
+
@@ -298,6 +343,18 @@
451
+
+ if(font->font!=NULL){
452
+
+ XGlyphInfo extents;
453
+
+ if(ioncore_g.enc_utf8)
454
+
+ XftTextExtentsUtf8(ioncore_g.dpy, font->font, (XftChar8 *)text, len, &extents);
456
+
+ XftTextExtents8(ioncore_g.dpy, font->font, (XftChar8 *)text, len, &extents);
457
+
+ return extents.xOff;
465
+
@@ -307,6 +364,7 @@
466
+
/*{{{ String drawing */
470
+
void debrush_do_draw_string_default(DEBrush *brush, int x, int y,
471
+
const char *str, int len, bool needfill,
472
+
DEColourGroup *colours)
473
+
@@ -366,6 +424,43 @@
478
+
+void debrush_do_draw_string_default(DEBrush *brush,
479
+
+ int x, int y, const char *str,
480
+
+ int len, bool needfill,
481
+
+ DEColourGroup *colours)
483
+
+ Window win = brush->win;
484
+
+ GC gc=brush->d->normal_gc;
488
+
+ if(brush->d->font==NULL)
491
+
+ font=brush->d->font->font;
492
+
+ draw=debrush_get_draw(brush, win);
495
+
+ XGlyphInfo extents;
496
+
+ if(ioncore_g.enc_utf8){
497
+
+ XftTextExtentsUtf8(ioncore_g.dpy, font, (XftChar8 *)str, len,
500
+
+ XftTextExtents8(ioncore_g.dpy, font, (XftChar8 *)str, len, &extents);
501
+
+ XftDrawRect(draw, &(colours->bg), x-extents.x, y-extents.y,
502
+
+ extents.width+10, extents.height);
506
+
+ if(ioncore_g.enc_utf8){
507
+
+ XftDrawStringUtf8(draw, &(colours->fg), font, x, y, (XftChar8 *)str,
510
+
+ XftDrawString8(draw, &(colours->fg), font, x, y, (XftChar8 *)str, len);
515
+
void debrush_do_draw_string(DEBrush *brush, int x, int y,
516
+
const char *str, int len, bool needfill,
517
+
diff -ur notion-3-2015061300/de/font.h notion-3-2015061300-PATCHED/de/font.h
518
+
--- notion-3-2015061300/de/font.h 2015-06-13 10:37:26.000000000 -0400
519
+
+++ notion-3-2015061300-PATCHED/de/font.h 2015-07-13 10:37:23.119297440 -0400
522
+
#include <ioncore/common.h>
523
+
#include <ioncore/gr.h>
525
+
+#include <X11/Xft/Xft.h>
528
+
INTRSTRUCT(DEFont);
533
+
XFontStruct *fontstruct;
534
+
+#ifdef XFT /* XFT */
537
+
DEFont *next, *prev;
540
+
diff -ur notion-3-2015061300/de/init.c notion-3-2015061300-PATCHED/de/init.c
541
+
--- notion-3-2015061300/de/init.c 2015-06-13 10:37:26.000000000 -0400
542
+
+++ notion-3-2015061300-PATCHED/de/init.c 2015-07-13 10:37:23.122297270 -0400
543
+
@@ -165,17 +165,26 @@
548
+
+ DEColour black, white;
551
+
+ de_alloc_colour(rootwin, &black, "black");
552
+
+ de_alloc_colour(rootwin, &white, "white");
554
+
+ black=DE_BLACK(rootwin);
555
+
+ white=DE_WHITE(rootwin);
558
+
de_get_colour(rootwin, &(cg->hl), tab, "highlight_colour",
559
+
- (based_on ? based_on->cgrp.hl : DE_WHITE(rootwin)));
560
+
+ (based_on ? based_on->cgrp.hl : white));
561
+
de_get_colour(rootwin, &(cg->sh), tab, "shadow_colour",
562
+
- (based_on ? based_on->cgrp.sh : DE_WHITE(rootwin)));
563
+
+ (based_on ? based_on->cgrp.sh : white));
564
+
de_get_colour(rootwin, &(cg->fg), tab, "foreground_colour",
565
+
- (based_on ? based_on->cgrp.fg : DE_WHITE(rootwin)));
566
+
+ (based_on ? based_on->cgrp.fg : white));
567
+
bgset=de_get_colour(rootwin, &(cg->bg), tab, "background_colour",
568
+
- (based_on ? based_on->cgrp.bg : DE_BLACK(rootwin)));
569
+
+ (based_on ? based_on->cgrp.bg : black));
571
+
- padinh=(based_on ? based_on->cgrp.pad : DE_WHITE(rootwin));
572
+
+ padinh=(based_on ? based_on->cgrp.pad : white);
574
+
de_get_colour_(rootwin, &(cg->pad), tab, "padding_colour",
575
+
(bgset ? cg->bg : padinh), padinh);
576
+
diff -ur notion-3-2015061300/de/style.c notion-3-2015061300-PATCHED/de/style.c
577
+
--- notion-3-2015061300/de/style.c 2015-06-13 10:37:26.000000000 -0400
578
+
+++ notion-3-2015061300-PATCHED/de/style.c 2015-07-13 10:37:23.128296929 -0400
579
+
@@ -70,10 +70,17 @@
580
+
/*gcv.function=GXclear;*/
581
+
gcv.stipple=stipple_pixmap;
582
+
gcvmask=GCFillStyle|GCStipple/*|GCFunction*/;
584
+
if(style->font!=NULL && style->font->fontstruct!=NULL){
585
+
gcv.font=style->font->fontstruct->fid;
589
+
+// if(style->font!=NULL){
590
+
+// gcv.font=style->font;
591
+
+// gcvmask|=GCFont;
595
+
style->stipple_gc=XCreateGC(dpy, root, gcvmask, &gcv);
596
+
XCopyGC(dpy, style->normal_gc,
597
+
@@ -201,6 +208,14 @@
599
+
bool destyle_init(DEStyle *style, WRootWin *rootwin, const char *name)
601
+
+ DEColour black, white;
603
+
+ de_alloc_colour(rootwin, &black, "black");
604
+
+ de_alloc_colour(rootwin, &white, "white");
606
+
+ black=DE_BLACK(rootwin);
607
+
+ white=DE_WHITE(rootwin);
609
+
if(!gr_stylespec_load(&style->spec, name))
612
+
@@ -223,11 +238,11 @@
613
+
style->textalign=DEALIGN_CENTER;
615
+
style->cgrp_alloced=FALSE;
616
+
- style->cgrp.bg=DE_BLACK(rootwin);
617
+
- style->cgrp.pad=DE_BLACK(rootwin);
618
+
- style->cgrp.fg=DE_WHITE(rootwin);
619
+
- style->cgrp.hl=DE_WHITE(rootwin);
620
+
- style->cgrp.sh=DE_WHITE(rootwin);
621
+
+ style->cgrp.bg=black;
622
+
+ style->cgrp.pad=black;
623
+
+ style->cgrp.fg=white;
624
+
+ style->cgrp.hl=white;
625
+
+ style->cgrp.sh=white;
626
+
gr_stylespec_init(&style->cgrp.spec);
629
+
diff -ur notion-3-2015061300/de/style.h notion-3-2015061300-PATCHED/de/style.h
630
+
--- notion-3-2015061300/de/style.h 2015-06-13 10:37:26.000000000 -0400
631
+
+++ notion-3-2015061300-PATCHED/de/style.h 2015-07-13 10:37:23.130296815 -0400
638
+
DEStyle *next, *prev;
640
+
diff -ur notion-3-2015061300/system-autodetect.mk notion-3-2015061300-PATCHED/system-autodetect.mk
641
+
--- notion-3-2015061300/system-autodetect.mk 2015-06-13 10:37:26.000000000 -0400
642
+
+++ notion-3-2015061300-PATCHED/system-autodetect.mk 2015-07-13 10:38:14.921332013 -0400
643
+
@@ -103,6 +103,19 @@
652
+
+ifeq ($(USE_XFT),1)
653
+
+EXTRA_INCLUDES += `pkg-config xft --cflags`
654
+
+EXTRA_LIBS += `pkg-config xft --libs`
655
+
+DEFINES += -DXFT -DCF_FALLBACK_FONT_NAME=\"Sans\"