dwm.c
changeset 1413 e0b1ca478d40
parent 1412 2bc44743117e
child 1414 68427ad40a9f
equal deleted inserted replaced
1412:2bc44743117e 1413:e0b1ca478d40
     1 #define XINULATOR /* debug, simulates dual head */
     1 //#define XINULATOR /* debug, simulates dual head */
     2 /* See LICENSE file for copyright and license details.
     2 /* See LICENSE file for copyright and license details.
     3  *
     3  *
     4  * dynamic window manager is designed like any other X client as well. It is
     4  * dynamic window manager is designed like any other X client as well. It is
     5  * driven through handling X events. In contrast to other X clients, a window
     5  * driven through handling X events. In contrast to other X clients, a window
     6  * manager selects for SubstructureRedirectMask on the root window, to receive
     6  * manager selects for SubstructureRedirectMask on the root window, to receive
  1647 		m->by = -bh;
  1647 		m->by = -bh;
  1648 }
  1648 }
  1649 
  1649 
  1650 void
  1650 void
  1651 updategeom(void) {
  1651 updategeom(void) {
  1652 	int i, n = 1;
  1652 	int i, di, n = 1, x, y;
       
  1653 	unsigned int dui;
  1653 	Client *c;
  1654 	Client *c;
  1654 	Monitor *newmons = NULL, *m, *tm;
  1655 	Monitor *newmons = NULL, *m, *tm;
       
  1656 	Window dummy;
  1655 
  1657 
  1656 #ifdef XINULATOR
  1658 #ifdef XINULATOR
  1657 	n = 2;
  1659 	n = 2;
  1658 #elif defined(XINERAMA)
  1660 #elif defined(XINERAMA)
  1659 	XineramaScreenInfo *info = NULL;
  1661 	XineramaScreenInfo *info = NULL;
  1718 		m->tagset[0] = m->tagset[1] = 1;
  1720 		m->tagset[0] = m->tagset[1] = 1;
  1719 		m->mfact = mfact;
  1721 		m->mfact = mfact;
  1720 		m->showbar = showbar;
  1722 		m->showbar = showbar;
  1721 		m->topbar = topbar;
  1723 		m->topbar = topbar;
  1722 		updatebarpos(m);
  1724 		updatebarpos(m);
  1723 		/* reassign all clients with same screen number */
       
  1724 		for(tm = mons; tm; tm = tm->next)
       
  1725 			if(tm->screen_number == m->screen_number) {
       
  1726 				m->clients = tm->clients;
       
  1727 				m->sel = m->stack = tm->stack;
       
  1728 				tm->clients = NULL;
       
  1729 				tm->stack = NULL;
       
  1730 				for(c = m->clients; c; c = c->next)
       
  1731 					c->mon = m;
       
  1732 			}
       
  1733 	}
  1725 	}
  1734 
  1726 
  1735 	/* reassign left over clients of disappeared monitors */
  1727 	/* reassign left over clients of disappeared monitors */
  1736 	for(tm = mons; tm; tm = tm->next) {
  1728 	for(tm = mons; tm; tm = tm->next) {
  1737 		while((c = tm->clients)) {
  1729 		while((c = tm->clients)) {
  1742 			attachstack(c);
  1734 			attachstack(c);
  1743 		}
  1735 		}
  1744 	}
  1736 	}
  1745 
  1737 
  1746 	/* select focused monitor */
  1738 	/* select focused monitor */
  1747 	if(!selmon) {
  1739 	selmon = newmons;
  1748 		selmon = newmons;
  1740 	if(XQueryPointer(dpy, root, &dummy, &dummy, &x, &y, &di, &di, &dui)) 
  1749 		int di, x, y;
  1741 		for(m = newmons; m; m = m->next)
  1750 		unsigned int dui;
  1742 			if(INRECT(x, y, m->wx, m->wy, m->ww, m->wh)) {
  1751 		Window dummy;
  1743 				selmon = m;
  1752 		if(XQueryPointer(dpy, root, &dummy, &dummy, &x, &y, &di, &di, &dui)) 
  1744 				break;
  1753 			for(m = newmons; m; m = m->next)
  1745 			}
  1754 				if(INRECT(x, y, m->wx, m->wy, m->ww, m->wh)) {
       
  1755 					selmon = m;
       
  1756 					break;
       
  1757 				}
       
  1758 	}
       
  1759 
  1746 
  1760 	/* final assignment of new monitors */
  1747 	/* final assignment of new monitors */
  1761 	cleanupmons();
  1748 	cleanupmons();
  1762 	mons = newmons;
  1749 	mons = newmons;
  1763 }
  1750 }