Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 206520 Details for
Bug 284350
x11-wm/scrotwm (new package)
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Use this patch only with >= scrotwm-0.9.11
use-xft.diff (text/plain), 4.71 KB, created by
Massimo Gengarelli
on 2009-10-09 11:16:46 UTC
(
hide
)
Description:
Use this patch only with >= scrotwm-0.9.11
Filename:
MIME Type:
Creator:
Massimo Gengarelli
Created:
2009-10-09 11:16:46 UTC
Size:
4.71 KB
patch
obsolete
>Index: scrotwm/scrotwm.c >=================================================================== >--- scrotwm.orig/scrotwm.c >+++ scrotwm/scrotwm.c >@@ -83,6 +83,7 @@ static const char *cvstag = "$scrotwm: s > #include <X11/Xproto.h> > #include <X11/Xutil.h> > #include <X11/extensions/Xrandr.h> >+#include <X11/Xft/Xft.h> > > #if RANDR_MAJOR < 1 > # error XRandR versions less than 1.0 are not supported >@@ -201,6 +202,10 @@ XGCValues bar_gcv; > int bar_fidx = 0; > XFontStruct *bar_fs; > char *bar_fonts[] = { NULL, NULL, NULL, NULL };/* XXX Make fully dynamic */ >+XftDraw *xft_draw; >+XftFont *bar_xft_fs; >+XftColor xft_color; >+int xft_loaded = 0; > char *spawn_term[] = { NULL, NULL }; /* XXX Make fully dynamic */ > > #define SWM_MENU_FN (2) >@@ -707,8 +712,17 @@ bar_print(struct swm_region *r, char *s) > { > XClearWindow(display, r->bar_window); > XSetForeground(display, bar_gc, r->s->c[SWM_S_COLOR_BAR_FONT].color); >- XDrawString(display, r->bar_window, bar_gc, 4, bar_fs->ascent, s, >- strlen(s)); >+ if (xft_loaded) { >+ xft_draw = XftDrawCreate(display, >+ r->bar_window, >+ DefaultVisual(display, DefaultScreen(display)), >+ DefaultColormap(display, DefaultScreen(display))); >+ XftDrawString8(xft_draw, &xft_color, bar_xft_fs, 4, >+ bar_xft_fs->ascent, s, strlen(s)); >+ } >+ else >+ XDrawString(display, r->bar_window, bar_gc, 4, bar_fs->ascent, s, >+ strlen(s)); > } > > void >@@ -893,28 +907,64 @@ bar_refresh(void) > bar_update(); > } > >+int >+is_xft(char *font, char *xft_result) >+{ >+ int i, j; >+ >+ if (font == NULL) >+ return (0); >+ >+ if (strncmp("xft:", font, 4) == 0) >+ for (i = 0, j = 4; font[j] != '\0'; i++, j++) >+ xft_result[i] = font[j]; >+ else >+ return (0); >+ >+ return (1); >+} >+ > void > bar_setup(struct swm_region *r) > { > int i; >+ char xftfont[64]; > > for (i = 0; bar_fonts[i] != NULL; i++) { >- bar_fs = XLoadQueryFont(display, bar_fonts[i]); >- if (bar_fs) { >+ if (is_xft(bar_fonts[i], xftfont)) { >+ bar_xft_fs = XftFontOpenName(display, >+ DefaultScreen(display), xftfont); >+ XftColorAllocName(display, >+ DefaultVisual(display, DefaultScreen(display)), >+ DefaultColormap(display, DefaultScreen(display)), >+ r->s->c[SWM_S_COLOR_BAR_FONT].name, >+ &xft_color); >+ xft_loaded = 1; >+ } >+ else { >+ bar_fs = XLoadQueryFont(display, bar_fonts[i]); >+ xft_loaded = 0; >+ } >+ >+ if (bar_fs || bar_xft_fs) { > bar_fidx = i; > break; > } > } > if (bar_fonts[i] == NULL) > errx(1, "couldn't load font"); >- bar_height = bar_fs->ascent + bar_fs->descent + 3; >- >+ if (!xft_loaded) >+ bar_height = bar_fs->ascent + bar_fs->descent + 3; >+ else >+ bar_height = bar_xft_fs->ascent + bar_xft_fs->descent + 3; >+ > r->bar_window = XCreateSimpleWindow(display, > r->s->root, X(r), Y(r), WIDTH(r) - 2, bar_height - 2, > 1, r->s->c[SWM_S_COLOR_BAR_BORDER].color, > r->s->c[SWM_S_COLOR_BAR].color); > bar_gc = XCreateGC(display, r->bar_window, 0, &bar_gcv); >- XSetFont(display, bar_gc, bar_fs->fid); >+ if (!xft_loaded) >+ XSetFont(display, bar_gc, bar_fs->fid); > XSelectInput(display, r->bar_window, VisibilityChangeMask); > if (bar_enabled) > XMapRaised(display, r->bar_window); >Index: scrotwm/linux/Makefile >=================================================================== >--- scrotwm.orig/linux/Makefile >+++ scrotwm/linux/Makefile >@@ -1,8 +1,8 @@ > # $scrotwm: Makefile,v 1.3 2009/09/17 02:22:52 marco Exp $ > >-CFLAGS+= -Wall -ggdb -D_GNU_SOURCE -I. >+CFLAGS+= -Wall -ggdb -D_GNU_SOURCE -I. -I/usr/include/freetype2 > CFLAGS+= -DSWM_LIB=\"$(LIBDIR)/libswmhack.so.$(LVERS)\" >-LDADD+= -lX11 -lXrandr >+LDADD+= -lX11 -lXrandr -lXft > > PREFIX?= /usr/local > BINDIR?= $(PREFIX)/bin >Index: scrotwm/scrotwm.1 >=================================================================== >--- scrotwm.orig/scrotwm.1 >+++ scrotwm/scrotwm.1 >@@ -95,7 +95,7 @@ Color of the status bar window in screen > Color of the font in status bar in screen > .Ar x . > .It Cm bar_font >-Status bar font. >+Status bar font. You can use an Xft font by prepending xft: to the font name (e.g. xft:terminus-9), otherwise will be used an X Core Font. > .It Cm bar_action > External script that populates additional information in the status bar, > such as battery life. >Index: scrotwm/scrotwm_it.1 >=================================================================== >--- scrotwm.orig/scrotwm_it.1 >+++ scrotwm/scrotwm_it.1 >@@ -96,7 +96,7 @@ Colore della barra di stato nello scherm > Colore del testo della barra di stato nello schermo > .Ar x . > .It Cm bar_font >-Font della barra di stato. >+Font della barra di stato. Se il nome del font è preceduto dalla stringa "xft:", scrotwm cercherà di caricare il font con la libreria Xft (es: xft:terminus-9), altrimenti verrà utilizzato un font X Core. > .It Cm bar_action > Script esterno che aggiunge informazioni come la carica della batteria alla > barra di stato.
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 284350
:
203634
|
203636
|
203637
|
203639
|
203640
|
203947
|
203948
|
203950
|
203952
|
204100
|
204102
|
204103
|
204105
|
204107
|
206282
|
206283
|
206319
|
206408
|
206410
|
206518
|
206520
|
206731
|
206967
|
206969
|
206970
|
206974
|
207019
|
210444
|
224619
|
224639
|
224641
|
224651
|
224655
|
253387