made fullscreen apps working fine in floating mode (there is no sane way to make them work in tiled mode, thus I switch to floating mode if I run such kind of app), also fixed the xterm issue reported by Sander 95e8d12b
arg@10ksloc.org · 2006-08-02 16:32 9 file(s) · +92 −79
client.c +10 −22
3 3
 * See LICENSE file for license details.
4 4
 */
5 5
#include "dwm.h"
6 -
7 6
#include <stdlib.h>
8 7
#include <string.h>
9 8
#include <X11/Xatom.h>
219 218
	c->h = wa->height;
220 219
	c->th = bh;
221 220
222 -
	c->border = 1;
221 +
	c->border = 0;
223 222
	setsize(c);
224 223
225 224
	if(c->h != sh && c->y < bh)
254 253
	if(!c->isfloat)
255 254
		c->isfloat = trans
256 255
			|| (c->maxw && c->minw &&
257 -
				c->maxw == c->minw && c->maxh == c->minh)
258 -
			|| (c->w == sw && c->h == sh);
256 +
				c->maxw == c->minw && c->maxh == c->minh);
259 257
	settitle(c);
260 258
	arrange(NULL);
261 259
271 269
{
272 270
	int bottom = c->y + c->h;
273 271
	int right = c->x + c->w;
274 -
	XConfigureEvent e;
272 +
	/*XConfigureEvent e;*/
275 273
	XWindowChanges wc;
276 274
277 275
	if(sizehints) {
302 300
	wc.y = c->y;
303 301
	wc.width = c->w;
304 302
	wc.height = c->h;
305 -
	wc.border_width = 1;
306 -
	XConfigureWindow(dpy, c->win,
307 -
			CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
308 -
309 -
	e.type = ConfigureNotify;
310 -
	e.event = c->win;
311 -
	e.window = c->win;
312 -
	e.x = c->x;
313 -
	e.y = c->y;
314 -
	e.width = c->w;
315 -
	e.height = c->h;
316 -
	e.border_width = c->border;
317 -
	e.above = None;
318 -
	e.override_redirect = False;
319 -
	XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&e);
303 +
	if(c->w == sw && c->h == sh)
304 +
		wc.border_width = 0;
305 +
	else
306 +
		wc.border_width = 1;
307 +
	XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
320 308
	XSync(dpy, False);
321 309
}
322 310
403 391
		oh = sel->h;
404 392
		sel->x = sx;
405 393
		sel->y = sy + bh;
406 -
		sel->w = sw - 2 * sel->border;
407 -
		sel->h = sh - 2 * sel->border - bh;
394 +
		sel->w = sw - 2;
395 +
		sel->h = sh - 2 - bh;
408 396
409 397
		higher(sel);
410 398
		resize(sel, False, TopLeft);
config.arg.h +9 −9
3 3
 * See LICENSE file for license details.
4 4
 */
5 5
6 -
#define DEFMODE			dotile /* dofloat */
7 -
#define FONT			"-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*"
8 -
#define BGCOLOR			"#0a2c2d"
9 -
#define FGCOLOR			"#ddeeee"
10 -
#define BORDERCOLOR		"#176164"
11 -
#define MODKEY			Mod1Mask
12 -
#define NUMLOCKMASK		Mod2Mask
13 -
#define MASTERW			52 /* percent */
14 -
15 6
enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast };
16 7
#define TAGS \
17 8
char *tags[TLast] = { \
21 12
	[Twork] = "work", \
22 13
	[Tmisc] = "misc", \
23 14
};
15 +
16 +
#define DEFMODE			dotile /* dofloat */
24 17
#define DEFTAG			Tdev
18 +
#define FONT			"-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*"
19 +
#define BGCOLOR			"#0a2c2d"
20 +
#define FGCOLOR			"#ddeeee"
21 +
#define BORDERCOLOR		"#176164"
22 +
#define MODKEY			Mod1Mask
23 +
#define NUMLOCKMASK		Mod2Mask
24 +
#define MASTERW			52 /* percent */
25 25
26 26
#define KEYS \
27 27
	const char *browse[] = { "firefox", NULL }; \
config.h +9 −9
3 3
 * See LICENSE file for license details.
4 4
 */
