view.c
changeset 480 680aca428830
parent 479 de69a7b0c8fa
child 481 382e3cb5d9a5
equal deleted inserted replaced
479:de69a7b0c8fa 480:680aca428830
    14 		return clients; /* don't touch floating order */
    14 		return clients; /* don't touch floating order */
    15 	for(min = c = clients; c; c = c->next)
    15 	for(min = c = clients; c; c = c->next)
    16 		if(c->weight < min->weight)
    16 		if(c->weight < min->weight)
    17 			min = c;
    17 			min = c;
    18 	return min;
    18 	return min;
       
    19 }
       
    20 
       
    21 static Client *
       
    22 nexttiled(Client *c) {
       
    23 	for(c = getnext(c); c && c->isfloat; c = getnext(c->next));
       
    24 	return c;
    19 }
    25 }
    20 
    26 
    21 static void
    27 static void
    22 reorder() {
    28 reorder() {
    23 	Client *c, *newclients, *tail;
    29 	Client *c, *newclients, *tail;
    34 			tail = newclients = c;
    40 			tail = newclients = c;
    35 	}
    41 	}
    36 	clients = newclients;
    42 	clients = newclients;
    37 }
    43 }
    38 
    44 
    39 static Client *
    45 static void
    40 nexttiled(Client *c) {
    46 togglemax(Client *c)
    41 	for(c = getnext(c); c && c->isfloat; c = getnext(c->next));
    47 {
    42 	return c;
    48 	if((c->ismax = !c->ismax)) {
       
    49 		c->rx = c->x; c->x = sx;
       
    50 		c->ry = c->y; c->y = bh;
       
    51 		c->rw = c->w; c->w = sw;
       
    52 		c->rh = c->h; c->h = sh;
       
    53 	}
       
    54 	else {
       
    55 		c->x = c->rx;
       
    56 		c->y = c->ry;
       
    57 		c->w = c->w;
       
    58 		c->h = c->h;
       
    59 	}
       
    60 	resize(c, True, TopLeft);
       
    61 	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
    43 }
    62 }
    44 
    63 
    45 /* extern */
    64 /* extern */
    46 
    65 
    47 void (*arrange)(Arg *) = DEFMODE;
    66 void (*arrange)(Arg *) = DEFMODE;
    80 	int h, i, n, w;
    99 	int h, i, n, w;
    81 	Client *c;
   100 	Client *c;
    82 
   101 
    83 	w = sw - mw;
   102 	w = sw - mw;
    84 	for(n = 0, c = clients; c; c = c->next)
   103 	for(n = 0, c = clients; c; c = c->next)
    85 		if(isvisible(c) && !c->isfloat)
   104 		if(isvisible(c)) {
    86 			n++;
   105 			if(c->isfloat) {
       
   106 				if(c->ismax)
       
   107 					togglemax(c);
       
   108 			}
       
   109 			else
       
   110 				n++;
       
   111 		}
    87 
   112 
    88 	if(n > 1)
   113 	if(n > 1)
    89 		h = (sh - bh) / (n - 1);
   114 		h = (sh - bh) / (n - 1);
    90 	else
   115 	else
    91 		h = sh - bh;
   116 		h = sh - bh;
   267 	arrange(NULL);
   292 	arrange(NULL);
   268 }
   293 }
   269 
   294 
   270 void
   295 void
   271 zoom(Arg *arg) {
   296 zoom(Arg *arg) {
   272 	int tmp;
       
   273 	unsigned int n;
   297 	unsigned int n;
   274 	Client *c;
   298 	Client *c;
   275 	XEvent ev;
   299 	XEvent ev;
   276 
   300 
   277 	if(!sel)
   301 	if(!sel)
   278 		return;
   302 		return;
   279 
   303 
   280 	if(sel->isfloat || (arrange == dofloat)) {
   304 	if(sel->isfloat || (arrange == dofloat)) {
   281 		sel->x = sx;
   305 		togglemax(sel);
   282 		sel->y = bh;
       
   283 		sel->w = sw;
       
   284 		sel->h = sh - bh;
       
   285 		resize(sel, True, TopLeft);
       
   286 		while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
       
   287 		return;
   306 		return;
   288 	}
   307 	}
   289 
   308 
   290 	for(n = 0, c = clients; c; c = c->next)
   309 	for(n = 0, c = clients; c; c = c->next)
   291 		if(isvisible(c) && !c->isfloat)
   310 		if(isvisible(c) && !c->isfloat)