client.c
changeset 799 30ec8b96a7f6
parent 786 d9198e713310
child 813 0ed770c96e51
equal deleted inserted replaced
798:2c42d9e7f79c 799:30ec8b96a7f6
   166 		XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]);
   166 		XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]);
   167 		XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
   167 		XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
   168 	}
   168 	}
   169 	else
   169 	else
   170 		XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
   170 		XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
   171 }
       
   172 
       
   173 void
       
   174 focusnext(Arg *arg) {
       
   175 	Client *c;
       
   176    
       
   177 	if(!sel)
       
   178 		return;
       
   179 	for(c = sel->next; c && !isvisible(c); c = c->next);
       
   180 	if(!c)
       
   181 		for(c = clients; c && !isvisible(c); c = c->next);
       
   182 	if(c) {
       
   183 		focus(c);
       
   184 		restack();
       
   185 	}
       
   186 }
       
   187 
       
   188 void
       
   189 focusprev(Arg *arg) {
       
   190 	Client *c;
       
   191 
       
   192 	if(!sel)
       
   193 		return;
       
   194 	for(c = sel->prev; c && !isvisible(c); c = c->prev);
       
   195 	if(!c) {
       
   196 		for(c = clients; c && c->next; c = c->next);
       
   197 		for(; c && !isvisible(c); c = c->prev);
       
   198 	}
       
   199 	if(c) {
       
   200 		focus(c);
       
   201 		restack();
       
   202 	}
       
   203 }
   171 }
   204 
   172 
   205 void
   173 void
   206 killclient(Arg *arg) {
   174 killclient(Arg *arg) {
   207 	if(!sel)
   175 	if(!sel)
   262 	XMapWindow(dpy, w);
   230 	XMapWindow(dpy, w);
   263 	setclientstate(c, NormalState);
   231 	setclientstate(c, NormalState);
   264 	if(isvisible(c))
   232 	if(isvisible(c))
   265 		focus(c);
   233 		focus(c);
   266 	lt->arrange();
   234 	lt->arrange();
   267 }
       
   268 
       
   269 Client *
       
   270 nexttiled(Client *c) {
       
   271 	for(; c && (c->isversatile || !isvisible(c)); c = c->next);
       
   272 	return c;
       
   273 }
   235 }
   274 
   236 
   275 void
   237 void
   276 resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
   238 resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
   277 	float actual, dx, dy, max, min;
   239 	float actual, dx, dy, max, min;
   339 		XSync(dpy, False);
   301 		XSync(dpy, False);
   340 	}
   302 	}
   341 }
   303 }
   342 
   304 
   343 void
   305 void
       
   306 toggleversatile(Arg *arg) {
       
   307 	if(!sel || lt->arrange == versatile)
       
   308 		return;
       
   309 	sel->isversatile = !sel->isversatile;
       
   310 	lt->arrange();
       
   311 }
       
   312 
       
   313 void
   344 updatesizehints(Client *c) {
   314 updatesizehints(Client *c) {
   345 	long msize;
   315 	long msize;
   346 	XSizeHints size;
   316 	XSizeHints size;
   347 
   317 
   348 	if(!XGetWMNormalHints(dpy, c->win, &size, &msize) || !size.flags)
   318 	if(!XGetWMNormalHints(dpy, c->win, &size, &msize) || !size.flags)