dwm.c
changeset 1434 b0ac204a2c03
parent 1433 a725636d4d81
child 1436 2a288c62abe5
equal deleted inserted replaced
1433:a725636d4d81 1434:b0ac204a2c03
   122 
   122 
   123 struct Monitor {
   123 struct Monitor {
   124 	int screen_number;
   124 	int screen_number;
   125 	float mfact;
   125 	float mfact;
   126 	int by, btx;          /* bar geometry */
   126 	int by, btx;          /* bar geometry */
   127 	int mx, my, mw, mh;           /* screen size */
   127 	int mx, my, mw, mh;   /* screen size */
   128 	int wx, wy, ww, wh;   /* window area  */
   128 	int wx, wy, ww, wh;   /* window area  */
   129 	unsigned int seltags;
   129 	unsigned int seltags;
   130 	unsigned int sellt;
   130 	unsigned int sellt;
   131 	unsigned int tagset[2];
   131 	unsigned int tagset[2];
   132 	Bool showbar;
   132 	Bool showbar;
   237 #endif /* XINERAMA */
   237 #endif /* XINERAMA */
   238 
   238 
   239 /* variables */
   239 /* variables */
   240 static char stext[256];
   240 static char stext[256];
   241 static int screen;
   241 static int screen;
   242 static int sx, sy, sw, sh;   /* X display screen geometry x, y, width, height */
   242 static int sw, sh;   /* X display screen geometry x, y, width, height */
   243 static int bh, blw = 0;      /* bar geometry */
   243 static int bh, blw = 0;      /* bar geometry */
   244 static int (*xerrorxlib)(Display *, XErrorEvent *);
   244 static int (*xerrorxlib)(Display *, XErrorEvent *);
   245 static unsigned int numlockmask = 0;
   245 static unsigned int numlockmask = 0;
   246 static void (*handler[LASTEvent]) (XEvent *) = {
   246 static void (*handler[LASTEvent]) (XEvent *) = {
   247 	[ButtonPress] = buttonpress,
   247 	[ButtonPress] = buttonpress,
   300 }
   300 }
   301 
   301 
   302 Bool
   302 Bool
   303 applysizehints(Client *c, int *x, int *y, int *w, int *h) {
   303 applysizehints(Client *c, int *x, int *y, int *w, int *h) {
   304 	Bool baseismin;
   304 	Bool baseismin;
       
   305 	Monitor *m = c->mon;
   305 
   306 
   306 	/* set minimum possible */
   307 	/* set minimum possible */
   307 	*w = MAX(1, *w);
   308 	*w = MAX(1, *w);
   308 	*h = MAX(1, *h);
   309 	*h = MAX(1, *h);
   309 
   310 
   310 	if(*x > sx + sw)
   311 	if(*x > m->mx + m->mw)
   311 		*x = sw - WIDTH(c);
   312 		*x = m->mw - WIDTH(c);
   312 	if(*y > sy + sh)
   313 	if(*y > m->my + m->mh)
   313 		*y = sh - HEIGHT(c);
   314 		*y = m->mh - HEIGHT(c);
   314 	if(*x + *w + 2 * c->bw < sx)
   315 	if(*x + *w + 2 * c->bw < m->mx)
   315 		*x = sx;
   316 		*x = m->mx;
   316 	if(*y + *h + 2 * c->bw < sy)
   317 	if(*y + *h + 2 * c->bw < m->my)
   317 		*y = sy;
   318 		*y = m->my;
   318 	if(*h < bh)
   319 	if(*h < bh)
   319 		*h = bh;
   320 		*h = bh;
   320 	if(*w < bh)
   321 	if(*w < bh)
   321 		*w = bh;
   322 		*w = bh;
   322 
   323 
  1427 
  1428 
  1428 	/* init screen */
  1429 	/* init screen */
  1429 	screen = DefaultScreen(dpy);
  1430 	screen = DefaultScreen(dpy);
  1430 	root = RootWindow(dpy, screen);
  1431 	root = RootWindow(dpy, screen);
  1431 	initfont(font);
  1432 	initfont(font);
  1432 	sx = 0;
       
  1433 	sy = 0;
       
  1434 	sw = DisplayWidth(dpy, screen);
  1433 	sw = DisplayWidth(dpy, screen);
  1435 	sh = DisplayHeight(dpy, screen);
  1434 	sh = DisplayHeight(dpy, screen);
  1436 	bh = dc.h = dc.font.height + 2;
  1435 	bh = dc.h = dc.font.height + 2;
  1437 	lt[0] = &layouts[0];
  1436 	lt[0] = &layouts[0];
  1438 	lt[1] = &layouts[1 % LENGTH(layouts)];
  1437 	lt[1] = &layouts[1 % LENGTH(layouts)];
  1733 	else
  1732 	else
  1734 #endif /* XINERAMA */
  1733 #endif /* XINERAMA */
  1735 	/* default monitor setup */
  1734 	/* default monitor setup */
  1736 	{
  1735 	{
  1737 		m->screen_number = 0;
  1736 		m->screen_number = 0;
  1738 		m->wx = sx;
  1737 		m->wx = 0;
  1739 		m->my = m->wy = sy;
  1738 		m->my = m->wy = 0;
  1740 		m->ww = sw;
  1739 		m->ww = sw;
  1741 		m->mh = m->wh = sh;
  1740 		m->mh = m->wh = sh;
  1742 	}
  1741 	}
  1743 
  1742 
  1744 	/* bar geometry setup */
  1743 	/* bar geometry setup */