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

Collapse All | Expand All

(-)scrotwm/scrotwm.c (-7 / +57 lines)
Lines 83-88 static const char *cvstag = "$scrotwm: s Link Here
83
#include <X11/Xproto.h>
83
#include <X11/Xproto.h>
84
#include <X11/Xutil.h>
84
#include <X11/Xutil.h>
85
#include <X11/extensions/Xrandr.h>
85
#include <X11/extensions/Xrandr.h>
86
#include <X11/Xft/Xft.h>
86
87
87
#if RANDR_MAJOR < 1
88
#if RANDR_MAJOR < 1
88
#  error XRandR versions less than 1.0 are not supported
89
#  error XRandR versions less than 1.0 are not supported
Lines 201-206 XGCValues bar_gcv; Link Here
201
int			bar_fidx = 0;
202
int			bar_fidx = 0;
202
XFontStruct		*bar_fs;
203
XFontStruct		*bar_fs;
203
char			*bar_fonts[] = { NULL, NULL, NULL, NULL };/* XXX Make fully dynamic */
204
char			*bar_fonts[] = { NULL, NULL, NULL, NULL };/* XXX Make fully dynamic */
205
XftDraw		*xft_draw;
206
XftFont		*bar_xft_fs;
207
XftColor	xft_color;
208
int			xft_loaded = 0;
204
char			*spawn_term[] = { NULL, NULL };		/* XXX Make fully dynamic */
209
char			*spawn_term[] = { NULL, NULL };		/* XXX Make fully dynamic */
205
210
206
#define SWM_MENU_FN	(2)
211
#define SWM_MENU_FN	(2)
Lines 707-714 bar_print(struct swm_region *r, char *s) Link Here
707
{
712
{
708
	XClearWindow(display, r->bar_window);
713
	XClearWindow(display, r->bar_window);
709
	XSetForeground(display, bar_gc, r->s->c[SWM_S_COLOR_BAR_FONT].color);
714
	XSetForeground(display, bar_gc, r->s->c[SWM_S_COLOR_BAR_FONT].color);
710
	XDrawString(display, r->bar_window, bar_gc, 4, bar_fs->ascent, s,
715
	if (xft_loaded) {
711
	    strlen(s));
716
		xft_draw = XftDrawCreate(display,
717
			r->bar_window,
718
			DefaultVisual(display, DefaultScreen(display)),
719
			DefaultColormap(display, DefaultScreen(display)));
720
		XftDrawString8(xft_draw, &xft_color, bar_xft_fs, 4,
721
			bar_xft_fs->ascent, s, strlen(s));
722
	}
723
	else 
724
		XDrawString(display, r->bar_window, bar_gc, 4, bar_fs->ascent, s,
725
		    strlen(s));
712
}
726
}
713
727
714
void
728
void
Lines 893-920 bar_refresh(void) Link Here
893
	bar_update();
907
	bar_update();
