dwm.c
changeset 1497 20de01c5ff82
parent 1496 de4a2998e1f5
child 1500 48c3f87c335d
equal deleted inserted replaced
1496:de4a2998e1f5 1497:20de01c5ff82
   156 static void attach(Client *c);
   156 static void attach(Client *c);
   157 static void attachstack(Client *c);
   157 static void attachstack(Client *c);
   158 static void buttonpress(XEvent *e);
   158 static void buttonpress(XEvent *e);
   159 static void checkotherwm(void);
   159 static void checkotherwm(void);
   160 static void cleanup(void);
   160 static void cleanup(void);
   161 static void cleanupmons(void);
   161 static void cleanupmon(Monitor *mon);
   162 static void clearurgent(Client *c);
   162 static void clearurgent(Client *c);
   163 static void configure(Client *c);
   163 static void configure(Client *c);
   164 static void configurenotify(XEvent *e);
   164 static void configurenotify(XEvent *e);
   165 static void configurerequest(XEvent *e);
   165 static void configurerequest(XEvent *e);
   166 static Monitor *createmon(void);
   166 static Monitor *createmon(void);
   478 	XFreePixmap(dpy, dc.drawable);
   478 	XFreePixmap(dpy, dc.drawable);
   479 	XFreeGC(dpy, dc.gc);
   479 	XFreeGC(dpy, dc.gc);
   480 	XFreeCursor(dpy, cursor[CurNormal]);
   480 	XFreeCursor(dpy, cursor[CurNormal]);
   481 	XFreeCursor(dpy, cursor[CurResize]);
   481 	XFreeCursor(dpy, cursor[CurResize]);
   482 	XFreeCursor(dpy, cursor[CurMove]);
   482 	XFreeCursor(dpy, cursor[CurMove]);
   483 	cleanupmons();
   483 	while(mons)
       
   484 		cleanupmon(mons);
   484 	XSync(dpy, False);
   485 	XSync(dpy, False);
   485 	XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
   486 	XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
   486 }
   487 }
   487 
   488 
   488 void
   489 void
   489 cleanupmons(void) {
   490 cleanupmon(Monitor *mon) {
   490 	Monitor *m;
   491 	Monitor *m;
   491 
   492 
   492 	while(mons) {
   493 	if(mon == mons)
   493 		m = mons->next;
   494 		mons = mons->next;
   494 		XUnmapWindow(dpy, mons->barwin);
   495 	else {
   495 		XDestroyWindow(dpy, mons->barwin);
   496 		for(m = mons; m && m->next != mon; m = m->next);
   496 		free(mons);
   497 		m->next = mon->next;
   497 		mons = m;
   498 	}
   498 	}
   499 	XUnmapWindow(dpy, mon->barwin);
       
   500 	XDestroyWindow(dpy, mon->barwin);
       
   501 	free(mon);
   499 }
   502 }
   500 
   503 
   501 void
   504 void
   502 clearurgent(Client *c) {
   505 clearurgent(Client *c) {
   503 	XWMHints *wmh;
   506 	XWMHints *wmh;
  1725 	Bool dirty = False;
  1728 	Bool dirty = False;
  1726 
  1729 
  1727 #ifdef XINERAMA
  1730 #ifdef XINERAMA
  1728 	if(XineramaIsActive(dpy)) {
  1731 	if(XineramaIsActive(dpy)) {
  1729 		int i, j, n, nn;
  1732 		int i, j, n, nn;
       
  1733 		Client *c;
  1730 		Monitor *m;
  1734 		Monitor *m;
  1731 		XineramaScreenInfo *info = XineramaQueryScreens(dpy, &nn);
  1735 		XineramaScreenInfo *info = XineramaQueryScreens(dpy, &nn);
  1732 		XineramaScreenInfo *unique = NULL;
  1736 		XineramaScreenInfo *unique = NULL;
  1733 
  1737 
  1734 		info = XineramaQueryScreens(dpy, &nn);
  1738 		info = XineramaQueryScreens(dpy, &nn);
  1753 				if(i >= n
  1757 				if(i >= n
  1754 				|| (unique[i].x_org != m->mx || unique[i].y_org != m->my
  1758 				|| (unique[i].x_org != m->mx || unique[i].y_org != m->my
  1755 				    || unique[i].width != m->mw || unique[i].height != m->mh))
  1759 				    || unique[i].width != m->mw || unique[i].height != m->mh))
  1756 				{
  1760 				{
  1757 					dirty = True;
  1761 					dirty = True;
  1758 					m->num = unique[i].screen_number;
  1762 					m->num = i;
  1759 					m->mx = m->wx = unique[i].x_org;
  1763 					m->mx = m->wx = unique[i].x_org;
  1760 					m->my = m->wy = unique[i].y_org;
  1764 					m->my = m->wy = unique[i].y_org;
  1761 					m->mw = m->ww = unique[i].width;
  1765 					m->mw = m->ww = unique[i].width;
  1762 					m->mh = m->wh = unique[i].height;
  1766 					m->mh = m->wh = unique[i].height;
  1763 					updatebarpos(m);
  1767 					updatebarpos(m);
  1764 				}
  1768 				}
  1765 		}
  1769 		}
  1766 		else { /* less monitors available */
  1770 		else { /* less monitors available nn < n */
  1767 			cleanup();
  1771 			for(i = nn; i < n; i++) {
  1768 			setup();
  1772 				for(m = mons; m && m->next; m = m->next);
  1769 			scan();
  1773 				while(m->clients) {
       
  1774 					dirty = True;
       
  1775 					c = m->clients;
       
  1776 					m->clients = c->next;
       
  1777 					detachstack(c);
       
  1778 					c->mon = mons;
       
  1779 					attach(c);
       
  1780 					attachstack(c);
       
  1781 				}
       
  1782 				if(m == selmon)
       
  1783 					selmon = mons;
       
  1784 				cleanupmon(m);
       
  1785 			}
  1770 		}
  1786 		}
  1771 		free(unique);
  1787 		free(unique);
  1772 	}
  1788 	}
  1773 	else
  1789 	else
  1774 #endif /* XINERAMA */
  1790 #endif /* XINERAMA */