about summary refs log tree commit diff stats
path: root/client.c
diff options
context:
space:
mode:
authorAnselm R. Garbe <garbeam@wmii.de>2006-07-13 21:42:17 +0200
committerAnselm R. Garbe <garbeam@wmii.de>2006-07-13 21:42:17 +0200
commit66da15324eef4f85c6dda13eba80430dc4cc97bb (patch)
treeb2ecd808ad31e5237cabebdc7d80fc6a4edaf1f4 /client.c
parent7fe717c29f9dafc4fc38313adbbb7c85619dec69 (diff)
downloaddwm-66da15324eef4f85c6dda13eba80430dc4cc97bb.tar.gz
added mini stuff
Diffstat (limited to 'client.c')
-rw-r--r--client.c51
1 files changed, 31 insertions, 20 deletions
diff --git a/client.c b/client.c
index 6d7bd92..3fb2318 100644
--- a/client.c
+++ b/client.c
@@ -11,10 +11,11 @@
 
 #include "dwm.h"
 
-static void (*arrange)(Arg *) = tiling;
+void (*arrange)(Arg *) = tiling;
 
 static Rule rule[] = {
-	{ "Firefox-bin", "Gecko", { [Twww] = "www" } },
+	/* class			instance	tags						floating */
+	{ "Firefox-bin",	"Gecko",	{ [Twww] = "www" },			False },
 };
 
 static Client *
@@ -64,27 +65,27 @@ view(Arg *arg)
 }
 
 void
-tag(Arg *arg)
+tappend(Arg *arg)
 {
-	int i, n;
 	if(!sel)
 		return;
 
-	if(arg->i == tsel) {
-		for(n = i = 0; i < TLast; i++)
-			if(sel->tags[i])
-				n++;
-		if(n < 2)
-			return;
-	}
-
-	if(sel->tags[arg->i])
-		sel->tags[arg->i] = NULL; /* toggle tag */
-	else
-		sel->tags[arg->i] = tags[arg->i];
+	sel->tags[arg->i] = tags[arg->i];
 	arrange(NULL);
 }
 
+void
+ttrunc(Arg *arg)
+{
+	int i;
+	if(!sel)
+		return;
+
+	for(i = 0; i < TLast; i++)
+		sel->tags[i] = NULL;
+	tappend(arg);
+}
+
 static void
 ban_client(Client *c)
 {
@@ -122,13 +123,18 @@ tiling(Arg *arg)
 	w = sw - mw;
 	arrange = tiling;
 	for(n = 0, c = clients; c; c = c->next)
-		if(c->tags[tsel])
+		if(c->tags[tsel] && !c->floating)
 			n++;
 
 	h = (n > 1) ? sh / (n - 1) : sh;
 
 	for(i = 0, c = clients; c; c = c->next) {
 		if(c->tags[tsel]) {
+			if(c->floating) {
+				craise(c);
+				resize(c, True);
+				continue;
+			}
 			if(n == 1) {
 				c->x = sx;
 				c->y = sy;
@@ -330,14 +336,13 @@ init_tags(Client *c)
 
 	if(XGetClassHint(dpy, c->win, &ch)) {
 		if(ch.res_class && ch.res_name) {
-			fprintf(stderr, "%s:%s\n", ch.res_class, ch.res_name);
 			for(i = 0; i < len; i++)
 				if(!strncmp(rule[i].class, ch.res_class, sizeof(rule[i].class))
 					&& !strncmp(rule[i].instance, ch.res_name, sizeof(rule[i].instance)))
 				{
-			fprintf(stderr, "->>>%s:%s\n", ch.res_class, ch.res_name);
 					for(j = 0; j < TLast; j++)
 						c->tags[j] = rule[i].tags[j];
+					c->floating = rule[i].floating;
 					matched = True;
 					break;
 				}
@@ -357,6 +362,7 @@ manage(Window w, XWindowAttributes *wa)
 {
 	Client *c, **l;
 	XSetWindowAttributes twa;
+	Window trans;
 
 	c = emallocz(sizeof(Client));
 	c->win = w;
@@ -370,7 +376,7 @@ manage(Window w, XWindowAttributes *wa)
 	update_size(c);
 	XSelectInput(dpy, c->win,
 			StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
-	XGetTransientForHint(dpy, c->win, &c->trans);
+	XGetTransientForHint(dpy, c->win, &trans);
 	twa.override_redirect = 1;
 	twa.background_pixmap = ParentRelative;
 	twa.event_mask = ExposureMask;
@@ -396,6 +402,11 @@ manage(Window w, XWindowAttributes *wa)
 			GrabModeAsync, GrabModeSync, None, None);
 	XGrabButton(dpy, Button3, Mod1Mask, c->win, False, ButtonPressMask,
 			GrabModeAsync, GrabModeSync, None, None);
+
+	if(!c->floating)
+		c->floating = trans
+			|| ((c->maxw == c->minw) && (c->maxh == c->minh));
+
 	arrange(NULL);
 	if(c->tags[tsel])
 		focus(c);
e the previous revision' href='/acidbong/suckless/dwm/blame/util.c?h=2.7&id=8c334ee078a682a4e5b01aad6b12d24cf9be26d6'>^
d4b7a9a ^


adaa28a ^
c47da14 ^
439e15d ^
9955ddc ^
dc5d967 ^
9955ddc ^



439e15d ^
a50b15a ^
439e15d ^



16c67f3 ^
7711ab6 ^
e48de30 ^
439e15d ^

0464e42 ^
439e15d ^


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