From fc901891333c740c6ca753628ef7656150f09cff Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Wed, 2 Jun 2010 12:05:45 -0400 Subject: [PATCH] [python] Reload program list in backgound thread at startup. --- alternative_wmiircs/python/wmiirc.py | 2 +- cmd/wmii/bar.c | 2 -- cmd/wmii/client.c | 4 +++- cmd/wmii/ewmh.c | 15 +++++++++++---- cmd/wmii/fns.h | 3 +-- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/alternative_wmiircs/python/wmiirc.py b/alternative_wmiircs/python/wmiirc.py index bf9ab029..edd14e4c 100644 --- a/alternative_wmiircs/python/wmiirc.py +++ b/alternative_wmiircs/python/wmiirc.py @@ -293,7 +293,7 @@ addresize('', 'Grow', 'grow') addresize('Control-', 'Shrink', 'grow', '-1') addresize('Shift-', 'Nudge', 'nudge') -Actions.rehash() +Thread(target=lambda: Actions.rehash()).start() if not os.environ.get('WMII_NOPLUGINS', ''): dirs = filter(curry(os.access, _, os.R_OK), diff --git a/cmd/wmii/bar.c b/cmd/wmii/bar.c index f81d8ed4..a7c1402c 100644 --- a/cmd/wmii/bar.c +++ b/cmd/wmii/bar.c @@ -23,14 +23,12 @@ bar_init(WMScreen *s) { s->brect.min.y = s->brect.max.y - labelh(def.font); wa.override_redirect = 1; - wa.background_pixmap = ParentRelative; wa.event_mask = ExposureMask | ButtonPressMask | ButtonReleaseMask | FocusChangeMask; s->barwin = createwindow(&scr.root, s->brect, scr.depth, InputOutput, &wa, CWOverrideRedirect - | CWBackPixmap | CWEventMask); s->barwin->aux = s; xdnd_initwindow(s->barwin); diff --git a/cmd/wmii/client.c b/cmd/wmii/client.c index 84084781..c628f3aa 100644 --- a/cmd/wmii/client.c +++ b/cmd/wmii/client.c @@ -644,8 +644,10 @@ client_kill(Client *c, bool nice) { XKillClient(display, c->w.xid); } - else if(c->proto & ProtoDelete) + else if(c->proto & ProtoDelete) { client_message(c, "WM_DELETE_WINDOW", 0); + ewmh_checkresponsive(c); + } else XKillClient(display, c->w.xid); } diff --git a/cmd/wmii/ewmh.c b/cmd/wmii/ewmh.c index 9779c953..a719f6db 100644 --- a/cmd/wmii/ewmh.c +++ b/cmd/wmii/ewmh.c @@ -76,6 +76,15 @@ ewmh_init(void) { changeprop_long(&scr.root, Net("SUPPORTED"), "ATOM", supported, nelem(supported)); } +void +ewmh_checkresponsive(Client *c) { + + if(nsec() / 1000000 - c->w.ewmh.ping > PingTime) { + event("Unresponsive %#C\n", c); + c->dead++; + } +} + static void tick(long id, void *v) { static int count; @@ -88,10 +97,8 @@ 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 && time - c->w.ewmh.ping > PingTime) { - event("Unresponsive %#C\n", c); - c->dead++; - } + if(c->dead == 1) + ewmh_checkresponsive(c); if(i % PingPartition == mod) sendmessage(&c->w, "WM_PROTOCOLS", NET("WM_PING"), time, c->w.xid, 0, 0); if(i % PingPartition == mod) diff --git a/cmd/wmii/fns.h b/cmd/wmii/fns.h index 314d2829..ba7cef65 100644 --- a/cmd/wmii/fns.h +++ b/cmd/wmii/fns.h @@ -136,14 +136,13 @@ void debug_event(XEvent*); void print_focus(const char*, Client*, const char*); /* ewmh.c */ -int ewmh_clientmessage(XClientMessageEvent*); +void ewmh_checkresponsive(Client*); void ewmh_destroyclient(Client*); void ewmh_framesize(Client*); void ewmh_getstrut(Client*); void ewmh_getwintype(Client*); void ewmh_init(void); void ewmh_initclient(Client*); -void ewmh_pingclient(Client*); bool ewmh_prop(Client*, Atom); long ewmh_protocols(Window*); void ewmh_updateclient(Client*);