Alopex

Check-in [7ebf00f16e]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:fixed redraw on chvt
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | master
Files: files | file ages | folders
SHA3-256:7ebf00f16ee0d69af9f41313d4d14ac2c83e65c4840404bce68bdd4e13d375f0
User & Date: jesse@mccluresk9.com 2014-02-08 18:42:21
Context
2014-02-12
15:28
icons are ready for testing check-in: 5d32742a6a user: jesse@mccluresk9.com tags: trunk, master
2014-02-08
18:42
fixed redraw on chvt check-in: 7ebf00f16e user: jesse@mccluresk9.com tags: trunk, master
2014-02-03
20:22
theming and other updates check-in: ce7cb981ee user: jesse@mccluresk9.com tags: trunk, master
Changes

Changes to TODO.

1
2
3
4
5

expose function in xlib.c
status background round-rects
remove macros from config.c
icons

<
<
<

1



2




icons

Changes to share/icecap.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
icecap.Tab.Text:					0.25 0.45 1.00 0.40 0.5
icecap.TabFocus.Background:	0.14 0.14 0.14 1.00 0.0
icecap.TabFocus.Border:			0.60 0.90 1.00 0.95 1.2
icecap.TabFocus.Text:			0.90 0.95 1.00 0.90 -10
icecap.TabTop.Background:		0.14 0.14 0.14 1.00 0.0
icecap.TabTop.Border:			0.00 0.40 1.00 0.80 1.0
icecap.TabTop.Text:				0.25 0.65 1.00 0.70 0.5
icecap.Status.Offset:			2.00 2.00 -4.0 -8.0 5.0
icecap.Status.Background:		0.14 0.14 0.14 0.40 0.0
icecap.Status.Border:			1.00 1.00 1.00 0.60 1.0
icecap.Status.Text:				0.80 0.80 0.80 1.00 0.0
icecap.Tag.Occupied:				0.00 0.00 1.00 1.00 0.0
icecap.Tag.View:					1.00 1.00 1.00 1.00 0.0
icecap.Tag.Alt:					0.80 0.00 0.00 1.00 0.0
icecap.Tag.Both:					0.80 0.00 0.80 1.00 0.0

!! vim: ft=xdefaults







|









8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
icecap.Tab.Text:					0.25 0.45 1.00 0.40 0.5
icecap.TabFocus.Background:	0.14 0.14 0.14 1.00 0.0
icecap.TabFocus.Border:			0.60 0.90 1.00 0.95 1.2
icecap.TabFocus.Text:			0.90 0.95 1.00 0.90 -10
icecap.TabTop.Background:		0.14 0.14 0.14 1.00 0.0
icecap.TabTop.Border:			0.00 0.40 1.00 0.80 1.0
icecap.TabTop.Text:				0.25 0.65 1.00 0.70 0.5
icecap.Status.Offset:			1.00 2.00 -2.0 -4.0 5.0
icecap.Status.Background:		0.14 0.14 0.14 0.40 0.0
icecap.Status.Border:			1.00 1.00 1.00 0.60 1.0
icecap.Status.Text:				0.80 0.80 0.80 1.00 0.0
icecap.Tag.Occupied:				0.00 0.00 1.00 1.00 0.0
icecap.Tag.View:					1.00 1.00 1.00 1.00 0.0
icecap.Tag.Alt:					0.80 0.00 0.00 1.00 0.0
icecap.Tag.Both:					0.80 0.00 0.80 1.00 0.0

!! vim: ft=xdefaults

Changes to src/alopex.h.

136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
	Margin margin;
	int nkeys;
	Key *key;
	int nrules;
	Rule *rule;
	int statfd;
	FILE *stat;
	const char *macro[26];
	char **tag_name;
	int *tag_icon, tag_count, tag_mode;
	int gap, split, mode, bar_pad, chain_delay, bar_opts, attach;
	int font_size;
	Bool focus_follow;
} Config;








<







136
137
138
139
140
141
142

143
144
145
146
147
148
149
	Margin margin;
	int nkeys;
	Key *key;
	int nrules;
	Rule *rule;
	int statfd;
	FILE *stat;

	char **tag_name;
	int *tag_icon, tag_count, tag_mode;
	int gap, split, mode, bar_pad, chain_delay, bar_opts, attach;
	int font_size;
	Bool focus_follow;
} Config;

Changes to src/config.c.

4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
..
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
...
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
extern int free_mons();
extern int get_mons(const char *, const char *);
extern int icons_init(const char *);
extern int icons_free();

static int config_general(XrmDatabase, const char *);
static int config_binds(XrmDatabase, const char *);
static int config_macros(XrmDatabase, const char *);
static int config_rules(XrmDatabase, const char *);
static int config_theme(XrmDatabase, const char *);

