[hackers] [wmii] [python] Reload program list in backgound thread at startup. || Kris Maglione

From: <hg_AT_suckless.org>
Date: Wed, 2 Jun 2010 16:06:14 +0000 (UTC)

changeset: 2690:9a522510855e
tag: tip
user: Kris Maglione <kris_AT_suckless.org>
date: Wed Jun 02 12:05:45 2010 -0400
files: alternative_wmiircs/python/wmiirc.py cmd/wmii/bar.c cmd/wmii/client.c cmd/wmii/ewmh.c cmd/wmii/fns.h
description:
[python] Reload program list in backgound thread at startup.

diff -r 6c0bd2c729a8 -r 9a522510855e alternative_wmiircs/python/wmiirc.py
--- a/alternative_wmiircs/python/wmiirc.py Wed Jun 02 02:09:23 2010 -0400
+++ b/alternative_wmiircs/python/wmiirc.py Wed Jun 02 12:05:45 2010 -0400
@@ -293,7 +293,7 @@
 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 -r 6c0bd2c729a8 -r 9a522510855e cmd/wmii/bar.c
--- a/cmd/wmii/bar.c Wed Jun 02 02:09:23 2010 -0400
+++ b/cmd/wmii/bar.c Wed Jun 02 12:05:45 2010 -0400
@@ -23,14 +23,12 @@
         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 -r 6c0bd2c729a8 -r 9a522510855e cmd/wmii/client.c
--- a/cmd/wmii/client.c Wed Jun 02 02:09:23 2010 -0400
+++ b/cmd/wmii/client.c Wed Jun 02 12:05:45 2010 -0400
@@ -644,8 +644,10 @@
 
                 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 -r 6c0bd2c729a8 -r 9a522510855e cmd/wmii/ewmh.c
--- a/cmd/wmii/ewmh.c Wed Jun 02 02:09:23 2010 -0400
+++ b/cmd/wmii/ewmh.c Wed Jun 02 12:05:45 2010 -0400
@@ -76,6 +76,15 @@
         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 @@
         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 -r 6c0bd2c729a8 -r 9a522510855e cmd/wmii/fns.h
--- a/cmd/wmii/fns.h Wed Jun 02 02:09:23 2010 -0400
+++ b/cmd/wmii/fns.h Wed Jun 02 12:05:45 2010 -0400
@@ -136,14 +136,13 @@
 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*);
Received on Wed Jun 02 2010 - 16:06:14 UTC

This archive was generated by hypermail 2.2.0 : Wed Jun 02 2010 - 16:12:03 UTC