5 5
6 -
#define DEFMODE			dotile /* dofloat */
7 -
#define FONT			"fixed"
8 -
#define BGCOLOR			"#666699"
9 -
#define FGCOLOR			"#eeeeee"
10 -
#define BORDERCOLOR		"#9999CC"
11 -
#define MODKEY			Mod1Mask
12 -
#define NUMLOCKMASK		Mod2Mask
13 -
#define MASTERW			52 /* percent */
14 -
15 6
enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast };
16 7
#define TAGS \
17 8
char *tags[TLast] = { \
21 12
	[Twork] = "work", \
22 13
	[Tmisc] = "misc", \
23 14
};
15 +
16 +
#define DEFMODE			dotile /* dofloat */
24 17
#define DEFTAG			Tdev
18 +
#define FONT			"fixed"
19 +
#define BGCOLOR			"#666699"
20 +
#define FGCOLOR			"#eeeeee"
21 +
#define BORDERCOLOR		"#9999CC"
22 +
#define MODKEY			Mod1Mask
23 +
#define NUMLOCKMASK		Mod2Mask
24 +
#define MASTERW			52 /* percent */
25 25
26 26
#define KEYS \
27 27
	const char *term[] = { "xterm", NULL }; \
draw.c +0 −1
3 3
 * See LICENSE file for license details.
4 4
 */
5 5
#include "dwm.h"
6 -
7 6
#include <stdio.h>
8 7
#include <string.h>
9 8
#include <X11/Xlocale.h>
dwm.h +2 −2
3 3
 * See LICENSE file for license details.
4 4
 */
5 5
6 -
#include <X11/Xlib.h>
7 6
#include CONFIG
7 +
#include <X11/Xlib.h>
8 8
9 9
/* mask shorthands, used in event.c and client.c */
10 10
#define BUTTONMASK		(ButtonPressMask | ButtonReleaseMask)
57 57
	int tx, ty, tw, th; /* title */
58 58
	int basew, baseh, incw, inch, maxw, maxh, minw, minh;
59 59
	int grav;
60 -
	unsigned int border;
61 60
	long flags; 
61 +
	unsigned int border;
62 62
	Bool isfloat;
63 63
	Bool ismax;
64 64
	Client *next;
event.c +46 −19
3 3
 * See LICENSE file for license details.
4 4
 */
5 5
#include "dwm.h"
6 -
7 6
#include <stdlib.h>
8 7
#include <X11/keysym.h>
9 8
#include <X11/Xatom.h>
151 150
{
152 151
	Client *c;
153 152
	XConfigureRequestEvent *ev = &e->xconfigurerequest;
153 +
	XEvent synev;
154 154
	XWindowChanges wc;
155 +
	unsigned long newmask;
155 156
156 -
	ev->value_mask &= ~CWSibling;
157 157
	if((c = getclient(ev->window))) {
158 158
		gravitate(c, True);
159 -
		if(ev->value_mask & CWX)
160 -
			c->x = ev->x;
161 -
		if(ev->value_mask & CWY)
162 -
			c->y = ev->y;
163 -
		if(ev->value_mask & CWWidth)
164 -
			c->w = ev->width;
165 -
		if(ev->value_mask & CWHeight)
166 -
			c->h = ev->height;
159 +
		if(c->isfloat) {
160 +
			if(ev->value_mask & CWX)
161 +
				c->x = ev->x;
162 +
			if(ev->value_mask & CWY)
163 +
				c->y = ev->y;
164 +
			if(ev->value_mask & CWWidth)
165 +
				c->w = ev->width;
166 +
			if(ev->value_mask & CWHeight)
167 +
				c->h = ev->height;
168 +
		}
167 169
		if(ev->value_mask & CWBorderWidth)
168 -
			c->border = 1;
170 +
			c->border = ev->border_width;
169 171
		gravitate(c, False);
172 +
170 173
		resize(c, True, TopLeft);
171 -
	}
172 174
173 -
	wc.x = ev->x;
174 -
	wc.y = ev->y;
175 -
	wc.width = ev->width;
176 -
	wc.height = ev->height;
177 -
	wc.border_width = 1;
178 -
	XConfigureWindow(dpy, ev->window,
179 -
			CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
175 +
		wc.x = c->x;
176 +
		wc.y = c->y;
177 +
		wc.width = c->w;
178 +
		wc.height = c->h;
179 +
		newmask = ev->value_mask & (~(CWSibling | CWStackMode | CWBorderWidth));
180 +
		if(newmask)
181 +
			XConfigureWindow(dpy, c->win, newmask, &wc);
182 +
		else {
183 +
			synev.type = ConfigureNotify;
184 +
			synev.xconfigure.display = dpy;
185 +
			synev.xconfigure.event = c->win;
186 +
			synev.xconfigure.window = c->win;
187 +
			synev.xconfigure.x = c->x;
188 +
			synev.xconfigure.y = c->y;
189 +
			synev.xconfigure.width = c->w;
190 +
			synev.xconfigure.height = c->h;
191 +
			synev.xconfigure.border_width = c->border;
192 +
			synev.xconfigure.above = None;
193 +
			/* Send synthetic ConfigureNotify */
194 +
			XSendEvent(dpy, c->win, True, NoEventMask, &synev);
195 +
		}
196 +
	}
197 +
	else {
198 +
		wc.x = ev->x;
199 +
		wc.y = ev->y;
200 +
		wc.width = ev->width;
201 +
		wc.height = ev->height;
202 +
		wc.border_width = ev->border_width;
203 +
		wc.sibling = ev->above;
204 +
		wc.stack_mode = ev->detail;
205 +
		XConfigureWindow(dpy, ev->window, ev->value_mask, &wc);
206 +
	}
180 207
	XSync(dpy, False);
181 208
}
182 209
main.c +8 −7
4 4
 */
