dwm.c
changeset 1454 b55c7bd92fda
parent 1453 0082921983cb
child 1455 d71d573c3165
equal deleted inserted replaced
1453:0082921983cb 1454:b55c7bd92fda
   121 } Layout;
   121 } Layout;
   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;               /* 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];
   407 	if((m = wintomon(ev->window)) && m != selmon) {
   407 	if((m = wintomon(ev->window)) && m != selmon) {
   408 		unfocus(selmon->sel);
   408 		unfocus(selmon->sel);
   409 		selmon = m;
   409 		selmon = m;
   410 		focus(NULL);
   410 		focus(NULL);
   411 	}
   411 	}
   412 	if(ev->window == selmon->barwin && ev->x >= selmon->btx) {
   412 	if(ev->window == selmon->barwin) {
   413 		i = 0;
   413 		i = x = 0;
   414 		x = selmon->btx;
       
   415 		do
   414 		do
   416 			x += TEXTW(tags[i]);
   415 			x += TEXTW(tags[i]);
   417 		while(ev->x >= x && ++i < LENGTH(tags));
   416 		while(ev->x >= x && ++i < LENGTH(tags));
   418 		if(i < LENGTH(tags)) {
   417 		if(i < LENGTH(tags)) {
   419 			click = ClkTagBar;
   418 			click = ClkTagBar;
   650 		occ |= c->tags;
   649 		occ |= c->tags;
   651 		if(c->isurgent)
   650 		if(c->isurgent)
   652 			urg |= c->tags;
   651 			urg |= c->tags;
   653 	}
   652 	}
   654 	dc.x = 0;
   653 	dc.x = 0;
   655 	if(mons->next) { /* more than a single monitor */
       
   656 		dc.w = TEXTW(monsyms[m->screen_number]);
       
   657 		drawtext(monsyms[m->screen_number], selmon == m ? dc.sel : dc.norm, False);
       
   658 		dc.x += dc.w;
       
   659 	}
       
   660 	m->btx = dc.x;
       
   661 	for(i = 0; i < LENGTH(tags); i++) {
   654 	for(i = 0; i < LENGTH(tags); i++) {
   662 		dc.w = TEXTW(tags[i]);
   655 		dc.w = TEXTW(tags[i]);
   663 		col = m->tagset[m->seltags] & 1 << i ? dc.sel : dc.norm;
   656 		col = m->tagset[m->seltags] & 1 << i ? dc.sel : dc.norm;
   664 		drawtext(tags[i], col, urg & 1 << i);
   657 		drawtext(tags[i], col, urg & 1 << i);
   665 		drawsquare(m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
   658 		drawsquare(m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
  1688 	XineramaScreenInfo *info = NULL;
  1681 	XineramaScreenInfo *info = NULL;
  1689 
  1682 
  1690 	if(XineramaIsActive(dpy))
  1683 	if(XineramaIsActive(dpy))
  1691 		info = XineramaQueryScreens(dpy, &n);
  1684 		info = XineramaQueryScreens(dpy, &n);
  1692 #endif /* XINERAMA */
  1685 #endif /* XINERAMA */
  1693 	if(n > LENGTH(monsyms))
       
  1694 		n = LENGTH(monsyms);
       
  1695 	/* allocate monitor(s) for the new geometry setup */
  1686 	/* allocate monitor(s) for the new geometry setup */
  1696 	for(i = 0; i < n; i++) {
  1687 	for(i = 0; i < n; i++) {
  1697 		if(!(m = (Monitor *)malloc(sizeof(Monitor))))
  1688 		if(!(m = (Monitor *)malloc(sizeof(Monitor))))
  1698 			die("fatal: could not malloc() %u bytes\n", sizeof(Monitor));
  1689 			die("fatal: could not malloc() %u bytes\n", sizeof(Monitor));
  1699 		m->next = newmons;
  1690 		m->next = newmons;