about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorarg@10ksloc.org <unknown>2006-08-02 16:32:05 +0200
committerarg@10ksloc.org <unknown>2006-08-02 16:32:05 +0200
commit95e8d12b7189d4cd01b8ae8ecebfa5835a1809e6 (patch)
tree98283068f4576b8b2e825dd5eff0eb6e94ddbdc0
parenta55f0e12fe5c1205f4d3e40c164fd087224fad7a (diff)
downloaddwm-95e8d12b7189d4cd01b8ae8ecebfa5835a1809e6.tar.gz
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
-rw-r--r--client.c32
-rw-r--r--config.arg.h18
-rw-r--r--config.h18
-rw-r--r--draw.c1
-rw-r--r--dwm.h4
-rw-r--r--event.c65
-rw-r--r--main.c15
-rw-r--r--tag.c17
-rw-r--r--util.c1
9 files changed, 92 insertions, 79 deletions
diff --git a/client.c b/client.c
index 5912c77..b6bda92 100644
--- a/client.c
+++ b/client.c
@@ -3,7 +3,6 @@
  * See LICENSE file for license details.
  */
 #include "dwm.h"
-
 #include <stdlib.h>
 #include <string.h>
 #include <X11/Xatom.h>
@@ -219,7 +218,7 @@ manage(Window w, XWindowAttributes *wa)
 	c->h = wa->height;
 	c->th = bh;
 
-	c->border = 1;
+	c->border = 0;
 	setsize(c);
 
 	if(c->h != sh && c->y < bh)
@@ -254,8 +253,7 @@ manage(Window w, XWindowAttributes *wa)
 	if(!c->isfloat)
 		c->isfloat = trans
 			|| (c->maxw && c->minw &&
-				c->maxw == c->minw && c->maxh == c->minh)
-			|| (c->w == sw && c->h == sh);
+				c->maxw == c->minw && c->maxh == c->minh);
 	settitle(c);
 	arrange(NULL);
 