FT_Face face, bface;
static pid_t pid;
static XrmDatabase xrdb;

................................................................................
	XrmValue val;
	if (theme) base = theme;
	else if (XrmGetResource(xrdb, class, class, &type, &val))
		base = val.addr;
	else base = _base;
	config_binds(xrdb, base);
	config_general(xrdb, base);
	config_macros(xrdb, base);
	config_rules(xrdb, base);
	config_theme(xrdb, base);
	chdir(pwd);
	return 0;
}

int config_free() {
................................................................................
			conf.key = realloc(conf.key, (conf.nkeys+1) * sizeof(Key));
			conf.key[conf.nkeys].keysym = sym;
			conf.key[conf.nkeys].mod = mods[j];
			conf.key[conf.nkeys].arg = val.addr;
			conf.nkeys++;
		}
	}
	return 0;
}

int config_macros(XrmDatabase xrdb, const char *base) {
	char class[256], *type;
	XrmValue val;
	char i;
	memset(conf.macro,0,26);
	for (i = 'a'; i < '{'; i++) {
		sprintf(class,"%s.Macro.%c",base,i);
		if (XrmGetResource(xrdb, class, class, &type, &val))
		conf.macro[i - 'a'] = val.addr;
	}
	return 0;
}

int config_rules(XrmDatabase xrdb, const char *base) {
	char class[256], *type, *rn, *rc;
	XrmValue val;
	conf.rule = NULL;







<







 







<







 







<
<
<
<
<
<
<
<
<
<
<
<
<







4
5
6
7
8
9
10

11
12
13
14
15
16
17
..
28
29
30
31
32
33
34

35
36
37
38
39
40
41
...
261
262
263
264
265
266
267













268
269
270
271
272
273
274
extern int free_mons();
extern int get_mons(const char *, const char *);
extern int icons_init(const char *);
extern int icons_free();

static int config_general(XrmDatabase, const char *);
static int config_binds(XrmDatabase, const char *);

static int config_rules(XrmDatabase, const char *);
static int config_theme(XrmDatabase, const char *);

FT_Face face, bface;
static pid_t pid;
static XrmDatabase xrdb;

................................................................................
	XrmValue val;
	if (theme) base = theme;
	else if (XrmGetResource(xrdb, class, class, &type, &val))
		base = val.addr;
	else base = _base;
	config_binds(xrdb, base);
	config_general(xrdb, base);

	config_rules(xrdb, base);
	config_theme(xrdb, base);
	chdir(pwd);
	return 0;
}

int config_free() {
................................................................................
			conf.key = realloc(conf.key, (conf.nkeys+1) * sizeof(Key));
			conf.key[conf.nkeys].keysym = sym;
			conf.key[conf.nkeys].mod = mods[j];
			conf.key[conf.nkeys].arg = val.addr;
			conf.nkeys++;
		}
	}













	return 0;
}

