dwm.c
changeset 1309 3affae730034
parent 1308 978d14197052
child 1310 1d52b420daa4
equal deleted inserted replaced
1308:978d14197052 1309:3affae730034
   137 static void attach(Client *c);
   137 static void attach(Client *c);
   138 static void attachstack(Client *c);
   138 static void attachstack(Client *c);
   139 static void buttonpress(XEvent *e);
   139 static void buttonpress(XEvent *e);
   140 static void checkotherwm(void);
   140 static void checkotherwm(void);
   141 static void cleanup(void);
   141 static void cleanup(void);
       
   142 static void clearurgent(void);
   142 static void configure(Client *c);
   143 static void configure(Client *c);
   143 static void configurenotify(XEvent *e);
   144 static void configurenotify(XEvent *e);
   144 static void configurerequest(XEvent *e);
   145 static void configurerequest(XEvent *e);
   145 static void destroynotify(XEvent *e);
   146 static void destroynotify(XEvent *e);
   146 static void detach(Client *c);
   147 static void detach(Client *c);
   373 	XSync(dpy, False);
   374 	XSync(dpy, False);
   374 	XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
   375 	XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
   375 }
   376 }
   376 
   377 
   377 void
   378 void
       
   379 clearurgent(void) {
       
   380 	XWMHints *wmh;
       
   381 	Client *c;
       
   382 
       
   383 	for(c = clients; c; c = c->next)
       
   384 		if(ISVISIBLE(c) && c->isurgent) {
       
   385 			c->isurgent = False;
       
   386 			if (!(wmh = XGetWMHints(dpy, c->win)))
       
   387 				continue;
       
   388 
       
   389 			wmh->flags &= ~XUrgencyHint;
       
   390 			XSetWMHints(dpy, c->win, wmh);
       
   391 			XFree(wmh);
       
   392 		}
       
   393 }
       
   394 
       
   395 void
   378 configure(Client *c) {
   396 configure(Client *c) {
   379 	XConfigureEvent ce;
   397 	XConfigureEvent ce;
   380 
   398 
   381 	ce.type = ConfigureNotify;
   399 	ce.type = ConfigureNotify;
   382 	ce.display = dpy;
   400 	ce.display = dpy;
  1494 toggleview(const Arg *arg) {
  1512 toggleview(const Arg *arg) {
  1495 	uint mask = tagset[seltags] ^ (arg->ui & TAGMASK);
  1513 	uint mask = tagset[seltags] ^ (arg->ui & TAGMASK);
  1496 
  1514 
  1497 	if(mask) {
  1515 	if(mask) {
  1498 		tagset[seltags] = mask;
  1516 		tagset[seltags] = mask;
       
  1517 		clearurgent();
  1499 		arrange();
  1518 		arrange();
  1500 	}
  1519 	}
  1501 }
  1520 }
  1502 
  1521 
  1503 void
  1522 void
  1624 void
  1643 void
  1625 updatewmhints(Client *c) {
  1644 updatewmhints(Client *c) {
  1626 	XWMHints *wmh;
  1645 	XWMHints *wmh;
  1627 
  1646 
  1628 	if((wmh = XGetWMHints(dpy, c->win))) {
  1647 	if((wmh = XGetWMHints(dpy, c->win))) {
  1629 		if(c == sel)
  1648 		if(ISVISIBLE(c) && wmh->flags & XUrgencyHint) {
  1630 			sel->isurgent = False;
  1649 			wmh->flags &= ~XUrgencyHint;
       
  1650 			XSetWMHints(dpy, c->win, wmh);
       
  1651 		}
  1631 		else
  1652 		else
  1632 			c->isurgent = (wmh->flags & XUrgencyHint) ? True : False;
  1653 			c->isurgent = (wmh->flags & XUrgencyHint) ? True : False;
       
  1654 
  1633 		XFree(wmh);
  1655 		XFree(wmh);
  1634 	}
  1656 	}
  1635 }
  1657 }
  1636 
  1658 
  1637 void
  1659 void
  1639 	if(arg && (arg->i & TAGMASK) == tagset[seltags])
  1661 	if(arg && (arg->i & TAGMASK) == tagset[seltags])
  1640 		return;
  1662 		return;
  1641 	seltags ^= 1; /* toggle sel tagset */
  1663 	seltags ^= 1; /* toggle sel tagset */
  1642 	if(arg && (arg->ui & TAGMASK))
  1664 	if(arg && (arg->ui & TAGMASK))
  1643 		tagset[seltags] = arg->i & TAGMASK;
  1665 		tagset[seltags] = arg->i & TAGMASK;
       
  1666 	clearurgent();
  1644 	arrange();
  1667 	arrange();
  1645 }
  1668 }
  1646 
  1669 
  1647 /* There's no way to check accesses to destroyed windows, thus those cases are
  1670 /* There's no way to check accesses to destroyed windows, thus those cases are
  1648  * ignored (especially on UnmapNotify's).  Other types of errors call Xlibs
  1671  * ignored (especially on UnmapNotify's).  Other types of errors call Xlibs