client.c
changeset 164 21071ae1fe68
parent 163 e2e1de08341d
child 173 1db04019684e
equal deleted inserted replaced
163:e2e1de08341d 164:21071ae1fe68
     1 /*
     1 /*
     2  * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
     2  * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
     3  * See LICENSE file for license details.
     3  * See LICENSE file for license details.
     4  */
     4  */
     5 #include "dwm.h"
     5 #include "dwm.h"
     6 
       
     7 #include <stdlib.h>
     6 #include <stdlib.h>
     8 #include <string.h>
     7 #include <string.h>
     9 #include <X11/Xatom.h>
     8 #include <X11/Xatom.h>
    10 #include <X11/Xutil.h>
     9 #include <X11/Xutil.h>
    11 
    10 
   217 	c->y = c->ty = wa->y;
   216 	c->y = c->ty = wa->y;
   218 	c->w = c->tw = wa->width;
   217 	c->w = c->tw = wa->width;
   219 	c->h = wa->height;
   218 	c->h = wa->height;
   220 	c->th = bh;
   219 	c->th = bh;
   221 
   220 
   222 	c->border = 1;
   221 	c->border = 0;
   223 	setsize(c);
   222 	setsize(c);
   224 
   223 
   225 	if(c->h != sh && c->y < bh)
   224 	if(c->h != sh && c->y < bh)
   226 		c->y = c->ty = bh;
   225 		c->y = c->ty = bh;
   227 
   226 
   252 
   251 
   253 	settags(c);
   252 	settags(c);
   254 	if(!c->isfloat)
   253 	if(!c->isfloat)
   255 		c->isfloat = trans
   254 		c->isfloat = trans
   256 			|| (c->maxw && c->minw &&
   255 			|| (c->maxw && c->minw &&
   257 				c->maxw == c->minw && c->maxh == c->minh)
   256 				c->maxw == c->minw && c->maxh == c->minh);
   258 			|| (c->w == sw && c->h == sh);
       
   259 	settitle(c);
   257 	settitle(c);
   260 	arrange(NULL);
   258 	arrange(NULL);
   261 
   259 
   262 	/* mapping the window now prevents flicker */
   260 	/* mapping the window now prevents flicker */
   263 	XMapRaised(dpy, c->win);
   261 	XMapRaised(dpy, c->win);
   269 void
   267 void
   270 resize(Client *c, Bool sizehints, Corner sticky)
   268 resize(Client *c, Bool sizehints, Corner sticky)
   271 {
   269 {
   272 	int bottom = c->y + c->h;
   270 	int bottom = c->y + c->h;
   273 	int right = c->x + c->w;
   271 	int right = c->x + c->w;
   274 	XConfigureEvent e;
   272 	/*XConfigureEvent e;*/
   275 	XWindowChanges wc;
   273 	XWindowChanges wc;
   276 
   274 
   277 	if(sizehints) {
   275 	if(sizehints) {
   278 		if(c->incw)
   276 		if(c->incw)
   279 			c->w -= (c->w - c->basew) % c->incw;
   277 			c->w -= (c->w - c->basew) % c->incw;
   300 	resizetitle(c);
   298 	resizetitle(c);
   301 	wc.x = c->x;
   299 	wc.x = c->x;
   302 	wc.y = c->y;
   300 	wc.y = c->y;
   303 	wc.width = c->w;
   301 	wc.width = c->w;
   304 	wc.height = c->h;
   302 	wc.height = c->h;
   305 	wc.border_width = 1;
   303 	if(c->w == sw && c->h == sh)
   306 	XConfigureWindow(dpy, c->win,
   304 		wc.border_width = 0;
   307 			CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
   305 	else
   308 
   306 		wc.border_width = 1;
   309 	e.type = ConfigureNotify;
   307 	XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
   310 	e.event = c->win;
       
   311 	e.window = c->win;
       
   312 	e.x = c->x;
       
   313 	e.y = c->y;
       
   314 	e.width = c->w;
       
   315 	e.height = c->h;
       
   316 	e.border_width = c->border;
       
   317 	e.above = None;
       
   318 	e.override_redirect = False;
       
   319 	XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&e);
       
   320 	XSync(dpy, False);
   308 	XSync(dpy, False);
   321 }
   309 }
   322 
   310 
   323 void
   311 void
   324 setsize(Client *c)
   312 setsize(Client *c)
   401 		oy = sel->y;
   389 		oy = sel->y;
   402 		ow = sel->w;
   390 		ow = sel->w;
   403 		oh = sel->h;
   391 		oh = sel->h;
   404 		sel->x = sx;
   392 		sel->x = sx;
   405 		sel->y = sy + bh;
   393 		sel->y = sy + bh;
   406 		sel->w = sw - 2 * sel->border;
   394 		sel->w = sw - 2;
   407 		sel->h = sh - 2 * sel->border - bh;
   395 		sel->h = sh - 2 - bh;
   408 
   396 
   409 		higher(sel);
   397 		higher(sel);
   410 		resize(sel, False, TopLeft);
   398 		resize(sel, False, TopLeft);
   411 
   399 
   412 		sel->x = ox;
   400 		sel->x = ox;