mirror of
https://github.com/0intro/wmii
synced 2024-11-21 21:31:33 +03:00
Show indication when clients are wedged.
This commit is contained in:
parent
7b50a929c4
commit
b5ed1df3a1
@ -76,13 +76,19 @@ ewmh_init(void) {
|
||||
changeprop_long(&scr.root, Net("SUPPORTED"), "ATOM", supported, nelem(supported));
|
||||
}
|
||||
|
||||
inline bool
|
||||
ewmh_responsive_p(Client *c) {
|
||||
return c->w.ewmh.ping == 0 || nsec() / 1000000 - c->w.ewmh.ping < PingTime;
|
||||
}
|
||||
|
||||
void
|
||||
ewmh_checkresponsive(Client *c) {
|
||||
|
||||
if(c->w.ewmh.ping > 0 && nsec() / 1000000 - c->w.ewmh.ping > PingTime) {
|
||||
event("Unresponsive %#C\n", c);
|
||||
c->dead++;
|
||||
}
|
||||
if(!ewmh_responsive_p(c))
|
||||
if(!c->dead)
|
||||
frame_draw(c->sel);
|
||||
else if(c->dead++ == 1)
|
||||
event("Unresponsive %#C\n", c);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -97,7 +103,7 @@ tick(long id, void *v) {
|
||||
mod = count % PingPartition;
|
||||
for(i=0, c=client; c; c=c->next, i++)
|
||||
if(c->proto & ProtoPing) {
|
||||
if(c->dead == 1)
|
||||
if(!ewmh_responsive_p(c))
|
||||
ewmh_checkresponsive(c);
|
||||
if(i % PingPartition == mod)
|
||||
sendmessage(&c->w, "WM_PROTOCOLS", NET("WM_PING"), time, c->w.xid, 0, 0);
|
||||
@ -407,6 +413,7 @@ ewmh_setstate(Client *c, Atom state, int action) {
|
||||
|
||||
static bool
|
||||
event_root_clientmessage(Window *w, void *aux, XClientMessageEvent *e) {
|
||||
Client *c;
|
||||
View *v;
|
||||
ulong *l;
|
||||
ulong msg;
|
||||
@ -433,11 +440,14 @@ event_root_clientmessage(Window *w, void *aux, XClientMessageEvent *e) {
|
||||
if(l[0] == NET("WM_PING")) {
|
||||
if(e->window != scr.root.xid)
|
||||
return false;
|
||||
if(!(w = findwin(l[2])))
|
||||
if(!(c = win2client(l[2])))
|
||||
return false;
|
||||
w->ewmh.ping = nsec() / 1000000;
|
||||
w->ewmh.lag = (w->ewmh.ping & 0xffffffff) - (l[1] & 0xffffffff);
|
||||
Dprint(DEwmh, "\twindow=%W lag=%,uld\n", w, w->ewmh.lag);
|
||||
i = ewmh_responsive_p(c);
|
||||
c->w.ewmh.ping = nsec() / 1000000;
|
||||
c->w.ewmh.lag = (c->w.ewmh.ping & 0xffffffff) - (l[1] & 0xffffffff);
|
||||
if(i == false)
|
||||
frame_draw(c->sel);
|
||||
Dprint(DEwmh, "\twindow=%W lag=%,uld\n", &c->w, c->w.ewmh.lag);
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
|
@ -145,6 +145,7 @@ void ewmh_init(void);
|
||||
void ewmh_initclient(Client*);
|
||||
bool ewmh_prop(Client*, Atom);
|
||||
long ewmh_protocols(Window*);
|
||||
bool ewmh_responsive_p(Client*);
|
||||
void ewmh_updateclient(Client*);
|
||||
void ewmh_updateclientlist(void);
|
||||
void ewmh_updateclients(void);
|
||||
|
@ -428,9 +428,7 @@ frame_draw(Frame *f) {
|
||||
uint w;
|
||||
int n, m;
|
||||
|
||||
if(f->view != selview)
|
||||
return;
|
||||
if(f->area == nil) /* Blech. */
|
||||
if(f == nil || f->view != selview || f->area == nil)
|
||||
return;
|
||||
|
||||
c = f->client;
|
||||
@ -503,8 +501,9 @@ frame_draw(Frame *f) {
|
||||
}else /* Make sure floating clients have room for their indicators. */
|
||||
if(c->floating)
|
||||
r.max.x -= Dx(f->grabbox);
|
||||
w = drawstring(img, def.font, r, West,
|
||||
c->name, col->fg);
|
||||
if(!ewmh_responsive_p(c))
|
||||
r.min.x += drawstring(img, def.font, r, West, "(wedged) ", col->fg);
|
||||
w = drawstring(img, def.font, r, West, c->name, col->fg);
|
||||
|
||||
/* Draw inner border on floating clients. */
|
||||
if(f->area->floating) {
|
||||
|
Loading…
Reference in New Issue
Block a user