@@ -271,7 +269,7 @@ resize(Client *c, Bool sizehints, Corner sticky)
 {
 	int bottom = c->y + c->h;
 	int right = c->x + c->w;
-	XConfigureEvent e;
+	/*XConfigureEvent e;*/
 	XWindowChanges wc;
 
 	if(sizehints) {
@@ -302,21 +300,11 @@ resize(Client *c, Bool sizehints, Corner sticky)
 	wc.y = c->y;
 	wc.width = c->w;
 	wc.height = c->h;
-	wc.border_width = 1;
-	XConfigureWindow(dpy, c->win,
-			CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
-
-	e.type = ConfigureNotify;
-	e.event = c->win;
-	e.window = c->win;
-	e.x = c->x;
-	e.y = c->y;
-	e.width = c->w;
-	e.height = c->h;
-	e.border_width = c->border;
-	e.above = None;
-	e.override_redirect = False;
-	XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&e);
+	if(c->w == sw && c->h == sh)
+		wc.border_width = 0;
+	else
+		wc.border_width = 1;
+	XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
 	XSync(dpy, False);
 }
 
@@ -403,8 +391,8 @@ togglemax(Arg *arg)
 		oh = sel->h;
 		sel->x = sx;
 		sel->y = sy + bh;
-		sel->w = sw - 2 * sel->border;
-		sel->h = sh - 2 * sel->border - bh;
+		sel->w = sw - 2;
+		sel->h = sh - 2 - bh;
 
 		higher(sel);
 		resize(sel, False, TopLeft);
diff --git a/config.arg.h b/config.arg.h
index 80d4918..933bcfb 100644
--- a/config.arg.h
+++ b/config.arg.h
@@ -3,15 +3,6 @@
  * See LICENSE file for license details.
  */
 
-#define DEFMODE			dotile /* dofloat */
-#define FONT			"-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*"
-#define BGCOLOR			"#0a2c2d"
-#define FGCOLOR			"#ddeeee"
-#define BORDERCOLOR		"#176164"
-#define MODKEY			Mod1Mask
-#define NUMLOCKMASK		Mod2Mask
-#define MASTERW			52 /* percent */
-
 enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast };
 #define TAGS \
 char *tags[TLast] = { \
@@ -21,7 +12,16 @@ char *tags[TLast] = { \
 	[Twork] = "work", \
 	[Tmisc] = "misc", \
 };
+
+#define DEFMODE			dotile /* dofloat */
 #define DEFTAG			Tdev
+#define FONT			"-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*"
+#define BGCOLOR			"#0a2c2d"
+#define FGCOLOR			"#ddeeee"
+#define BORDERCOLOR		"#176164"
+#define MODKEY			Mod1Mask
+#define NUMLOCKMASK		Mod2Mask
+#define MASTERW			52 /* percent */
 
 #define KEYS \
 	const char *browse[] = { "firefox", NULL }; \
diff --git a/config.h b/config.h
index d9070e3..1e8cb39 100644
--- a/config.h
+++ b/config.h
@@ -3,15 +3,6 @@
  * See LICENSE file for license details.
  */
 
-#define DEFMODE			dotile /* dofloat */
-#define FONT			"fixed"
-#define BGCOLOR			"#666699"
-#define FGCOLOR			"#eeeeee"
-#define BORDERCOLOR		"#9999CC"
-#define MODKEY			Mod1Mask
-#define NUMLOCKMASK		Mod2Mask
-#define MASTERW			52 /* percent */
-
 enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast };
 #define TAGS \
 char *tags[TLast] = { \
@@ -21,7 +12,16 @@ char *tags[TLast] = { \
 	[Twork] = "work", \
 	[Tmisc] = "misc", \
 };
+
+#define DEFMODE			dotile /* dofloat */
 #define DEFTAG			Tdev
+#define FONT			"fixed"
+#define BGCOLOR			"#666699"
+#define FGCOLOR			"#eeeeee"
+#define BORDERCOLOR		"#9999CC"
+#define MODKEY			Mod1Mask
+#define NUMLOCKMASK		Mod2Mask
+#define MASTERW			52 /* percent */
 
 #define KEYS \
 	const char *term[] = { "xterm", NULL }; \
diff --git a/draw.c b/draw.c
index 4f8594c..4ba5cd6 100644
--- a/draw.c
+++ b/draw.c
@@ -3,7 +3,6 @@
  * See LICENSE file for license details.
  */
 #include "dwm.h"
-
 #include <stdio.h>
 #include <string.h>
 #include <X11/Xlocale.h>
diff --git a/dwm.h b/dwm.h
index 0ed778c..803fe9f 100644
--- a/dwm.h
+++ b/dwm.h
@@ -3,8 +3,8 @@
  * See LICENSE file for license details.
  */
 
-#include <X11/Xlib.h>
 #include CONFIG
+#include <X11/Xlib.h>
 
 /* mask shorthands, used in event.c and client.c */
 #define BUTTONMASK		(ButtonPressMask | ButtonReleaseMask)
@@ -57,8 +57,8 @@ struct Client {
 	int tx, ty, tw, th; /* title */
 	int basew, baseh, incw, inch, maxw, maxh, minw, minh;
 	int grav;
-	unsigned int border;
 	long flags; 
+	unsigned int border;
 	Bool isfloat;
 	Bool ismax;
 	Client *next;
diff --git a/event.c b/event.c
index faee103..0c159c7 100644
--- a/event.c
+++ b/event.c
@@ -3,7 +3,6 @@
  * See LICENSE file for license details.
  */
 #include "dwm.h"
-
 #include <stdlib.h>
 #include <X11/keysym.h>
 #include <X11/Xatom.h>
@@ -151,32 +150,60 @@ configurerequest(XEvent *e)
 {
 	Client *c;
 	XConfigureRequestEvent *ev = &e->xconfigurerequest;
+	XEvent synev;
 	XWindowChanges wc;
+	unsigned long newmask;
 
-	ev->value_mask &= ~CWSibling;
 	if((c = getclient(ev->window))) {
 		gravitate(c, True);
-		if(ev->value_mask & CWX)
-			c->x = ev->x;
-		if(ev->value_mask & CWY)
-			c->y = ev->y;
-		if(ev->value_mask & CWWidth)
-			c->w = ev->width;
-		if(ev->value_mask & CWHeight)
-			c->h = ev->height;
+		if(c->isfloat) {
+			if(ev->value_mask & CWX)
+				c->x = ev->x;
+			if(ev->value_mask & CWY)
+				c->y = ev->y;
+			if(ev->value_mask & CWWidth)
+				c->w = ev->width;
+			if(ev->value_mask & CWHeight)
+				c->h = ev->height;
+		}
 		if(ev->value_mask & CWBorderWidth)
-			c->border = 1;
+			c->border = ev->border_width;
 		gravitate(c, False);
+
 		resize(c, True, TopLeft);
-	}
 
-	wc.x = ev->x;
-	wc.y = ev->y;
-	wc.width = ev->width;
-	wc.height = ev->height;
-	wc.border_width = 1;
-	XConfigureWindow(dpy, ev->window,
-			CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
+		wc.x = c->x;
+		wc.y = c->y;
+		wc.width = c->w;
+		wc.height = c->h;
+		newmask = ev->value_mask & (~(CWSibling | CWStackMode | CWBorderWidth));
+		if(newmask)
+			XConfigureWindow(dpy, c->win, newmask, &wc);
+		else {
+			synev.type = ConfigureNotify;
+			synev.xconfigure.display = dpy;
+			synev.xconfigure.event = c->win;
+			synev.xconfigure.window = c->win;
+			synev.xconfigure.x = c->x;
+			synev.xconfigure.y = c->y;
+			synev.xconfigure.width = c->w;
+			synev.xconfigure.height = c->h;
+			synev.xconfigure.border_width = c->border;
+			synev.xconfigure.above = None;
+			/* Send synthetic ConfigureNotify */
+			XSendEvent(dpy, c->win, True, NoEventMask, &synev);
+		}
+	}
+	else {
+		wc.x = ev->x;
+		wc.y = ev->y;
+		wc.width = ev->width;
+		wc.height = ev->height;
+		wc.border_width = ev->border_width;
+		wc.sibling = ev->above;
+		wc.stack_mode = ev->detail;
+		XConfigureWindow(dpy, ev->window, ev->value_mask, &wc);
+	}
 	XSync(dpy, False);
 }
 
diff --git a/main.c b/main.c
index 86d72fa..33a2a9a 100644
--- a/main.c
+++ b/main.c
@@ -4,7 +4,6 @@
  */
 
 #include "dwm.h"
-
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -15,7 +14,6 @@
 #include <X11/Xatom.h>
 #include <X11/Xproto.h>
 
-
 /* static */
 
 static int (*xerrorxlib)(Display *, XErrorEvent *);
@@ -165,6 +163,7 @@ main(int argc, char *argv[])
 	int i;
 	unsigned int mask;
 	fd_set rd;
+	Bool readin = True;
 	Window w;
 	XEvent ev;
 	XSetWindowAttributes wa;
@@ -251,7 +250,8 @@ main(int argc, char *argv[])
 	/* main event loop, reads status text from stdin as well */
 	while(running) {
 		FD_ZERO(&rd);
-		FD_SET(STDIN_FILENO, &rd);
+		if(readin)
+			FD_SET(STDIN_FILENO, &rd);
 		FD_SET(ConnectionNumber(dpy), &rd);
 
 		i = select(ConnectionNumber(dpy) + 1, &rd, 0, 0, 0);
@@ -267,11 +267,12 @@ main(int argc, char *argv[])
 						(handler[ev.type])(&ev); /* call handler */
 				}
 			}
-			if(FD_ISSET(STDIN_FILENO, &rd)) {
-				if(!fgets(stext, sizeof(stext), stdin))
-					break;
-				else 
+			if(readin && FD_ISSET(STDIN_FILENO, &rd)) {
+				readin = NULL != fgets(stext, sizeof(stext), stdin);
+				if(readin)
 					stext[strlen(stext) - 1] = 0;
+				else 
+					strcpy(stext, "broken pipe");
 				drawstatus();
 			}
 		}
diff --git a/tag.c b/tag.c
index f6c33ea..f4ddfd9 100644
--- a/tag.c
+++ b/tag.c
@@ -3,7 +3,6 @@
  * See LICENSE file for license details.
  */
 #include "dwm.h"
-
 #include <regex.h>
 #include <stdio.h>
 #include <string.h>
@@ -86,26 +85,26 @@ dotile(Arg *arg)
 			if(n == 1) {
 				c->x = sx;
 				c->y = sy + bh;
-				c->w = sw - 2 * c->border;
-				c->h = sh - 2 * c->border - bh;
+				c->w = sw - 2;
+				c->h = sh - 2 - bh;
 			}
 			else if(i == 0) {
 				c->x = sx;
 				c->y = sy + bh;
-				c->w = mw - 2 * c->border;
-				c->h = sh - 2 * c->border - bh;
+				c->w = mw - 2;
+				c->h = sh - 2 - bh;
 			}
 			else if(h > bh) {
 				c->x = sx + mw;
 				c->y = sy + (i - 1) * h + bh;
-				c->w = w - 2 * c->border;
-				c->h = h - 2 * c->border;
+				c->w = w - 2;
+				c->h = h - 2;
 			}
 			else { /* fallback if h < bh */
 				c->x = sx + mw;
 				c->y = sy + bh;
-				c->w = w - 2 * c->border;
-				c->h = sh - 2 * c->border - bh;
+				c->w = w - 2;
+				c->h = sh - 2 - bh;
 			}
 			resize(c, False, TopLeft);
 			i++;
diff --git a/util.c b/util.c
index 6eb19b4..7aff2aa 100644
--- a/util.c
+++ b/util.c
@@ -3,7 +3,6 @@
  * See LICENSE file for license details.
  */
 #include "dwm.h"
-
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
d='n5' href='#n5'>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