about summary refs log tree commit diff stats
path: root/dwm.c
diff options
context:
space:
mode:
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c64
1 files changed, 54 insertions, 10 deletions
diff --git a/dwm.c b/dwm.c
index 14aa808..af13a58 100644
--- a/dwm.c
+++ b/dwm.c
@@ -40,6 +40,21 @@
 #include <X11/Xlib.h>
 #include <X11/Xproto.h>
 #include <X11/Xutil.h>
+/*
+ * TODO: Idea:
+ * I intend to not provide real Xinerama support, but instead having a Column
+ * tilecols[] array which is used by tile(), and a Column maxcols[] arrays which is used by
+ * maximise(). Those arrays should be initialized in config.h. For simplicity
+ * reasons mwfact should be replaced with a more advanced method which
+ * implements the same, but using the boundary between tilecols[0] and
+ * tilecols[1] instead. Besides this, get rid of BARPOS and use instead the
+ * following mechanism:
+ *
+ * #define BX 0
+ * #define BY 0
+ * #define BW sw
+ * bh is calculated automatically and should be used for the 
+ */
 #ifdef XINERAMA
 #include <X11/extensions/Xinerama.h>
 #endif
@@ -78,6 +93,10 @@ struct Client {
 
 typedef struct {
 	int x, y, w, h;
+} Column;
+
+typedef struct {
+	int x, y, w, h;
 	unsigned long norm[ColLast];
 	unsigned long sel[ColLast];
 	Drawable drawable;
@@ -195,7 +214,7 @@ void selectview(const char *arg);
 /* variables */
 char stext[256], buf[256];
 double mwfact;
-int screen, sx, sy, sw, sh, wax, way, waw, wah, xscreens;
+int screen, sx, sy, sw, sh, wax, way, waw, wah, ncols;
 int (*xerrorxlib)(Display *, XErrorEvent *);
 unsigned int bh, bpos;
 unsigned int blw = 0;
@@ -224,14 +243,12 @@ Bool *seltags;
 Client *clients = NULL;
 Client *sel = NULL;
 Client *stack = NULL;
+Column *cols = NULL;
 Cursor cursor[CurLast];
 Display *dpy;
 DC dc = {0};
 Layout *lt;
 Window root, barwin;
-#ifdef XINERAMA
-XineramaScreenInfo *info = NULL;
-#endif
 
 /* configuration, allows nested code to access above variables */
 #include "config.h"
@@ -393,10 +410,6 @@ cleanup(void) {
 	XFreeCursor(dpy, cursor[CurResize]);
 	XFreeCursor(dpy, cursor[CurMove]);
 	XDestroyWindow(dpy, barwin);
-#if XINERAMA
-	if(info)
-		XFree(info);
-#endif
 	XSync(dpy, False);
 	XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
 }
@@ -1458,8 +1471,12 @@ setmwfact(const char *arg) {
 
 void
 setup(void) {
+	int screens = 1;
 	unsigned int i;
 	XSetWindowAttributes wa;
+#ifdef XINERAMA
+	XineramaScreenInfo *info;
+#endif
 
 	/* init screen */
 	screen = DefaultScreen(dpy);
@@ -1482,11 +1499,38 @@ setup(void) {
 	cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing);
 	cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur);
 
+	ncols = 2;
 #ifdef XINERAMA
-	if(XineramaIsActive(dpy))
-		info = XineramaQueryScreens(dpy, &xscreens);
+	if(XineramaIsActive(dpy)) {
+		if((info = XineramaQueryScreens(dpy, &screens))) {
+			if(screens == 1) {
+				sx = info[0].x_org;
+				sy = info[0].y_org;
+				sw = info[0].width;
+				sh = info[0].height;
+			}
+			else {
+				ncols = screens;
+				cols = emallocz(ncols * sizeof(Column));
+				for(i = 0; i < ncols; i++) {
+					cols[i].x = info[i].x_org;
+					cols[i].y = info[i].y_org;
+					cols[i].w = info[i].width;
+					cols[i].h = info[i].height;
+				}
+			}
+			XFree(info);
+		}
+	}
+	else
 #endif
+	{
+		cols = emallocz(ncols * sizeof(Column));
+		cols[0].x = sx;
+		cols[0].y = sy;
 
+
+	}
 	/* init appearance */
 	dc.norm[ColBorder] = getcolor(NORMBORDERCOLOR);
 	dc.norm[ColBG] = getcolor(NORMBGCOLOR);
s='alt'>
b4d5b589 ^
0ca56ed8 ^


b4d5b589 ^
0ca56ed8 ^




b4d5b589 ^
0ca56ed8 ^
b4d5b589 ^
414b452f ^
bf37b4d5 ^
414b452f ^

0ca56ed8 ^

bf37b4d5 ^
bf37b4d5 ^
0ca56ed8 ^

0ca56ed8 ^
b4d5b589 ^





















0ca56ed8 ^
b4d5b589 ^
0ca56ed8 ^

























bf37b4d5 ^
b4d5b589 ^










0ca56ed8 ^

b4d5b589 ^







0ca56ed8 ^






203563b3 ^

0ca56ed8 ^





203563b3 ^

0ca56ed8 ^

203563b3 ^

bf37b4d5 ^

0ca56ed8 ^



bf37b4d5 ^
203563b3 ^
bf37b4d5 ^

203563b3 ^


6c69569a ^
bf37b4d5 ^
203563b3 ^

bf37b4d5 ^





















6c69569a ^



bf37b4d5 ^



0ca56ed8 ^







203563b3 ^
0ca56ed8 ^


203563b3 ^
414b452f ^
0ca56ed8 ^





203563b3 ^


0ca56ed8 ^

b4d5b589 ^




0ca56ed8 ^



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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257