applied Markus' tagset purge of alternative view on _NET_ACTIVE_WINDOW event
bb3bd6fe
1 file(s) · +18 −20
| 153 | 153 | static void checkotherwm(void); |
|
| 154 | 154 | static void cleanup(void); |
|
| 155 | 155 | static void cleanupmon(Monitor *mon); |
|
| 156 | - | static void clearurgent(Client *c); |
|
| 157 | 156 | static void clientmessage(XEvent *e); |
|
| 158 | 157 | static void configure(Client *c); |
|
| 159 | 158 | static void configurenotify(XEvent *e); |
|
| 204 | 203 | static void setlayout(const Arg *arg); |
|
| 205 | 204 | static void setmfact(const Arg *arg); |
|
| 206 | 205 | static void setup(void); |
|
| 206 | + | static void seturgent(Client *c, int urg); |
|
| 207 | 207 | static void showhide(Client *c); |
|
| 208 | 208 | static void sigchld(int unused); |
|
| 209 | 209 | static void spawn(const Arg *arg); |
|
| 509 | 509 | } |
|
| 510 | 510 | ||
| 511 | 511 | void |
|
| 512 | - | clearurgent(Client *c) |
|
| 513 | - | { |
|
| 514 | - | XWMHints *wmh; |
|
| 515 | - | ||
| 516 | - | c->isurgent = 0; |
|
| 517 | - | if (!(wmh = XGetWMHints(dpy, c->win))) |
|
| 518 | - | return; |
|
| 519 | - | wmh->flags &= ~XUrgencyHint; |
|
| 520 | - | XSetWMHints(dpy, c->win, wmh); |
|
| 521 | - | XFree(wmh); |
|
| 522 | - | } |
|
| 523 | - | ||
| 524 | - | void |
|
| 525 | 512 | clientmessage(XEvent *e) |
|
| 526 | 513 | { |
|
| 527 | 514 | XClientMessageEvent *cme = &e->xclient; |
|
| 534 | 521 | setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */ |
|
| 535 | 522 | || (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen))); |
|
| 536 | 523 | } else if (cme->message_type == netatom[NetActiveWindow]) { |
|
| 537 | - | if (!ISVISIBLE(c)) { |
|
| 538 | - | c->mon->seltags ^= 1; |
|
| 539 | - | c->mon->tagset[c->mon->seltags] = c->tags; |
|
| 540 | - | } |
|
| 541 | - | pop(c); |
|
| 524 | + | if (c != selmon->sel && !c->isurgent) |
|
| 525 | + | seturgent(c, 1); |
|
| 542 | 526 | } |
|
| 543 | 527 | } |
|
| 544 | 528 | ||
| 806 | 790 | if (c->mon != selmon) |
|
| 807 | 791 | selmon = c->mon; |
|
| 808 | 792 | if (c->isurgent) |
|
| 809 | - | clearurgent(c); |
|
| 793 | + | seturgent(c, 0); |
|
| 810 | 794 | detachstack(c); |
|
| 811 | 795 | attachstack(c); |
|
| 812 | 796 | grabbuttons(c, 1); |
|
| 1614 | 1598 | XSelectInput(dpy, root, wa.event_mask); |
|
| 1615 | 1599 | grabkeys(); |
|
| 1616 | 1600 | focus(NULL); |
|
| 1601 | + | } |
|
| 1602 | + | ||
| 1603 | + | ||
| 1604 | + | void |
|
| 1605 | + | seturgent(Client *c, int urg) |
|
| 1606 | + | { |
|
| 1607 | + | XWMHints *wmh; |
|
| 1608 | + | ||
| 1609 | + | c->isurgent = urg; |
|
| 1610 | + | if (!(wmh = XGetWMHints(dpy, c->win))) |
|
| 1611 | + | return; |
|
| 1612 | + | wmh->flags = urg ? (wmh->flags | XUrgencyHint) : (wmh->flags & ~XUrgencyHint); |
|
| 1613 | + | XSetWMHints(dpy, c->win, wmh); |
|
| 1614 | + | XFree(wmh); |
|
| 1617 | 1615 | } |
|
| 1618 | 1616 | ||
| 1619 | 1617 | void |
|