Alopex

Check-in [4d4a27276d]

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

Overview
Comment:fixed title bug
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | master
Files: files | file ages | folders
SHA3-256: 4d4a27276d47713967f398aa4fa93ded4d67b36d640b4ebe9a77060ef4cfeb37
User & Date: jesse@mccluresk9.com 2014-02-03 00:13:07
Context
2014-02-03
20:22
theming and other updates check-in: ce7cb981ee user: jesse@mccluresk9.com tags: trunk, master
00:13
fixed title bug check-in: 4d4a27276d user: jesse@mccluresk9.com tags: trunk, master
2014-02-02
23:11
add PKGBUILD check-in: 3f2971ca02 user: jesse@mccluresk9.com tags: trunk, master
Changes

Changes to TODO.

1
2
3
4
5
6
7

bug: bars "freeze" and stop getting redrawn after some time
	- C->bar->buf is painted to C->win, but buf isn't updated.
	- only the buf in use at the time is affected
	- *very* rare - hard to replicate to learn more
icons
switch from configdb to config

<
<
<
<


1




2
3





icons
switch from configdb to config

Changes to src/atoms.c.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
..
29
30
31
32
33
34
35
















36
37
38
39
40
41
42

int atoms_init() {
	atom[WM_PROTOCOLS] = make_atom("WM_PROTOCOLS");
	atom[WM_DELETE_WINDOW] = make_atom("WM_DELETE_WINDOW");
	atom[WM_STATE] = make_atom("WM_STATE");
	atom[WM_TAKE_FOCUS] = make_atom("WM_TAKE_FOCUS");
//	atom[NET_SUPPORTED] = make_atom("_NET_SUPPORTED");
//	atom[NET_WM_NAME] = make_atom("_NET_WM_NAME");
//	atom[NET_WM_STATE] = make_atom("_NET_WM_STATE");
//	atom[NET_WM_STATE_FULLSCREEN] = make_atom("_NET_WM_STATE_FULLSCREEN");
//	atom[NET_ACTIVE_WINDOW] = make_atom("_NET_ACTIVE_WINDOW");
//	atom[NET_WM_WINDOW_TYPE] = make_atom("_NET_WM_WINDOW_TYPE");
//	atom[NET_WM_TYPE_DIALOG] = make_atom("_NET_WM_TYPE_DIALOG");
//	atom[NET_CLIENT_LIST] = make_atom("_NET_CLIENT_LIST");
	return 0;
................................................................................
	if (!XGetWindowProperty(dpy, c->win, atom[type], 0L, sizeof(at),
			False, XA_ATOM, &aa, &i, &ul, &ul, &uc) == Success && uc)
		return at;
	at = *(Atom *)uc;
	XFree(uc);
	return at;
}

