5 5
6 6
#include "dwm.h"
7 -
8 7
#include <errno.h>
9 8
#include <stdio.h>
10 9
#include <stdlib.h>
14 13
#include <X11/cursorfont.h>
15 14
#include <X11/Xatom.h>
16 15
#include <X11/Xproto.h>
17 -
18 16
19 17
/* static */
20 18
165 163
	int i;
166 164
	unsigned int mask;
167 165
	fd_set rd;
166 +
	Bool readin = True;
168 167
	Window w;
169 168
	XEvent ev;
170 169
	XSetWindowAttributes wa;
251 250
	/* main event loop, reads status text from stdin as well */
252 251
	while(running) {
253 252
		FD_ZERO(&rd);
254 -
		FD_SET(STDIN_FILENO, &rd);
253 +
		if(readin)
254 +
			FD_SET(STDIN_FILENO, &rd);
255 255
		FD_SET(ConnectionNumber(dpy), &rd);
256 256
257 257
		i = select(ConnectionNumber(dpy) + 1, &rd, 0, 0, 0);
267 267
						(handler[ev.type])(&ev); /* call handler */
268 268
				}
269 269
			}
270 -
			if(FD_ISSET(STDIN_FILENO, &rd)) {
271 -
				if(!fgets(stext, sizeof(stext), stdin))
272 -
					break;
270 +
			if(readin && FD_ISSET(STDIN_FILENO, &rd)) {
271 +
				readin = NULL != fgets(stext, sizeof(stext), stdin);
272 +
				if(readin)
273 +
					stext[strlen(stext) - 1] = 0;
273 274
				else 
274 -
					stext[strlen(stext) - 1] = 0;
275 +
					strcpy(stext, "broken pipe");
275 276
				drawstatus();
276 277
			}
277 278
		}
tag.c +8 −9
3 3
 * See LICENSE file for license details.
4 4
 */
5 5
#include "dwm.h"
6 -
7 6
#include <regex.h>
8 7
#include <stdio.h>
9 8
#include <string.h>
86 85
			if(n == 1) {
87 86
				c->x = sx;
88 87
				c->y = sy + bh;
89 -
				c->w = sw - 2 * c->border;
90 -
				c->h = sh - 2 * c->border - bh;
88 +
				c->w = sw - 2;
89 +
				c->h = sh - 2 - bh;
91 90
			}
92 91
			else if(i == 0) {
93 92
				c->x = sx;
94 93
				c->y = sy + bh;
95 -
				c->w = mw - 2 * c->border;
96 -
				c->h = sh - 2 * c->border - bh;
94 +
				c->w = mw - 2;
95 +
				c->h = sh - 2 - bh;
97 96
			}
98 97
			else if(h > bh) {
99 98
				c->x = sx + mw;
100 99
				c->y = sy + (i - 1) * h + bh;
101 -
				c->w = w - 2 * c->border;
102 -
				c->h = h - 2 * c->border;
100 +
				c->w = w - 2;
101 +
				c->h = h - 2;
103 102
			}
104 103
			else { /* fallback if h < bh */
105 104
				c->x = sx + mw;
106 105
				c->y = sy + bh;
107 -
				c->w = w - 2 * c->border;
108 -
				c->h = sh - 2 * c->border - bh;
106 +
				c->w = w - 2;
107 +
				c->h = sh - 2 - bh;
109 108
			}
110 109
			resize(c, False, TopLeft);
111 110
			i++;
util.c +0 −1
3 3
 * See LICENSE file for license details.
4 4
 */
5 5
#include "dwm.h"
6 -
7 6
#include <stdarg.h>
8 7
#include <stdio.h>
9 8
#include <stdlib.h>