dwm.c
changeset 1215 840fd59e3141
parent 1213 368a80dcf5bd
child 1216 b24cafa2cdf9
equal deleted inserted replaced
1214:941bd7c15a32 1215:840fd59e3141
    37 #include <X11/keysym.h>
    37 #include <X11/keysym.h>
    38 #include <X11/Xatom.h>
    38 #include <X11/Xatom.h>
    39 #include <X11/Xlib.h>
    39 #include <X11/Xlib.h>
    40 #include <X11/Xproto.h>
    40 #include <X11/Xproto.h>
    41 #include <X11/Xutil.h>
    41 #include <X11/Xutil.h>
       
    42 #ifdef XINERAMA
       
    43 #include <X11/extensions/Xinerama.h>
       
    44 #endif
    42 
    45 
    43 /* macros */
    46 /* macros */
    44 #define MAX(a, b)       ((a) > (b) ? (a) : (b))
    47 #define MAX(a, b)       ((a) > (b) ? (a) : (b))
    45 #define MIN(a, b)       ((a) < (b) ? (a) : (b))
    48 #define MIN(a, b)       ((a) < (b) ? (a) : (b))
    46 #define BUTTONMASK      (ButtonPressMask|ButtonReleaseMask)
    49 #define BUTTONMASK      (ButtonPressMask|ButtonReleaseMask)
  1577 	XMoveResizeWindow(dpy, barwin, bx, by, bw, bh);
  1580 	XMoveResizeWindow(dpy, barwin, bx, by, bw, bh);
  1578 }
  1581 }
  1579 
  1582 
  1580 void
  1583 void
  1581 updategeom(void) {
  1584 updategeom(void) {
  1582 	unsigned int i;
  1585 	int i;
  1583 
  1586 #ifdef XINERAMA
  1584 #ifdef CUSTOMGEOM /* define your own if you are Xinerama user */
  1587 	XineramaScreenInfo *info = NULL;
  1585 	CUSTOMGEOM
  1588 
  1586 #else
  1589 	/* window area geometry */
       
  1590 	if(XineramaIsActive(dpy)) {
       
  1591 		info = XineramaQueryScreens(dpy, &i);
       
  1592 		wx = info[0].x_org;
       
  1593 		wy = showbar && topbar ? info[0].y_org + info[0].height + bh : info[0].y_org;
       
  1594 		ww = info[0].width;
       
  1595 		wh = showbar ? info[0].height - bh : info[0].height;
       
  1596 		XFree(info);
       
  1597 	}
       
  1598 	else
       
  1599 #endif
       
  1600 	{
       
  1601 		wx = sx;
       
  1602 		wy = showbar && topbar ? sy + bh : sy;
       
  1603 		ww = sw;
       
  1604 		wh = showbar ? sh - bh : sh;
       
  1605 	}
       
  1606 
  1587 	/* bar geometry*/
  1607 	/* bar geometry*/
  1588 	bx = 0;
  1608 	bx = wx;
  1589 	by = showbar ? (topbar ? 0 : sh - bh) : -bh;
  1609 	by = showbar ? (topbar ? 0 : wy + wh) : -bh;
  1590 	bw = sw;
  1610 	bw = ww;
  1591 
       
  1592 	/* window area geometry */
       
  1593 	wx = sx;
       
  1594 	wy = showbar && topbar ? sy + bh : sy;
       
  1595 	ww = sw;
       
  1596 	wh = showbar ? sh - bh : sh;
       
  1597 #endif
       
  1598 
  1611 
  1599 	/* update layout geometries */
  1612 	/* update layout geometries */
  1600 	for(i = 0; i < LENGTH(layouts); i++)
  1613 	for(i = 0; i < LENGTH(layouts); i++)
  1601 		if(layouts[i].updategeom)
  1614 		if(layouts[i].updategeom)
  1602 			layouts[i].updategeom();
  1615 			layouts[i].updategeom();