dwm-meillo
diff client.c @ 53:529901e6a227
added mini stuff
author | Anselm R. Garbe <garbeam@wmii.de> |
---|---|
date | Thu, 13 Jul 2006 21:42:17 +0200 |
parents | d18f6dd0cf23 |
children | a64602deac83 |
line diff
1.1 --- a/client.c Thu Jul 13 20:28:19 2006 +0200 1.2 +++ b/client.c Thu Jul 13 21:42:17 2006 +0200 1.3 @@ -11,10 +11,11 @@ 1.4 1.5 #include "dwm.h" 1.6 1.7 -static void (*arrange)(Arg *) = tiling; 1.8 +void (*arrange)(Arg *) = tiling; 1.9 1.10 static Rule rule[] = { 1.11 - { "Firefox-bin", "Gecko", { [Twww] = "www" } }, 1.12 + /* class instance tags floating */ 1.13 + { "Firefox-bin", "Gecko", { [Twww] = "www" }, False }, 1.14 }; 1.15 1.16 static Client * 1.17 @@ -64,25 +65,25 @@ 1.18 } 1.19 1.20 void 1.21 -tag(Arg *arg) 1.22 +tappend(Arg *arg) 1.23 { 1.24 - int i, n; 1.25 if(!sel) 1.26 return; 1.27 1.28 - if(arg->i == tsel) { 1.29 - for(n = i = 0; i < TLast; i++) 1.30 - if(sel->tags[i]) 1.31 - n++; 1.32 - if(n < 2) 1.33 - return; 1.34 - } 1.35 + sel->tags[arg->i] = tags[arg->i]; 1.36 + arrange(NULL); 1.37 +} 1.38 1.39 - if(sel->tags[arg->i]) 1.40 - sel->tags[arg->i] = NULL; /* toggle tag */ 1.41 - else 1.42 - sel->tags[arg->i] = tags[arg->i]; 1.43 - arrange(NULL); 1.44 +void 1.45 +ttrunc(Arg *arg) 1.46 +{ 1.47 + int i; 1.48 + if(!sel) 1.49 + return; 1.50 + 1.51 + for(i = 0; i < TLast; i++) 1.52 + sel->tags[i] = NULL; 1.53 + tappend(arg); 1.54 } 1.55 1.56 static void 1.57 @@ -122,13 +123,18 @@ 1.58 w = sw - mw; 1.59 arrange = tiling; 1.60 for(n = 0, c = clients; c; c = c->next) 1.61 - if(c->tags[tsel]) 1.62 + if(c->tags[tsel] && !c->floating) 1.63 n++; 1.64 1.65 h = (n > 1) ? sh / (n - 1) : sh; 1.66 1.67 for(i = 0, c = clients; c; c = c->next) { 1.68 if(c->tags[tsel]) { 1.69 + if(c->floating) { 1.70 + craise(c); 1.71 + resize(c, True); 1.72 + continue; 1.73 + } 1.74 if(n == 1) { 1.75 c->x = sx; 1.76 c->y = sy; 1.77 @@ -330,14 +336,13 @@ 1.78 1.79 if(XGetClassHint(dpy, c->win, &ch)) { 1.80 if(ch.res_class && ch.res_name) { 1.81 - fprintf(stderr, "%s:%s\n", ch.res_class, ch.res_name); 1.82 for(i = 0; i < len; i++) 1.83 if(!strncmp(rule[i].class, ch.res_class, sizeof(rule[i].class)) 1.84 && !strncmp(rule[i].instance, ch.res_name, sizeof(rule[i].instance))) 1.85 { 1.86 - fprintf(stderr, "->>>%s:%s\n", ch.res_class, ch.res_name); 1.87 for(j = 0; j < TLast; j++) 1.88 c->tags[j] = rule[i].tags[j]; 1.89 + c->floating = rule[i].floating; 1.90 matched = True; 1.91 break; 1.92 } 1.93 @@ -357,6 +362,7 @@ 1.94 { 1.95 Client *c, **l; 1.96 XSetWindowAttributes twa; 1.97 + Window trans; 1.98 1.99 c = emallocz(sizeof(Client)); 1.100 c->win = w; 1.101 @@ -370,7 +376,7 @@ 1.102 update_size(c); 1.103 XSelectInput(dpy, c->win, 1.104 StructureNotifyMask | PropertyChangeMask | EnterWindowMask); 1.105 - XGetTransientForHint(dpy, c->win, &c->trans); 1.106 + XGetTransientForHint(dpy, c->win, &trans); 1.107 twa.override_redirect = 1; 1.108 twa.background_pixmap = ParentRelative; 1.109 twa.event_mask = ExposureMask; 1.110 @@ -396,6 +402,11 @@ 1.111 GrabModeAsync, GrabModeSync, None, None); 1.112 XGrabButton(dpy, Button3, Mod1Mask, c->win, False, ButtonPressMask, 1.113 GrabModeAsync, GrabModeSync, None, None); 1.114 + 1.115 + if(!c->floating) 1.116 + c->floating = trans 1.117 + || ((c->maxw == c->minw) && (c->maxh == c->minh)); 1.118 + 1.119 arrange(NULL); 1.120 if(c->tags[tsel]) 1.121 focus(c);