sanders solution is convincing and elegant
This commit is contained in:
		
							parent
							
								
									da0b2a2f31
								
							
						
					
					
						commit
						69b738c097
					
				
							
								
								
									
										8
									
								
								client.c
								
								
								
								
							
							
						
						
									
										8
									
								
								client.c
								
								
								
								
							| 
						 | 
					@ -99,14 +99,6 @@ focus(Client *c)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if(c) {
 | 
						if(c) {
 | 
				
			||||||
		if((c->isfloat || arrange == dofloat) && (c != clients)) {
 | 
					 | 
				
			||||||
			detach(c);
 | 
					 | 
				
			||||||
			if(clients) {
 | 
					 | 
				
			||||||
				clients->prev = c;
 | 
					 | 
				
			||||||
				c->next = clients;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			clients = c;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		grabbuttons(c, True);
 | 
							grabbuttons(c, True);
 | 
				
			||||||
		drawtitle(c);
 | 
							drawtitle(c);
 | 
				
			||||||
		XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
 | 
							XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										50
									
								
								view.c
								
								
								
								
							
							
						
						
									
										50
									
								
								view.c
								
								
								
								
							| 
						 | 
					@ -215,52 +215,20 @@ resizecol(Arg *arg)
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
restack()
 | 
					restack()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	static unsigned int nwins = 0;
 | 
					 | 
				
			||||||
	static Window *wins = NULL;
 | 
					 | 
				
			||||||
	unsigned int f, fi, m, mi, n;
 | 
					 | 
				
			||||||
	Client *c;
 | 
						Client *c;
 | 
				
			||||||
	XEvent ev;
 | 
						XEvent ev;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
	for(f = 0, m = 0, c = clients; c; c = c->next)
 | 
						if(!sel)
 | 
				
			||||||
		if(isvisible(c)) {
 | 
					 | 
				
			||||||
			if(c->isfloat || arrange == dofloat)
 | 
					 | 
				
			||||||
				f++;
 | 
					 | 
				
			||||||
			else
 | 
					 | 
				
			||||||
				m++;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	if(!(n = 2 * (f + m))) {
 | 
					 | 
				
			||||||
		drawstatus();
 | 
					 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
 | 
						if(sel->isfloat || arrange == dofloat) {
 | 
				
			||||||
 | 
							XRaiseWindow(dpy, sel->win);
 | 
				
			||||||
 | 
							XRaiseWindow(dpy, sel->twin);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if(nwins < n) {
 | 
						if(arrange != dofloat) 
 | 
				
			||||||
		nwins = n;
 | 
							for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
 | 
				
			||||||
		wins = erealloc(wins, nwins * sizeof(Window));
 | 
								XLowerWindow(dpy, c->twin);
 | 
				
			||||||
	}
 | 
								XLowerWindow(dpy, c->win);
 | 
				
			||||||
 | 
					 | 
				
			||||||
	fi = 0;
 | 
					 | 
				
			||||||
	mi = 2 * f;
 | 
					 | 
				
			||||||
	if(sel) {
 | 
					 | 
				
			||||||
		if(sel->isfloat || arrange == dofloat) {
 | 
					 | 
				
			||||||
			wins[fi++] = sel->twin;
 | 
					 | 
				
			||||||
			wins[fi++] = sel->win;
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else {
 | 
					 | 
				
			||||||
			wins[mi++] = sel->twin;
 | 
					 | 
				
			||||||
			wins[mi++] = sel->win;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	for(c = clients; c; c = c->next)
 | 
					 | 
				
			||||||
		if(isvisible(c) && c != sel) {
 | 
					 | 
				
			||||||
			if(c->isfloat || arrange == dofloat) {
 | 
					 | 
				
			||||||
				wins[fi++] = c->twin;
 | 
					 | 
				
			||||||
				wins[fi++] = c->win;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			else {
 | 
					 | 
				
			||||||
				wins[mi++] = c->twin;
 | 
					 | 
				
			||||||
				wins[mi++] = c->win;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	XRestackWindows(dpy, wins, n);
 | 
					 | 
				
			||||||
	drawall();
 | 
						drawall();
 | 
				
			||||||
	XSync(dpy, False);
 | 
						XSync(dpy, False);
 | 
				
			||||||
	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
 | 
						while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue