applied Markus' tagset purge of alternative view on _NET_ACTIVE_WINDOW event

This commit is contained in:
Anselm R Garbe 2016-12-05 10:16:46 +01:00
parent e63bf22948
commit bb3bd6fec3

38
dwm.c
View file

@ -153,7 +153,6 @@ static void buttonpress(XEvent *e);
static void checkotherwm(void); static void checkotherwm(void);
static void cleanup(void); static void cleanup(void);
static void cleanupmon(Monitor *mon); static void cleanupmon(Monitor *mon);
static void clearurgent(Client *c);
static void clientmessage(XEvent *e); static void clientmessage(XEvent *e);
static void configure(Client *c); static void configure(Client *c);
static void configurenotify(XEvent *e); static void configurenotify(XEvent *e);
@ -204,6 +203,7 @@ static void setfullscreen(Client *c, int fullscreen);
static void setlayout(const Arg *arg); static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg); static void setmfact(const Arg *arg);
static void setup(void); static void setup(void);
static void seturgent(Client *c, int urg);
static void showhide(Client *c); static void showhide(Client *c);
static void sigchld(int unused); static void sigchld(int unused);
static void spawn(const Arg *arg); static void spawn(const Arg *arg);
@ -508,19 +508,6 @@ cleanupmon(Monitor *mon)
free(mon); free(mon);
} }
void
clearurgent(Client *c)
{
XWMHints *wmh;
c->isurgent = 0;
if (!(wmh = XGetWMHints(dpy, c->win)))
return;
wmh->flags &= ~XUrgencyHint;
XSetWMHints(dpy, c->win, wmh);
XFree(wmh);
}
void void
clientmessage(XEvent *e) clientmessage(XEvent *e)
{ {
@ -534,11 +521,8 @@ clientmessage(XEvent *e)
setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */ setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */
|| (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen))); || (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen)));
} else if (cme->message_type == netatom[NetActiveWindow]) { } else if (cme->message_type == netatom[NetActiveWindow]) {
if (!ISVISIBLE(c)) { if (c != selmon->sel && !c->isurgent)
c->mon->seltags ^= 1; seturgent(c, 1);
c->mon->tagset[c->mon->seltags] = c->tags;
}
pop(c);
} }
} }
@ -806,7 +790,7 @@ focus(Client *c)
if (c->mon != selmon) if (c->mon != selmon)
selmon = c->mon; selmon = c->mon;
if (c->isurgent) if (c->isurgent)
clearurgent(c); seturgent(c, 0);
detachstack(c); detachstack(c);
attachstack(c); attachstack(c);
grabbuttons(c, 1); grabbuttons(c, 1);
@ -1616,6 +1600,20 @@ setup(void)
focus(NULL); focus(NULL);
} }
void
seturgent(Client *c, int urg)
{
XWMHints *wmh;
c->isurgent = urg;
if (!(wmh = XGetWMHints(dpy, c->win)))
return;
wmh->flags = urg ? (wmh->flags | XUrgencyHint) : (wmh->flags & ~XUrgencyHint);
XSetWMHints(dpy, c->win, wmh);
XFree(wmh);
}
void void
showhide(Client *c) showhide(Client *c)
{ {