int config_rules(XrmDatabase xrdb, const char *base) {
	char class[256], *type, *rn, *rc;
	XrmValue val;
	conf.rule = NULL;

Changes to src/draw.c.

4
5
6
7
8
9
10

11
12
13
14
15
16
17
18
19
20


21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
...
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208

209
210
211
212
213
214
215
static int round_rect(Bar *, int, int, int, int, int, int, int, int);
static int set_color(cairo_t *, int);
static int sbar_icon(Bar *, int);
static int sbar_text(Bar *, const char *);

int draw_bar_sub(Monitor *M, Container *C, Bar *S, int x, Bool bg) {
	if (C->bar->opts & BAR_HIDE) return 0;

	cairo_rectangle(C->bar->ctx, x, 0, S->w, C->bar->h);
	cairo_clip(C->bar->ctx);
	if (bg) { /* draw background as needed */
		int y = (C->bar->opts & BAR_BOTTOM ? C->y+C->h : C->y-C->bar->h);
		if (C->top)
			cairo_set_source_surface(C->bar->ctx, M->bg, -C->x, -y);
		else
			cairo_set_source_surface(C->bar->ctx, M->bg, -C->x, 0);
		cairo_paint(C->bar->ctx);
	}


	cairo_set_source_surface(C->bar->ctx, S->buf, x, 0);
	cairo_paint(C->bar->ctx);
	cairo_reset_clip(C->bar->ctx);
	return 0;
}

int draw_bars(Bool bg) {
	Monitor *M; Container *C;
	int n, count;;
	for (M = mons; M; M = M->next) {
		count = n = 0;
		for (C = M->container; C; C = C->next) if (C->top) count++;
		for (C = M->container; C; C = C->next) {
			/* paint status to buf */
			if (n == 0) {
				draw_bar_sub(M, C, &sbar[0], 0, bg);
................................................................................
	set_color(S->ctx, TagOccupied);
	if (M->occ & (1<<i)) cairo_set_font_face(S->ctx, conf.bfont);
	else cairo_set_font_face(S->ctx, conf.font);
	if ( (M->tags & (1<<i)) && (M->tags & (1<<(1+16))) )
		set_color(S->ctx, TagBoth);
	else if (M->tags & (1<<i)) set_color(S->ctx, TagView);
	else if (M->tags & (1<<(i+16))) set_color(S->ctx, TagAlt);
	else if (!(M->occ & (1<<i))) return 1;
	sbar_text(S, conf.tag_name[i]);
	S->xoff += conf.bar_pad;
	return 0;
}

int sbar_tags(Monitor *M) {
	if (M->container->bar->opts & BAR_HIDE) return 0;
	Bar *S = &M->tbar;
	cairo_save(S->ctx);
	cairo_set_operator(S->ctx, CAIRO_OPERATOR_CLEAR);
	cairo_paint(S->ctx);
	cairo_restore(S->ctx);
	S->xoff = 0;
	int i;
	for (i = 0; conf.tag_name[i]; i++) {
		switch (conf.tag_mode) {
			case TAG_ICON_TEXT: sbar_tag_icon(M, S, i);
			case TAG_TEXT: sbar_tag_text(M, S, i); break;
			case TAG_TEXT_ICON: sbar_tag_text(M, S, i);
			case TAG_ICON: sbar_tag_icon(M, S, i); break;
		}
	}

	S->w = S->xoff;
	return 0;
}

int sbar_text(Bar *S, const char *str) {
	cairo_move_to(S->ctx, S->xoff, S->h - 4);
	cairo_show_text(S->ctx, str);







>










>
>








|







 







|


|









|
|


|
|
|
|


>







4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
...
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
static int round_rect(Bar *, int, int, int, int, int, int, int, int);
static int set_color(cairo_t *, int);
static int sbar_icon(Bar *, int);
static int sbar_text(Bar *, const char *);

int draw_bar_sub(Monitor *M, Container *C, Bar *S, int x, Bool bg) {
	if (C->bar->opts & BAR_HIDE) return 0;
	if (S->w < 1) return 0;
	cairo_rectangle(C->bar->ctx, x, 0, S->w, C->bar->h);
	cairo_clip(C->bar->ctx);
	if (bg) { /* draw background as needed */
		int y = (C->bar->opts & BAR_BOTTOM ? C->y+C->h : C->y-C->bar->h);
		if (C->top)
			cairo_set_source_surface(C->bar->ctx, M->bg, -C->x, -y);
		else
			cairo_set_source_surface(C->bar->ctx, M->bg, -C->x, 0);
		cairo_paint(C->bar->ctx);
	}
	round_rect(C->bar, x, 0, S->w, S->h, StatusOffset,
			StatusBackground, StatusBorder, StatusText);
	cairo_set_source_surface(C->bar->ctx, S->buf, x, 0);
	cairo_paint(C->bar->ctx);
	cairo_reset_clip(C->bar->ctx);
	return 0;
}

int draw_bars(Bool bg) {
	Monitor *M; Container *C;
	int n, count;
	for (M = mons; M; M = M->next) {
		count = n = 0;
		for (C = M->container; C; C = C->next) if (C->top) count++;
		for (C = M->container; C; C = C->next) {
			/* paint status to buf */
			if (n == 0) {
				draw_bar_sub(M, C, &sbar[0], 0, bg);
................................................................................
	set_color(S->ctx, TagOccupied);
	if (M->occ & (1<<i)) cairo_set_font_face(S->ctx, conf.bfont);
	else cairo_set_font_face(S->ctx, conf.font);
	if ( (M->tags & (1<<i)) && (M->tags & (1<<(1+16))) )
		set_color(S->ctx, TagBoth);
	else if (M->tags & (1<<i)) set_color(S->ctx, TagView);
	else if (M->tags & (1<<(i+16))) set_color(S->ctx, TagAlt);
	else if (!(M->occ & (1<<i))) return 0;
	sbar_text(S, conf.tag_name[i]);
	S->xoff += conf.bar_pad;
	return 1;
}

int sbar_tags(Monitor *M) {
	if (M->container->bar->opts & BAR_HIDE) return 0;
	Bar *S = &M->tbar;
	cairo_save(S->ctx);
	cairo_set_operator(S->ctx, CAIRO_OPERATOR_CLEAR);
	cairo_paint(S->ctx);
	cairo_restore(S->ctx);
	S->xoff = conf.bar_pad;
	int i, count = 0;
	for (i = 0; conf.tag_name[i]; i++) {
		switch (conf.tag_mode) {
			case TAG_ICON_TEXT: count += sbar_tag_icon(M, S, i);
			case TAG_TEXT: count += sbar_tag_text(M, S, i); break;
			case TAG_TEXT_ICON: count += sbar_tag_text(M, S, i);
			case TAG_ICON: count += sbar_tag_icon(M, S, i); break;
		}
	}
	if (!count) S->xoff = 0;
	S->w = S->xoff;
	return 0;
}

int sbar_text(Bar *S, const char *str) {
	cairo_move_to(S->ctx, S->xoff, S->h - 4);
	cairo_show_text(S->ctx, str);

Changes to src/xlib.c.

149
150
151
152
153
154
155

156
157
158
159
160
161
162
...
272
273
274
275
276
277
278



279
280
281
282
283
284
285
...
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
			C->bar->h = conf.bar_opts & BAR_HEIGHT;
			C->bar->buf = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
					C->bar->w, C->bar->h);
			C->bar->ctx = cairo_create(C->bar->buf);
			cairo_set_font_face(C->bar->ctx, conf.font);
			cairo_set_font_size(C->bar->ctx, conf.font_size);
			C->win = XCreateSimpleWindow(dpy,root,0,0,M->w,C->bar->h,0,0,0);

			t = cairo_xlib_surface_create(dpy, C->win,
					DefaultVisual(dpy,scr), M->w, C->bar->h);
			C->ctx = cairo_create(t);
			cairo_surface_destroy(t);
			XMapWindow(dpy, C->win);
		}
		M->tbar.buf = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
................................................................................
	Monitor *M;
	for (M = mons; M; M = M->next) {
		if (M->x + M->w > purgX) purgX = M->x + M->w + 10;
		if (M->y + M->h > purgY) purgY = M->y + M->h + 10;
	}
	XClearWindow(dpy,root);
	/* BINDING + GRABS */



	XSelectInput(dpy, root, SELECT_EVENTS);
	unsigned int mod[] = {0, LockMask, Mod2Mask, LockMask|Mod2Mask};
	KeyCode code;
	Key *key;
	XUngrabKey(dpy, AnyKey, AnyModifier, root);
	XSync(dpy,True);
	int i, j;
................................................................................
	Container *C;
	for (C = m->container; C; C = C->next)
		if (C->top && C->top == c) m->focus = C;
	tile();
}

void expose(XEvent *ev) {
	/* TODO: fix this! */
	Monitor *M; Container *C;
	//draw_bars(True);
	for (M = mons; M; M = M->next) {
		for (C = M->container; C; C = C->next){
			cairo_set_source_surface(C->ctx, C->bar->buf, 0, 0);
			cairo_paint(C->ctx);
		}
	}
}







>







 







>
>
>







 







<

|







149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
...
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
...
451
452
453
454
455
456
457

458
459
460
461
462
463
464
465
466
			C->bar->h = conf.bar_opts & BAR_HEIGHT;
			C->bar->buf = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
					C->bar->w, C->bar->h);
			C->bar->ctx = cairo_create(C->bar->buf);
			cairo_set_font_face(C->bar->ctx, conf.font);
			cairo_set_font_size(C->bar->ctx, conf.font_size);
			C->win = XCreateSimpleWindow(dpy,root,0,0,M->w,C->bar->h,0,0,0);
			XSelectInput(dpy, C->win, SELECT_EVENTS);
			t = cairo_xlib_surface_create(dpy, C->win,
					DefaultVisual(dpy,scr), M->w, C->bar->h);
			C->ctx = cairo_create(t);
			cairo_surface_destroy(t);
			XMapWindow(dpy, C->win);
		}
		M->tbar.buf = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
................................................................................
	Monitor *M;
	for (M = mons; M; M = M->next) {
		if (M->x + M->w > purgX) purgX = M->x + M->w + 10;
		if (M->y + M->h > purgY) purgY = M->y + M->h + 10;
	}
	XClearWindow(dpy,root);
	/* BINDING + GRABS */
//XSetWindowAttributes wa;
//wa.event_mask = SELECT_EVENTS;
//XChangeWindowAttributes(dpy,root,CWEventMask,&wa);
	XSelectInput(dpy, root, SELECT_EVENTS);
	unsigned int mod[] = {0, LockMask, Mod2Mask, LockMask|Mod2Mask};
	KeyCode code;
	Key *key;
	XUngrabKey(dpy, AnyKey, AnyModifier, root);
	XSync(dpy,True);
	int i, j;
................................................................................
	Container *C;
	for (C = m->container; C; C = C->next)
		if (C->top && C->top == c) m->focus = C;
	tile();
}

void expose(XEvent *ev) {

	Monitor *M; Container *C;
//	draw_bars(True);
	for (M = mons; M; M = M->next) {
		for (C = M->container; C; C = C->next){
			cairo_set_source_surface(C->ctx, C->bar->buf, 0, 0);
			cairo_paint(C->ctx);
		}
	}
}