about summary refs log tree commit diff stats
path: root/layout.c
diff options
context:
space:
mode:
Diffstat (limited to 'layout.c')
-rw-r--r--layout.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/layout.c b/layout.c
index 96e125a..2763d2c 100644
--- a/layout.c
+++ b/layout.c
@@ -98,7 +98,6 @@ void
 initlayouts(void) {
 	unsigned int i, w;
 
-	/* TODO deserialize ltidx if present */
 	nlayouts = sizeof layouts / sizeof layouts[0];
 	for(blw = i = 0; i < nlayouts; i++) {
 		w = textw(layouts[i].symbol);
@@ -110,21 +109,13 @@ initlayouts(void) {
 void
 loaddwmprops(void) {
 	unsigned int i;
-	XTextProperty name;
-
-	/* check if window has set a property */
-	name.nitems = 0;
-	XGetTextProperty(dpy, root, &name, dwmprops);
-	if(name.nitems && name.encoding == XA_STRING) {
-		strncpy(prop, (char *)name.value, sizeof prop - 1);
-		prop[sizeof prop - 1] = '\0';
-		XFree(name.value);
+
+	if(gettextprop(root, dwmprops, prop, sizeof prop)) {
 		for(i = 0; i < ntags && i < sizeof prop - 1 && prop[i] != '\0'; i++)
 			seltags[i] = prop[i] == '1';
 		if(i < sizeof prop - 1 && prop[i] != '\0') {
-			i = prop[i];
-			if(i < nlayouts)
-				ltidx = i;
+			if(prop[i] < nlayouts)
+				ltidx = prop[i];
 		}
 	}
 }
1a75cd ^
8bb115d ^


f81e4bd ^



















91a75cd ^

1
2
3
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78