dwm.c
changeset 1411 652fe08b6eaa
parent 1410 1bfaa3ddc995
child 1412 2bc44743117e
equal deleted inserted replaced
1410:1bfaa3ddc995 1411:652fe08b6eaa
       
     1 #define XINULATOR /* debug, simulates dual head */
     1 /* See LICENSE file for copyright and license details.
     2 /* See LICENSE file for copyright and license details.
     2  *
     3  *
     3  * 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
     4  * 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
     5  * manager selects for SubstructureRedirectMask on the root window, to receive
     6  * manager selects for SubstructureRedirectMask on the root window, to receive
  1156 	XUngrabPointer(dpy, CurrentTime);
  1157 	XUngrabPointer(dpy, CurrentTime);
  1157 }
  1158 }
  1158 
  1159 
  1159 Client *
  1160 Client *
  1160 nexttiled(Client *c) {
  1161 nexttiled(Client *c) {
  1161 	// TODO: m handling
       
  1162 	for(; c && (c->isfloating || !ISVISIBLE(c)); c = c->next);
  1162 	for(; c && (c->isfloating || !ISVISIBLE(c)); c = c->next);
  1163 	return c;
  1163 	return c;
  1164 }
  1164 }
  1165 
  1165 
  1166 void
  1166 void
  1591 	XGrabServer(dpy);
  1591 	XGrabServer(dpy);
  1592 	XSetErrorHandler(xerrordummy);
  1592 	XSetErrorHandler(xerrordummy);
  1593 	XConfigureWindow(dpy, c->win, CWBorderWidth, &wc); /* restore border */
  1593 	XConfigureWindow(dpy, c->win, CWBorderWidth, &wc); /* restore border */
  1594 	detach(c);
  1594 	detach(c);
  1595 	detachstack(c);
  1595 	detachstack(c);
  1596 	if(selmon->sel == c)
  1596 	if(c->mon->sel == c) {
       
  1597 		c->mon->sel = c->mon->stack;
  1597 		focus(NULL);
  1598 		focus(NULL);
       
  1599 	}
  1598 	XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
  1600 	XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
  1599 	setclientstate(c, WithdrawnState);
  1601 	setclientstate(c, WithdrawnState);
  1600 	free(c);
  1602 	free(c);
  1601 	XSync(dpy, False);
  1603 	XSync(dpy, False);
  1602 	XSetErrorHandler(xerror);
  1604 	XSetErrorHandler(xerror);
  1649 updategeom(void) {
  1651 updategeom(void) {
  1650 	int i, n = 1;
  1652 	int i, n = 1;
  1651 	Client *c;
  1653 	Client *c;
  1652 	Monitor *newmons = NULL, *m, *tm;
  1654 	Monitor *newmons = NULL, *m, *tm;
  1653 
  1655 
  1654 #ifdef XINERAMA
  1656 #ifdef XINULATOR
       
  1657 	n = 2;
       
  1658 #elif defined(XINERAMA)
  1655 	XineramaScreenInfo *info = NULL;
  1659 	XineramaScreenInfo *info = NULL;
  1656 
  1660 
  1657 	if(XineramaIsActive(dpy))
  1661 	if(XineramaIsActive(dpy))
  1658 		info = XineramaQueryScreens(dpy, &n);
  1662 		info = XineramaQueryScreens(dpy, &n);
  1659 #endif
  1663 #endif
  1663 		m->next = newmons;
  1667 		m->next = newmons;
  1664 		newmons = m;
  1668 		newmons = m;
  1665 	}
  1669 	}
  1666 
  1670 
  1667 	/* initialise monitor(s) */
  1671 	/* initialise monitor(s) */
  1668 #ifdef XINERAMA
  1672 #ifdef XINULATOR
       
  1673 	if(1) {
       
  1674 		m = newmons;
       
  1675 		m->screen_number = 0;
       
  1676 		m->wx = sx;
       
  1677 		m->my = m->wy = sy;
       
  1678 		m->ww = sw;
       
  1679 		m->mh = m->wh = sh / 2;
       
  1680 		m = newmons->next;
       
  1681 		m->screen_number = 1;
       
  1682 		m->wx = sx;
       
  1683 		m->my = m->wy = sy + sh / 2;
       
  1684 		m->ww = sw;
       
  1685 		m->mh = m->wh = sh / 2;
       
  1686 	}
       
  1687 	else
       
  1688 #elif defined(XINERAMA)
  1669 	if(XineramaIsActive(dpy)) {
  1689 	if(XineramaIsActive(dpy)) {
  1670 		for(i = 0, m = newmons; m; m = m->next, i++) {
  1690 		for(i = 0, m = newmons; m; m = m->next, i++) {
  1671 			m->screen_number = info[i].screen_number;
  1691 			m->screen_number = info[i].screen_number;
  1672 			m->wx = info[i].x_org;
  1692 			m->wx = info[i].x_org;
  1673 			m->my = m->wy = info[i].y_org;
  1693 			m->my = m->wy = info[i].y_org;