int send_message(Client *c, int type, int msg) {
	XEvent ev;
	ev.type = ClientMessage;
	ev.xclient.window = c->win;
	ev.xclient.message_type = atom[type];
	//ev.xclient.message_type = XInternAtom(dpy, "WM_PROTOCOLS", True);







|







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
..
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58

int atoms_init() {
	atom[WM_PROTOCOLS] = make_atom("WM_PROTOCOLS");
	atom[WM_DELETE_WINDOW] = make_atom("WM_DELETE_WINDOW");
	atom[WM_STATE] = make_atom("WM_STATE");
	atom[WM_TAKE_FOCUS] = make_atom("WM_TAKE_FOCUS");
//	atom[NET_SUPPORTED] = make_atom("_NET_SUPPORTED");
	atom[NET_WM_NAME] = make_atom("_NET_WM_NAME");
//	atom[NET_WM_STATE] = make_atom("_NET_WM_STATE");
//	atom[NET_WM_STATE_FULLSCREEN] = make_atom("_NET_WM_STATE_FULLSCREEN");
//	atom[NET_ACTIVE_WINDOW] = make_atom("_NET_ACTIVE_WINDOW");
//	atom[NET_WM_WINDOW_TYPE] = make_atom("_NET_WM_WINDOW_TYPE");
//	atom[NET_WM_TYPE_DIALOG] = make_atom("_NET_WM_TYPE_DIALOG");
//	atom[NET_CLIENT_LIST] = make_atom("_NET_CLIENT_LIST");
	return 0;
................................................................................
	if (!XGetWindowProperty(dpy, c->win, atom[type], 0L, sizeof(at),
			False, XA_ATOM, &aa, &i, &ul, &ul, &uc) == Success && uc)
		return at;
	at = *(Atom *)uc;
	XFree(uc);
	return at;
}

char *get_text(Client *c, int type) {
	char **strs = NULL;
	int n;
	XTextProperty text;
	XGetTextProperty(dpy, c->win, &text, atom[type]);
	if (!text.nitems) return NULL;
	if (text.encoding == XA_STRING) return (char *) text.value;
	else if (XmbTextPropertyToTextList(dpy, &text, &strs, &n)>=Success) {
		char *tmp = strdup(*strs);
		XFreeStringList(strs);
		XFree(text.value);
		return tmp;
	}
}


int send_message(Client *c, int type, int msg) {
	XEvent ev;
	ev.type = ClientMessage;
	ev.xclient.window = c->win;
	ev.xclient.message_type = atom[type];
	//ev.xclient.message_type = XInternAtom(dpy, "WM_PROTOCOLS", True);

Changes to src/draw.c.

70
71
72
73
74
75
76



77
78
79
80
81
82
83
	if (m->focus == C && C->top == c) theme = 3;
	else if (C->top == c) theme = 6;
	round_rect(b, x, 0, w, h, TabOffset, TabBackground + theme,
			TabBorder + theme, TabText + theme);
	double off = conf.theme[TabText+theme].r;
	cairo_text_extents_t ext;
	cairo_text_extents(b->ctx, c->title, &ext);



	if (off < 0) off *= -1;
	else {
		off *= w - ext.x_advance;
		if (off < 0) off = 0;
	}
	// if icon, adjust off
	// TODO icons







>
>
>







70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
	if (m->focus == C && C->top == c) theme = 3;
	else if (C->top == c) theme = 6;
	round_rect(b, x, 0, w, h, TabOffset, TabBackground + theme,
			TabBorder + theme, TabText + theme);
	double off = conf.theme[TabText+theme].r;
	cairo_text_extents_t ext;
	cairo_text_extents(b->ctx, c->title, &ext);
fprintf(stderr,"TITLE: %s\nSTATUS: %s\n",
c->title,
cairo_status_to_string(cairo_status(b->ctx)));
	if (off < 0) off *= -1;
	else {
		off *= w - ext.x_advance;
		if (off < 0) off = 0;
	}
	// if icon, adjust off
	// TODO icons

Changes to src/xlib.c.

11
12
13
14
15
16
17

18
19
20
21
22
23
24
...
353
354
355
356
357
358
359
360
361

362

363
364
365
366
367
368
369
#define GRABMODE2	ButtonPressMask, GrabModeAsync, GrabModeAsync, \
	None, None

extern int config_init(const char *);
extern int config_free();
extern int draw_bars(Bool);
extern int sbar_parse(Bar *, const char *);


static int apply_rules(Client *);
static int get_hints(Client *);
static int get_icon(Client *);
static int get_name(Client *);

static void buttonpress(XEvent *);
................................................................................
	// TODO
	return 0;
}

int get_name(Client *c) {
	static const char *noname = "(no name)";
	Client *p;
	if (c->title) XFree(c->title);
	XFetchName(dpy, c->win, &c->title);

	if (!c->title) c->title = strdup(noname);

}


/**** EVENT HANDLERS ****/

void buttonpress(XEvent *ev) {
	XButtonEvent *e = &ev->xbutton;







>







 







|
|
>
|
>







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
...
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
#define GRABMODE2	ButtonPressMask, GrabModeAsync, GrabModeAsync, \
	None, None

extern int config_init(const char *);
extern int config_free();
extern int draw_bars(Bool);
extern int sbar_parse(Bar *, const char *);
extern char *get_text(Client *, int);

static int apply_rules(Client *);
static int get_hints(Client *);
static int get_icon(Client *);
static int get_name(Client *);

static void buttonpress(XEvent *);
................................................................................
	// TODO
	return 0;
}

int get_name(Client *c) {
	static const char *noname = "(no name)";
	Client *p;
	if (c->title && c->title != noname) XFree(c->title);
	if ( !(c->title=get_text(c,NET_WM_NAME)) )
		if ( !(c->title=get_text(c,XA_WM_NAME)) )
			c->title = strdup(noname);
	return 0;
}


/**** EVENT HANDLERS ****/

void buttonpress(XEvent *ev) {
	XButtonEvent *e = &ev->xbutton;