commit fc901891333c740c6ca753628ef7656150f09cff
parent 625246858d0ce09215f5720f9d7822be57774392
Author: Kris Maglione <kris@suckless.org>
Date: Wed, 2 Jun 2010 12:05:45 -0400
[python] Reload program list in backgound thread at startup.
Diffstat:
5 files changed, 16 insertions(+), 10 deletions(-)
diff --git 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
@@ -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
@@ -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
@@ -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
@@ -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*);