894
}
908
}
895
909
910
int
911
is_xft(char *font, char *xft_result)
912
{
913
	int i, j;
914
915
	if (font == NULL)
916
		return (0);
917
918
	if (strncmp("xft:", font, 4) == 0)
919
		for (i = 0, j = 4; font[j] != '\0'; i++, j++)
920
			xft_result[i] = font[j];
921
	else
922
		return (0);
923
	
924
	return (1);
925
}
926
896
void
927
void
897
bar_setup(struct swm_region *r)
928
bar_setup(struct swm_region *r)
898
{
929
{
899
	int			i;
930
	int			i;
931
	char		xftfont[64];
900
932
901
	for (i = 0; bar_fonts[i] != NULL; i++) {
933
	for (i = 0; bar_fonts[i] != NULL; i++) {
902
		bar_fs = XLoadQueryFont(display, bar_fonts[i]);
934
		if (is_xft(bar_fonts[i], xftfont)) {
903
		if (bar_fs) {
935
			bar_xft_fs = XftFontOpenName(display,
936
				DefaultScreen(display), xftfont);
937
			XftColorAllocName(display,
938
				DefaultVisual(display, DefaultScreen(display)),
939
				DefaultColormap(display, DefaultScreen(display)),
940
				r->s->c[SWM_S_COLOR_BAR_FONT].name,
941
				&xft_color);
942
			xft_loaded = 1;
943
		}
944
		else {
945
			bar_fs = XLoadQueryFont(display, bar_fonts[i]);
946
			xft_loaded = 0;
947
		}
948
949
		if (bar_fs || bar_xft_fs) {
904
			bar_fidx = i;
950
			bar_fidx = i;
905
			break;
951
			break;
906
		}
952
		}
907
	}
953
	}
908
	if (bar_fonts[i] == NULL)
954
	if (bar_fonts[i] == NULL)
909
			errx(1, "couldn't load font");
955
			errx(1, "couldn't load font");
910
	bar_height = bar_fs->ascent + bar_fs->descent + 3;
956
	if (!xft_loaded) 
911
957
		bar_height = bar_fs->ascent + bar_fs->descent + 3;
958
	else
959
		bar_height = bar_xft_fs->ascent + bar_xft_fs->descent + 3;
960
		
912
	r->bar_window = XCreateSimpleWindow(display,
961
	r->bar_window = XCreateSimpleWindow(display,
913
	    r->s->root, X(r), Y(r), WIDTH(r) - 2, bar_height - 2,
962
	    r->s->root, X(r), Y(r), WIDTH(r) - 2, bar_height - 2,
914
	    1, r->s->c[SWM_S_COLOR_BAR_BORDER].color,
963
	    1, r->s->c[SWM_S_COLOR_BAR_BORDER].color,
915
	    r->s->c[SWM_S_COLOR_BAR].color);
964
	    r->s->c[SWM_S_COLOR_BAR].color);
916
	bar_gc = XCreateGC(display, r->bar_window, 0, &bar_gcv);
965
	bar_gc = XCreateGC(display, r->bar_window, 0, &bar_gcv);
917
	XSetFont(display, bar_gc, bar_fs->fid);
966
	if (!xft_loaded)
967
		XSetFont(display, bar_gc, bar_fs->fid);
918
	XSelectInput(display, r->bar_window, VisibilityChangeMask);
968
	XSelectInput(display, r->bar_window, VisibilityChangeMask);
919
	if (bar_enabled)
969
	if (bar_enabled)
920
		XMapRaised(display, r->bar_window);
970
		XMapRaised(display, r->bar_window);
(-)scrotwm/linux/Makefile (-2 / +2 lines)
Lines 1-8 Link Here
1
# $scrotwm: Makefile,v 1.3 2009/09/17 02:22:52 marco Exp $ 
1
# $scrotwm: Makefile,v 1.3 2009/09/17 02:22:52 marco Exp $ 
2
2
3
CFLAGS+= -Wall -ggdb -D_GNU_SOURCE -I.
3
CFLAGS+= -Wall -ggdb -D_GNU_SOURCE -I. -I/usr/include/freetype2
4
CFLAGS+= -DSWM_LIB=\"$(LIBDIR)/libswmhack.so.$(LVERS)\"
4
CFLAGS+= -DSWM_LIB=\"$(LIBDIR)/libswmhack.so.$(LVERS)\"
5
LDADD+= -lX11 -lXrandr
5
LDADD+= -lX11 -lXrandr -lXft
6
6
7
PREFIX?= /usr/local
7
PREFIX?= /usr/local
8
BINDIR?= $(PREFIX)/bin
8
BINDIR?= $(PREFIX)/bin
(-)scrotwm/scrotwm.1 (-1 / +1 lines)
Lines 95-101 Color of the status bar window in screen Link Here
95
Color of the font in status bar in screen
95
Color of the font in status bar in screen
96
.Ar x .
96
.Ar x .
97
.It Cm bar_font
97
.It Cm bar_font
98
Status bar font.
98
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.
99
.It Cm bar_action
99
.It Cm bar_action
100
External script that populates additional information in the status bar,
100
External script that populates additional information in the status bar,
101
such as battery life.
101
such as battery life.
(-)scrotwm/scrotwm_it.1 (-1 / +1 lines)
Lines 96-102 Colore della barra di stato nello scherm Link Here
96
Colore del testo della barra di stato nello schermo
96
Colore del testo della barra di stato nello schermo
97
.Ar x .
97
.Ar x .
98
.It Cm bar_font
98
.It Cm bar_font
99
Font della barra di stato.
99
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.
100
.It Cm bar_action
100
.It Cm bar_action
101
Script esterno che aggiunge informazioni come la carica della batteria alla
101
Script esterno che aggiunge informazioni come la carica della batteria alla
102
barra di stato.
102
barra di stato.

Return to bug 284350